[gdal-dev] How to append data into an existing database table

Jeremy Palmer JPalmer at linz.govt.nz
Mon Jan 9 19:43:40 EST 2012


I knew I was missing something!

I've now noticed that empty fields within the CSV get populated as a literal '' rather than null. Is there any option to control this behavior as well?

Thanks again,
Jeremy

> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at mines-paris.org]
> Sent: Tuesday, 10 January 2012 11:24 a.m.
> To: gdal-dev at lists.osgeo.org
> Cc: Jeremy Palmer
> Subject: Re: [gdal-dev] How to append data into an existing database table
> 
> Le lundi 09 janvier 2012 22:47:21, Jeremy Palmer a écrit :
> > Hi All,
> >
> > I've got an existing spatial table in PostgreSQL with has an existing
> > primary key (non-serial) and shape column:
> >
> > CREATE TABLE test_1
> > (
> >   id integer NOT NULL,
> >   appellation TEXT,
> >   affected_surveys TEXT,
> >   parcel_intent TEXT NOT NULL,
> >   topology_type VARCHAR(100) NOT NULL,
> >   statutory_actions TEXT,
> >   land_district VARCHAR(100) NOT NULL,
> >   titles TEXT,
> >   survey_area numeric(20,4),
> >   calc_area numeric(20,4) NOT NULL,
> >   shape geometry,
> >   PRIMARY KEY (id)
> > );
> >
> > I'm trying to append data from a CSV file into a pg database but I'm having
> > problems:
> >
> > ogr2ogr -append -f PostgreSQL "PG:host=xxxx dbname=xxxx" test1.vrt -nln
> > test_1
> 
> Try adding the -preserve_fid option of ogr2ogr.
#####################################################################################

This message contains information, which is confidential and may be subject to legal privilege. 
If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message.
If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info at linz.govt.nz) and destroy the original message.
LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ.

Thank You.

#####################################################################################


More information about the gdal-dev mailing list