Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type
Date
Msg-id CAKFQuwbnCgcYh46JBXSnLvMk47wsHDdnGybSS59CQ5Wp+HewgQ@mail.gmail.com
Whole thread Raw
In response to [BUGS] BUG #14853: Parameter type is required even when the query does notneed to know the type  (edpeur@gmail.com)
Responses Re: [BUGS] BUG #14853: Parameter type is required even when the querydoes not need to know the type
List pgsql-bugs
On Fri, Oct 13, 2017 at 7:03 AM, <edpeur@gmail.com> wrote:
The following bug has been logged on the website:

Bug reference:      14853
Logged by:          Eduardo Perez
Email address:      edpeur@gmail.com
PostgreSQL version: Unsupported/Unknown
Operating system:   All
Description:

The query:
SELECT ? IS NULL
should work even when the parameter type is unknown, as there is no need to
know the type in that query.

While your statement is correct the behavior that all parameters must have a type is not buggy.  As I'm not in a position to comprehend just how much could go wrong by removing that restriction (and making it work only in cases where type doesn't matter, like IS NULL, is unappealing) I'll forgo much speculation but will say that given that the error is both immediate and obvious the likelihood of changing this is quite low.

The PostgreSQL project has intentionally made a number of changes in the past that tighten up things in the area of types (unknowns and casting) with full awareness that those changes may break existing applications.  It was felt that, on the whole, the benefit to future coders outweighed the inconvenience of a subset of the existing code.

David J.

pgsql-bugs by date:

Previous
From: Fabrízio de Royes Mello
Date:
Subject: Re: [BUGS] BUG #14851: Systemd kills long-running recovery
Next
From: John R Pierce
Date:
Subject: Re: [BUGS] BUG #14851: Systemd kills long-running recovery