Обсуждение: Determing Postgres version
For an off-campus project, my web hosting ISP has the PostgreSQL postmaster running on a host separate from where my web pages are hosted. My queries work OK, but I can't get LIMIT to work. I suspect he hasn't upgraded to version 7 yet. How can I query for a version? I can't use pg_config --version because it's not on my local host and anyway it wouldn't find the postmaster on this host. Can I use a SQL query to determine the version of the postmaster? Thanks in advance. Gary ************************************************************************** * Gary B. Hoffman, Computing Services Manager e-mail: ghoffman@ucsd.edu * * Graduate School of International Relations and Pacific Studies (IR/PS) * * University of California, San Diego (UCSD) voice: (858) 534-1989 * * 9500 Gilman Dr. MC 0519 fax: (858) 534-3939 * * La Jolla, CA 92093-0519 USA web: http://www-irps.ucsd.edu/ * **************************************************************************
Try: select version(); Chirs > -----Original Message----- > From: pgsql-php-owner@postgresql.org > [mailto:pgsql-php-owner@postgresql.org]On Behalf Of Gary Hoffman > Sent: Monday, 17 December 2001 2:24 PM > To: pgsql-php@postgresql.org > Subject: [PHP] Determing Postgres version > > > For an off-campus project, my web hosting ISP has the PostgreSQL > postmaster running on a host separate from where my web pages are hosted. > My queries work OK, but I can't get LIMIT to work. I suspect he hasn't > upgraded to version 7 yet. How can I query for a version? I can't use > pg_config --version because it's not on my local host and anyway it > wouldn't find the postmaster on this host. > > Can I use a SQL query to determine the version of the postmaster? > > Thanks in advance. > Gary > > ************************************************************************** > * Gary B. Hoffman, Computing Services Manager e-mail: ghoffman@ucsd.edu * > * Graduate School of International Relations and Pacific Studies (IR/PS) * > * University of California, San Diego (UCSD) voice: (858) 534-1989 * > * 9500 Gilman Dr. MC 0519 fax: (858) 534-3939 * > * La Jolla, CA 92093-0519 USA web: http://www-irps.ucsd.edu/ * > ************************************************************************** > > > > > > ---------------------------(end of broadcast)--------------------------- > TIP 2: you can get off all lists at once with the unregister command > (send "unregister YourEmailAddressHere" to majordomo@postgresql.org) >
Well, I thought of that. Here's what I get: ERROR: function version() does not exist Any other ideas, short of actually asking the ISP help desk? Gary chriskl@familyhealth.com.au writes: >Try: > >select version(); > >Chirs > >> -----Original Message----- >> From: pgsql-php-owner@postgresql.org >> [mailto:pgsql-php-owner@postgresql.org]On Behalf Of Gary Hoffman >> Sent: Monday, 17 December 2001 2:24 PM >> To: pgsql-php@postgresql.org >> Subject: [PHP] Determing Postgres version >> >> >> For an off-campus project, my web hosting ISP has the PostgreSQL >> postmaster running on a host separate from where my web pages are >hosted. >> My queries work OK, but I can't get LIMIT to work. I suspect he hasn't >> upgraded to version 7 yet. How can I query for a version? I can't use >> pg_config --version because it's not on my local host and anyway it >> wouldn't find the postmaster on this host. >> >> Can I use a SQL query to determine the version of the postmaster? >> >> Thanks in advance. >> Gary ************************************************************************** * Gary B. Hoffman, Computing Services Manager e-mail: ghoffman@ucsd.edu * * Graduate School of International Relations and Pacific Studies (IR/PS) * * University of California, San Diego (UCSD) voice: (858) 534-1989 * * 9500 Gilman Dr. MC 0519 fax: (858) 534-3939 * * La Jolla, CA 92093-0519 USA web: http://www-irps.ucsd.edu/ * **************************************************************************
On Mon, 17 Dec 2001, Gary Hoffman wrote:
> Well, I thought of that.
>
> Here's what I get:
> ERROR: function version() does not exist
>
> Any other ideas, short of actually asking the ISP help desk?
I just did it and it worked fine:
$query = "select version()";
$res = pg_exec($conn,$query);
if(!$res) {
die("not found");
}
if(($x = pg_numrows($res)) < 1) {
echo("not found in database\n");
exit;
}
$row = pg_fetch_row($res,$ii);
echo("version: $row[0]");
and it gives:
version: PostgreSQL 7.1.2 on i386-unknown-freebsd4.2, compiled by GCC 2.95.2
Maybe it's really old?
Vince.
--
==========================================================================
Vince Vielhaber -- KA8CSH email: vev@michvhf.com http://www.pop4.net
56K Nationwide Dialup from $16.00/mo at Pop4 Networking
Online Campground Directory http://www.camping-usa.com
Online Giftshop Superstore http://www.cloudninegifts.com
==========================================================================
> -----Original Message-----
> From: Gary Hoffman [mailto:ghoffman@ucsd.edu]
> Sent: Tuesday, 18 December 2001 12:16 AM
> To: chriskl@familyhealth.com.au
> Cc: pgsql-php@postgresql.org
> Subject: Re: RE: [PHP] Determing Postgres version
>
>
> Well, I thought of that.
>
> Here's what I get:
> ERROR: function version() does not exist
>
> Any other ideas, short of actually asking the ISP help desk?
Not really - bit before my time!
Another thought - if the old version of postgres doesn't support LIMIT, does
it support CURSORs? If it does, you can simulate LIMIT by going:
BEGIN;
DECLARE mycursor CURSOR
FOR SELECT * FROM table;
FETCH FORWARD limit_no IN mycursor;
CLOSE mycursor;
COMMIT;
Chris