public inbox for [email protected]  
help / color / mirror / Atom feed
From: Morgan Owens <[email protected]>
To: Nick Farmer <[email protected]>
To: [email protected]
Subject: Re: Parameter types are inferred from context of first use only.
Date: Thu, 9 Aug 2018 12:18:27 +1200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<[email protected]>

On 2018-08-09 05:24, Bruce Momjian wrote:
> On Mon, Jul 23, 2018 at 09:14:48AM +0000, PG Doc comments form wrote:
>> The following documentation comment has been logged on the website:
>>
>> Page: https://www.postgresql.org/docs/10/static/sql-prepare.html
>> Description:
>>
>> Background can be found on the bugs list (pgsql-bug #15289). It was
>> explained that when a prepared statement parameter needs to have its type
>> inferred then, should the parameter be used more than once, only the first
>> use is considered. (The example in that report is that the type of $1 can be
>> inferred from "($1 = col) or ($1 is null)" but not from "($1 is null) or ($1
>> = col)".)
>>
>> The documentation as it stands says only that the parameter's type is
>> inferred from the context in which it is used. The "first use only" proviso
>> is not mentioned (hence "context" isn't so broad as to consist of all of the
>> expressions in which the parameter appears).
> 
> I have developed the attached patch to cover what you found.
> 

That says it for me. The third mention of context doesn't need anything 
because it's referring specifically to the (single) use of $2 in the 
example. I have to presume the type inference happens before any 
structural changes that might change the meaning of "first occurrence".

Nick




view thread (5+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Parameter types are inferred from context of first use only.
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox