Re: real - integer type cast in prepared statements

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrei <andyk(at)softwarium(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: real - integer type cast in prepared statements
Date: 2006-03-07 14:48:02
Message-ID: 18194.1141742882@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andrei <andyk(at)softwarium(dot)net> writes:
> Why when I prepare statement by parsing such query: 'SELECT * FROM
> "test" WHERE "ind" < $1 + 1' ("ind" is of type REAL) $1 is interpreted
> by backend as INTEGER?

Because the context in which its type first has to be resolved is "$1 + 1",
and the "1" is INTEGER.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Emi Lu 2006-03-07 14:54:11 Re: About when we should setup index?
Previous Message Kenneth Downs 2006-03-07 14:38:04 per-statement, after, what's new?