PostgreSQL Source Code git master
pg_attrdef.h
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_attrdef.h
4 * definition of the "attribute defaults" system catalog (pg_attrdef)
5 *
6 *
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/catalog/pg_attrdef.h
11 *
12 * NOTES
13 * The Catalog.pm module reads this file and derives schema
14 * information.
15 *
16 *-------------------------------------------------------------------------
17 */
18#ifndef PG_ATTRDEF_H
19#define PG_ATTRDEF_H
20
21#include "catalog/genbki.h"
23#include "catalog/pg_attrdef_d.h" /* IWYU pragma: export */
24
25/* ----------------
26 * pg_attrdef definition. cpp turns this into
27 * typedef struct FormData_pg_attrdef
28 * ----------------
29 */
30CATALOG(pg_attrdef,2604,AttrDefaultRelationId)
31{
32 Oid oid; /* oid */
33
34 Oid adrelid BKI_LOOKUP(pg_class); /* OID of table containing
35 * attribute */
36 int16 adnum; /* attnum of attribute */
37
38#ifdef CATALOG_VARLEN /* variable-length fields start here */
39 pg_node_tree adbin BKI_FORCE_NOT_NULL; /* nodeToString representation of
40 * default */
41#endif
43
44/* ----------------
45 * Form_pg_attrdef corresponds to a pointer to a tuple with
46 * the format of pg_attrdef relation.
47 * ----------------
48 */
50
51DECLARE_TOAST(pg_attrdef, 2830, 2831);
52
53DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, AttrDefaultIndexId, pg_attrdef, btree(adrelid oid_ops, adnum int2_ops));
54DECLARE_UNIQUE_INDEX_PKEY(pg_attrdef_oid_index, 2657, AttrDefaultOidIndexId, pg_attrdef, btree(oid oid_ops));
55
56DECLARE_FOREIGN_KEY((adrelid, adnum), pg_attribute, (attrelid, attnum));
57
58
60 Node *expr, bool is_internal,
61 bool add_column_mode);
62extern void RemoveAttrDefault(Oid relid, AttrNumber attnum,
63 DropBehavior behavior,
64 bool complain, bool internal);
65extern void RemoveAttrDefaultById(Oid attrdefId);
66
69
70#endif /* PG_ATTRDEF_H */
int16 AttrNumber
Definition: attnum.h:21
int16_t int16
Definition: c.h:483
#define BKI_LOOKUP(catalog)
Definition: genbki.h:46
#define BKI_FORCE_NOT_NULL
Definition: genbki.h:33
DropBehavior
Definition: parsenodes.h:2384
DECLARE_UNIQUE_INDEX_PKEY(pg_attrdef_oid_index, 2657, AttrDefaultOidIndexId, pg_attrdef, btree(oid oid_ops))
FormData_pg_attrdef * Form_pg_attrdef
Definition: pg_attrdef.h:49
void RemoveAttrDefaultById(Oid attrdefId)
Definition: pg_attrdef.c:268
Oid GetAttrDefaultOid(Oid relid, AttrNumber attnum)
Definition: pg_attrdef.c:339
CATALOG(pg_attrdef, 2604, AttrDefaultRelationId)
Definition: pg_attrdef.h:30
DECLARE_FOREIGN_KEY((adrelid, adnum), pg_attribute,(attrelid, attnum))
DECLARE_TOAST(pg_attrdef, 2830, 2831)
Oid StoreAttrDefault(Relation rel, AttrNumber attnum, Node *expr, bool is_internal, bool add_column_mode)
Definition: pg_attrdef.c:46
FormData_pg_attrdef
Definition: pg_attrdef.h:42
ObjectAddress GetAttrDefaultColumnAddress(Oid attrdefoid)
Definition: pg_attrdef.c:381
void RemoveAttrDefault(Oid relid, AttrNumber attnum, DropBehavior behavior, bool complain, bool internal)
Definition: pg_attrdef.c:213
DECLARE_UNIQUE_INDEX(pg_attrdef_adrelid_adnum_index, 2656, AttrDefaultIndexId, pg_attrdef, btree(adrelid oid_ops, adnum int2_ops))
int16 attnum
Definition: pg_attribute.h:74
unsigned int Oid
Definition: postgres_ext.h:32
Definition: nodes.h:129