[postgis-users] Problem with correlative ID after using INSERT INTO
Paul Ramsey
pramsey at opengeo.org
Thu Oct 6 08:24:42 PDT 2011
You have little-to-no control over the order things are stored in the
database, you have to specify your order in your SELECT queries
instead.
P.
On Thu, Oct 6, 2011 at 5:17 AM, Gery . <gamejihou at hotmail.com> wrote:
>
>
> 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
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
>
More information about the postgis-users
mailing list