Bug report #5938

primary key/autoincrement not imported in sqlite

Added by Yves Jacolin over 12 years ago. Updated over 5 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:C++ plugins/Offline editing
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:15372

Description

When a postgis table with a primary key + autoincrement field is imported in sqlite with the offline plugin, the schema is a little bit different:

                                         Table « public.XXXX

    Column     |       Type       |                                    Modificateurs
----------------+------------------+------------------------------------------------------------------------------------------                                                                                                           
 ogc_fid        | integer          | not NULL by default, nextval('public.XXXX_ogc_fid_seq'::regclass)
 geom           | geometry         |                                                                                                               
 identifiant    | character(16)    |   
 numero         | character(10)    |                                      
 type           | character(50)    |                                                                      
 name | character(50)    |                                     
 longueur       | double precision |                                                                     
Index :
    "XXXX_pk" PRIMARY KEY, btree (ogc_fid)
    "XXXX_geom_idx" gist (geom)
Contraintes de vérification :
    "enforce_dims_geom" CHECK (st_ndims(geom) = 2)
    "enforce_geotype_geom" CHECK (geometrytype(geom) = 'LINESTRING'::text OR geom IS NULL)
    "enforce_srid_geom" CHECK (srid(geom) = 21781)
CREATE TABLE 'XXXX' (
  'ogc_fid' INTEGER,
  'identifiant' TEXT,
  'numero' TEXT,
  'type' TEXT,
  'name' TEXT,
  'longueur' REAL,
  "Geometry" LINESTRING
)

"PRIMARY KEY" and "AUTOINCREMENT" is missing. In that case it should be better to not import back this field in the postgis table, but if it is not possible the sqlite scheme is not correct and the user need to define ogc_fid field value when editing offline.

History

#1 Updated by Alexander Bruy over 12 years ago

  • Category changed from Python plugins to C++ Plugins

#2 Updated by Paolo Cavallini about 12 years ago

  • Target version set to Version 2.0.0

#3 Updated by Jürgen Fischer over 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#4 Updated by Jürgen Fischer over 10 years ago

  • Category changed from C++ Plugins to C++ plugins/Offline editing

#5 Updated by Jürgen Fischer about 10 years ago

  • Subject changed from [offlline] primarykey/autoincrement not import in sqlite to primary key/autoincrement not imported in sqlite

#6 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Luigi Pirelli about 6 years ago

  • Description updated (diff)

FYI related PR-Fix has been closed due to lack of comments: https://github.com/qgis/QGIS/pull/8023

#8 Updated by Giovanni Manghi over 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF