Re: Parameter types are inferred from context of first use only.

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: farmernick-pg(at)varteg(dot)nz, pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Parameter types are inferred from context of first use only.
Date: 2018-08-08 17:24:44
Message-ID: 20180808172444.GC2611@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

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.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
prepare.diff text/x-diff 1.3 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Morgan Owens 2018-08-09 00:18:27 Re: Parameter types are inferred from context of first use only.
Previous Message David G. Johnston 2018-08-08 16:58:43 Re: dblink_error_message return value