[postgis-users] FW: Problem with correlative ID after using INSERT INTO
Gery .
gamejihou at hotmail.com
Thu Oct 6 11:41:21 PDT 2011
Thanks Paul, I put ORDER BY ID before Select and after it but didn't work. Could you provide me please an example based on the code below?
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;
Thanks,
----------------------------------------
> From: gamejihou at hotmail.com
> To: postgis-users at postgis.refractions.net
> Subject: Problem with correlative ID after using INSERT INTO
> Date: Thu, 6 Oct 2011 12:17:54 +0000
>
>
>
> 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