#2137 closed bug (fixed)
Wrong ID provided to the PostGIS on save
Reported by: | fsat | Owned by: | nobody |
---|---|---|---|
Priority: | major: does not work as expected | Milestone: | Version 1.4.0 |
Component: | Data Provider | Version: | Trunk |
Keywords: | Cc: | fsat | |
Must Fix for Release: | No | Platform: | Gentoo |
Platform Version: | Awaiting user input: | no |
Description
I'm trying to use qgis with my PostGIS database. I have only 3 tables for different kinds of components. So I've created a couple of updatable views to make a work with QGIS more comfortable and to keep my internal structure. But when I'm setting a unique ID to the element (in QGIS) I receive a complaints about duplicate ID. For example: I have an empty view (but not empty table with elements), but I know - the ID=15 is unique, I create a new element in the layer associated with this view and set the ID to 15, but on save I receive error. After the empty record created manualy with ID=15 and I'm saving to this view - I see ID's started from 16. Inspite of provided data to ID field it is counted automaticaly.
Attachments (1)
Change History (7)
comment:1 by , 15 years ago
Cc: | added |
---|
comment:2 by , 15 years ago
comment:3 by , 15 years ago
Schema is attached to the ticket, to populate it with sample data just execute the following statements.
insert into maps (ID, NAME) values(1, "map1"); insert into layers (ID, NAME, MAP_ID) values(1, "layer1", 1);
After that you can add LINESTRING layer in QGIS using view with name "map1_l1_l" and draw a line. And after that add POINT layer in QGIS using view with name "map1_l1_s" and reproduce my error.
As you can see from section:
view_name | 'i ' | ' |
as on insert to ' view_name ' do instead (
insert into layer_elements (layer_id, id, name) values(' lid ', NEW.id, NEW.name); insert into ' le ' (id, the_geom) values(NEW.id, NEW.the_geom); )';
The ID is not calculated automaticaly, I'm using the provided one, without defaults.
PostGIS version - 1.4.0, Postgresql version - 8.2.14, QGIS version - 1.3.0
comment:4 by , 15 years ago
Sorry, little mistake in queries. Following are correct ones.
insert into maps (ID, NAME) values(1, 'map1');
insert into layers (ID, NAME, MAP_ID) values(1, 'layer1', 1);
follow-up: 6 comment:5 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
should be fixed in r12235 - hopefully without breaking something else.
can you provide sample data?