PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/genam.h"
#include "access/htup_details.h"
#include "access/table.h"
#include "access/xact.h"
#include "catalog/catalog.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/objectaccess.h"
#include "catalog/objectaddress.h"
#include "catalog/partition.h"
#include "catalog/pg_inherits.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_proc.h"
#include "catalog/pg_publication.h"
#include "catalog/pg_publication_namespace.h"
#include "catalog/pg_publication_rel.h"
#include "catalog/pg_type.h"
#include "commands/dbcommands.h"
#include "commands/defrem.h"
#include "commands/event_trigger.h"
#include "commands/publicationcmds.h"
#include "funcapi.h"
#include "miscadmin.h"
#include "nodes/nodeFuncs.h"
#include "parser/parse_clause.h"
#include "parser/parse_collate.h"
#include "parser/parse_relation.h"
#include "storage/lmgr.h"
#include "utils/acl.h"
#include "utils/array.h"
#include "utils/builtins.h"
#include "utils/catcache.h"
#include "utils/fmgroids.h"
#include "utils/inval.h"
#include "utils/lsyscache.h"
#include "utils/rel.h"
#include "utils/syscache.h"
#include "utils/varlena.h"
Go to the source code of this file.
Data Structures | |
struct | rf_context |
Typedefs | |
typedef struct rf_context | rf_context |
typedef struct rf_context rf_context |
void AlterPublication | ( | ParseState * | pstate, |
AlterPublicationStmt * | stmt | ||
) |
Definition at line 1393 of file publicationcmds.c.
References AccessExclusiveLock, aclcheck_error(), ACLCHECK_NOT_OWNER, AlterPublicationOptions(), AlterPublicationSchemas(), AlterPublicationTables(), CheckAlterPublication(), CStringGetDatum, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, GetUserId(), heap_freetuple(), HeapTupleIsValid, LockDatabaseObject(), NIL, OBJECT_PUBLICATION, ObjectIdGetDatum, ObjectsInPublicationToOids(), AlterPublicationStmt::options, ParseState::p_sourcetext, pg_publication_ownercheck(), PUBLICATIONNAME, PUBLICATIONOID, AlterPublicationStmt::pubname, AlterPublicationStmt::pubobjects, RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by ProcessUtilitySlow().
|
static |
Definition at line 904 of file publicationcmds.c.
References AccessShareLock, Assert(), BoolGetDatum, CacheInvalidateRelcacheAll(), CatalogTupleUpdate(), CommandCounterIncrement(), ereport, errcode(), errdetail(), errmsg(), ERROR, EventTriggerCollectSimpleCommand(), get_rel_name(), get_rel_relkind(), GetAllSchemaPublicationRelations(), GetPublicationRelations(), GetPubPartitionOptionRelations(), GETSTRUCT, heap_attisnull(), heap_modify_tuple(), HeapTupleIsValid, InvalidatePublicationRels(), InvalidObjectAddress, InvokeObjectPostAlterHook, lfirst_oid, list_concat_unique_oid(), LockDatabaseObject(), NIL, ObjectAddressSet, ObjectIdGetDatum, AlterPublicationStmt::options, parse_publication_options(), PublicationActions::pubdelete, PublicationActions::pubinsert, PUBLICATION_PART_ALL, PUBLICATION_PART_ROOT, PUBLICATIONRELMAP, AlterPublicationStmt::pubname, PublicationActions::pubtruncate, PublicationActions::pubupdate, RelationGetDescr, ReleaseSysCache(), relname, SearchSysCache2(), HeapTupleData::t_self, and values.
Referenced by AlterPublication().
ObjectAddress AlterPublicationOwner | ( | const char * | name, |
Oid | newOwnerId | ||
) |
Definition at line 2001 of file publicationcmds.c.
References AlterPublicationOwner_internal(), CStringGetDatum, ereport, errcode(), errmsg(), ERROR, GETSTRUCT, heap_freetuple(), HeapTupleIsValid, name, ObjectAddressSet, PUBLICATIONNAME, RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by ExecAlterOwnerStmt().
Definition at line 1943 of file publicationcmds.c.
References ACL_CREATE, aclcheck_error(), ACLCHECK_NOT_OWNER, ACLCHECK_OK, CatalogTupleUpdate(), changeDependencyOnOwner(), check_is_member_of_role(), ereport, errcode(), errhint(), errmsg(), ERROR, get_database_name(), GETSTRUCT, GetUserId(), InvokeObjectPostAlterHook, is_schema_publication(), MyDatabaseId, NameStr, OBJECT_DATABASE, OBJECT_PUBLICATION, pg_database_aclcheck(), pg_publication_ownercheck(), superuser(), superuser_arg(), and HeapTupleData::t_self.
Referenced by AlterPublicationOwner(), and AlterPublicationOwner_oid().
Definition at line 2036 of file publicationcmds.c.
References AlterPublicationOwner_internal(), ereport, errcode(), errmsg(), ERROR, heap_freetuple(), HeapTupleIsValid, ObjectIdGetDatum, PUBLICATIONOID, RowExclusiveLock, SearchSysCacheCopy1, table_close(), and table_open().
Referenced by shdepReassignOwned().
|
static |
Definition at line 1291 of file publicationcmds.c.
References AlterPublicationStmt::action, AP_AddObjects, AP_DropObjects, AP_SetObjects, CheckObjSchemaNotAlreadyInPublication(), CloseTableList(), GetPublicationRelations(), GetPublicationSchemas(), GETSTRUCT, list_difference_oid(), LockSchemaList(), NIL, OpenRelIdList(), PUBLICATION_PART_ROOT, PublicationAddSchemas(), PublicationDropSchemas(), and PUBLICATIONOBJ_TABLES_IN_SCHEMA.
Referenced by AlterPublication().
|
static |
Definition at line 1112 of file publicationcmds.c.
References AlterPublicationStmt::action, AP_AddObjects, AP_DropObjects, AP_SetObjects, attnum, bms_add_member(), bms_equal(), CheckObjSchemaNotAlreadyInPublication(), CheckPubRelationColumnList(), CloseTableList(), PublicationRelInfo::columns, equal(), get_attnum(), GetPublicationRelations(), GetPublicationSchemas(), GETSTRUCT, HeapTupleIsValid, lappend(), lfirst, lfirst_oid, list_concat_copy(), NIL, ObjectIdGetDatum, OpenTableList(), palloc(), pub_collist_to_bitmapset(), PUBLICATION_PART_ROOT, PublicationAddTables(), PublicationDropTables(), PUBLICATIONOBJ_TABLE, PUBLICATIONRELMAP, PublicationRelInfo::relation, RelationGetRelid, ReleaseSysCache(), SearchSysCache2(), ShareUpdateExclusiveLock, stringToNode(), strVal, SysCacheGetAttr(), table_open(), TextDatumGetCString, TransformPubWhereClauses(), and PublicationRelInfo::whereClause.
Referenced by AlterPublication().
|
static |
Definition at line 645 of file publicationcmds.c.
References check_simple_rowfilter_expr_walker().
Referenced by TransformPubWhereClauses().
|
static |
Definition at line 552 of file publicationcmds.c.
References _, ereport, errcode(), errdetail(), errmsg(), ERROR, expr_allowed_in_node(), expression_tree_walker(), exprLocation(), FirstNormalObjectId, InvalidAttrNumber, lfirst_oid, nodeTag, parser_errposition(), T_ArrayExpr, T_BooleanTest, T_BoolExpr, T_CaseExpr, T_CaseTestExpr, T_CoalesceExpr, T_CollateExpr, T_Const, T_DistinctExpr, T_FuncExpr, T_List, T_MinMaxExpr, T_NullIfExpr, T_NullTest, T_OpExpr, T_RelabelType, T_RowCompareExpr, T_RowExpr, T_ScalarArrayOpExpr, T_Var, and T_XmlExpr.
Referenced by check_simple_rowfilter_expr().
|
static |
Definition at line 1355 of file publicationcmds.c.
References AlterPublicationStmt::action, AP_AddObjects, AP_SetObjects, ereport, errcode(), errdetail(), errmsg(), ERROR, GETSTRUCT, NameStr, and superuser().
Referenced by AlterPublication().
|
static |
Definition at line 222 of file publicationcmds.c.
References ereport, errcode(), errdetail(), errmsg(), ERROR, get_namespace_name(), lfirst, list_member_oid(), PUBLICATIONOBJ_TABLE, PUBLICATIONOBJ_TABLES_IN_SCHEMA, PublicationRelInfo::relation, RelationGetNamespace, and RelationGetRelationName.
Referenced by AlterPublicationSchemas(), AlterPublicationTables(), and CreatePublication().
|
static |
Definition at line 723 of file publicationcmds.c.
References PublicationRelInfo::columns, ereport, errcode(), errdetail(), errmsg(), ERROR, lfirst, NIL, RelationData::rd_rel, PublicationRelInfo::relation, and RelationGetRelationName.
Referenced by AlterPublicationTables(), and CreatePublication().
|
static |
Definition at line 1754 of file publicationcmds.c.
References lfirst, list_free_deep(), NoLock, PublicationRelInfo::relation, and table_close().
Referenced by AlterPublicationSchemas(), AlterPublicationTables(), and CreatePublication().
|
static |
Definition at line 260 of file publicationcmds.c.
References attnum, bms_is_member(), rf_context::bms_replident, expression_tree_walker(), FirstLowInvalidHeapAttributeNumber, get_attname(), get_attnum(), IsA, rf_context::parentid, rf_context::pubviaroot, rf_context::relid, and Var::varattno.
Referenced by pub_rf_contains_invalid_column().
Definition at line 479 of file publicationcmds.c.
References FirstNormalObjectId, and func_volatile().
Referenced by expr_allowed_in_node().
ObjectAddress CreatePublication | ( | ParseState * | pstate, |
CreatePublicationStmt * | stmt | ||
) |
Definition at line 755 of file publicationcmds.c.
References ACL_CREATE, aclcheck_error(), ACLCHECK_OK, BoolGetDatum, CacheInvalidateRelcacheAll(), CatalogTupleInsert(), CheckObjSchemaNotAlreadyInPublication(), CheckPubRelationColumnList(), CloseTableList(), CommandCounterIncrement(), CStringGetDatum, DirectFunctionCall1, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errhint(), errmsg(), ERROR, CreatePublicationStmt::for_all_tables, get_database_name(), GetNewOidWithIndex(), GetSysCacheOid1, GetUserId(), heap_form_tuple(), heap_freetuple(), InvokeObjectPostCreateHook, list_length(), LockSchemaList(), MyDatabaseId, namein(), NIL, OBJECT_DATABASE, ObjectAddressSet, ObjectIdGetDatum, ObjectsInPublicationToOids(), OidIsValid, OpenTableList(), CreatePublicationStmt::options, ParseState::p_sourcetext, parse_publication_options(), pg_database_aclcheck(), PublicationActions::pubdelete, PublicationActions::pubinsert, PublicationAddSchemas(), PublicationAddTables(), PUBLICATIONNAME, PUBLICATIONOBJ_TABLE, CreatePublicationStmt::pubname, CreatePublicationStmt::pubobjects, PublicationActions::pubtruncate, PublicationActions::pubupdate, recordDependencyOnOwner(), RelationGetDescr, RowExclusiveLock, superuser(), table_close(), table_open(), TransformPubWhereClauses(), values, wal_level, WAL_LEVEL_LOGICAL, and WARNING.
Referenced by ProcessUtilitySlow().
|
static |
Definition at line 492 of file publicationcmds.c.
References _, check_functions_in_node(), contain_mutable_or_user_functions_checker(), exprCollation(), exprInputCollation(), exprType(), FirstNormalObjectId, and IsA.
Referenced by check_simple_rowfilter_expr_walker().
void InvalidatePublicationRels | ( | List * | relids | ) |
Definition at line 1091 of file publicationcmds.c.
References CacheInvalidateRelcacheAll(), CacheInvalidateRelcacheByRelid(), lfirst_oid, list_length(), and MAX_RELCACHE_INVAL_MSGS.
Referenced by AlterPublicationOptions(), publication_add_relation(), publication_add_schema(), RemovePublicationRelById(), and RemovePublicationSchemaById().
|
static |
Definition at line 1774 of file publicationcmds.c.
References AccessShareLock, CHECK_FOR_INTERRUPTS, ereport, errcode(), errmsg(), ERROR, lfirst_oid, LockDatabaseObject(), NAMESPACEOID, ObjectIdGetDatum, and SearchSysCacheExists1.
Referenced by AlterPublicationSchemas(), and CreatePublication().
|
static |
Definition at line 169 of file publicationcmds.c.
References elog, ereport, errcode(), errmsg(), ERROR, fetch_search_path(), get_namespace_oid(), lappend(), lfirst, linitial_oid, list_append_unique_oid(), list_free(), PublicationObjSpec::name, NIL, PUBLICATIONOBJ_TABLE, PUBLICATIONOBJ_TABLES_IN_CUR_SCHEMA, PUBLICATIONOBJ_TABLES_IN_SCHEMA, PublicationObjSpec::pubobjtype, and PublicationObjSpec::pubtable.
Referenced by AlterPublication(), and CreatePublication().
Definition at line 1578 of file publicationcmds.c.
References lappend(), lfirst_oid, NIL, palloc(), PublicationRelInfo::relation, ShareUpdateExclusiveLock, and table_open().
Referenced by AlterPublicationSchemas().
Definition at line 1604 of file publicationcmds.c.
References CHECK_FOR_INTERRUPTS, PublicationRelInfo::columns, PublicationTable::columns, ereport, errcode(), ERRCODE_DUPLICATE_OBJECT, errmsg(), ERROR, find_all_inheritors(), RangeVar::inh, lappend(), lappend_oid(), lfirst_node, lfirst_oid, list_free(), list_member_oid(), NIL, NoLock, palloc(), RelationData::rd_rel, PublicationRelInfo::relation, PublicationTable::relation, RelationGetRelationName, RelationGetRelid, ShareUpdateExclusiveLock, table_close(), table_open(), table_openrv(), PublicationRelInfo::whereClause, and PublicationTable::whereClause.
Referenced by AlterPublicationTables(), and CreatePublication().
|
static |
Definition at line 81 of file publicationcmds.c.
References defGetBoolean(), defGetString(), DefElem::defname, ereport, errcode(), errmsg(), ERROR, errorConflictingDefElem(), if(), lfirst, PublicationActions::pubdelete, PublicationActions::pubinsert, PublicationActions::pubtruncate, PublicationActions::pubupdate, and SplitIdentifierString().
Referenced by AlterPublicationOptions(), and CreatePublication().
bool pub_collist_contains_invalid_column | ( | Oid | pubid, |
Relation | relation, | ||
List * | ancestors, | ||
bool | pubviaroot | ||
) |
Definition at line 375 of file publicationcmds.c.
References attnum, bms_free(), bms_is_member(), bms_next_member(), FirstLowInvalidHeapAttributeNumber, get_attname(), get_attnum(), GetTopMostAncestorInPublication(), HeapTupleIsValid, INDEX_ATTR_BITMAP_IDENTITY_KEY, ObjectIdGetDatum, OidIsValid, pub_collist_to_bitmapset(), PUBLICATIONRELMAP, RelationData::rd_rel, RelationGetIndexAttrBitmap(), RelationGetRelid, ReleaseSysCache(), SearchSysCache2(), SysCacheGetAttr(), and x.
Referenced by RelationBuildPublicationDesc().
bool pub_rf_contains_invalid_column | ( | Oid | pubid, |
Relation | relation, | ||
List * | ancestors, | ||
bool | pubviaroot | ||
) |
Definition at line 299 of file publicationcmds.c.
References rf_context::bms_replident, contain_invalid_rfcolumn_walker(), GetTopMostAncestorInPublication(), HeapTupleIsValid, INDEX_ATTR_BITMAP_IDENTITY_KEY, ObjectIdGetDatum, OidIsValid, rf_context::parentid, PUBLICATIONRELMAP, rf_context::pubviaroot, RelationData::rd_rel, RelationGetIndexAttrBitmap(), RelationGetRelid, ReleaseSysCache(), rf_context::relid, SearchSysCache2(), stringToNode(), SysCacheGetAttr(), and TextDatumGetCString.
Referenced by RelationBuildPublicationDesc().
|
static |
Definition at line 1881 of file publicationcmds.c.
References Assert(), EventTriggerCollectSimpleCommand(), AlterPublicationStmt::for_all_tables, InvalidObjectAddress, InvokeObjectPostCreateHook, lfirst_oid, ObjectAddress::objectId, and publication_add_schema().
Referenced by AlterPublicationSchemas(), and CreatePublication().
|
static |
Definition at line 1802 of file publicationcmds.c.
References aclcheck_error(), ACLCHECK_NOT_OWNER, Assert(), EventTriggerCollectSimpleCommand(), AlterPublicationStmt::for_all_tables, get_relkind_objtype(), GetUserId(), InvalidObjectAddress, InvokeObjectPostCreateHook, lfirst, ObjectAddress::objectId, pg_class_ownercheck(), publication_add_relation(), RelationData::rd_rel, PublicationRelInfo::relation, RelationGetRelationName, and RelationGetRelid.
Referenced by AlterPublicationTables(), and CreatePublication().
Definition at line 1909 of file publicationcmds.c.
References DROP_CASCADE, ereport, errcode(), errmsg(), ERROR, get_namespace_name(), GetSysCacheOid2, lfirst_oid, ObjectAddressSet, ObjectIdGetDatum, OidIsValid, performDeletion(), and PUBLICATIONNAMESPACEMAP.
Referenced by AlterPublicationSchemas().
Definition at line 1836 of file publicationcmds.c.
References PublicationRelInfo::columns, DROP_CASCADE, ereport, errcode(), errmsg(), ERROR, GetSysCacheOid2, lfirst, ObjectAddressSet, ObjectIdGetDatum, OidIsValid, performDeletion(), PUBLICATIONRELMAP, PublicationRelInfo::relation, RelationGetRelationName, RelationGetRelid, and PublicationRelInfo::whereClause.
Referenced by AlterPublicationTables().
void RemovePublicationById | ( | Oid | pubid | ) |
Definition at line 1511 of file publicationcmds.c.
References CacheInvalidateRelcacheAll(), CatalogTupleDelete(), elog, ERROR, GETSTRUCT, HeapTupleIsValid, ObjectIdGetDatum, PUBLICATIONOID, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
void RemovePublicationRelById | ( | Oid | proid | ) |
Definition at line 1470 of file publicationcmds.c.
References CatalogTupleDelete(), elog, ERROR, GetPubPartitionOptionRelations(), GETSTRUCT, HeapTupleIsValid, InvalidatePublicationRels(), NIL, ObjectIdGetDatum, PUBLICATION_PART_ALL, PUBLICATIONREL, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
void RemovePublicationSchemaById | ( | Oid | psoid | ) |
Definition at line 1540 of file publicationcmds.c.
References CatalogTupleDelete(), elog, ERROR, GetSchemaPublicationRelations(), GETSTRUCT, HeapTupleIsValid, InvalidatePublicationRels(), NIL, ObjectIdGetDatum, PUBLICATION_PART_ALL, PUBLICATIONNAMESPACE, ReleaseSysCache(), RowExclusiveLock, SearchSysCache1(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by doDeletion().
|
static |
Definition at line 660 of file publicationcmds.c.
References AccessShareLock, addNSItemToQuery(), addRangeTableEntryForRelation(), assign_expr_collations(), check_simple_rowfilter_expr(), copyObject, ereport, errcode(), errdetail(), errmsg(), ERROR, EXPR_KIND_WHERE, free_parsestate(), lfirst, make_parsestate(), ParseState::p_sourcetext, RelationData::rd_rel, PublicationRelInfo::relation, RelationGetRelationName, transformWhereClause(), and PublicationRelInfo::whereClause.
Referenced by AlterPublicationTables(), and CreatePublication().