Skip to content

Generated always columns are not properly handled in View/Edit Data #9672

@pms967

Description

@pms967

Generated always columns are not properly handled in View/Edit Data

Editing data in tables which includes one (or more) generated always column can be a nightmare.

If by accident you change the value of one such column(s), there seem to be no way to reset its value to "[default]". As a consequence, you cannot save your (other, wanted) changes since obviously that will result in an error:

cannot insert a non-DEFAULT value into column "...."
Column "...." is a generated column.

As a consequence, you can not e.g. add row(s) to such a table by duplicating existing ones (copy/paste a row) and and then change the values in some of the (non generated) columns.

A similar issue exists when Importing Data from CSV files, though that perhaps can be handled by selecting which columns to import (but I am afraid that can work only if the generated column(s) are the very last one(s), after all the "normal" ones).

To Reproduce

Trivial:

  1. Create a table including PK, some normal columns and at least one generated column (GENERATED ALWAYS AS ...);
  2. Open it in the View/Edit Data tool;
  3. Select a row;
  4. Click on the "Copy" icon;
  5. Click on the "Paste" icon;
  6. Change some of the non-generated columns (pkey and whatever);
  7. try to save ==> Error
  8. would like to change the generate column to "[default]" to avoid that error: can't fine any way to do so.

Expected behavior

  • Generated columns should be handled properly: attempts to directly change their value to anything but "DEFAULT" should be disabled, and any value pasted into them should be ignored (otherwise copy/paste of a whole row would be impossible).

  • Queries generated by View/Edit Data must properly handle generated always columns in insert / update queries (always set them to DEFAULT, regardless of the corresponding cell content in the GUI).

  • Right-clicking on any "cell" should give the possibility to reset its value to [default] (and [null] as well).

Other possible (unrelated) improvement:

  • cell selections should obey the standard modifiers: Shift to select a range of "cells", Ctrl to add a column to the existing selection, ecc.

Desktop (please complete the following information):

  • OS: Debian GNU/Linux 13 (trixie)
  • DE : KDE Plasma
  • pgAdmin version: 9.12
  • Mode: Desktop
  • Package type: DEB (from ftp.postgresql.org repository)

Metadata

Metadata

Type

No type

Projects

Status

In Review

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions