Opened 14 years ago

Closed 14 years ago

#3291 closed defect (fixed)

Postgresql 7.x compatibility (patch included)

Reported by: dpanech Owned by: pramsey
Priority: normal Milestone:
Component: PostGIS Interface Version: 5.4
Severity: normal Keywords: postgis PQserverVersion
Cc: dmorissette

Description

The file mappostgis.c uses the function PQserverVersion, which was is absent in libpq 7.4.19 that I am using.

I think "select version();" SQL should do the same thing.

Attachments (3)

mapserver-5.4.2-pgversion.patch (1.6 KB ) - added by dpanech 14 years ago.
Patch for finding out server version using SQL when PQserverVersion function is unavailable
3291-1.patch (3.0 KB ) - added by pramsey 14 years ago.
Altered patch
3291-2.patch (2.9 KB ) - added by dpanech 14 years ago.
Use PQparameterStatus to get version string

Download all attachments as: .zip

Change History (13)

comment:1 by dpanech, 14 years ago

Note about the patch: it changes two files, configure.in and mappostgis.c. But the "Preview" mode on this website only shows the first file. Download the patch to see al changes, please.

comment:2 by dpanech, 14 years ago

Summary: Postgresql 7.x compatibilityPostgresql 7.x compatibility (patch included)

by dpanech, 14 years ago

Patch for finding out server version using SQL when PQserverVersion function is unavailable

comment:3 by dmorissette, 14 years ago

Cc: dmorissette added
Component: Build ProblemsPostGIS Interface
Owner: changed from dmorissette to pramsey

Moving to postgis component for Paul to review.

comment:4 by pramsey, 14 years ago

The patch is incomplete, it only has the configure routine for setting the define. BTW, this must be against a very old version of PostGIS as well... what PostGIS version are you running?

comment:5 by pramsey, 14 years ago

dmorissette has set me straight, the patch is complete but not displaying right. This line seems suspect to me:

    int pgversion = atoi (PQgetvalue (pgresult, 0, 0));

When I run select version(); I get a big string:

PostgreSQL 8.4.2 on i386-apple-darwin10.2.0, compiled by GCC i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5646) (dot 1), 64-bit

Are you saying on earlier versions you get the simple version number string? 70400?

by pramsey, 14 years ago

Attachment: 3291-1.patch added

Altered patch

comment:6 by pramsey, 14 years ago

Please test this version of the patch and see if it does what you want/expect.

comment:7 by dpanech, 14 years ago

Thanks, your patch works; but I found a somewhat better/safer way of getting the version string. See 3291-2.patch.

by dpanech, 14 years ago

Attachment: 3291-2.patch added

Use PQparameterStatus to get version string

in reply to:  7 comment:8 by dpanech, 14 years ago

PQparameterStatus ("server_version") returns just the version string ("7.4.19" or some such), so we can avoid executing SQL.

in reply to:  4 comment:9 by dpanech, 14 years ago

Replying to pramsey:

The patch is incomplete, it only has the configure routine for setting the define. BTW, this must be against a very old version of PostGIS as well... what PostGIS version are you running?

I'm running version 7.4.19... but anyway, it was my mistake, "version()" does return a long "human-readable" string. See corrections in my second patch.

comment:10 by pramsey, 14 years ago

Resolution: fixed
Status: newclosed

Changes committed against branch 5.4, 5.6 and trunk.

Note: See TracTickets for help on using tickets.