When creating a subscription, the replication slot already exists. In
- that case, the subscription can be created using the NOCREATE
- SLOT option to associate with the existing slot.
+ that case, the subscription can be created using
+ the create_slot = false option to associate with the
+ existing slot.
When creating a subscription, the remote host is not reachable or in an
unclear state. In that case, the subscription can be created using
- the NOCONNECT option. The remote host will then not
+ the connect = false option. The remote host will then not
be contacted at all. This is what
pg_dump
uses. The remote replication slot will then have to be created
manually before the subscription can be activated.
-ALTER PUBLICATION name WITH ( option [, ... ] )
-
-
- PUBLISH INSERT | NOPUBLISH INSERT
- | PUBLISH UPDATE | NOPUBLISH UPDATE
- | PUBLISH DELETE | NOPUBLISH DELETE
-
ALTER PUBLICATION name ADD TABLE [ ONLY ] table_name [ * ] [, ...]
ALTER PUBLICATION name SET TABLE [ ONLY ] table_name [ * ] [, ...]
ALTER PUBLICATION name DROP TABLE [ ONLY ] table_name [ * ] [, ...]
+ALTER PUBLICATION name SET ( publication_parameter [= value] [, ... ] )
ALTER PUBLICATION name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER PUBLICATION name RENAME TO new_name
The first variant of this command listed in the synopsis can change
all of the publication properties specified in
. Properties not mentioned in the
- command retain their previous settings. Database superusers can change any
- of these settings for any role.
+ command retain their previous settings.
- PUBLISH INSERT
- NOPUBLISH INSERT
- PUBLISH UPDATE
- NOPUBLISH UPDATE
- PUBLISH DELETE
- NOPUBLISH DELETE
+ table_name
- These clauses alter properties originally set by
- . See there for more information.
+ Name of an existing table. If ONLY> is specified before the
+ table name, only that table is affected. If ONLY> is not
+ specified, the table and all its descendant tables (if any) are
+ affected. Optionally, *> can be specified after the table
+ name to explicitly indicate that descendant tables are included.
- <replaceable class="parameter">table_name>
+ <literal>SET ( publication_parameter [= value] [, ... ] )>
- Name of an existing table. If ONLY> is specified before the
- table name, only that table is affected. If ONLY> is not
- specified, the table and all its descendant tables (if any) are
- affected. Optionally, *> can be specified after the table
- name to explicitly indicate that descendant tables are included.
+ This clause alters publication parameters originally set by
+ . See there for more information.
Examples
- Change the publication to not publish inserts:
+ Change the publication to publish only deletes and updates:
-ALTER PUBLICATION noinsert WITH (NOPUBLISH INSERT);
+ALTER PUBLICATION noinsert SET (publish = 'update, delete');
-ALTER SUBSCRIPTION name WITH ( suboption [, ... ] )
-
-
- SLOT NAME = slot_name
- | SYNCHRONOUS_COMMIT = synchronous_commit
-
-ALTER SUBSCRIPTION name SET PUBLICATION publication_name [, ...] { REFRESH WITH ( puboption [, ... ] ) | NOREFRESH }
-ALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( puboption [, ... ] ) ]
-
-
- COPY DATA | NOCOPY DATA
-
ALTER SUBSCRIPTION name CONNECTION 'conninfo'
+ALTER SUBSCRIPTION name SET PUBLICATION publication_name [, ...] { REFRESH [ WITH ( refresh_option value [, ... ] ) ] | SKIP REFRESH }
+ALTER SUBSCRIPTION name REFRESH PUBLICATION [ WITH ( refresh_option value [, ... ] ) ]
ALTER SUBSCRIPTION name ENABLE
ALTER SUBSCRIPTION name DISABLE
+ALTER SUBSCRIPTION name SET ( subscription_parameter [= value] [, ... ] )
ALTER SUBSCRIPTION name OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
ALTER SUBSCRIPTION name RENAME TO new_name
CONNECTION 'conninfo'
- SLOT NAME = slot_name
- SYNCHRONOUS_COMMIT = synchronous_commit
- These clauses alter properties originally set by
+ This clause alters the connection property originally set by
. See there for more
information.
Changes list of subscribed publications. See
for more information.
+
- When REFRESH is specified, this command will also
- act like REFRESH PUBLICATION. When
- NOREFRESH is specified, the comamnd will not try to
- refresh table information.
+ When REFRESH is specified, this command will also act
+ like REFRESH
+ PUBLICATION. refresh_option specifies
+ additional options for the refresh operation, as described
+ under REFRESH PUBLICATION. When
+ SKIP REFRESH is specified, the command will not try
+ to refresh table information. Note that
+ either REFRESH or SKIP REFRESH
+ must be specified.
REFRESH PUBLICATION
- Fetch missing table information from publisher. This will start
+ Fetch missing table information from publisher. This will start
replication of tables that were added to the subscribed-to publications
since the last invocation of REFRESH PUBLICATION or
since CREATE SUBSCRIPTION.
+
- The COPY DATA and NOCOPY DATA
- options specify if the existing data in the publications that are being
- subscribed to should be copied. COPY DATA is the
- default.
+ refresh_option specifies additional options for the
+ refresh operation. The supported options are:
+
+
+
+ copy_data (boolean)
+
+ Specifies whether the existing data in the publications that are
+ being subscribed to should be copied once the replication starts.
+ The default is true.
+
+
+
+
+
+ SET ( subscription_parameter [= value] [, ... ] )
+
+ This clause alters parameters originally set by
+ . See there for more
+ information. The allowed options are slot_name and
+ synchronous_commit
+
+
+
+
new_owner
Change the publication subscribed by a subscription to
insert_only:
-ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only;
+ALTER SUBSCRIPTION mysub SET PUBLICATION insert_only REFRESH;
CREATE PUBLICATION name
[ FOR TABLE [ ONLY ] table_name [ * ] [, ...]
| FOR ALL TABLES ]
- [ WITH ( option [, ... ] ) ]
+ [ WITH ( publication_parameter [= value] [, ... ] ) ]
-
- PUBLISH INSERT | NOPUBLISH INSERT
- | PUBLISH UPDATE | NOPUBLISH UPDATE
- | PUBLISH DELETE | NOPUBLISH DELETE
- PUBLISH INSERT
- NOPUBLISH INSERT
-
- These clauses determine whether the new publication will send
- the INSERT operations to the subscribers.
- PUBLISH INSERT is the default.
-
-
-
-
-
- PUBLISH UPDATE
- NOPUBLISH UPDATE
+ WITH ( publication_parameter [= value] [, ... ] )
- These clauses determine whether the new publication will send
- the UPDATE operations to the subscribers.
- PUBLISH UPDATE is the default.
-
-
-
+ This clause specifies optional parameters for a publication. The
+ following parameters are supported:
+
+
+
+ publish (string)
+
+ This parameter determines which DML operations will be published by
+ the new publication to the subscribers. The value is
+ comma-separated list of operations. The allowed operations are
+ insert, update, and
+ delete. The default is to publish all actions,
+ and so the default value for this option is
+ 'insert, update, delete'.
+
+
+
+
-
- PUBLISH DELETE
- NOPUBLISH DELETE
-
- These clauses determine whether the new publication will send
- the DELETE operations to the subscribers.
- PUBLISH DELETE is the default.
operations in one table:
CREATE PUBLICATION insert_only FOR TABLE mydata
- WITH (NOPUBLISH UPDATE, NOPUBLISH DELETE);
+ WITH (publish = 'insert');
CREATE SUBSCRIPTION subscription_name
CONNECTION 'conninfo'
- PUBLICATION { publication_name [, ...] }
- [ WITH ( option [, ... ] ) ]
-
-
- | ENABLED | DISABLED
- | CREATE SLOT | NOCREATE SLOT
- | SLOT NAME = slot_name
- | COPY DATA | NOCOPY DATA
- | SYNCHRONOUS_COMMIT = synchronous_commit
- | NOCONNECT
+ PUBLICATION publication_name [, ...]
+ [ WITH ( subscription_parameter [= value] [, ... ] ) ]
CREATE SUBSCRIPTION cannot be executed inside a
- transaction block when CREATE SLOT is specified.
+ transaction block when the parameter create_slot is specified.
PUBLICATION publication_name
- Name(s) of the publications on the publisher to subscribe to.
-
-
-
-
-
- ENABLED
- DISABLED
-
- Specifies whether the subscription should be actively replicating or
- if it should be just setup but not started yet. Note that the
- replication slot as described above is created in either case.
- ENABLED is the default.
-
-
-
-
-
- CREATE SLOT
- NOCREATE SLOT
-
- Specifies whether the command should create the replication slot on the
- publisher. CREATE SLOT is the default.
-
-
-
-
-
- SLOT NAME = slot_name
-
- Name of the replication slot to use. The default behavior is to use
- subscription_name> for slot name.
-
-
- When SLOT NAME is set to
- NONE, there will be no replication slot associated
- with the subscription. This can be used if the replication slot will be
- created later manually. Such subscriptions must also have both
- ENABLED and CREATE SLOT set
- to false.
-
-
-
-
-
- COPY DATA
- NOCOPY DATA
-
- Specifies if the existing data in the publications that are being
- subscribed to should be copied once the replication starts.
- COPY DATA is the default.
+ Names of the publications on the publisher to subscribe to.
- SYNCHRONOUS_COMMIT = synchronous_commit
+ WITH ( subscription_parameter [= value] [, ... ] )
- The value of this parameter overrides the
- setting. The default value is
- off.
-
-
- It is safe to use off for logical replication: If the
- subscriber loses transactions because of missing synchronization, the
- data will be resent from the publisher.
-
-
- A different setting might be appropriate when doing synchronous logical
- replication. The logical replication workers report the positions of
- writes and flushes to the publisher, and when using synchronous
- replication, the publisher will wait for the actual flush. This means
- that setting SYNCHRONOUS_COMMIT for the subscriber
- to off when the subscription is used for synchronous
- replication might increase the latency for COMMIT on
- the publisher. In this scenario, it can be advantageous to set
- SYNCHRONOUS_COMMIT to local or
- higher.
-
-
-
-
-
- NOCONNECT
-
- Instructs CREATE SUBSCRIPTION to skip the initial
- connection to the provider. This will change default values of other
- options to DISABLED,
- NOCREATE SLOT, and NOCOPY DATA.
-
- It's not allowed to combine NOCONNECT and
- ENABLED, CREATE SLOT, or
- COPY DATA.
-
- Since no connection is made when this option is specified, the tables
- are not subscribed, so after you enable the subscription nothing will
- be replicated. It is required to run
- ALTER SUBSCRIPTION ... REFRESH PUBLICATION> in order for
- tables to be subscribed.
+ This clause specifies optional parameters for a subscription. The
+ following parameters are supported:
+
+
+
+ copy_data (boolean)
+
+ Specifies whether the existing data in the publications that are
+ being subscribed to should be copied once the replication starts.
+ The default is true.
+
+
+
+
+
+ create_slot (boolean)
+
+ Specifies whether the command should create the replication slot on
+ the publisher. The default is true.
+
+
+
+
+
+ enabled (boolean)
+
+ Specifies whether the subscription should be actively replicating,
+ or whether it should be just setup but not started yet. The default
+ is true.
+
+
+
+
+
+ slot_name (string)
+
+ Name of the replication slot to use. The default behavior is to
+ use the name of the subscription for the slot name.
+
+
+ When slot_name is set to
+ NONE, there will be no replication slot
+ associated with the subscription. This can be used if the
+ replication slot will be created later manually. Such
+ subscriptions must also have both enabled and
+ create_slot set to false.
+
+
+
+
+
+ synchronous_commit (enum)
+
+ The value of this parameter overrides the
+ setting. The default
+ value is off.
+
+
+ It is safe to use off for logical replication:
+ If the subscriber loses transactions because of missing
+ synchronization, the data will be resent from the publisher.
+
+
+ A different setting might be appropriate when doing synchronous
+ logical replication. The logical replication workers report the
+ positions of writes and flushes to the publisher, and when using
+ synchronous replication, the publisher will wait for the actual
+ flush. This means that setting
+ synchronous_commit for the subscriber to
+ off when the subscription is used for
+ synchronous replication might increase the latency for
+ COMMIT on the publisher. In this scenario, it
+ can be advantageous to set synchronous_commit
+ to local or higher.
+
+
+
+
+
+ connect (boolean)
+
+ Specifies whether the CREATE SUBSCRIPTION
+ should connect to the publisher at all. Setting this to
+ false will change default values of
+ enabled, create_slot and
+ copy_data to false.
+
+
+ It is not allowed to combine connect set to
+ false and enabled,
+ create_slot, or copy_data
+ set to true.
+
+
+ Since no connection is made when this option is specified, the
+ tables are not subscribed, and so after you enable the subscription
+ nothing will be replicated. It is required to run
+ ALTER SUBSCRIPTION ... REFRESH PUBLICATION> in order
+ for tables to be subscribed.
+
+
+
+
CREATE SUBSCRIPTION mysub
CONNECTION 'host=192.168.1.50 port=5432 user=foo dbname=foodb'
PUBLICATION insert_only
- WITH (DISABLED);
+ WITH (enabled = false);
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/syscache.h"
+#include "utils/varlena.h"
/* Same as MAXNUMMESSAGES in sinvaladt.c */
#define MAX_RELCACHE_INVAL_MSGS 4096
static void
parse_publication_options(List *options,
- bool *publish_insert_given,
+ bool *publish_given,
bool *publish_insert,
- bool *publish_update_given,
bool *publish_update,
- bool *publish_delete_given,
bool *publish_delete)
{
ListCell *lc;
- *publish_insert_given = false;
- *publish_update_given = false;
- *publish_delete_given = false;
+ *publish_given = false;
/* Defaults are true */
*publish_insert = true;
{
DefElem *defel = (DefElem *) lfirst(lc);
- if (strcmp(defel->defname, "publish insert") == 0)
+ if (strcmp(defel->defname, "publish") == 0)
{
- if (*publish_insert_given)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
+ char *publish;
+ List *publish_list;
+ ListCell *lc;
- *publish_insert_given = true;
- *publish_insert = defGetBoolean(defel);
- }
- else if (strcmp(defel->defname, "nopublish insert") == 0)
- {
- if (*publish_insert_given)
+ if (*publish_given)
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("conflicting or redundant options")));
- *publish_insert_given = true;
- *publish_insert = !defGetBoolean(defel);
- }
- else if (strcmp(defel->defname, "publish update") == 0)
- {
- if (*publish_update_given)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
+ /*
+ * If publish option was given only the explicitly listed actions
+ * should be published.
+ */
+ *publish_insert = false;
+ *publish_update = false;
+ *publish_delete = false;
- *publish_update_given = true;
- *publish_update = defGetBoolean(defel);
- }
- else if (strcmp(defel->defname, "nopublish update") == 0)
- {
- if (*publish_update_given)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
+ *publish_given = true;
+ publish = defGetString(defel);
- *publish_update_given = true;
- *publish_update = !defGetBoolean(defel);
- }
- else if (strcmp(defel->defname, "publish delete") == 0)
- {
- if (*publish_delete_given)
+ if (!SplitIdentifierString(publish, ',', &publish_list))
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
-
- *publish_delete_given = true;
- *publish_delete = defGetBoolean(defel);
- }
- else if (strcmp(defel->defname, "nopublish delete") == 0)
- {
- if (*publish_delete_given)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
+ errmsg("invalid publish list")));
- *publish_delete_given = true;
- *publish_delete = !defGetBoolean(defel);
+ /* Process the option list. */
+ foreach (lc, publish_list)
+ {
+ char *publish_opt = (char *)lfirst(lc);
+
+ if (strcmp(publish_opt, "insert") == 0)
+ *publish_insert = true;
+ else if (strcmp(publish_opt, "update") == 0)
+ *publish_update = true;
+ else if (strcmp(publish_opt, "delete") == 0)
+ *publish_delete = true;
+ else
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("unrecognized \"publish\" value: \"%s\"", publish_opt)));
+ }
}
else
- elog(ERROR, "unrecognized option: %s", defel->defname);
+ ereport(ERROR,
+ (errcode(ERRCODE_SYNTAX_ERROR),
+ errmsg("unrecognized publication parameter: %s", defel->defname)));
}
}
bool nulls[Natts_pg_publication];
Datum values[Natts_pg_publication];
HeapTuple tup;
- bool publish_insert_given;
- bool publish_update_given;
- bool publish_delete_given;
+ bool publish_given;
bool publish_insert;
bool publish_update;
bool publish_delete;
values[Anum_pg_publication_pubowner - 1] = ObjectIdGetDatum(GetUserId());
parse_publication_options(stmt->options,
- &publish_insert_given, &publish_insert,
- &publish_update_given, &publish_update,
- &publish_delete_given, &publish_delete);
+ &publish_given, &publish_insert,
+ &publish_update, &publish_delete);
values[Anum_pg_publication_puballtables - 1] =
BoolGetDatum(stmt->for_all_tables);
bool nulls[Natts_pg_publication];
bool replaces[Natts_pg_publication];
Datum values[Natts_pg_publication];
- bool publish_insert_given;
- bool publish_update_given;
- bool publish_delete_given;
+ bool publish_given;
bool publish_insert;
bool publish_update;
bool publish_delete;
ObjectAddress obj;
parse_publication_options(stmt->options,
- &publish_insert_given, &publish_insert,
- &publish_update_given, &publish_update,
- &publish_delete_given, &publish_delete);
+ &publish_given, &publish_insert,
+ &publish_update, &publish_delete);
/* Everything ok, form a new tuple. */
memset(values, 0, sizeof(values));
memset(nulls, false, sizeof(nulls));
memset(replaces, false, sizeof(replaces));
- if (publish_insert_given)
+ if (publish_given)
{
- values[Anum_pg_publication_pubinsert - 1] =
- BoolGetDatum(publish_insert);
+ values[Anum_pg_publication_pubinsert - 1] = BoolGetDatum(publish_insert);
replaces[Anum_pg_publication_pubinsert - 1] = true;
- }
- if (publish_update_given)
- {
- values[Anum_pg_publication_pubupdate - 1] =
- BoolGetDatum(publish_update);
+
+ values[Anum_pg_publication_pubupdate - 1] = BoolGetDatum(publish_update);
replaces[Anum_pg_publication_pubupdate - 1] = true;
- }
- if (publish_delete_given)
- {
- values[Anum_pg_publication_pubdelete - 1] =
- BoolGetDatum(publish_delete);
+
+ values[Anum_pg_publication_pubdelete - 1] = BoolGetDatum(publish_delete);
replaces[Anum_pg_publication_pubdelete - 1] = true;
}
{
DefElem *defel = (DefElem *) lfirst(lc);
- if (strcmp(defel->defname, "noconnect") == 0 && connect)
+ if (strcmp(defel->defname, "connect") == 0 && connect)
{
if (connect_given)
ereport(ERROR,
errmsg("conflicting or redundant options")));
connect_given = true;
- *connect = !defGetBoolean(defel);
+ *connect = defGetBoolean(defel);
}
else if (strcmp(defel->defname, "enabled") == 0 && enabled)
{
*enabled_given = true;
*enabled = defGetBoolean(defel);
}
- else if (strcmp(defel->defname, "disabled") == 0 && enabled)
- {
- if (*enabled_given)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
-
- *enabled_given = true;
- *enabled = !defGetBoolean(defel);
- }
- else if (strcmp(defel->defname, "create slot") == 0 && create_slot)
+ else if (strcmp(defel->defname, "create_slot") == 0 && create_slot)
{
if (create_slot_given)
ereport(ERROR,
create_slot_given = true;
*create_slot = defGetBoolean(defel);
}
- else if (strcmp(defel->defname, "nocreate slot") == 0 && create_slot)
- {
- if (create_slot_given)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
-
- create_slot_given = true;
- *create_slot = !defGetBoolean(defel);
- }
- else if (strcmp(defel->defname, "slot name") == 0 && slot_name)
+ else if (strcmp(defel->defname, "slot_name") == 0 && slot_name)
{
if (*slot_name_given)
ereport(ERROR,
if (strcmp(*slot_name, "none") == 0)
*slot_name = NULL;
}
- else if (strcmp(defel->defname, "copy data") == 0 && copy_data)
+ else if (strcmp(defel->defname, "copy_data") == 0 && copy_data)
{
if (copy_data_given)
ereport(ERROR,
copy_data_given = true;
*copy_data = defGetBoolean(defel);
}
- else if (strcmp(defel->defname, "nocopy data") == 0 && copy_data)
- {
- if (copy_data_given)
- ereport(ERROR,
- (errcode(ERRCODE_SYNTAX_ERROR),
- errmsg("conflicting or redundant options")));
-
- copy_data_given = true;
- *copy_data = !defGetBoolean(defel);
- }
else if (strcmp(defel->defname, "synchronous_commit") == 0 &&
synchronous_commit)
{
* replication slot.
*/
if (create_slot)
- PreventTransactionChain(isTopLevel, "CREATE SUBSCRIPTION ... CREATE SLOT");
+ PreventTransactionChain(isTopLevel, "CREATE SUBSCRIPTION ... WITH (create_slot = true)");
if (!superuser())
ereport(ERROR,
database_name access_method_clause access_method attr_name
name cursor_name file_name
index_name opt_index_name cluster_index_specification
- def_key
%type func_name handler_name qual_Op qual_all_Op subquery_Op
opt_class opt_inline_handler opt_validator validator_clause
MAPPING MATCH MATERIALIZED MAXVALUE METHOD MINUTE_P MINVALUE MODE MONTH_P MOVE
NAME_P NAMES NATIONAL NATURAL NCHAR NEW NEXT NO NONE
- NOREFRESH NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
+ NOT NOTHING NOTIFY NOTNULL NOWAIT NULL_P NULLIF
NULLS_P NUMERIC
OBJECT_P OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OPTIONS OR
| def_list ',' def_elem { $$ = lappend($1, $3); }
;
-def_elem: def_key '=' def_arg
+def_elem: ColLabel '=' def_arg
{
$$ = makeDefElem($1, (Node *) $3, @1);
}
- | def_key
+ | ColLabel
{
$$ = makeDefElem($1, NULL, @1);
}
;
-def_key:
- ColLabel { $$ = $1; }
- | ColLabel ColLabel { $$ = psprintf("%s %s", $1, $2); }
- ;
-
/* Note: any simple identifier will be returned as a type name! */
def_arg: func_type { $$ = (Node *)$1; }
| reserved_keyword { $$ = (Node *)makeString(pstrdup($1)); }
}
;
+
/*****************************************************************************
*
- * ALTER PUBLICATION name [ WITH ] options
+ * ALTER PUBLICATION name SET ( options )
*
* ALTER PUBLICATION name ADD TABLE table [, table2]
*
*****************************************************************************/
AlterPublicationStmt:
- ALTER PUBLICATION name WITH definition
+ ALTER PUBLICATION name SET definition
{
AlterPublicationStmt *n = makeNode(AlterPublicationStmt);
n->pubname = $3;
/*****************************************************************************
*
- * ALTER SUBSCRIPTION name [ WITH ] options
+ * ALTER SUBSCRIPTION name ...
*
*****************************************************************************/
AlterSubscriptionStmt:
- ALTER SUBSCRIPTION name WITH definition
+ ALTER SUBSCRIPTION name SET definition
{
AlterSubscriptionStmt *n =
makeNode(AlterSubscriptionStmt);
n->options = $8;
$$ = (Node *)n;
}
- | ALTER SUBSCRIPTION name SET PUBLICATION publication_name_list NOREFRESH
+ | ALTER SUBSCRIPTION name SET PUBLICATION publication_name_list SKIP REFRESH
{
AlterSubscriptionStmt *n =
makeNode(AlterSubscriptionStmt);
| NEW
| NEXT
| NO
- | NOREFRESH
| NOTHING
| NOTIFY
| NOWAIT
PQExpBuffer delq;
PQExpBuffer query;
PQExpBuffer labelq;
+ bool first = true;
if (!(pubinfo->dobj.dump & DUMP_COMPONENT_DEFINITION))
return;
if (pubinfo->puballtables)
appendPQExpBufferStr(query, " FOR ALL TABLES");
- appendPQExpBufferStr(query, " WITH (");
+ appendPQExpBufferStr(query, " WITH (publish = '");
if (pubinfo->pubinsert)
- appendPQExpBufferStr(query, "PUBLISH INSERT");
- else
- appendPQExpBufferStr(query, "NOPUBLISH INSERT");
+ {
+ appendPQExpBufferStr(query, "insert");
+ first = false;
+ }
+
+ if (!first)
+ appendPQExpBufferStr(query, ", ");
if (pubinfo->pubupdate)
- appendPQExpBufferStr(query, ", PUBLISH UPDATE");
- else
- appendPQExpBufferStr(query, ", NOPUBLISH UPDATE");
+ {
+ appendPQExpBufferStr(query, "update");
+ first = false;
+ }
+
+ if (!first)
+ appendPQExpBufferStr(query, ", ");
if (pubinfo->pubdelete)
- appendPQExpBufferStr(query, ", PUBLISH DELETE");
- else
- appendPQExpBufferStr(query, ", NOPUBLISH DELETE");
+ {
+ appendPQExpBufferStr(query, "delete");
+ first = false;
+ }
- appendPQExpBufferStr(query, ");\n");
+ appendPQExpBufferStr(query, "');\n");
ArchiveEntry(fout, pubinfo->dobj.catId, pubinfo->dobj.dumpId,
pubinfo->dobj.name,
appendPQExpBufferStr(publications, fmtId(pubnames[i]));
}
- appendPQExpBuffer(query, " PUBLICATION %s WITH (NOCONNECT, SLOT NAME = ", publications->data);
+ appendPQExpBuffer(query, " PUBLICATION %s WITH (connect = false, slot_name = ", publications->data);
appendStringLiteralAH(query, subinfo->subslotname, fout);
if (strcmp(subinfo->subsynccommit, "off") != 0)
- appendPQExpBuffer(query, ", SYNCHRONOUS_COMMIT = %s", fmtId(subinfo->subsynccommit));
+ appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));
appendPQExpBufferStr(query, ");\n");
create_order => 50,
create_sql => 'CREATE PUBLICATION pub1;',
regexp => qr/^
- \QCREATE PUBLICATION pub1 WITH (PUBLISH INSERT, PUBLISH UPDATE, PUBLISH DELETE);\E
+ \QCREATE PUBLICATION pub1 WITH (publish = 'insert, update, delete');\E
/xm,
like => {
binary_upgrade => 1,
create_order => 50,
create_sql => 'CREATE PUBLICATION pub2
FOR ALL TABLES
- WITH (NOPUBLISH INSERT,
- NOPUBLISH UPDATE,
- NOPUBLISH DELETE);',
+ WITH (publish = \'\');',
regexp => qr/^
- \QCREATE PUBLICATION pub2 FOR ALL TABLES WITH (NOPUBLISH INSERT, NOPUBLISH UPDATE, NOPUBLISH DELETE);\E
+ \QCREATE PUBLICATION pub2 FOR ALL TABLES WITH (publish = '');\E
/xm,
like => {
binary_upgrade => 1,
create_order => 50,
create_sql => 'CREATE SUBSCRIPTION sub1
CONNECTION \'dbname=doesnotexist\' PUBLICATION pub1
- WITH (NOCONNECT);',
+ WITH (connect = false);',
regexp => qr/^
- \QCREATE SUBSCRIPTION sub1 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (NOCONNECT, SLOT NAME = 'sub1');\E
+ \QCREATE SUBSCRIPTION sub1 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (connect = false, slot_name = 'sub1');\E
/xm,
like => {
binary_upgrade => 1,
COMPLETE_WITH_LIST6("WITH (", "ADD TABLE", "SET TABLE", "DROP TABLE",
"OWNER TO", "RENAME TO");
}
- /* ALTER PUBLICATION .. WITH ( ... */
- else if (HeadMatches3("ALTER", "PUBLICATION",MatchAny) && TailMatches2("WITH", "("))
+ /* ALTER PUBLICATION .. SET ( ... */
+ else if (HeadMatches3("ALTER", "PUBLICATION",MatchAny) && TailMatches2("SET", "("))
{
- COMPLETE_WITH_LIST6("PUBLISH INSERT", "NOPUBLISH INSERT", "PUBLISH UPDATE",
- "NOPUBLISH UPDATE", "PUBLISH DELETE", "NOPUBLISH DELETE");
+ COMPLETE_WITH_CONST("publish");
}
/* ALTER SUBSCRIPTION ... */
else if (Matches3("ALTER","SUBSCRIPTION",MatchAny))
{
- COMPLETE_WITH_LIST8("WITH (", "CONNECTION", "SET PUBLICATION", "ENABLE",
+ COMPLETE_WITH_LIST8("SET (", "CONNECTION", "SET PUBLICATION", "ENABLE",
"DISABLE", "OWNER TO", "RENAME TO", "REFRESH PUBLICATION WITH (");
}
/* ALTER SUBSCRIPTION REFRESH PUBLICATION WITH ( ... */
else if (HeadMatches3("ALTER", "SUBSCRIPTION", MatchAny) &&
TailMatches4("REFRESH", "PUBLICATION", "WITH", "("))
{
- COMPLETE_WITH_LIST2("COPY DATA", "NOCOPY DATA");
+ COMPLETE_WITH_CONST("copy_data");
}
- /* ALTER SUBSCRIPTION .. WITH ( ... */
- else if (HeadMatches3("ALTER", "SUBSCRIPTION", MatchAny) && TailMatches2("WITH", "("))
+ /* ALTER SUBSCRIPTION .. SET ( ... */
+ else if (HeadMatches3("ALTER", "SUBSCRIPTION", MatchAny) && TailMatches2("SET", "("))
{
- COMPLETE_WITH_CONST("SLOT NAME");
+ COMPLETE_WITH_CONST("slot_name");
}
/* ALTER SCHEMA */
else if (Matches3("ALTER", "SCHEMA", MatchAny))
COMPLETE_WITH_SCHEMA_QUERY(Query_for_list_of_tables, NULL);
/* Complete "CREATE PUBLICATION [...] WITH" */
else if (HeadMatches2("CREATE", "PUBLICATION") && TailMatches2("WITH", "("))
- COMPLETE_WITH_LIST2("PUBLISH", "NOPUBLISH");
- else if (HeadMatches2("CREATE", "PUBLICATION") && TailMatches3("WITH", "(", MatchAny))
- COMPLETE_WITH_LIST3("INSERT", "UPDATE", "DELETE");
+ COMPLETE_WITH_CONST("publish");
/* CREATE RULE */
/* Complete "CREATE RULE " with "AS ON" */
COMPLETE_WITH_CONST("WITH (");
/* Complete "CREATE SUBSCRIPTION ... WITH ( " */
else if (HeadMatches2("CREATE", "SUBSCRIPTION") && TailMatches2("WITH", "("))
- COMPLETE_WITH_LIST8("ENABLED", "DISABLED", "CREATE SLOT",
- "NOCREATE SLOT", "SLOT NAME", "COPY DATA", "NOCOPY DATA",
- "NOCONNECT");
+ COMPLETE_WITH_LIST5("enabled", "create_slot", "slot_name",
+ "copy_data", "connect");
/* CREATE TRIGGER --- is allowed inside CREATE SCHEMA, so use TailMatches */
/* complete CREATE TRIGGER with BEFORE,AFTER,INSTEAD OF */
PG_KEYWORD("next", NEXT, UNRESERVED_KEYWORD)
PG_KEYWORD("no", NO, UNRESERVED_KEYWORD)
PG_KEYWORD("none", NONE, COL_NAME_KEYWORD)
-PG_KEYWORD("norefresh", NOREFRESH, UNRESERVED_KEYWORD)
PG_KEYWORD("not", NOT, RESERVED_KEYWORD)
PG_KEYWORD("nothing", NOTHING, UNRESERVED_KEYWORD)
PG_KEYWORD("notify", NOTIFY, UNRESERVED_KEYWORD)
SECURITY LABEL ON SCHEMA dummy_seclabel_test IS 'unclassified'; -- OK
SET client_min_messages = error;
CREATE PUBLICATION dummy_pub;
-CREATE SUBSCRIPTION dummy_sub CONNECTION '' PUBLICATION foo WITH (NOCONNECT, SLOT NAME = NONE);
+CREATE SUBSCRIPTION dummy_sub CONNECTION '' PUBLICATION foo WITH (connect = false, slot_name = NONE);
RESET client_min_messages;
SECURITY LABEL ON PUBLICATION dummy_pub IS 'classified';
SECURITY LABEL ON SUBSCRIPTION dummy_sub IS 'classified';
SET client_min_messages = error;
CREATE PUBLICATION dummy_pub;
-CREATE SUBSCRIPTION dummy_sub CONNECTION '' PUBLICATION foo WITH (NOCONNECT, SLOT NAME = NONE);
+CREATE SUBSCRIPTION dummy_sub CONNECTION '' PUBLICATION foo WITH (connect = false, slot_name = NONE);
RESET client_min_messages;
SECURITY LABEL ON PUBLICATION dummy_pub IS 'classified';
SECURITY LABEL ON SUBSCRIPTION dummy_sub IS 'classified';
FROM SQL WITH FUNCTION varchar_transform(internal),
TO SQL WITH FUNCTION int4recv(internal));
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
-CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (NOCONNECT, SLOT NAME = NONE);
+CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
CREATE STATISTICS addr_nsp.gentable_stat ON (a,b) FROM addr_nsp.gentable;
-- test some error cases
test publication
(1 row)
-CREATE PUBLICATION testpib_ins_trunct WITH (nopublish delete, nopublish update);
-ALTER PUBLICATION testpub_default WITH (nopublish insert, nopublish delete);
+CREATE PUBLICATION testpib_ins_trunct WITH (publish = insert);
+ALTER PUBLICATION testpub_default SET (publish = update);
+-- error cases
+CREATE PUBLICATION testpub_xxx WITH (foo);
+ERROR: unrecognized publication parameter: foo
+CREATE PUBLICATION testpub_xxx WITH (publish = 'cluster, vacuum');
+ERROR: unrecognized "publish" value: "cluster"
\dRp
List of publications
Name | Owner | Inserts | Updates | Deletes
testpub_default | regress_publication_user | f | t | f
(2 rows)
-ALTER PUBLICATION testpub_default WITH (publish insert, publish delete);
+ALTER PUBLICATION testpub_default SET (publish = 'insert, update, delete');
\dRp
List of publications
Name | Owner | Inserts | Updates | Deletes
CREATE TABLE pub_test.testpub_nopk (foo int, bar int);
CREATE VIEW testpub_view AS SELECT 1;
CREATE TABLE testpub_parted (a int) PARTITION BY LIST (a);
-CREATE PUBLICATION testpub_foralltables FOR ALL TABLES WITH (nopublish delete, nopublish update);
-ALTER PUBLICATION testpub_foralltables WITH (publish update);
+CREATE PUBLICATION testpub_foralltables FOR ALL TABLES WITH (publish = 'insert');
+ALTER PUBLICATION testpub_foralltables SET (publish = 'insert, update');
CREATE TABLE testpub_tbl2 (id serial primary key, data text);
-- fail - can't add to for all tables publication
ALTER PUBLICATION testpub_foralltables ADD TABLE testpub_tbl2;
^
-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block
BEGIN;
-CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub WITH (CREATE SLOT);
-ERROR: CREATE SUBSCRIPTION ... CREATE SLOT cannot run inside a transaction block
+CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub WITH (create_slot);
+ERROR: CREATE SUBSCRIPTION ... WITH (create_slot = true) cannot run inside a transaction block
COMMIT;
-- fail - invalid connection string
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub;
ERROR: invalid connection string syntax: missing "=" after "testconn" in connection info string
-- fail - duplicate publications
-CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION foo, testpub, foo WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION foo, testpub, foo WITH (connect = false);
ERROR: publication name "foo" used more than once
-- ok
-CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
WARNING: tables were not subscribed, you will have to run ALTER SUBSCRIPTION ... REFRESH PUBLICATION to subscribe the tables
COMMENT ON SUBSCRIPTION testsub IS 'test subscription';
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
(1 row)
-- fail - name already exists
-CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
ERROR: subscription "testsub" already exists
-- fail - must be superuser
SET SESSION AUTHORIZATION 'regress_subscription_user2';
-CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION foo WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION foo WITH (connect = false);
ERROR: must be superuser to create subscriptions
SET SESSION AUTHORIZATION 'regress_subscription_user';
-- fail - invalid connection string
testsub | regress_subscription_user | f | {testpub} | off | dbname=doesnotexist
(1 row)
-ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 NOREFRESH;
+ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 SKIP REFRESH;
ALTER SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist2';
-ALTER SUBSCRIPTION testsub WITH (SLOT NAME = 'newname');
+ALTER SUBSCRIPTION testsub SET (slot_name = 'newname');
-- fail
ALTER SUBSCRIPTION doesnotexist CONNECTION 'dbname=doesnotexist2';
ERROR: subscription "doesnotexist" does not exist
ERROR: must be owner of subscription testsub
RESET ROLE;
ALTER SUBSCRIPTION testsub RENAME TO testsub_foo;
-ALTER SUBSCRIPTION testsub_foo WITH (SYNCHRONOUS_COMMIT = local);
-ALTER SUBSCRIPTION testsub_foo WITH (SYNCHRONOUS_COMMIT = foobar);
+ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = local);
+ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = foobar);
ERROR: invalid value for parameter "synchronous_commit": "foobar"
HINT: Available values: local, remote_write, remote_apply, on, off.
\dRs+
DROP SUBSCRIPTION testsub;
ERROR: DROP SUBSCRIPTION cannot run inside a transaction block
COMMIT;
-ALTER SUBSCRIPTION testsub WITH (SLOT NAME = NONE);
+ALTER SUBSCRIPTION testsub SET (slot_name = NONE);
-- now it works
BEGIN;
DROP SUBSCRIPTION testsub;
FROM SQL WITH FUNCTION varchar_transform(internal),
TO SQL WITH FUNCTION int4recv(internal));
CREATE PUBLICATION addr_pub FOR TABLE addr_nsp.gentable;
-CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (NOCONNECT, SLOT NAME = NONE);
+CREATE SUBSCRIPTION addr_sub CONNECTION '' PUBLICATION bar WITH (connect = false, slot_name = NONE);
CREATE STATISTICS addr_nsp.gentable_stat ON (a,b) FROM addr_nsp.gentable;
-- test some error cases
COMMENT ON PUBLICATION testpub_default IS 'test publication';
SELECT obj_description(p.oid, 'pg_publication') FROM pg_publication p;
-CREATE PUBLICATION testpib_ins_trunct WITH (nopublish delete, nopublish update);
+CREATE PUBLICATION testpib_ins_trunct WITH (publish = insert);
-ALTER PUBLICATION testpub_default WITH (nopublish insert, nopublish delete);
+ALTER PUBLICATION testpub_default SET (publish = update);
+
+-- error cases
+CREATE PUBLICATION testpub_xxx WITH (foo);
+CREATE PUBLICATION testpub_xxx WITH (publish = 'cluster, vacuum');
\dRp
-ALTER PUBLICATION testpub_default WITH (publish insert, publish delete);
+ALTER PUBLICATION testpub_default SET (publish = 'insert, update, delete');
\dRp
CREATE VIEW testpub_view AS SELECT 1;
CREATE TABLE testpub_parted (a int) PARTITION BY LIST (a);
-CREATE PUBLICATION testpub_foralltables FOR ALL TABLES WITH (nopublish delete, nopublish update);
-ALTER PUBLICATION testpub_foralltables WITH (publish update);
+CREATE PUBLICATION testpub_foralltables FOR ALL TABLES WITH (publish = 'insert');
+ALTER PUBLICATION testpub_foralltables SET (publish = 'insert, update');
CREATE TABLE testpub_tbl2 (id serial primary key, data text);
-- fail - can't add to for all tables publication
-- fail - cannot do CREATE SUBSCRIPTION CREATE SLOT inside transaction block
BEGIN;
-CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub WITH (CREATE SLOT);
+CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub WITH (create_slot);
COMMIT;
-- fail - invalid connection string
CREATE SUBSCRIPTION testsub CONNECTION 'testconn' PUBLICATION testpub;
-- fail - duplicate publications
-CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION foo, testpub, foo WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION foo, testpub, foo WITH (connect = false);
-- ok
-CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
COMMENT ON SUBSCRIPTION testsub IS 'test subscription';
SELECT obj_description(s.oid, 'pg_subscription') FROM pg_subscription s;
-- fail - name already exists
-CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist' PUBLICATION testpub WITH (connect = false);
-- fail - must be superuser
SET SESSION AUTHORIZATION 'regress_subscription_user2';
-CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION foo WITH (NOCONNECT);
+CREATE SUBSCRIPTION testsub2 CONNECTION 'dbname=doesnotexist' PUBLICATION foo WITH (connect = false);
SET SESSION AUTHORIZATION 'regress_subscription_user';
-- fail - invalid connection string
\dRs+
-ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 NOREFRESH;
+ALTER SUBSCRIPTION testsub SET PUBLICATION testpub2, testpub3 SKIP REFRESH;
ALTER SUBSCRIPTION testsub CONNECTION 'dbname=doesnotexist2';
-ALTER SUBSCRIPTION testsub WITH (SLOT NAME = 'newname');
+ALTER SUBSCRIPTION testsub SET (slot_name = 'newname');
-- fail
ALTER SUBSCRIPTION doesnotexist CONNECTION 'dbname=doesnotexist2';
RESET ROLE;
ALTER SUBSCRIPTION testsub RENAME TO testsub_foo;
-ALTER SUBSCRIPTION testsub_foo WITH (SYNCHRONOUS_COMMIT = local);
-ALTER SUBSCRIPTION testsub_foo WITH (SYNCHRONOUS_COMMIT = foobar);
+ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = local);
+ALTER SUBSCRIPTION testsub_foo SET (synchronous_commit = foobar);
\dRs+
DROP SUBSCRIPTION testsub;
COMMIT;
-ALTER SUBSCRIPTION testsub WITH (SLOT NAME = NONE);
+ALTER SUBSCRIPTION testsub SET (slot_name = NONE);
-- now it works
BEGIN;
$node_publisher->safe_psql('postgres',
"CREATE PUBLICATION tap_pub");
$node_publisher->safe_psql('postgres',
- "CREATE PUBLICATION tap_pub_ins_only WITH (nopublish delete, nopublish update)");
+ "CREATE PUBLICATION tap_pub_ins_only WITH (publish = insert)");
$node_publisher->safe_psql('postgres',
"ALTER PUBLICATION tap_pub ADD TABLE tab_rep, tab_full");
$node_publisher->safe_psql('postgres',
$oldpid = $node_publisher->safe_psql('postgres',
"SELECT pid FROM pg_stat_replication WHERE application_name = '$appname';");
$node_subscriber->safe_psql('postgres',
- "ALTER SUBSCRIPTION tap_sub SET PUBLICATION tap_pub_ins_only REFRESH WITH (NOCOPY DATA)");
+ "ALTER SUBSCRIPTION tap_sub SET PUBLICATION tap_pub_ins_only REFRESH WITH (copy_data = false)");
$node_publisher->poll_query_until('postgres',
"SELECT pid != $oldpid FROM pg_stat_replication WHERE application_name = '$appname';")
or die "Timed out while waiting for apply to restart";
# check alter publication (relcache invalidation etc)
$node_publisher->safe_psql('postgres',
- "ALTER PUBLICATION tap_pub_ins_only WITH (publish delete)");
+ "ALTER PUBLICATION tap_pub_ins_only SET (publish = 'insert, delete')");
$node_publisher->safe_psql('postgres',
"ALTER PUBLICATION tap_pub_ins_only ADD TABLE tab_full");
$node_publisher->safe_psql('postgres',
"DELETE FROM tab_ins WHERE a > 0");
$node_subscriber->safe_psql('postgres',
- "ALTER SUBSCRIPTION tap_sub REFRESH PUBLICATION WITH (NOCOPY DATA)");
+ "ALTER SUBSCRIPTION tap_sub REFRESH PUBLICATION WITH (copy_data = false)");
$node_publisher->safe_psql('postgres',
"INSERT INTO tab_full VALUES(0)");
my $appname = 'tap_sub';
$node_subscriber->safe_psql('postgres',
- "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (SLOT NAME = tap_sub_slot)");
+ "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (slot_name = tap_sub_slot)");
# Wait for subscriber to finish initialization
my $caughtup_query =
my $appname = 'tap_sub';
$node_subscriber->safe_psql('postgres',
- "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (NOCOPY DATA)");
+ "CREATE SUBSCRIPTION tap_sub CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (copy_data = false)");
# Wait for subscriber to finish initialization
my $caughtup_query =
# now check another subscription for the same node pair
$node_subscriber->safe_psql('postgres',
- "CREATE SUBSCRIPTION tap_sub2 CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (NOCOPY DATA)");
+ "CREATE SUBSCRIPTION tap_sub2 CONNECTION '$publisher_connstr application_name=$appname' PUBLICATION tap_pub WITH (copy_data = false)");
# wait for it to start
$node_subscriber->poll_query_until('postgres', "SELECT pid IS NOT NULL FROM pg_stat_subscription WHERE subname = 'tap_sub2' AND relid IS NULL")