Обсуждение: Information Schema DBMS VERSION wrong

Поиск
Список
Период
Сортировка

Information Schema DBMS VERSION wrong

От
Michael Fuhr
Дата:
The following query doesn't return the version of PostgreSQL currently
running, but rather the version of initdb that initialized the cluster:

SELECT character_value
FROM information_schema.sql_implementation_info
WHERE implementation_info_name = 'DBMS VERSION';

Is that the intended or desired behavior?

sql_implementation_info is a table rather than a view, so its
contents are hardcoded by initdb.  Would it make sense to turn it
into a view?  This is admittedly a minor issue that might not merit
the effort, but it still seems wrong.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/


Re: Information Schema DBMS VERSION wrong

От
Tom Lane
Дата:
Michael Fuhr <mike@fuhr.org> writes:
> The following query doesn't return the version of PostgreSQL currently
> running, but rather the version of initdb that initialized the cluster:

> SELECT character_value
> FROM information_schema.sql_implementation_info
> WHERE implementation_info_name = 'DBMS VERSION';

> Is that the intended or desired behavior?

Not sure if it was really thought about, but seeing that (a) you can get
the current version from "select version()" and (b) there isn't any
other way to get the initdb version, it seems like this behavior is
fine.
        regards, tom lane


Re: Information Schema DBMS VERSION wrong

От
Peter Eisentraut
Дата:
Am Freitag, 29. Juli 2005 06:28 schrieb Tom Lane:
> > The following query doesn't return the version of PostgreSQL currently
> > running, but rather the version of initdb that initialized the cluster:

> Not sure if it was really thought about, but seeing that (a) you can get
> the current version from "select version()" and (b) there isn't any
> other way to get the initdb version, it seems like this behavior is
> fine.

I thought about this and I don't like it.  It could just as well confuse 
people who are in the name of portability or whatever are trying to move 
their application to use the information schema.  If we wanted to have a way 
to get certain information, we should design an interface for it and not rely 
on an accident.

-- 
Peter Eisentraut
http://developer.postgresql.org/~petere/