max() unexpected type conversion
От | Hélder M. Vieira |
---|---|
Тема | max() unexpected type conversion |
Дата | |
Msg-id | 000901c5ee99$c275e380$580bfea9@hmv02 обсуждение исходный текст |
Ответы |
Re: max() unexpected type conversion
|
Список | pgsql-sql |
Hello. I'm having some trouble with an unexpected conversion performed by the max() function. If max() operates on a 'varchar' type column, the result appears with 'text' type. Should I expect this behaviour in the current and later versions ? I mention this because I'm using ODBC in VB, and this type conversion has a bad outcome, because 'text' columns require a specific treatment (a second reading of the column contents returns null). Therefore, if this conversion is beeing made as a result of a design option, I'll have to use a different approach (something like 'select ... order by ... desc limit 1'). A small sample follows, giving a 'text' type result: create table test ( testcol varchar(4) not null ); insert into test (testcol) values ('A'); insert into test (testcol) values ('A'); insert into test (testcol) values ('B'); insert into test (testcol) values ('B'); insert into test (testcol) values ('C'); insert into test (testcol) values ('C'); select max(testcol) from test; Thank you Hélder M. Vieira
В списке pgsql-sql по дате отправления: