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


Reply via email to