From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> |
Cc: | Alastair McKinley <a(dot)mckinley(at)analyticsengines(dot)com>, "pgsql-general\(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Possible bug: SQL function parameter in window frame definition |
Date: | 2019-09-28 20:37:43 |
Message-ID: | 32758.1569703063@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-hackers |
Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> writes:
> "Alastair" == Alastair McKinley <a(dot)mckinley(at)analyticsengines(dot)com> writes:
> Alastair> This appears to be a bug to me.
> Yes, it's a bug, related to function inlining (the select f(3); is not
> inlined and therefore works, but the select * from f(3); is being
> inlined, but the original Param is somehow making it into the final plan
> rather than being substituted with its value). Looking into why.
It looks to me that the reason is that query_tree_mutator (likewise
query_tree_walker) fails to visit query->windowClause, which is a
bug of the first magnitude if we allow those to contain expressions.
Not sure how we've missed that up to now.
Looking at struct Query, it seems like that's not the only questionable
omission. We're also not descending into
Node *utilityStmt; /* non-null if commandType == CMD_UTILITY */
List *groupClause; /* a list of SortGroupClause's */
List *groupingSets; /* a list of GroupingSet's if present */
List *distinctClause; /* a list of SortGroupClause's */
List *sortClause; /* a list of SortGroupClause's */
List *rowMarks; /* a list of RowMarkClause's */
Now probably this is never called on utility statements, and maybe
there is never a reason for anyone to examine or mutate SortGroupClauses,
GroupingSets, or RowMarkClauses, but I'm not sure it's any business of
this module to assume that.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Gierth | 2019-09-28 21:30:59 | Re: Possible bug: SQL function parameter in window frame definition |
Previous Message | Pavel Stehule | 2019-09-28 16:43:19 | Re: JSONB maximal length ? |
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2019-09-28 20:52:18 | Re: PostgreSQL12 and older versions of OpenSSL |
Previous Message | Bruce Momjian | 2019-09-28 19:59:00 | Re: Usage of the system truststore for SSL certificate validation |