Re: Broken type checking for empty subqueries - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Broken type checking for empty subqueries
Date
Msg-id 960060.1695913059@sss.pgh.pa.us
Whole thread Raw
In response to Re: Broken type checking for empty subqueries  (David Rowley <dgrowleyml@gmail.com>)
Responses Re: Broken type checking for empty subqueries
List pgsql-bugs
David Rowley <dgrowleyml@gmail.com> writes:
> I've not looked at the code to see if this would be practical or not,
> but I wonder if we could reduce these bug reports by using the new
> soft error reporting that's now done in the input functions to have
> constant folding just silently not do any folding for the expression
> if a cast fails.

Sadly, I doubt that would cover enough of the problem space to make
much difference to people who try to do this sort of thing.

> ... I imagine most people who
> have had them fail during constant folding have just redesigned or
> found some hack to prevent the folding from taking place anyway.

Yeah.  The given query looks like it was already hacked to avoid
constant-folding, though I wonder if whoever wrote it really understood
that.  Otherwise it'd be a lot more natural to use something like CASE.
Anyway, adding OFFSET 0 to suppress sub-select folding is probably
the best answer here.

            regards, tom lane



pgsql-bugs by date:

Previous
From: David Rowley
Date:
Subject: Re: Broken type checking for empty subqueries
Next
From: Akash Kava
Date:
Subject: Re: BUG #18138: Using limit on VALUES causes type conversion to fail.