Re: select statement fails

Поиск
Список
Период
Сортировка
От Albe Laurenz
Тема Re: select statement fails
Дата
Msg-id D960CB61B694CF459DCFB4B0128514C201FA5AB9@exadv11.host.magwien.gv.at
обсуждение исходный текст
Ответ на select statement fails  ("Andrus" <kobruleht2@hot.ee>)
Список pgsql-general
Andrus wrote:
> Any idea why the following select statement does not return rows ?
> This select statement is generated by npgsql2 beta 3 so I
> cannot change it in my application.
> How to fix without changing select statement ?
>
> Andrus.
>
> create temp table test ( tc char(1) );
> insert into test values(' ');
> select * from test where tc=' '::text;

Because the arguments to the operator "=" are of different type,
implicit type conversion takes place.
"character(1)" will by converted to "text", during this conversion
trailing blanks will be ignored, as befits the "character(n)" type.

You can get what you probably want by:

create temp table test ( tc varchar(1) );

Yours,
Laurenz Albe

В списке pgsql-general по дате отправления:

Предыдущее
От: "Albe Laurenz"
Дата:
Сообщение: Re: wrong query result
Следующее
От: "Markus Wollny"
Дата:
Сообщение: Re: tsvector_update_trigger throws error "column is not of tsvector type"