Thread: libpq++ - copy - default values

libpq++ - copy - default values

From
"V. A."
Date:
Hi!

I wrote a little Programm that puts all telefoncall-information from my
ISDN-card
and those from my telefonesystem into the Postgresdb, using the libpq++
library. My problem is, that I don't know how I can tell the copy-command to
leave the first field untouched, so that it gets the default value from a
sequence....
Can anyone tell me, how I can do this?

Thanks in advanced!

Viktor
Ps: Postgres 6.4 - Linux


Re: [INTERFACES] libpq++ - copy - default values

From
"Thomas G. Lockhart"
Date:
> My problem is, that I don't know how I can tell the copy-command to
> leave the first field untouched, so that it gets the default value
> from a sequence....
> Can anyone tell me, how I can do this?

afaik "copy" always fills all columns. You might get better results
using a series of inserts, which do allow default values to be used.

                       - Tom

Re: [INTERFACES] libpq++ - copy - default values

From
Tom Lane
Date:
"V. A." <a2891891@smail.Uni-Koeln.DE> writes:
> My problem is, that I don't know how I can tell the copy-command to
> leave the first field untouched, so that it gets the default value from a
> sequence....

You can't.  COPY is for plain verbatim dumping and reloading of data.
Use INSERT if you need to have any calculations done.

            regards, tom lane