Re: Types pollution with iso-8859-1 oids and server-side parameters binding - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Types pollution with iso-8859-1 oids and server-side parameters binding
Date
Msg-id 2234572.1651616332@sss.pgh.pa.us
Whole thread Raw
In response to Re: Types pollution with iso-8859-1 oids and server-side parameters binding  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Tue, May 3, 2022 at 12:55 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> What do you think ought to happen?  The same parameter somehow having
>> different types in different places?

> Based upon:
> "When a parameter's data type is not specified or is declared as unknown,
> the type is inferred from the context in which the parameter is first
> referenced (if possible)."

Right ...

> The parameter would seem to be first referenced as a timestamp (at least in
> parsing order).

Actually, if you look at transformUpdateStmt, you'll see the parsing
order is WITH, then FROM, then WHERE, then RETURNING, then the targetlist.
Some of this is constrained by semantics: we have to do WITH first because
it'll define pseudo-tables used in FROM, and we have to do FROM before
we can make sense of the rest.  We could possibly do the targetlist
before WHERE, but any assumption that it works left-to-right is just
doomed to failure by the poor consistency of SQL syntax.

            regards, tom lane



pgsql-bugs by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Types pollution with iso-8859-1 oids and server-side parameters binding
Next
From: Daniele Varrazzo
Date:
Subject: Re: Types pollution with iso-8859-1 oids and server-side parameters binding