Thread: no meaningful way to determine fe or be version?

no meaningful way to determine fe or be version?

From
pgsql-bugs@postgresql.org
Date:
Paul M. Aoki (aoki@acm.org) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
no meaningful way to determine fe or be version?

Long Description
both the odbc and jdbc drivers seem to hardcode the database version, e.g., org/postgresql/jdbc2/DatabaseMetaData.java
alwaysreturns "6.5.2" when you call getDatabaseProductVersion(). 

it would be nice if the metadata routines were actually tied to something returned from the backend.

Sample Code


No file was uploaded with this report

Re: no meaningful way to determine fe or be version?

From
Bruce Momjian
Date:
You can do a 'SELECT version()' to get a version string from the
backend.

> Paul M. Aoki (aoki@acm.org) reports a bug with a severity of 3
> The lower the number the more severe it is.
>
> Short Description
> no meaningful way to determine fe or be version?
>
> Long Description
> both the odbc and jdbc drivers seem to hardcode the database version, e.g.,
org/postgresql/jdbc2/DatabaseMetaData.javaalways returns "6.5.2" when you call getDatabaseProductVersion(). 
>
> it would be nice if the metadata routines were actually tied to something returned from the backend.
>
> Sample Code
>
>
> No file was uploaded with this report
>
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: no meaningful way to determine fe or be version?

From
aoki@acm.org (Paul M. Aoki)
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > it would be nice if the metadata routines were actually tied to something retu
rned from the backend.
>
> You can do a 'SELECT version()' to get a version string from the
> backend.

thanks for the workaround.

the original point still stands, of course ;-)
--
 Paul M. Aoki / Xerox Palo Alto Research Center / 3333 Coyote Hill Road
 aoki@acm.org / Computer Science Laboratory     / Palo Alto, CA 94304-1314

Re: no meaningful way to determine fe or be version?

From
Bruce Momjian
Date:
Yes, should we return the client or server version from the interface?
If we return the server version, how does someone query the client version?

> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > it would be nice if the metadata routines were actually tied to something retu
> rned from the backend.
> >
> > You can do a 'SELECT version()' to get a version string from the
> > backend.
>
> thanks for the workaround.
>
> the original point still stands, of course ;-)
> --
>  Paul M. Aoki / Xerox Palo Alto Research Center / 3333 Coyote Hill Road
>  aoki@acm.org / Computer Science Laboratory     / Palo Alto, CA 94304-1314
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: no meaningful way to determine fe or be version?

From
aoki@acm.org (Paul M. Aoki)
Date:
Bruce Momjian <pgman@candle.pha.pa.us> writes:
> Yes, should we return the client or server version from the interface?
> If we return the server version, how does someone query the client version?

sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*)
are actually fine - they return a major/minor version that have been
getting manually updated (they're much more visible, being in
org/postgresql/Driver.java).  the server-side interfaces
(DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
tied to the server, return hardcoded strings and haven't been getting
updated regularly.
--
 Paul M. Aoki / Xerox Palo Alto Research Center / 3333 Coyote Hill Road
 aoki@acm.org / Computer Science Laboratory     / Palo Alto, CA 94304-1314

Re: no meaningful way to determine fe or be version?

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Yes, should we return the client or server version from the interface? 
> > If we return the server version, how does someone query the client version?
> 
> sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*) 
> are actually fine - they return a major/minor version that have been
> getting manually updated (they're much more visible, being in 
> org/postgresql/Driver.java).  the server-side interfaces 
> (DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
> tied to the server, return hardcoded strings and haven't been getting
> updated regularly.

Oh, really.  I didn't know there was that distinction.  Sounds like they
should be callling SELECT version().  Comments, Java folks?

--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

From
Joseph Shraibman
Date:
Bruce Momjian wrote:
> 
> > Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > > Yes, should we return the client or server version from the interface?
> > > If we return the server version, how does someone query the client version?
> >
> > sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*)
> > are actually fine - they return a major/minor version that have been
> > getting manually updated (they're much more visible, being in
> > org/postgresql/Driver.java).  the server-side interfaces
> > (DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
> > tied to the server, return hardcoded strings and haven't been getting
> > updated regularly.
> 
> Oh, really.  I didn't know there was that distinction.  Sounds like they
> should be callling SELECT version().  Comments, Java folks?
> 
I remember someone posting a patch saying that he changed the code to do
that.  Or saying he was going to post a patch, I forget.

Anyway, I just checked and it isn't in the cvs.

-- 
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio.  http://www.targabot.com


Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

From
Anders Bengtsson
Date:
Bruce Momjian wrote:
> 
> > sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*)
> > are actually fine - they return a major/minor version that have been
> > getting manually updated (they're much more visible, being in
> > org/postgresql/Driver.java).  the server-side interfaces
> > (DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
> > tied to the server, return hardcoded strings and haven't been getting
> > updated regularly.
> 
> Oh, really.  I didn't know there was that distinction.  Sounds like they
> should be callling SELECT version().  Comments, Java folks?

I posted a patch for the JDBC driver to pgsql-interfaces to do just that
some time ago. Don't know what happened to it, though .. 

/Anders
________________________________________________________________________
A n d e r s  B e n g t s s o n                        anders@lecando.com
http://www.lecando.com


Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

From
Bruce Momjian
Date:
This concerns me.  Did we lose a patch here?  Can you send it again?

> Bruce Momjian wrote:
> > 
> > > sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*)
> > > are actually fine - they return a major/minor version that have been
> > > getting manually updated (they're much more visible, being in
> > > org/postgresql/Driver.java).  the server-side interfaces
> > > (DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
> > > tied to the server, return hardcoded strings and haven't been getting
> > > updated regularly.
> > 
> > Oh, really.  I didn't know there was that distinction.  Sounds like they
> > should be callling SELECT version().  Comments, Java folks?
> 
> I posted a patch for the JDBC driver to pgsql-interfaces to do just that
> some time ago. Don't know what happened to it, though .. 
> 
> /Anders
> ________________________________________________________________________
> A n d e r s  B e n g t s s o n                        anders@lecando.com
> http://www.lecando.com
> 


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [INTERFACES] Re: no meaningful way to determine fe or beversion?

From
Anders Bengtsson
Date:
I think Peter Mount looked at it, but there where some big changes to
the JDBC driver going on at that time. When I look at the code in CVS
now it looks nothing like what it did when I did the patch against it.

Anyway, I found my old patch in the archives:
http://www.postgresql.org/mhonarc/pgsql-interfaces/2000-09/msg00051.html

/Anders

Bruce Momjian wrote:
> 
> This concerns me.  Did we lose a patch here?  Can you send it again?

> >
> > I posted a patch for the JDBC driver to pgsql-interfaces to do just that
> > some time ago. Don't know what happened to it, though ..

_____________________________________________________________________
A n d e r s  B e n g t s s o n                     anders@lecando.com
Stockholm, Sweden


Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

From
Joseph Shraibman
Date:
Try submitting it to the psgsl-patches list.

Anders Bengtsson wrote:
> 
> Bruce Momjian wrote:
> >
> > > sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*)
> > > are actually fine - they return a major/minor version that have been
> > > getting manually updated (they're much more visible, being in
> > > org/postgresql/Driver.java).  the server-side interfaces
> > > (DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
> > > tied to the server, return hardcoded strings and haven't been getting
> > > updated regularly.
> >
> > Oh, really.  I didn't know there was that distinction.  Sounds like they
> > should be callling SELECT version().  Comments, Java folks?
> 
> I posted a patch for the JDBC driver to pgsql-interfaces to do just that
> some time ago. Don't know what happened to it, though ..
> 
> /Anders
> ________________________________________________________________________
> A n d e r s  B e n g t s s o n                        anders@lecando.com
> http://www.lecando.com

-- 
Joseph Shraibman
jks@selectacast.net
Increase signal to noise ratio.  http://www.targabot.com


Re: [INTERFACES] Re: no meaningful way to determine fe or beversion?

From
Bruce Momjian
Date:
OK, I think I understand this now.

getDatabaseProductVersion() calls getVersion, which is defined in
Driver.java.in as the version string from configure.  It returns the
version of the client jdbc code.  To get the server version, you need
that SELECT you suggested.

Is that OK?


> I think Peter Mount looked at it, but there where some big changes to
> the JDBC driver going on at that time. When I look at the code in CVS
> now it looks nothing like what it did when I did the patch against it.
> 
> Anyway, I found my old patch in the archives:
> http://www.postgresql.org/mhonarc/pgsql-interfaces/2000-09/msg00051.html
> 
> /Anders
> 
> Bruce Momjian wrote:
> > 
> > This concerns me.  Did we lose a patch here?  Can you send it again?
> 
> > >
> > > I posted a patch for the JDBC driver to pgsql-interfaces to do just that
> > > some time ago. Don't know what happened to it, though ..
> 
> _____________________________________________________________________
> A n d e r s  B e n g t s s o n                     anders@lecando.com
> Stockholm, Sweden
> 


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

From
Bruce Momjian
Date:
Sorry, I am just now catching up to the fact that this problem was
already discussed.  I have gotten the patch from the URL supplied by the
author, and have applied it to the CVS tree.  It will appear in
tomorrow's snapshot, and in 7.1.


Thanks for the patch.  Someone else we complaining about this also just
last week.  I will let him know it will be fixed in 7.1.


> Try submitting it to the psgsl-patches list.
> 
> Anders Bengtsson wrote:
> > 
> > Bruce Momjian wrote:
> > >
> > > > sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*)
> > > > are actually fine - they return a major/minor version that have been
> > > > getting manually updated (they're much more visible, being in
> > > > org/postgresql/Driver.java).  the server-side interfaces
> > > > (DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
> > > > tied to the server, return hardcoded strings and haven't been getting
> > > > updated regularly.
> > >
> > > Oh, really.  I didn't know there was that distinction.  Sounds like they
> > > should be callling SELECT version().  Comments, Java folks?
> > 
> > I posted a patch for the JDBC driver to pgsql-interfaces to do just that
> > some time ago. Don't know what happened to it, though ..
> > 
> > /Anders
> > ________________________________________________________________________
> > A n d e r s  B e n g t s s o n                        anders@lecando.com
> > http://www.lecando.com
> 
> -- 
> Joseph Shraibman
> jks@selectacast.net
> Increase signal to noise ratio.  http://www.targabot.com
> 


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


Re: no meaningful way to determine fe or be version?

From
Bruce Momjian
Date:
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Yes, should we return the client or server version from the interface?
> > If we return the server version, how does someone query the client version?
>
> sorry, yes.  the client-side interfaces (DatabaseMetaData.getDriver*)
> are actually fine - they return a major/minor version that have been
> getting manually updated (they're much more visible, being in
> org/postgresql/Driver.java).  the server-side interfaces
> (DatabaseMetaData.getDatabase{Name,Version}) are the ones that aren't
> tied to the server, return hardcoded strings and haven't been getting
> updated regularly.

Good news.  Someone supplied a patch to getDatabaseProductVersion() that
properly does the SELECT version(); and returns the result.  It will
appear in 7.1.


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Re: [INTERFACES] Re: no meaningful way to determine fe or beversion?

From
Bruce Momjian
Date:
Thanks.  This URL was a huge help.  I applied the change to the proper
function.


> I think Peter Mount looked at it, but there where some big changes to
> the JDBC driver going on at that time. When I look at the code in CVS
> now it looks nothing like what it did when I did the patch against it.
> 
> Anyway, I found my old patch in the archives:
> http://www.postgresql.org/mhonarc/pgsql-interfaces/2000-09/msg00051.html
> 
> /Anders
> 
> Bruce Momjian wrote:
> > 
> > This concerns me.  Did we lose a patch here?  Can you send it again?
> 
> > >
> > > I posted a patch for the JDBC driver to pgsql-interfaces to do just that
> > > some time ago. Don't know what happened to it, though ..
> 
> _____________________________________________________________________
> A n d e r s  B e n g t s s o n                     anders@lecando.com
> Stockholm, Sweden
> 


--  Bruce Momjian                        |  http://candle.pha.pa.us pgman@candle.pha.pa.us               |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026