Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#4700 closed defect (fixed)

Internal getsrid calls fail against PostGIS 2.0

Reported by: PaulFMichell Owned by: warmerdam
Priority: normal Milestone: 1.9.2
Component: OGR_SF Version:
Severity: normal Keywords: PostGIS 2.0 getsrid ExecuteSQL
Cc:

Description

We have just upgraded our server to PostGIS 2.0 from 1.5 and the following code now outputs an error message to the console:

OGRLayer := OGR_DS_ExecuteSQL(InputOGRDataSource, PChar('SELECT * FROM "MasterMap"."structure" WHERE st_intersects("wkb_geometry", st_geomfromtext(MULTIPOLYGON(((479072.9 260525.1,479072.9 261033.4,479870.6 261033.4,479870.6 260525.1,479072.9 260525.1))), 27700))'), Nil, Nil); OGR_DS_CopyLayer(OutputOGRDataSource, OGRLayer, PChar('Test'), OutputOptions);

The error output is:


ERROR 1: ERROR: function getsrid(geometry) does not exist LINE 1: SELECT getsrid("wkb_geometry") FROM (SELECT * FROM "MasterMa...

HINT: No function matches the given name and argument types. You might need to add explicit type casts.


We do not call getsrid in our code at all, so it must be called internally by the DLL. I think the getsrid function has been removed in PostGIS 2.0 and replaced by st_srid. We have tested this with gdal20dev.dll (7/6/2012 SVN).

Change History (2)

comment:1 by Even Rouault, 12 years ago

Milestone: 1.9.2
Resolution: fixed
Status: newclosed
Version: svn-trunk

r24545 /trunk/ (5 files in 2 dirs): PG: optimize SRID fetching on SQL result layer; compatibility with PostGIS 2.0 by using ST_SRID (#4699, #4700)

r24546 /branches/1.9/ (5 files in 2 dirs): PG: optimize SRID fetching on SQL result layer; compatibility with PostGIS 2.0 by using ST_SRID (#4699, #4700)

comment:2 by PaulFMichell, 12 years ago

Thanks for the quick response. I'll test the fix on Monday.

Note: See TracTickets for help on using tickets.