pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Eduardo Pérez Ureta <edpeur@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #14853: Parameter type is required even when the query does not need to know the type
Date: Mon, 16 Oct 2017 14:33:56 -0400
Message-ID: <18575.1508178836@sss.pgh.pa.us> (raw)
In-Reply-To: <22d2db6e-d458-3893-f8a9-52a0f129fc10@2ndquadrant.com>
References: <20171013140350.8210.40918@wrigleys.postgresql.org>
	<CAKFQuwbnCgcYh46JBXSnLvMk47wsHDdnGybSS59CQ5Wp+HewgQ@mail.gmail.com>
	<CAM7oS3GU2v-oAp-Uws0VNUttdjUrNq01Psqttk8X8=xAro4fKg@mail.gmail.com>
	<CAKFQuwZU0OBrJCVfChuXkShi+L_-9psDDUYGXvrnYbbD-Odxug@mail.gmail.com>
	<CAM7oS3H9gU0Gqvz9B9p6h22i8363z=Pv3bdDj74g7-9wmEw8tQ@mail.gmail.com>
	<CAKFQuwawYCkJ+WH1NoGTnn1OEB-4jLE93ktOpeO94xEHPtJNhw@mail.gmail.com>
	<CAM7oS3HQwJoiT4Yza5kG-zcTU_grPA1RrtniuekvCuUR+C7hpg@mail.gmail.com>
	<CAKFQuwY2ce_MPA1NfURTy_O-XY6whj9eODPu6FA5r_k0q9dSKw@mail.gmail.com>
	<CAM7oS3FkCsSRM_W4xhuujuV8tv=VLVPCPA3z3UNzV0WY2uaP8g@mail.gmail.com>
	<22d2db6e-d458-3893-f8a9-52a0f129fc10@2ndquadrant.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Tomas Vondra <tomas.vondra@2ndquadrant.com> writes:
> In other words, the fact that "make check" passes may easily be just due
> to an omission in the regression tests. Apparently there's no test that
> we actually produce the error when the type can't be inferred.

> That being said, I don't know if this is a correct change or not.

The patch as presented (ie, just remove the check that all types
got determined) has no chance whatsoever of being accepted.  The
reason that check exists is that client-side code isn't necessarily
going to cope with being told that a parameter it is supposed to supply
is of type "unknown".  psql doesn't really care (in fact I don't think
it uses parameters at all), which is why the core regression tests pass.
But other clients such as JDBC have considerably more logic that depends
on the types of parameters.  We're not going to risk breaking them for
this sort of dubious-in-any-case feature.

It's possible that we'd accept a patch that resolves the parameter
as type text if it's in a context where the type doesn't matter.
(Are there any such contexts other than IS [NOT] NULL?)
Arguably that's more consistent with the fact that we now resolve
"select $1" as being type text.  But I'm not sure if that breaks any
cases that work today.  The obvious counterexample is something like

prepare foo as select $1 is not null and $1 > 42;

where the parameter would need to be resolved as some other type later.
But that presently fails with "could not determine data type", so I don't
see a very good reason why "operator does not exist: text > integer" is
a worse outcome.  The sticking point would be whether there are related
cases that succeed but such a patch would cause them to fail (or
silently change behavior, which is likely worse).

> You'll need to submit it to pgsql-hackers though.

Yes, this is certainly not a bug but a RFE.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (17+ messages)

Message-ID: <18575.1508178836@sss.pgh.pa.us>
Permalink:  ../18575.1508178836@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/18575.1508178836@sss.pgh.pa.us

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: tgl@sss.pgh.pa.us, tomas.vondra@2ndquadrant.com, edpeur@gmail.com, david.g.johnston@gmail.com
  Subject: Re: BUG #14853: Parameter type is required even when the query does not need to know the type
  In-Reply-To: <18575.1508178836@sss.pgh.pa.us>
  References: <20171013140350.8210.40918@wrigleys.postgresql.org> <CAKFQuwbnCgcYh46JBXSnLvMk47wsHDdnGybSS59CQ5Wp+HewgQ@mail.gmail.com> <CAM7oS3GU2v-oAp-Uws0VNUttdjUrNq01Psqttk8X8=xAro4fKg@mail.gmail.com> <CAKFQuwZU0OBrJCVfChuXkShi+L_-9psDDUYGXvrnYbbD-Odxug@mail.gmail.com> <CAM7oS3H9gU0Gqvz9B9p6h22i8363z=Pv3bdDj74g7-9wmEw8tQ@mail.gmail.com> <CAKFQuwawYCkJ+WH1NoGTnn1OEB-4jLE93ktOpeO94xEHPtJNhw@mail.gmail.com> <CAM7oS3HQwJoiT4Yza5kG-zcTU_grPA1RrtniuekvCuUR+C7hpg@mail.gmail.com> <CAKFQuwY2ce_MPA1NfURTy_O-XY6whj9eODPu6FA5r_k0q9dSKw@mail.gmail.com> <CAM7oS3FkCsSRM_W4xhuujuV8tv=VLVPCPA3z3UNzV0WY2uaP8g@mail.gmail.com> <22d2db6e-d458-3893-f8a9-52a0f129fc10@2ndquadrant.com> <18575.1508178836@sss.pgh.pa.us>

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

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