From: | Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com> |
---|---|
To: | Justin Pryzby <pryzby(at)telsasoft(dot)com> |
Cc: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: PoC/WIP: Extended statistics on expressions |
Date: | 2021-08-16 13:19:53 |
Message-ID: | 58cbfa74-9356-778b-3e10-94e3075c5807@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 8/16/21 3:31 AM, Justin Pryzby wrote:
> On 1/22/21 5:01 AM, Justin Pryzby wrote:
>>> In any case, why are there so many parentheses ?
>
> On Fri, Jan 22, 2021 at 02:09:04PM +0100, Tomas Vondra wrote:
>> That's a bug in pg_get_statisticsobj_worker, probably. It shouldn't be
>> adding extra parentheses, on top of what deparse_expression_pretty does.
>> Will fix.
>
> The extra parens are still here - is it intended ?
>
Ah, thanks for reminding me! I was looking at this, and the problem is
that pg_get_statisticsobj_worker only does this:
prettyFlags = PRETTYFLAG_INDENT;
Changing that to
prettyFlags = PRETTYFLAG_INDENT | PRETTYFLAG_PAREN;
fixes this (not sure we need the INDENT flag - probably not).
I'm a bit confused, though. My assumption was "PRETTYFLAG_PAREN = true"
would force the deparsing itself to add the parens, if needed, but in
reality it works the other way around.
I guess it's more complicated due to deparsing multi-level expressions,
but unfortunately, there's no comment explaining what it does.
regards
--
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 2021-08-16 13:20:07 | Some RELKIND macro refactoring |
Previous Message | Daniel Gustafsson | 2021-08-16 11:42:01 | Re: Slightly improve initdb --sync-only option's help message |