[postgis-users] Problem with correlative ID after using INSERT INTO

Gery . gamejihou at hotmail.com
Thu Oct 6 05:17:54 PDT 2011



Hello,

I'm trying to get a table, composed of other two tables, but the correlative ID of one of them changes, it "jumps", this is what happens:

**************
   id  | name
 ...
   34 | 79-051
   35 | 79-052
   52 | 79-076
  214 | 96-008A
  215 |     | 96-009
   36 | 79-053
   37 | 79-055
   ....
****************

this shape was inserted as follows:

shp2pgsql -s 4326 -W UTF-8 -g geom -I -D /home/postgres/shp/line/line.shp | psql -U postgres -d mydb

after checking it in my db, it looks like:

**********
 ...
   34 | 79-051
   35 | 79-052
   36 | 79-053
   37 | 79-055
   ...
**********

this is the part of the code I used to insert this table:

INSERT INTO both_lines (ID, SURVEY, PROFILE, TYPE, SOURCE, LENGTH_KM, LENGTH_NM, COMMENTS, GEOM)
SELECT ID, SURVEY, PROFILE, TYPE, SOURCE, LENGTH_KM, LENGTH_NM, COMMENTS, GEOM FROM line;

I tried adding "ORDER BY ID" at the end of the second line (after "line") but didn't work.

Any suggestions are very welcome, thanks in advance,

Gery
 		 	   		  


More information about the postgis-users mailing list