@@ -96,13 +96,33 @@ source of truth for three behaviours:
9696 that already has them would fail.
9797- ` block_in_repset ` : a table in this schema, or belonging to this extension,
9898 may not be added to a replication set.
99- - ` replicate_ddl ` : applies to schemas only. When ` false ` , AutoDDL keeps DDL
100- targeting this schema node-local -- it runs where issued but is not shipped
101- to other nodes. It is not meaningful for extensions, so it is required for
102- ` schema ` rows and is ` NULL ` for ` extension ` rows (a ` CHECK ` enforces this,
103- and ` reserved_object_add ` sets it to ` NULL ` automatically for an extension).
99+ - ` replicate_ddl ` : when ` false ` , AutoDDL keeps the object's DDL node-local
100+ -- it runs where issued but is not shipped to other nodes. The default is
101+ ` true ` .
104102
105- Only DDL whose target schema Spock can identify is kept local: ` CREATE `
103+ For an extension, ` CREATE EXTENSION ` , ` ALTER EXTENSION ` , `DROP
104+ EXTENSION` , ` COMMENT ON EXTENSION` and ` SECURITY LABEL ON EXTENSION` are
105+ kept local; run them on each node. A ` DROP EXTENSION ` that names both a
106+ node-local extension and a replicated one is refused while DDL replication
107+ is on; drop them in separate statements. ` CREATE EXTENSION ... CASCADE ` of
108+ a replicated extension that requires a node-local one is also refused, even
109+ when every required extension is already installed; create the node-local
110+ extension on each node first, then run the ` CREATE EXTENSION ` without
111+ ` CASCADE ` . ` spock.replicate_ddl() ` refuses all of these statements for a
112+ node-local extension. Whatever a statement on a node-local extension does
113+ with ` CASCADE ` also stays on the local node: objects that depend on the
114+ extension are dropped only there, and extensions that `CREATE EXTENSION
115+ ... CASCADE` installs are installed only there.
116+
117+ A statement that removes a node-local extension without naming it is not
118+ caught: ` DROP EXTENSION ... CASCADE ` of an extension it requires, `DROP
119+ SCHEMA ... CASCADE` of a schema it was created in, or ` DROP OWNED BY` its
120+ owner. Such a statement replicates, and each peer must then drop the
121+ node-local extension from its apply worker. Drop the node-local extension
122+ on each node first.
123+
124+ For a schema, only DDL whose target schema Spock can identify is kept
125+ local: ` CREATE `
106126 ` SCHEMA ` /` TABLE ` /` TABLE AS ` /` SEQUENCE ` /` VIEW ` /` INDEX ` , ` ALTER TABLE ` , and
107127 ` DROP ` of those object kinds. Other DDL against the schema (for example
108128 ` GRANT ` , ` COMMENT ` , ` TRUNCATE ` , or ` ALTER ... SET SCHEMA ` ) is not classified
@@ -124,8 +144,11 @@ modified:
124144
125145` spock ` , ` snowflake ` , ` lolor ` and ` coldfront ` each have both a ` schema ` and an
126146` extension ` row. The ` replicate_ddl ` column above is the value on the
127- ` schema ` row; the ` extension ` row carries ` replicate_ddl = NULL ` (not
128- applicable), while ` exclude_from_dump ` /` block_in_repset ` apply to both.
147+ ` schema ` row. The ` extension ` rows have ` replicate_ddl = true ` (replicated),
148+ except ` lolor ` , whose extension row is ` false ` : lolor refuses to be created
149+ or dropped by an apply worker, so ` CREATE ` , ` ALTER ` and `DROP EXTENSION
150+ lolor` are run on each node instead of being replicated.
151+ ` exclude_from_dump ` /` block_in_repset ` apply to both rows.
129152
130153` lolor ` is excluded from the dump but is intentionally allowed in replication
131154sets: its tables must replicate so that large objects survive a
@@ -383,7 +406,7 @@ changed.
383406
384407`spock.reserved_object_add(p_name name, p_kind text, p_exclude_from_dump bool
385408DEFAULT true, p_block_in_repset bool DEFAULT true, p_replicate_ddl bool
386- DEFAULT NULL )`
409+ DEFAULT true )`
387410
388411Parameters:
389412
@@ -393,11 +416,10 @@ Parameters:
393416 default is ` true ` .
394417- ` p_block_in_repset ` blocks the object from replication sets; the default is
395418 ` true ` .
396- - ` p_replicate_ddl ` applies to schemas only. For a schema, leaving it unset
397- (` NULL ` ) defaults to ` true ` ; pass ` false ` to keep the schema node-local so
398- AutoDDL does not ship its DDL to other nodes (as ` pgedge_ace ` is). For
399- ` p_kind = 'extension' ` the argument is ignored and the value is stored as
400- ` NULL ` .
419+ - ` p_replicate_ddl ` : pass ` false ` to keep the object node-local so AutoDDL
420+ does not ship its DDL to other nodes (as ` pgedge_ace ` and the ` lolor `
421+ extension are). The default is ` true ` , and an explicit ` NULL ` is taken as
422+ ` true ` .
401423
402424### spock.reserved_object_remove
403425
0 commit comments