pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Justin Pryzby <pryzby@telsasoft.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: gkokolatos@pm.me, pgsql-hackers@postgresql.org, Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Tatsuro Yamada <tatsuro.yamada.tf@nttcom.co.jp>
Subject: Re: v13: show extended stats target in \d
Date: Sat, 5 Sep 2020 16:06:58 -0500
Message-ID: <20200905210658.GA6744@telsasoft.com> (raw)
In-Reply-To: <20200901210825.GA20170@alvherre.pgsql>
References: <20200901011429.GZ5450@telsasoft.com>
	<20200901210825.GA20170@alvherre.pgsql>

On Tue, Sep 01, 2020 at 05:08:25PM -0400, Alvaro Herrera wrote:
> +1 on fixing this, since the ability to change stats target is new in
> pg13.
> 
> On 2020-Aug-31, Justin Pryzby wrote:
> 
> > Maybe it should have a comma, like ", STATISTICS %s"?
> 
> It does need some separator.  Maybe a comma is sufficient, but I'm not
> sure: that will fail when we add cross-relation stats, because the
> FROM clause will have more relations and possibly have commas too.

Good thought.

You said it'll "fail", but I guess you mean it could be confusing to look at.

I didn't actually know that "multiple tables" were planned for MV stats.
Another consideration is expression stats (as compared with expression
indexes).  I don't see how that helps guide this decision at all, though.

I think trying to parse \d output is discouraged and a bad idea, but it's
obviously not ok if the output is ambiguous.

But it's not ambiguous, since STATISTICS is capitalized and unquoted.
Arguably, "nn" could be construed as looking like a table alias, which doesn't
make sense here, and integer aliases would also need to be quoted (and seem
unlikely and not useful).

... FROM t1, t2, STATISTICS nn

I think this is 1) unambiguous; 2) clear; 3) consistent with other output and
with the "ALTER STATISTICS SET STATISTICS NN" command.  It could say "SET" but
I don't think it's useful to include; 4) seems to reasonably anticipate future
support for expressions and multiple tables; 

I'm happy if someone suggests something better, but I don't know what that
would be.  Unless we hurried up and finished this for v13, and included
stxstattarget.
https://commitfest.postgresql.org/29/2692/
https://www.postgresql.org/message-id/flat/c0939aba-3b12-b596-dd08-913dda4b40f0%40nttcom.co.jp_1#326...

Maybe it's not relevant, but I found these don't have a separator.
ppendPQExpBufferStr(&buf, " DEFERRABLE");
ppendPQExpBufferStr(&buf, " INITIALLY DEFERRED");
ppendPQExpBufferStr(&buf, " INVALID");
ppendPQExpBufferStr(&buf, " PRIMARY KEY,");
ppendPQExpBufferStr(&buf, " REPLICA IDENTITY");
ppendPQExpBufferStr(&buf, " UNIQUE,");
ppendPQExpBufferStr(&buf, " UNIQUE CONSTRAINT,");
ppendPQExpBufferStr(&buf, " CLUSTER");
ppendPQExpBufferStr(&buf, " AS RESTRICTIVE");
ppendPQExpBuffer(&buf, "\n      TO %s",

These look like the only similar things with more than a single separator:
ppendPQExpBuffer(&buf, "\n      USING (%s)",
ppendPQExpBuffer(&buf, "\n      WITH CHECK (%s)",

-- 
Justin





view thread (9+ messages)  latest in thread

Message-ID: <20200905210658.GA6744@telsasoft.com>
Permalink:  ../20200905210658.GA6744@telsasoft.com/
Also on:    postgresql.org/message-id/20200905210658.GA6744@telsasoft.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: pryzby@telsasoft.com, alvherre@2ndquadrant.com, tomas.vondra@2ndquadrant.com, tatsuro.yamada.tf@nttcom.co.jp
  Subject: Re: v13: show extended stats target in \d
  In-Reply-To: <20200905210658.GA6744@telsasoft.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox