Re: BUG #12458: Comparison with CHAR is inconsistent between string types

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: BUG #12458: Comparison with CHAR is inconsistent between string types
Дата
Msg-id CA+HiwqHjF2JW7E1LhK4UXEnWhOxMcMV7ke+ensode-eH8yz+cg@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #12458: Comparison with CHAR is inconsistent between string types  (tneumann@users.sourceforge.net)
Ответы Re: BUG #12458: Comparison with CHAR is inconsistent between string types
Список pgsql-bugs
On Thu, Jan 8, 2015 at 6:39 AM,  <tneumann@users.sourceforge.net> wrote:
> The following two queries return different results:
>
> select 'A'::char(1)='A '::text;
> select 'A'::char(1)='A '::varchar(10);
>
> I would expect both queries to return "true", and this is also suggested by
> the documentation (section 8.3.), but the text comparison returns false.
>

Quick inspection of pg_operator suggests there is no '=' operator that
takes varchar as either of the operands. Not sure why that is so. It
appears the comparison proceeds using =(char, char) operator with the
varchar operand appropriately coerced. Hence the result.

Thanks,
Amit

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