Hi,
I have two questions about the copy (SQL or not) command.
If I understood it well, \copy is just an interface to the SQL copy
command.
First of all, it stops if a unique index rule is broken.
This means that one can not insert a set of datas using copy, and
relying on the database's core to drop off the non unique entries.
Am I wrong ? Is there any solution to force copy inserting all good
entries, and dropping the bad ones (e.g: in case of doubles) without
stopping it's execution ?
Second question is :
I have a very simple table with a sequence :
create sequence uidseq start 1;
CREATE TABLE users (
uid int4
default nextval('uidseq'), -- Primary Key
login varchar(15)
);
Can I use copy to fill in my users table, and relying on the system to
affect the right sequence numbers ?
e.g :
If I do :
INSERT INTO users (login) VALUES ('test') ;
Then, the right sequence number will be given.
But, if I import (copy) a file with the following format :
\t<login>
where \t stands for a tab sign, and using :
copy users from '/tmp/users';
Then, all my users get an uid of 0.
Thanks for any reply.
--
Frederic OLIVIE (Alf) - Information System Manager
GROLIER INTERACTIVE Europe / Online Groupe
11, rue de Cambrai, 75927, Paris Cedex 19, France
Voice : +33-(0)1-55-45-47-91, Fax : +33-(0)1-55-45-47-10
Mobile : +33-(0)6-03-03-33-50
MailTo:alf@grolier.fr http://www.club-internet.fr
Very Funny Scotty, now beam down my clothes !!!
Captain James T. Kirk, Starship Enterprise.