Re: Copy/foreign key contraints
От | Ken Godee |
---|---|
Тема | Re: Copy/foreign key contraints |
Дата | |
Msg-id | 3DF9FE43.31079.43557A@localhost обсуждение исходный текст |
Ответ на | Copy/foreign key contraints ("Ken Godee" <ken@perfect-image.com>) |
Список | pgsql-general |
Ron, The file I'm COPYing is straight ascii data, and just delimited no sql statements, I'm adding data to an existing table. ie. ------file----------- 25467^John Doe^480-555-1212^^12/13/2002 --------------------- "COPY transx from '/tmp/transx.dat' delimiters '^' with null as ''; I had thought this was pretty straight forward, I don't have a very complex set up and thought I was just missing something (and probally am) or this was a common problem. Another poster suggested forwarding alittle more info and schema to list, which I'll post a little later. > OOPS, correction as: > Also, if names are NOT double quoted "custID" any reference to them get > converted to lower case, so you're references must be case-correct too. > eg CONSTRAINT "mycon" FOREIGN KEY ("custID") REFERENCES ..... > > > Ron St.Pierre wrote: > > > Check your ascii file and make sure that the column or constraint > > names are not quoted. If so, check for spaces at the end of names > > eg CONSTRAINT 'mycon' FOREIGN KEY ('custid ') REFERENCES ...... <- > > note the space inside quotes after custid > > > > Also, if names are double quoted "custID" any reference to them get > > converted to lower case, so you're references must be case-correct too. > > eg CONSTRAINT "mycon" FOREIGN KEY ("custID") REFERENCES ..... > > > > > > > > Ken Godee wrote: > > > >> The data's not originally coming from a postgres database, > >> it's in a ascii delimited format, sorry for not mentioning that. > >> > >> > >>> Ken Godee wrote: > >>> > >>> > >>>> table 1: customer.custid primary key > >>>> table 2: transx.custid foreign key > >>>> > >>>> When using COPY to import data I received; > >>>> > >>>> "<unnamed>referential integerity violation-key referenced from > >>>> table transx not found in customer" (fairly vague statement) > >>>> > >>>> > >>> > >> > >> > >> ---------------------------(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 > >> > >> > > > > > > > -- > Ron St.Pierre > Syscor R&D > tel: 250-361-1681 > email: rstpierre@syscor.com > > >
В списке pgsql-general по дате отправления: