Skip to content

Edit PostgreSQL Query

This page explains updating a saved PostgreSQL query in the Pirivision Compass module via the Edit action.

Prerequisite

At least one PostgreSQL query must be saved in the Compass list. If none, see Create PostgreSQL Query first.


1. Find the Query and Click Edit

Click Compass in the left menu. On the card of the PostgreSQL query you want to edit, click the Edit button (pencil icon).


2. The SQL Editor Opens — Existing Query Pre-filled

The editor pre-loads the existing PostgreSQL query.


3. Editable Fields

Field Editable? Notes
SQL Query Text ✅ Yes Editable directly in the editor
Query Name ✅ Yes In the save panel
Description ✅ Yes In the save panel
Global Variables ✅ Yes Add / edit / delete
Cache Duration ✅ Yes In the save panel
Target Folder ✅ Yes A different folder can be picked
Data Source ❌ No Create a new query for a different PostgreSQL

4. Update and Test

Make the necessary changes in the editor. Test with the Run button.

Column Name Change

If you change column names in the PostgreSQL query, data mappings on Cartography widgets bound to this query may break. Check bound widgets after the update.


5. Save

Click the Save button. Update the fields in the save panel. Save with Save.


6. Common Errors

Error / Symptom Possible Cause Solution
"you already have a query named '...'" The new name is used by another query Enter a different name
pq: syntax error at or near "..." The updated query has a syntax error Review the query
"update failed: no rows were affected" The update was not saved Refresh the page and try again
Cartography widget appears empty A column name changed Update the widget's data mapping

PostgreSQL Queries — Overview