From: | "Ken Godee" <ken(at)perfect-image(dot)com> |
---|---|
To: | rstpierre(at)syscor(dot)com, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Copy/foreign key contraints |
Date: | 2002-12-13 22:35:32 |
Message-ID: | 3DF9FE43.31079.43557A@localhost |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)postgresql(dot)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(at)syscor(dot)com
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Moritz Sinn | 2002-12-13 22:53:21 | getting datatype of array elements |
Previous Message | Steve Crawford | 2002-12-13 19:47:49 | Re: \dD Bug?? |