Re: BUG #17052: Incorrect params inferred on PREPARE (part 2) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #17052: Incorrect params inferred on PREPARE (part 2)
Date
Msg-id 1119504.1623170371@sss.pgh.pa.us
Whole thread Raw
In response to BUG #17052: Incorrect params inferred on PREPARE (part 2)  (PG Bug reporting form <noreply@postgresql.org>)
List pgsql-bugs
PG Bug reporting form <noreply@postgresql.org> writes:
>   SET timestampCol = $1 + interval '1 minute';
> ...results in an error...
> ERROR:  column "timestampcol" is of type timestamp without time zone but
> expression is of type interval
> LINE 4:   set timestampCol = $1 + interval '1 minute';
>                              ^

As in your other report, the context in which the parameter type is
guessed is just the immediate context of the plus-operator expression.
The relevant rule there is "guess that an unknown input is of the same
type as the other input", so we resolve the operator as interval + interval.

            regards, tom lane



pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #17051: Incorrect params inferred on PREPARE
Next
From: Tom Lane
Date:
Subject: Re: setting the timezone parameter with space cause diff result