postgresql/src/include/catalog/pg_publication_namespace.h
Tomas Vondra 75b1521dae Add decoding of sequences to built-in replication
This commit adds support for decoding of sequences to the built-in
replication (the infrastructure was added by commit 0da92dc530).

The syntax and behavior mostly mimics handling of tables, i.e. a
publication may be defined as FOR ALL SEQUENCES (replicating all
sequences in a database), FOR ALL SEQUENCES IN SCHEMA (replicating
all sequences in a particular schema) or individual sequences.

To publish sequence modifications, the publication has to include
'sequence' action. The protocol is extended with a new message,
describing sequence increments.

A new system view pg_publication_sequences lists all the sequences
added to a publication, both directly and indirectly. Various psql
commands (\d and \dRp) are improved to also display publications
including a given sequence, or sequences included in a publication.

Author: Tomas Vondra, Cary Huang
Reviewed-by: Peter Eisentraut, Amit Kapila, Hannu Krosing, Andres
             Freund, Petr Jelinek
Discussion: https://postgr.es/m/d045f3c2-6cfb-06d3-5540-e63c320df8bc@enterprisedb.com
Discussion: https://postgr.es/m/1710ed7e13b.cd7177461430746.3372264562543607781@highgo.ca
2022-03-24 18:49:27 +01:00

56 lines
2.2 KiB
C

/*-------------------------------------------------------------------------
*
* pg_publication_namespace.h
* definition of the system catalog for mappings between schemas and
* publications (pg_publication_namespace)
*
* Portions Copyright (c) 1996-2022, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_publication_namespace.h
*
* NOTES
* The Catalog.pm module reads this file and derives schema
* information.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_PUBLICATION_NAMESPACE_H
#define PG_PUBLICATION_NAMESPACE_H
#include "catalog/genbki.h"
#include "catalog/pg_publication_namespace_d.h"
/* ----------------
* pg_publication_namespace definition. cpp turns this into
* typedef struct FormData_pg_publication_namespace
* ----------------
*/
CATALOG(pg_publication_namespace,8901,PublicationNamespaceRelationId)
{
Oid oid; /* oid */
Oid pnpubid BKI_LOOKUP(pg_publication); /* Oid of the publication */
Oid pnnspid BKI_LOOKUP(pg_namespace); /* Oid of the schema */
char pntype; /* object type to include */
} FormData_pg_publication_namespace;
/* ----------------
* Form_pg_publication_namespace corresponds to a pointer to a tuple with
* the format of pg_publication_namespace relation.
* ----------------
*/
typedef FormData_pg_publication_namespace *Form_pg_publication_namespace;
DECLARE_UNIQUE_INDEX_PKEY(pg_publication_namespace_oid_index, 8902, PublicationNamespaceObjectIndexId, on pg_publication_namespace using btree(oid oid_ops));
DECLARE_UNIQUE_INDEX(pg_publication_namespace_pnnspid_pnpubid_pntype_index, 8903, PublicationNamespacePnnspidPnpubidPntypeIndexId, on pg_publication_namespace using btree(pnnspid oid_ops, pnpubid oid_ops, pntype char_ops));
/* object type to include from a schema, maps to relkind */
#define PUB_OBJTYPE_TABLE 't' /* table (regular or partitioned) */
#define PUB_OBJTYPE_SEQUENCE 's' /* sequence object */
#define PUB_OBJTYPE_UNSUPPORTED 'u' /* used for non-replicated types */
extern char pub_get_object_type_for_relkind(char relkind);
#endif /* PG_PUBLICATION_NAMESPACE_H */