pgadmin-org / pgadmin-org/pgadmin4
Editing a row with expression/alias columns in Query Tool fails to save with "column does not exist" error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 891
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 8
Description
Describe the bug
If your query includes a calculated or aliased column — for example first_name || ' ' || last_name AS the_name — and you edit any cell on an existing row and hit Save, pgAdmin throws an error. It tries to update the alias column (the_name) on the table, which doesn't actually exist as a real column. The column header shows a lock icon, so pgAdmin already knows it's not editable — but it still includes it when building the UPDATE.
To Reproduce
Open the Query Tool on any database where you can create tables.
Run this to set up a test table with some data:
DROP TABLE IF EXISTS some_table;
CREATE TABLE some_table (id INT PRIMARY KEY, first_name TEXT, last_name TEXT);
INSERT INTO some_table VALUES (1, 'John', 'Doe');
SELECT id, first_name, last_name,
first_name || ' ' || last_name AS the_name
FROM some_table;
In the result grid, click on an editable cell — for example, change first_name from John to Jane.
Press F5 to save.
You'll see an error in the result panel.
Expected behavior
The save should succeed. Only real table columns (id, first_name, last_name) should be updated. The alias column the_name should be ignored completely.
Error message
ERROR: column "the_name" of relation "some_table" does not exist
LINE 2: the_name = $1::text WHERE
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in the Query Tool result grid's save/update path and trace how editable and locked columns are selected for the UPDATE. Reproduce the issue with the SQL and table from the report, then verify that saving a change to first_name succeeds without including the_name and that the reported column-does-not-exist error is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql, python
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100