Re: COPY TO order - Mailing list pgsql-general

From Christopher Browne
Subject Re: COPY TO order
Date
Msg-id m3ekqvbm1i.fsf@wolfe.cbbrowne.com
Whole thread Raw
In response to COPY TO order  (Clodoaldo Pinto Neto <clodoaldo_pinto@yahoo.com.br>)
Responses Re: COPY TO order
List pgsql-general
Centuries ago, Nostradamus foresaw when clodoaldo_pinto@yahoo.com.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."

pgsql-general by date:

Previous
From: Mark Lubratt
Date:
Subject: Access Conversion
Next
From:
Date:
Subject: Postmaster won't shut down