cloudbeaver icon indicating copy to clipboard operation
cloudbeaver copied to clipboard

Cannot update PostgreSQL updatable view

Open ajkq opened this issue 3 years ago • 4 comments

Describe the bug A PostgreSQL updatable view cannot be updated. Error message: Can't detect row identifier for data container 'v_test'. It must have at least one unique key.

To Reproduce Steps to reproduce the behavior: 1.

CREATE SCHEMA test;
CREATE TABLE test.test (
	id integer PRIMARY KEY,
	value integer NULL
);
CREATE VIEW test.v_test
AS SELECT test.id, test.value
FROM test.test;
INSERT INTO test.v_test (id, value) VALUES(1, NULL);

  1. Try to change value

Desktop:

  • OS: macOS 11.4
  • Browser Chrome
  • Version 91

Additional context Database: PostgreSQL 13.3

ajkq avatar Jun 03 '21 01:06 ajkq

Thank you for the report. We will add this option.

kseniiaguzeeva avatar Jun 09 '21 12:06 kseniiaguzeeva

It requires a complicated UI to define virtual unique key.

We have such a feature in the desktop product.

serge-rider avatar Jul 06 '21 12:07 serge-rider

Adminer uses all columns in the where clause. Would that be an option?

ajkq avatar Jul 09 '21 01:07 ajkq

Thank you for your idea. A lot of UI changes must be done to implement the feature by the best way. An option to use all columns as a unique key can make work with tables inconvenient in some cases.

kseniiaguzeeva avatar Jul 09 '21 12:07 kseniiaguzeeva