Re: COPY tablename FROM and null values

From: JSP <jason(dot)palivino(at)gmail(dot)com>
To: Luckys <plpgsql(at)gmail(dot)com>
Cc: marchesini(at)unipg(dot)it, "Achilleus Mantzios" <achill(at)matrix(dot)gatewaynet(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: COPY tablename FROM and null values
Date: 2006-03-22 12:33:11
Message-ID: f16343260603220433y57af766ejc2b73a8286651adc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

yup... Replace the empty spaces in the file with some other value...

replace null values with \N

then try COPYing again

On 3/22/06, Luckys <plpgsql(at)gmail(dot)com> wrote:
>
>
>
> On 3/22/06, Achilleus Mantzios <achill(at)matrix(dot)gatewaynet(dot)com> wrote:
> >
> > O ivan marchesini έγραψε στις Mar 22, 2006 :
> >
> > > Dear users,
> > > I'm working on a Postgres 7.4 server
> > >
> > > I have a .txt file, containing some tabular data, where data are
> > > delimited by TABs.
> > > there are 3 columns:
> > >
> > > column1 int4, column2 float8, column3 float8
> > >
> > > the problem is that column3 contains also null values ( i.e. sometimes
> > is
> > > empty)
> > >
> > > so when I try to use COPY tablename FROM 'filename.txt' I obtain an
> > > error
> > >
> > > I have tried also using " WITH NULL AS ' ' " but without good
> > results...
> > >
> > > can someone explain me how to solve this problem???
> >
> > batch edit your file (with sed,awk,perl,C,java,...) and build your
> > explicit INSERT statements in some version of your file.
>
>
> or Replace the empty spaces in the file with some other value (0.0)
>
> >
> > > thank you very much
> > >
> > > Ivan
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > -Achilleus
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 5: don't forget to increase your free space map settings
> >
>
>

--

"The trouble with the rat race is that even if you win, you're still a rat."
--- Lily Tomlin

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2006-03-22 13:29:56 Re: COPY tablename FROM and null values
Previous Message Luckys 2006-03-22 12:27:25 Re: COPY tablename FROM and null values