On Thu, Jan 8, 2015 at 6:39 AM, <tneumann(at)users(dot)sourceforge(dot)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