Skip site navigation (1) Skip section navigation (2)

Re: last row of table after csv import

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: last row of table after csv import
Date: 2011-10-18 12:34:00
Message-ID: j7jrmb$s1f$1@dough.gmane.org (view raw or flat)
Thread:
Lists: pgsql-novice
e-letter, 18.10.2011 14:18:
> No interface, using command terminal to enter sql commands.
>
> The csv file of data is not ordered in any way, so I expect the
> command '\copy' to import data into a table without changing the
> relative positions of data.
>
That is a wrong assumption. There is no inherent order of the rows in a table.

Even straight after an insert the order of rows is not guaranteed to be the order in which they were inserted.
The only way to get a defined sort order is to use an ORDER BY clause when SELECTing the data.

Thomas





In response to

pgsql-novice by date

Next:From: Daniel StaalDate: 2011-10-18 13:52:56
Subject: Re: last row of table after csv import
Previous:From: e-letterDate: 2011-10-18 12:18:29
Subject: Re: last row of table after csv import

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group