Re: [HACKERS] COPY TABLE TO

2003-12-22 Thread Paulo Scardine
SELECT x, y (SELECT 1 AS ord, COUNT(*) as x, NULL AS y FROM tablex UNION SELECT 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" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Se

Re: [HACKERS] COPY TABLE TO

2003-12-22 Thread Tom Lane
"Paul Punett" <[EMAIL PROTECTED]> writes: > I need count as the first record? Any suggestions please ? SQL does not guarantee any particular ordering of rows in a table. You cannot do what you're doing and expect it to be reliable. You could do something like this: add a sequence-number column to

Re: [HACKERS] COPY TABLE TO

2003-12-22 Thread Jeroen T. Vermeulen
On Mon, Dec 22, 2003 at 10:35:08AM -, Paul Punett wrote: > > I need to write a tab separated text file such that the first row contains > number of records in the table. Whether COPY does what you want may depend on what you want to do with special characters. If your table contains strings