Ticket #3291 (closed defect: fixed)

Opened 3 years ago

Last modified 3 years ago

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

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

Change History

  Changed 3 years ago by dpanech

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.

  Changed 3 years ago by dpanech

  • summary changed from Postgresql 7.x compatibility to Postgresql 7.x compatibility (patch included)

Changed 3 years ago by dpanech

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

  Changed 3 years ago by dmorissette

  • cc dmorissette added
  • owner changed from dmorissette to pramsey
  • component changed from Build Problems to PostGIS Interface

Moving to postgis component for Paul to review.

follow-up: ↓ 9   Changed 3 years ago by 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?

  Changed 3 years ago by pramsey

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?

Changed 3 years ago by pramsey

Altered patch

  Changed 3 years ago by pramsey

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

follow-up: ↓ 8   Changed 3 years ago by dpanech

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

Changed 3 years ago by dpanech

Use PQparameterStatus to get version string

in reply to: ↑ 7   Changed 3 years ago by dpanech

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

in reply to: ↑ 4   Changed 3 years ago by dpanech

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.

  Changed 3 years ago by pramsey

  • status changed from new to closed
  • resolution set to fixed

Changes committed against branch 5.4, 5.6 and trunk.

Note: See TracTickets for help on using tickets.