On Monday 28 April 2003 15:56, jgimenez@sipec_quitaesto_.es wrote:
> Somebody could explain me why this query...
>
> SELECT *
> FROM articulos,eans
> WHERE articulos.id_iinterno=eans.id_iinterno
> AND eans.id_iean=345
>
> is slower than this one? (the difference is the quotes around the
> number....)
>
> SELECT *
> FROM articulos,eans
> WHERE articulos.id_iinterno=eans.id_iinterno
> AND eans.id_iean='345'
In second case, postgresql typecasted it correctly. Even
eans.id_iean=345::int8 would have worked the same way. By default postgresql
treats a number as int4 while comparing and integer and float8 for a real
numbe. I discovered that yesterday.
Until the planner/parser gets smarter, this is going to be an FAQ..
Shridhar