Обсуждение: BUG #4083: Return type of MAX and MIN of a VARCHAR column is TEXT

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

BUG #4083: Return type of MAX and MIN of a VARCHAR column is TEXT

От
"Pedro Gimeno"
Дата:
The following bug has been logged online:

Bug reference:      4083
Logged by:          Pedro Gimeno
Email address:      pgsql-001@personal.formauri.es
PostgreSQL version: 8.2.5
Operating system:   Irrelevant
Description:        Return type of MAX and MIN of a VARCHAR column is TEXT
Details:

Example:

CREATE TABLE a (x VARCHAR(40));

INSERT INTO a (x) VALUES ("blah");

SELECT MAX(x),MIN(x) FROM a;

The last query's return types are both TEXT, which in Zeos are not treated
in the same way as varchar.

Since the queries are designed to work with multiple servers, the only
workaround we've found so far is to create aggregate functions MAX(varchar)
and MIN(varchar) that return varchar.

Re: BUG #4083: Return type of MAX and MIN of a VARCHAR column is TEXT

От
Tom Lane
Дата:
"Pedro Gimeno" <pgsql-001@personal.formauri.es> writes:
> Description:        Return type of MAX and MIN of a VARCHAR column is TEXT

This is not a bug.  Most if not all operations with varchar will return
text --- it doesn't have its own operators.

> The last query's return types are both TEXT, which in Zeos are not treated
> in the same way as varchar.

I think you need to file a bug with Zeos to fix whatever their problem
is with text.

            regards, tom lane

Re: BUG #4083: Return type of MAX and MIN of a VARCHAR column is TEXT

От
Peter Eisentraut
Дата:
Tom Lane wrote:
> I think you need to file a bug with Zeos to fix whatever their problem
> is with text.

Well, to be fair, type text is not SQL standard.  But surely Zeos won't get
very far with this superstrict typing approach.  At least a little bit more
context might help us understand.