Re: logical replication syntax (was DROP SUBSCRIPTION, query cancellations and slot handling)

From: Petr Jelinek <petr(dot)jelinek(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: logical replication syntax (was DROP SUBSCRIPTION, query cancellations and slot handling)
Date: 2017-05-02 12:45:56
Message-ID: cacf7538-5658-a93f-c03a-83d309ed1d9a@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02/05/17 14:13, Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>> On Thu, Apr 20, 2017 at 7:46 AM, Petr Jelinek
>> <petr(dot)jelinek(at)2ndquadrant(dot)com> wrote:
>>> DROP SUBSCRIPTION mysub NODROP SLOT;
>
>> I'm pretty uninspired by this choice of syntax. Logical replication
>> seems to have added a whole bunch of syntax that involves prefixing
>> words with "no". In various places, there's NODROP, NOREFRESH, NOCOPY
>> DATA, NOCONNECT, and NOPUBLISH. But "NO" is not an English prefix,
>> and there's no precedent of which I'm aware for such SQL syntax. In
>> most places, we've chosen to name the option and then the user set it
>> to "on" or "off". So for example you type EXPLAIN (ANALYZE, TIMING
>> OFF) or EXPLAIN (ANALYZE, TIMING FALSE), not EXPLAIN (ANALYZE,
>> NOTIMING). I think most of the logical replication stuff could have
>> been done this way pretty easily, but for some reason it picked a
>> completely different approach.
>
> I tend to agree with this criticism, but it's not quite true that we
> don't do this anywhere else --- see CREATE USER for one example, where
> we have monstrosities like NOBYPASSRLS. Still, at least those are single
> words without arguments. "NODROP SLOT" is pretty ugly, not least
> because if you want to claim CREATE USER as syntax precedent, you ought
> to spell it NODROPSLOT.
>
> Having said that, I doubt that anyone would argue that CREATE USER is
> anything but legacy syntax, or that our more recent syntax designs aren't
> better models to follow.
>
> It's not quite too late to revisit the syntax of the log rep commands
> ... shall we add this as an open item?

I am happy to implement something different, it's quite trivial to
change. But I am not going to propose anything different as I can't
think of better syntax (if I could I would have done it). I don't like
the OFF or FALSE (ie DROP SLOT OFF) any more than what is there now and
it also seems to not map very well to action (as opposed to output
option as it is in EXPLAIN). It might not be very close to SQL way but
that's because SQL way would be do not do any of those default actions
unless they are actually asked for (ie NODROP SLOT would be default and
DROP SLOT would be the option) but that's IMHO less user friendly.

--
Petr Jelinek http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2017-05-02 12:47:10 Re: UPDATE of partition key
Previous Message Michael Paquier 2017-05-02 12:43:45 Re: logical replication and PANIC during shutdown checkpoint in publisher