[gdal-dev] Copying FIDs into existing PG schema

Jeremy Palmer JPalmer at linz.govt.nz
Tue Feb 7 17:52:17 EST 2012


Wow, thanks Even! 

I now follow the logic for the original insert method. And yes your implementation makes a reasonable assumption.

Thanks again,
Jeremy

> -----Original Message-----
> From: Even Rouault [mailto:even.rouault at mines-paris.org]
> Sent: Wednesday, 8 February 2012 11:50 a.m.
> To: gdal-dev at lists.osgeo.org
> Cc: Jeremy Palmer
> Subject: Re: [gdal-dev] Copying FIDs into existing PG schema
> 
> > Is there a specific reason for the OGRPGTableLayer::BuildCopyFields (and
> > CreateFeatureViaCopy) checking that the field must exist in the layer
> > FieldDefn before adding it to the copy field list? Or is this a bug?
> 
> Jeremy,
> 
> I've created http://trac.osgeo.org/gdal/ticket/4495 to capture the issue and
> pushed a fix.
> 
> Note however that this area is a bit fragile since there are valid use cases
> where we don't want to impose the FID and let the DB do the autoincrement (*).
> The issue is that in COPY mode you must choose at the beginning if you will
> set or not the FID column for all the features to be copied. So the heuristics
> is now : if the first feature to be copied has a FID set, then we will also set
> it for all following features. Otherwise, if the first feature to be copied has
> no FID set, we will not set it and let the DB pick up a value for us for all
> the features. This is hopefully a reasonable assumption. I'm afraid I have no
> idea how to do it differently.
> 
> But in INSERT mode, you can freely alternate features with FID set or unset.
> 
> (*) I'm happy that we have a rich regression suite for the PG driver because
> my first attemps at fixing the 'new' use case initially broke those use cases.
> 
> Best regards,
> 
> Even
#####################################################################################

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