From: | "Albe Laurenz" <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
---|---|
To: | "Andrus *EXTERN*" <kobruleht2(at)hot(dot)ee>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: select statement fails |
Date: | 2008-04-09 11:48:04 |
Message-ID: | D960CB61B694CF459DCFB4B0128514C201FA5AB9@exadv11.host.magwien.gv.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Wollny | 2008-04-09 11:49:22 | Re: tsvector_update_trigger throws error "column is not of tsvector type" |
Previous Message | Albe Laurenz | 2008-04-09 11:37:54 | Re: wrong query result |