Doc: CREATE_REPLICATION_SLOT command requires the plugin name

Started by Antonin Houskaover 4 years ago6 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

won't retrysuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t45438
psql -h localhost -U postgres

Built from patchset v3 (message #3), July 27, 2026 at 03:30 PM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t45438_3 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t45438_3 && git checkout t45438_3

Patchset v3 (message #3) is on t45438_3

Jump to latest
#1Antonin Houska
ah@cybertec.at

I got a syntax error when using the command according to the existing
documentation. The output_plugin parameter needs to be passed too.

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

Attachments:

doc_create_replication_slot.difftext/x-diffDownload+1-1
#2Amit Kapila
amit.kapila16@gmail.com
In reply to: Antonin Houska (#1)
Re: Doc: CREATE_REPLICATION_SLOT command requires the plugin name

On Tue, Feb 1, 2022 at 3:44 PM Antonin Houska <ah@cybertec.at> wrote:

I got a syntax error when using the command according to the existing
documentation. The output_plugin parameter needs to be passed too.

Why do we need it for physical slots? The syntax in repl_gram.y is as follows:
/* CREATE_REPLICATION_SLOT slot TEMPORARY PHYSICAL [options] */
K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_PHYSICAL create_slot_options
...
/* CREATE_REPLICATION_SLOT slot TEMPORARY LOGICAL plugin [options] */
| K_CREATE_REPLICATION_SLOT IDENT opt_temporary K_LOGICAL IDENT
create_slot_options

The logical slots do need output_plugin but not physical ones.

--
With Regards,
Amit Kapila.

#3Antonin Houska
ah@cybertec.at
In reply to: Amit Kapila (#2)
Re: Doc: CREATE_REPLICATION_SLOT command requires the plugin name

Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Feb 1, 2022 at 3:44 PM Antonin Houska <ah@cybertec.at> wrote:

I got a syntax error when using the command according to the existing
documentation. The output_plugin parameter needs to be passed too.

Why do we need it for physical slots?

Sure we don't, the missing curly brackets seem to be the problem. I used the
other form of the command for reference, which therefore might need a minor
fix too.

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

Attachments:

t45438_3
doc_create_replication_slot_v2.difftext/x-diffDownload+3-2
#4Amit Kapila
amit.kapila16@gmail.com
In reply to: Antonin Houska (#3)
Re: Doc: CREATE_REPLICATION_SLOT command requires the plugin name

On Tue, Feb 1, 2022 at 5:43 PM Antonin Houska <ah@cybertec.at> wrote:

Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Feb 1, 2022 at 3:44 PM Antonin Houska <ah@cybertec.at> wrote:

I got a syntax error when using the command according to the existing
documentation. The output_plugin parameter needs to be passed too.

Why do we need it for physical slots?

Sure we don't, the missing curly brackets seem to be the problem. I used the
other form of the command for reference, which therefore might need a minor
fix too.

Okay, I see that it is not very clear from the documentation.

   <varlistentry>
-    <term><literal>CREATE_REPLICATION_SLOT</literal> <replaceable
class="parameter">slot_name</replaceable> [
<literal>TEMPORARY</literal> ] { <literal>PHYSICAL</literal> [
<literal>RESERVE_WAL</literal> ] | <literal>LOGICAL</literal>
<replaceable class="parameter">output_plugin</replaceable> [
<literal>EXPORT_SNAPSHOT</literal> |
<literal>NOEXPORT_SNAPSHOT</literal> | <literal>USE_SNAPSHOT</literal>
| <literal>TWO_PHASE</literal> ] }
+    <term><literal>CREATE_REPLICATION_SLOT</literal> <replaceable
class="parameter">slot_name</replaceable> [
<literal>TEMPORARY</literal> ] { <literal>PHYSICAL</literal> [
<literal>RESERVE_WAL</literal> ] | { <literal>LOGICAL</literal>
<replaceable class="parameter">output_plugin</replaceable>
+} [ <literal>EXPORT_SNAPSHOT</literal> |
<literal>NOEXPORT_SNAPSHOT</literal> | <literal>USE_SNAPSHOT</literal>
| <literal>TWO_PHASE</literal> ] }

Instead of adding additional '{}', can't we simply use:
{ <literal>PHYSICAL</literal> [ <literal>RESERVE_WAL</literal> ] |
<literal>LOGICAL</literal> <replaceable
class="parameter">output_plugin</replaceable> } [
<literal>EXPORT_SNAPSHOT</literal> |
<literal>NOEXPORT_SNAPSHOT</literal> | <literal>USE_SNAPSHOT</literal>
| <literal>TWO_PHASE</literal> ]

I am not sure change to other syntax is useful as that is kept for
backward compatibility. I think we can keep that as it is.

--
With Regards,
Amit Kapila.

#5Antonin Houska
ah@cybertec.at
In reply to: Amit Kapila (#4)
Re: Doc: CREATE_REPLICATION_SLOT command requires the plugin name

Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Feb 1, 2022 at 5:43 PM Antonin Houska <ah@cybertec.at> wrote:

Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Feb 1, 2022 at 3:44 PM Antonin Houska <ah@cybertec.at> wrote:

I got a syntax error when using the command according to the existing
documentation. The output_plugin parameter needs to be passed too.

Why do we need it for physical slots?

Sure we don't, the missing curly brackets seem to be the problem. I used the
other form of the command for reference, which therefore might need a minor
fix too.

Instead of adding additional '{}', can't we simply use:
{ <literal>PHYSICAL</literal> [ <literal>RESERVE_WAL</literal> ] |
<literal>LOGICAL</literal> <replaceable
class="parameter">output_plugin</replaceable> } [
<literal>EXPORT_SNAPSHOT</literal> |
<literal>NOEXPORT_SNAPSHOT</literal> | <literal>USE_SNAPSHOT</literal>
| <literal>TWO_PHASE</literal> ]

Do you mean changing

CREATE_REPLICATION_SLOT slot_name [ TEMPORARY ] { PHYSICAL [ RESERVE_WAL ] | LOGICAL output_plugin [ EXPORT_SNAPSHOT | NOEXPORT_SNAPSHOT | USE_SNAPSHOT | TWO_PHASE ] }

to

CREATE_REPLICATION_SLOT slot_name [ TEMPORARY ] { PHYSICAL [ RESERVE_WAL ] | LOGICAL output_plugin } [ EXPORT_SNAPSHOT | NOEXPORT_SNAPSHOT | USE_SNAPSHOT | TWO_PHASE ]

?

I'm not sure, IMHO that would still allow for commands like

CREATE_REPLICATION_SLOT slot_name PHYSICAL output_plugin

--
Antonin Houska
Web: https://www.cybertec-postgresql.com

#6Amit Kapila
amit.kapila16@gmail.com
In reply to: Antonin Houska (#5)
Re: Doc: CREATE_REPLICATION_SLOT command requires the plugin name

On Wed, Feb 2, 2022 at 12:41 PM Antonin Houska <ah@cybertec.at> wrote:

Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Feb 1, 2022 at 5:43 PM Antonin Houska <ah@cybertec.at> wrote:

Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, Feb 1, 2022 at 3:44 PM Antonin Houska <ah@cybertec.at> wrote:

I got a syntax error when using the command according to the existing
documentation. The output_plugin parameter needs to be passed too.

Why do we need it for physical slots?

Sure we don't, the missing curly brackets seem to be the problem. I used the
other form of the command for reference, which therefore might need a minor
fix too.

Instead of adding additional '{}', can't we simply use:
{ <literal>PHYSICAL</literal> [ <literal>RESERVE_WAL</literal> ] |
<literal>LOGICAL</literal> <replaceable
class="parameter">output_plugin</replaceable> } [
<literal>EXPORT_SNAPSHOT</literal> |
<literal>NOEXPORT_SNAPSHOT</literal> | <literal>USE_SNAPSHOT</literal>
| <literal>TWO_PHASE</literal> ]

Do you mean changing

CREATE_REPLICATION_SLOT slot_name [ TEMPORARY ] { PHYSICAL [ RESERVE_WAL ] | LOGICAL output_plugin [ EXPORT_SNAPSHOT | NOEXPORT_SNAPSHOT | USE_SNAPSHOT | TWO_PHASE ] }

to

CREATE_REPLICATION_SLOT slot_name [ TEMPORARY ] { PHYSICAL [ RESERVE_WAL ] | LOGICAL output_plugin } [ EXPORT_SNAPSHOT | NOEXPORT_SNAPSHOT | USE_SNAPSHOT | TWO_PHASE ]

?

I'm not sure, IMHO that would still allow for commands like

CREATE_REPLICATION_SLOT slot_name PHYSICAL output_plugin

I don't think so. Symbol '|' differentiates that, check its usage at
other places like Create Table doc page [1]https://www.postgresql.org/docs/devel/sql-createtable.html. Considering that, it
seems to me that the way it is currently mentioned in docs is correct.

CREATE_REPLICATION_SLOT slot_name [ TEMPORARY ] { PHYSICAL [
RESERVE_WAL ] | LOGICAL output_plugin [ EXPORT_SNAPSHOT |
NOEXPORT_SNAPSHOT | USE_SNAPSHOT | TWO_PHASE ] }

According to me, this means output_plugin and all other options
related to snapshot can be mentioned only for logical slots.

[1]: https://www.postgresql.org/docs/devel/sql-createtable.html

--
With Regards,
Amit Kapila.