#6411 closed defect (fixed)

PG: append of several layers in PG_USE_COPY mode fails

Reported by: Even Rouault Owned by: warmerdam
Priority: normal Milestone: 2.0.3
Component: OGR_SF Version: unspecified
Severity: normal Keywords: pg ogr2ogr append copy
Cc:

Description

The following which might be representative of ogr2ogr -append into a PG database fails due to a missing endCopy() calls when resolving the second layer definition

from osgeo import gdal, ogr

gdal.SetConfigOption('PG_USE_COPY', 'YES')
ds = ogr.Open('pg:dbname=autotest', update= 1)
ds.GetLayerCount()
lyr = ds.GetLayerByName('test1')
f = ogr.Feature(lyr.GetLayerDefn())
lyr.CreateFeature(f)
print("before ds.GetLayerByName('test2')")
lyr = ds.GetLayerByName('test2')
print("after ds.GetLayerByName('test2')")
f = ogr.Feature(lyr.GetLayerDefn()) # error emited here
print("before second CreateFeature")
lyr.CreateFeature(f)
ds = None

Change History (1)

comment:1 Changed 18 months ago by Even Rouault

Component: defaultOGR_SF
Keywords: pg ogr2ogr append copy added
Milestone: 2.0.3
Resolution: fixed
Status: newclosed

trunk r33691, branches/2.0 r33692 "PG: fix append of several layers in PG_USE_COPY mode and within transaction (ogr2ogr -append use case) (fix by Jürgen Ficher, test by myself, #6411)"

Note: See TracTickets for help on using tickets.