From: | PG Bug reporting form <noreply(at)postgresql(dot)org> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Cc: | cherio(at)gmail(dot)com |
Subject: | BUG #16653: Regression in CTE evaluation |
Date: | 2020-10-04 16:18:43 |
Message-ID: | 16653-3154c42c219f8693@postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 16653
Logged by: Yuri Cherio
Email address: cherio(at)gmail(dot)com
PostgreSQL version: 13.0
Operating system: Ubuntu Linux 20.04
Description:
The following SQL worked in versions 9 through 12. It is throwing an error
in version 13.
CREATE TABLE test AS SELECT now() AS tstmp, 'value' AS val;
WITH exp_days AS (
SELECT ''::TEXT AS days WHERE '' ~ E'^[-]?\\d+$'
)
SELECT test.*
FROM test
CROSS JOIN exp_days
WHERE tstmp > date(current_date - CAST(exp_days.days || ' days' AS
interval));
I'd leave alone why this SQL looks ridiculous - it is a very, very
simplified case of more complex dynamic query. Statement "exp_days" returns
no rows and in previous versions the optimizer would not even try evaluating
WHERE in the final query. It doesn't seem to be the case starting version
13.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2020-10-04 17:13:59 | Re: BUG #16653: Regression in CTE evaluation |
Previous Message | David G. Johnston | 2020-10-03 20:02:24 | Re: BUG #16652: SELECT pg_reload_conf(); returning true despite loading config has failed |