Re: BUG #17052: Incorrect params inferred on PREPARE (part 2)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: arthur(dot)mcgibbon(at)gmail(dot)com
Cc: pgsql-bugs(at)lists(dot)postgresql(dot)org
Subject: Re: BUG #17052: Incorrect params inferred on PREPARE (part 2)
Date: 2021-06-08 16:39:31
Message-ID: 1119504.1623170371@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

PG Bug reporting form <noreply(at)postgresql(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2021-06-08 18:02:50 Re: setting the timezone parameter with space cause diff result
Previous Message Tom Lane 2021-06-08 16:35:38 Re: BUG #17051: Incorrect params inferred on PREPARE