GispoCoding / qaava

QGIS toolbox for land use planners in Finland. Kaavoittajan työkalut QGIS-lisäosana. NOT UPDATED!
GNU General Public License v2.0
4 stars 3 forks source link

Adding new rows to codelistst #31

Closed SannaJokela closed 10 months ago

SannaJokela commented 3 years ago

Error for most of the codelists when adding new rows - due to problems with the foreign key. QGIS does not understand the existing values for gid and tries to add the same gid that already existst. Workaround: forms > default value (aggregate('layerxxx','max',"gid")+1). Needs corrections for QGIS projects (both asemakaava and yleiskaava)

SannaJokela commented 3 years ago

Is this something that is related to this issue: https://www.2ndquadrant.com/en/blog/postgresql-10-identity-columns/

pavetsu14 commented 3 years ago

That was it.

Problem appears for tables:

Possible solution (for koodistot.dokumenttityyppi):

-- let's create a new PostGIS table which involves all the data the original table does + new column for unique id CREATE TABLE koodistot.dokumenttityyppi2 ( ugid uuid DEFAULT uuid_generate_v4(), gid INTEGER NOT NULL DEFAULT nextval('koodistot.dokumenttityyppi_gid_seq'::regclass), nimi VARCHAR, kuvaus VARCHAR, PRIMARY KEY (ugid) );

INSERT INTO koodistot.dokumenttityyppi2 ( gid, nimi, kuvaus ) SELECT * FROM koodistot.dokumenttityyppi;

SannaJokela commented 10 months ago

No longer updated