Re: COPY TABLE TO - Mailing list pgsql-hackers

From Paulo Scardine
Subject Re: COPY TABLE TO
Date
Msg-id 012101c3c8a0$d36e7560$6101a8c0@wxppaulos
Whole thread Raw
In response to COPY TABLE TO  ("Paul Punett" <paul.punett@shazamteam.com>)
List pgsql-hackers
SELECT x, y
(SELECT 1 AS ord, COUNT(*) as x, NULL AS y FROM tablexUNIONSELECT 2, x, y FROM tablex)

May be you will have to do some explicit casting depending on the field
types.

--
Paulo Scardine

----- Original Message ----- 
From: "Paul Punett" <paul.punett@shazamteam.com>
To: <pgsql-hackers@postgresql.org>
Sent: Monday, December 22, 2003 8:35 AM
Subject: [HACKERS] COPY TABLE TO


> Hi,
>
> I need to write a tab separated text file such that the first row contains
> number of records in the table.
> I insert first row with '0' (zero) as first column & rest columns NULL.
> Then at the end of writing records to table I do a select into Variable
> count(*) from table.
> & update the first record with the count returned.
> Unfortunately after the update the first row becomes the last row & hence
> COPY TO FileName sends the count as the last record.
>
> I need count as the first record? Any suggestions please ?
> The documentation says indexing does not affect copy order.
>
> I am developing on C++ with PostGre on windows. I need to port to Linux
> later. Any suggestions on linking C++ code to PostGre (queries &
functions)
>
> Thanks
> Paul
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>
>



pgsql-hackers by date:

Previous
From: "Marc G. Fournier"
Date:
Subject: Re: [COMMITTERS] pgsql-server/doc/src/sgml Tag: REL7_4_STABLE
Next
From: Tom Lane
Date:
Subject: Re: [COMMITTERS] pgsql-server/doc/src/sgml Tag: REL7_4_STABLE r ...