COPY extended?

From: Alfred Perlstein <bright(at)wintelcom(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: COPY extended?
Date: 2000-07-24 23:16:34
Message-ID: 20000724161634.I13979@fw.wintelcom.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

With the TEXT form of COPY IN, is it possible to specify which columns?

If not, it would be nice to be able to do this:

COPY tablename (row1, row2, row3) from stdin;

About binary copy...

Maybe this is new, but the COPY IN with 'binary format', would this
work via a libpq connection?

About 'binary' COPY, even though the specifcation is there, I'm
not sure it's very clear:

At the start of the file
uint32 number of tuples
For each tuple
uint32 total length of tuple data
uint32 oid (if specified)
uint32 number of null attributes
[uint32,...,uint32] attribute numbers of attributes, counting from 0
- <tuple data>

I'm not sure I understand this, what is "number of null attributes"?

does "attribute numbers of attributes, counting from 0" mean that
if I have a table like so:

create table foo ( f1 int4, f2 int4 );

that 'f1' would be 0 and 'f2' would be 1? (The example seems to suggest
that 'f1' is 1 and 'f2' is 2)

How does one delimit the tuple data? It says:
"Notice how the char(2) field is padded with nulls to four bytes
and the text field is preceded by its length"

I'm not sure what that means, does it mean, that if
sizeof(feild) < sizeof(uint32) then? which way do I pad? Are there
any macros in libpq to assist in making this compact data?

thanks,
--
-Alfred Perlstein - [bright(at)wintelcom(dot)net|alfred(at)freebsd(dot)org]
"I have the heart of a child; I keep it in a jar on my desk."

Browse pgsql-hackers by date

  From Date Subject
Next Message Hiroshi Inoue 2000-07-24 23:55:32 RE: Vacuum only with 20% old tuples
Previous Message Larry Rosenman 2000-07-24 23:00:46 Re: INET/CIDR types