Re: quick question abt pg_dump and restore

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Josh Harrison <joshques(at)gmail(dot)com>, "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: quick question abt pg_dump and restore
Date: 2008-01-09 15:54:21
Message-ID: 6319.1199894061@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> Josh Harrison escribi:
>> Fine. I can use order by when I want to order it in terms of some columns.
>> But What if I want to maintain the same order as in the database1? ie., I
>> want my rows of TableABC in Database2 to be the same order as the rows in
>> TableABC in Database 1 ???

> You can't.

According to the SQL standard, a table is an *unordered* collection of
rows, and the results of any query are produced in an unspecified order
(unless you use ORDER BY). The ambiguity about row ordering is
intentional and is exploited by most DBMSes including Postgres to
improve implementation efficiency. If you assume there is such a thing
as a specific ordering within a table, you'll live to regret it
eventually.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Josh Harrison 2008-01-09 15:55:11 Re: quick question abt pg_dump and restore
Previous Message Scott Marlowe 2008-01-09 15:51:16 Re: PgSql Mirroring/Fail Over Server