29 #include "utils/fmgroids.h"
60 (
errcode(ERRCODE_UNDEFINED_DATABASE),
61 errmsg(
"database \"%s\" does not exist", database)));
77 stmt->object, relation);
80 switch (
stmt->objtype)
93 if (relation->
rd_rel->relkind != RELKIND_RELATION &&
94 relation->
rd_rel->relkind != RELKIND_VIEW &&
95 relation->
rd_rel->relkind != RELKIND_MATVIEW &&
96 relation->
rd_rel->relkind != RELKIND_COMPOSITE_TYPE &&
97 relation->
rd_rel->relkind != RELKIND_FOREIGN_TABLE &&
98 relation->
rd_rel->relkind != RELKIND_PARTITIONED_TABLE)
100 (
errcode(ERRCODE_WRONG_OBJECT_TYPE),
101 errmsg(
"cannot set comment on relation \"%s\"",
127 if (relation != NULL)
151 bool nulls[Natts_pg_description];
152 bool replaces[Natts_pg_description];
162 for (
i = 0;
i < Natts_pg_description;
i++)
176 Anum_pg_description_objoid,
180 Anum_pg_description_classoid,
184 Anum_pg_description_objsubid,
213 if (newtuple == NULL &&
comment != NULL)
220 if (newtuple != NULL)
246 bool nulls[Natts_pg_shdescription];
247 bool replaces[Natts_pg_shdescription];
257 for (
i = 0;
i < Natts_pg_shdescription;
i++)
270 Anum_pg_shdescription_objoid,
274 Anum_pg_shdescription_classoid,
303 if (newtuple == NULL &&
comment != NULL)
310 if (newtuple != NULL)
337 Anum_pg_description_objoid,
341 Anum_pg_description_classoid,
348 Anum_pg_description_objsubid,
384 Anum_pg_shdescription_objoid,
388 Anum_pg_shdescription_classoid,
422 Anum_pg_description_objoid,
426 Anum_pg_description_classoid,
430 Anum_pg_description_objsubid,
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define TextDatumGetCString(d)
#define OidIsValid(objectId)
Oid get_database_oid(const char *dbname, bool missing_ok)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void systable_endscan(SysScanDesc sysscan)
HeapTuple systable_getnext(SysScanDesc sysscan)
SysScanDesc systable_beginscan(Relation heapRelation, Oid indexId, bool indexOK, Snapshot snapshot, int nkeys, ScanKey key)
HeapTuple heap_modify_tuple(HeapTuple tuple, TupleDesc tupleDesc, const Datum *replValues, const bool *replIsnull, const bool *doReplace)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, const Datum *values, const bool *isnull)
void heap_freetuple(HeapTuple htup)
static Datum heap_getattr(HeapTuple tup, int attnum, TupleDesc tupleDesc, bool *isnull)
void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
void CatalogTupleInsert(Relation heapRel, HeapTuple tup)
void CatalogTupleDelete(Relation heapRel, ItemPointer tid)
#define ShareUpdateExclusiveLock
void check_object_ownership(Oid roleid, ObjectType objtype, ObjectAddress address, Node *object, Relation relation)
const ObjectAddress InvalidObjectAddress
ObjectAddress get_object_address(ObjectType objtype, Node *object, Relation *relp, LOCKMODE lockmode, bool missing_ok)
int errdetail_relkind_not_supported(char relkind)
static Datum ObjectIdGetDatum(Oid X)
static Datum Int32GetDatum(int32 X)
#define RelationGetDescr(relation)
#define RelationGetRelationName(relation)
void ScanKeyInit(ScanKey entry, AttrNumber attributeNumber, StrategyNumber strategy, RegProcedure procedure, Datum argument)
void relation_close(Relation relation, LOCKMODE lockmode)
#define BTEqualStrategyNumber
void table_close(Relation relation, LOCKMODE lockmode)
Relation table_open(Oid relationId, LOCKMODE lockmode)