no meaningful way to determine fe or be version?

Started by PostgreSQL Bugs Listover 25 years ago15 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

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 always 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

#2Bruce Momjian
bruce@momjian.us
In reply to: PostgreSQL Bugs List (#1)
Re: no meaningful way to determine fe or be version?

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.java always 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
#3Noname
aoki@acm.org
In reply to: Bruce Momjian (#2)
Re: no meaningful way to determine fe or be 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

#4Bruce Momjian
bruce@momjian.us
In reply to: Noname (#3)
Re: no meaningful way to determine fe or be version?

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
#5Noname
aoki@acm.org
In reply to: Bruce Momjian (#4)
Re: no meaningful way to determine fe or be version?

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

#6Bruce Momjian
bruce@momjian.us
In reply to: Noname (#5)
Re: no meaningful way to determine fe or be version?

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, Pennsylvania 19026
#7Joseph Shraibman
jks@selectacast.net
In reply to: Bruce Momjian (#6)
Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

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

#8Anders Bengtsson
anders@lecando.com
In reply to: Bruce Momjian (#6)
Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

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

#9Bruce Momjian
bruce@momjian.us
In reply to: Anders Bengtsson (#8)
Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

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, Pennsylvania 19026
#10Anders Bengtsson
anders@lecando.com
In reply to: Bruce Momjian (#9)
Re: [INTERFACES] Re: no meaningful way to determine fe or beversion?

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

#11Joseph Shraibman
jks@selectacast.net
In reply to: Bruce Momjian (#6)
Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

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

#12Bruce Momjian
bruce@momjian.us
In reply to: Anders Bengtsson (#10)
Re: [INTERFACES] Re: no meaningful way to determine fe or beversion?

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, Pennsylvania 19026
#13Bruce Momjian
bruce@momjian.us
In reply to: Joseph Shraibman (#11)
Re: [INTERFACES] Re: no meaningful way to determine fe or be version?

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, Pennsylvania 19026
#14Bruce Momjian
bruce@momjian.us
In reply to: Noname (#5)
Re: no meaningful way to determine fe or be version?

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
#15Bruce Momjian
bruce@momjian.us
In reply to: Anders Bengtsson (#10)
Re: [INTERFACES] Re: no meaningful way to determine fe or beversion?

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, Pennsylvania 19026