Re: inet/cidr data types

From: Tino Wildenhain <tino(at)wildenhain(dot)de>
To: Russell Aspinwall <russell(dot)aspinwall(at)flomerics(dot)co(dot)uk>, pgsql-general(at)postgresql(dot)org
Subject: Re: inet/cidr data types
Date: 2002-11-08 13:03:17
Message-ID: 17116111.1036764197@liza
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Russel,

it might be more easy and faster if you use the copy comand:

COPY targettable
FROM 'filename' [USING] DELIMITERS 'delimiter'
WITH NULL AS ''

delimiter depends on your data, either ',' or ';' or '\t'

Regards
Tino

--On Freitag, 8. November 2002 12:18 +0000 Russell Aspinwall
<russell(dot)aspinwall(at)flomerics(dot)co(dot)uk> wrote:

> Hi,
>
> I need to store 2GB of accumulated data into a database. I have built
> v7.2.3 with Java, Tcl/Tk, Perl, C++ language extensions. I have written
> nawk scripts to convert csv data into the appropiate INSERT INTO
> commands, then adding the data is a simple matter of running psql -d
> <database> -f date.psql
>
> Some of the fields are of type inet or cidr , however these fields do
> not always contain a value. I need to be able to set the field to null
> in my INSERT INTO command the empty values are represented by ''.
> However during the INSERT command, the command can fail with a message
> like. I would like to be able to queries on these fields but
> automatically exclude the null values.
>
> psql:test.psql:1: ERROR: invalid CIDR value ''
>
> Any help would be appreciated.
>
> Russell
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to majordomo(at)postgresql(dot)org)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Nigel J. Andrews 2002-11-08 13:13:28 Re: indexes on varchar fields
Previous Message Robert John Shepherd 2002-11-08 12:41:59 Re: Restoring a db dump with tsearch fields fails