From: | Yura Sokolov <y(dot)sokolov(at)postgrespro(dot)ru> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Jumble Query with COERCE_SQL_SYNTAX |
Date: | 2022-03-29 12:52:57 |
Message-ID: | 2a0a943877fe79eaf79f1ad752765823d95dce7e.camel@postgrespro.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Good day.
v14 introduced the way to get original text for some kind of expressions
using new 'funcformat' - COERCE_SQL_SYNTAX:
- EXTRACT(part from timestamp)
- (text IS [form] NORMALIZED)
and others.
Mentioned EXTRACT and NORMALIZED statements has parts, that are not
usual arguments but some kind of syntax. At least, there is no way to:
PREPARE a(text) as select extract($1 from now());
But JumbleExpr doesn't distinguish it and marks this argument as a
variable constant, ie remembers it in 'clocations'.
I believe such "non-variable constant" should not be jumbled as
replaceable thing.
In our case (extended pg_stat_statements), we attempt to generalize
plan and then explain generalized plan. But using constant list from
JumbleState we mistakenly replace first argument in EXTRACT expression
with parameter. And then 'get_func_sql_syntax' fails on assertion "first
argument is text constant".
Sure we could workaround in our plan mutator with skipping such first
argument. But I wonder, is it correct at all to not count it as a
non-modifiable syntax part in JumbleExpr?
------
regards,
Sokolov Yura
y(dot)sokolov(at)postgrespro(dot)ru
funny(dot)falcon(at)gmail(dot)coma
From | Date | Subject | |
---|---|---|---|
Next Message | Aleksander Alekseev | 2022-03-29 13:09:14 | Re: XID formatting and SLRU refactorings (was: Add 64-bit XIDs into PostgreSQL 15) |
Previous Message | Robert Haas | 2022-03-29 12:51:20 | Re: refactoring basebackup.c (zstd workers) |