summary and request

From: expect <expect(at)ihubbell(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: summary and request
Date: 2003-08-15 17:18:44
Message-ID: 20030815101844.026dc3ce.expect@ihubbell.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches


I'd like to summarize what I know (or don't know) since this topic has been
hit around a little and I'm new to this. I'm hoping it will clear things up,
at least for me. You are all the experts, I want to make sure I am singing
from the same page.

data sample:
id | fm | ls | addr | city | st | z |c| start|end
----------------------------------------------------------------------------------

191922C,Bob Cobb,D'Obbalina Sr.,312 Elm Street,Yountville,CA,94599,5,062001,082009
339111C,Elma Thelma,Velma,98 Oak Lane,St. Louis,MO,63119-2065,,,

What I wanted to do was to import lots of these from a text file. In the case
where there is an empty string (i.e. no value after a comma) I wanted to
define the column in the table in a way that would accept the empty string but
replace it with the default value for that column. I didn't know that the
copy command is just some C code that stuffs the data into the db ala
fois grois.

What I would really benefit from (and I hope some other new soul would too)
is if someone would outline exactly how they would approach this problem.

Maybe provide the correct table definition and the copy command. Or if that
just won't work an alternate approach. I realize that some of you have
done this partially but there have been too many replies to get into a
single cohesive instruction.

Anyway I suppose my initial frustration in trying to do this may have blinded
me from reason.

create table contact (
id character(7) NOT NULL,
fm character(30) DEFAULT 'xzxzxzxz',
ls character(30) DEFAULT 'xzxzxzxz',
addr character(30) DEFAULT '123 xzxzxzxz',
city character(25) DEFAULT 'xzxzxzxz',
st character(2) DEFAULT 'xz',
c character(1) DEFAULT 'x',
start decimal(6) DEFAULT 122038,
end decimal(6) DEFAULT 122038,
CONSTRAINT handle PRIMARY KEY (id)
) WITHOUT OIDS;

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Pflug 2003-08-15 17:20:48 Re: [GENERAL] 7.4Beta
Previous Message Jan Wieck 2003-08-15 17:13:06 Re: [GENERAL] 7.4Beta

Browse pgsql-patches by date

  From Date Subject
Next Message elein 2003-08-15 17:26:14 Re: join of array
Previous Message Joe Conway 2003-08-15 17:06:36 Re: join of array