Re: COPY TO order

From: Christopher Browne <cbbrowne(at)acm(dot)org>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: COPY TO order
Date: 2004-04-10 20:44:25
Message-ID: m3ekqvbm1i.fsf@wolfe.cbbrowne.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Centuries ago, Nostradamus foresaw when clodoaldo_pinto(at)yahoo(dot)com(dot)br (Clodoaldo Pinto Neto) would write:
> How to make sure COPY TO writes the table lines to the file in the same order
> they were inserted?

You probably want to rewrite PostgreSQL then.

> I'm producing html pages in pl/pgsql and using COPY TO to write then
> to file. Occasionaly, about once in 7 or 9, the lines are copied to
> the file out of the order they were inserted in the table.

If you need to maintain data in some order, then you need to add a key
field that indicates that ordering, and use ORDER BY in order to
select the data in that order.

That will involve not using COPY TO.
--
let name="cbbrowne" and tld="cbbrowne.com" in String.concat "@" [name;tld];;
http://cbbrowne.com/info/lisp.html
Would-be National Mottos:
Poland: "We probably would have had a happier history if we were
between Canada and Mexico, not Germany and Russia."

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message wespvp 2004-04-11 03:10:42 Postmaster won't shut down
Previous Message Mark Lubratt 2004-04-10 19:13:04 Access Conversion