Skip to main content

postgres_static_analyzer_ddl_catalog_structs/
struct_gen.rs

1use super::*;
2
3/// The DDL-only contents of [`pg_aggregate`](https://www.postgresql.org/docs/17/catalog-pg-aggregate.html)
4#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
5pub struct PgAggregate {
6	/// `regproc` `(references pg_proc.oid)` pg_proc OID of the aggregate function
7	pub aggfnoid: Str,
8	/// `char`  Aggregate kind: n for “normal” aggregates, o for “ordered-set” aggregates, or h for “hypothetical-set” aggregates
9	pub aggkind: PgAggregateAggkind,
10	/// `int2`  Number of direct (non-aggregated) arguments of an ordered-set or hypothetical-set aggregate, counting a variadic array as one argument. If equal to pronargs, the aggregate must be variadic and the variadic array describes the aggregated arguments as well as the final direct arguments. Always zero for normal aggregates.
11	pub aggnumdirectargs: u16,
12	/// `regproc` `(references pg_proc.oid)` Transition function
13	pub aggtransfn: Str,
14	/// `regproc` `(references pg_proc.oid)` Final function (zero if none)
15	pub aggfinalfn: Option<Str>,
16	/// `regproc` `(references pg_proc.oid)` Combine function (zero if none)
17	pub aggcombinefn: Option<Str>,
18	/// `regproc` `(references pg_proc.oid)` Serialization function (zero if none)
19	pub aggserialfn: Option<Str>,
20	/// `regproc` `(references pg_proc.oid)` Deserialization function (zero if none)
21	pub aggdeserialfn: Option<Str>,
22	/// `regproc` `(references pg_proc.oid)` Forward transition function for moving-aggregate mode (zero if none)
23	pub aggmtransfn: Option<Str>,
24	/// `regproc` `(references pg_proc.oid)` Inverse transition function for moving-aggregate mode (zero if none)
25	pub aggminvtransfn: Option<Str>,
26	/// `regproc` `(references pg_proc.oid)` Final function for moving-aggregate mode (zero if none)
27	pub aggmfinalfn: Option<Str>,
28	/// `bool`  True to pass extra dummy arguments to aggfinalfn
29	pub aggfinalextra: bool,
30	/// `bool`  True to pass extra dummy arguments to aggmfinalfn
31	pub aggmfinalextra: bool,
32	/// `char`  Whether aggfinalfn modifies the transition state value: r if it is read-only, s if the aggtransfn cannot be applied after the aggfinalfn, or w if it writes on the value
33	pub aggfinalmodify: PgAggregateAggfinalmodify,
34	/// `char`  Like aggfinalmodify, but for the aggmfinalfn
35	pub aggmfinalmodify: PgAggregateAggmfinalmodify,
36	/// `oid` `(references pg_operator.oid)` Associated sort operator (zero if none)
37	pub aggsortop: Option<Str>,
38	/// `oid` `(references pg_type.oid)` Data type of the aggregate function's internal transition (state) data
39	pub aggtranstype: Str,
40	// aggtransspace int4  Approximate average size (in bytes) of the transition state data, or zero to use a default estimate
41	/// `oid` `(references pg_type.oid)` Data type of the aggregate function's internal transition (state) data for moving-aggregate mode (zero if none)
42	pub aggmtranstype: Option<Str>,
43	// aggmtransspace int4  Approximate average size (in bytes) of the transition state data for moving-aggregate mode, or zero to use a default estimate
44	/// `text`  The initial value of the transition state. This is a text field containing the initial value in its external string representation. If this field is null, the transition state value starts out null.
45	pub agginitval: Option<Str>,
46	/// `text`  The initial value of the transition state for moving-aggregate mode. This is a text field containing the initial value in its external string representation. If this field is null, the transition state value starts out null.
47	pub aggminitval: Option<Str>,
48}
49
50pg_char_enum!(PgAggregateAggkind { 'n' => Normal, 'o' => OrderedSet, 'h' => HypotheticalSet });
51pg_char_enum!(PgAggregateAggfinalmodify { 'r' => ReadOnly, 's' => CannotApply, 'w' => Writes });
52pg_char_enum!(PgAggregateAggmfinalmodify { 'r' => ReadOnly, 's' => CannotApply, 'w' => Writes });
53
54
55/// The DDL-only contents of [`pg_am`](https://www.postgresql.org/docs/17/catalog-pg-am.html)
56#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
57pub struct PgAm {
58	// oid oid  Row identifier
59	/// `name`  Name of the access method
60	pub amname: Str,
61	/// `regproc` `(references pg_proc.oid)` OID of a handler function that is responsible for supplying information about the access method
62	pub amhandler: Str,
63	/// `char`  t = table (including materialized views), i = index.
64	pub amtype: PgAmAmtype,
65	/// `text`  The comment from pg_description
66	pub description: Option<Str>,
67}
68impl_hash_and_equivalent!(PgAm, amname);
69
70pg_char_enum!(PgAmAmtype { 't' => Table, 'i' => Index });
71
72
73/// The DDL-only contents of [`pg_amop`](https://www.postgresql.org/docs/17/catalog-pg-amop.html)
74#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
75pub struct PgAmop {
76	// oid oid  Row identifier
77	/// `oid` `(references pg_opfamily.oid)` The operator family this entry is for
78	pub amopfamily: Str,
79	/// `oid` `(references pg_type.oid)` Left-hand input data type of operator
80	pub amoplefttype: Str,
81	/// `oid` `(references pg_type.oid)` Right-hand input data type of operator
82	pub amoprighttype: Str,
83	/// `int2`  Operator strategy number
84	pub amopstrategy: u16,
85	/// `char`  Operator purpose, either s for search or o for ordering
86	pub amoppurpose: PgAmopAmoppurpose,
87	/// `oid` `(references pg_operator.oid)` OID of the operator
88	pub amopopr: Str,
89	/// `oid` `(references pg_am.oid)` Index access method operator family is for
90	pub amopmethod: Str,
91	/// `oid` `(references pg_opfamily.oid)` The B-tree operator family this entry sorts according to, if an ordering operator; zero if a search operator
92	pub amopsortfamily: Option<Str>,
93}
94
95pg_char_enum!(PgAmopAmoppurpose { 's' => Search, 'o' => Ordering });
96
97
98/// The DDL-only contents of [`pg_amproc`](https://www.postgresql.org/docs/17/catalog-pg-amproc.html)
99#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
100pub struct PgAmproc {
101	// oid oid  Row identifier
102	/// `oid` `(references pg_opfamily.oid)` The operator family this entry is for
103	pub amprocfamily: Str,
104	/// `oid` `(references pg_type.oid)` Left-hand input data type of associated operator
105	pub amproclefttype: Str,
106	/// `oid` `(references pg_type.oid)` Right-hand input data type of associated operator
107	pub amprocrighttype: Str,
108	/// `int2`  Support function number
109	pub amprocnum: u16,
110	/// `regproc` `(references pg_proc.oid)` OID of the function
111	pub amproc: Str,
112}
113
114
115/// The DDL-only contents of [`pg_attrdef`](https://www.postgresql.org/docs/17/catalog-pg-attrdef.html)
116#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
117pub struct PgAttrdef {
118	// oid oid  Row identifier
119	/// `oid` `(references pg_class.oid)` The table this column belongs to
120	pub adrelid: Str,
121	/// `int2` `(references pg_attribute.attnum)` The number of the column
122	pub adnum: u16,
123	/// `pg_node_tree`  The column default value, in nodeToString() representation. Use pg_get_expr(adbin, adrelid) to convert it to an SQL expression.
124	pub adbin: Str,
125}
126
127
128/// The DDL-only contents of [`pg_attribute`](https://www.postgresql.org/docs/17/catalog-pg-attribute.html)
129#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
130pub struct PgAttribute {
131	/// `oid` `(references pg_class.oid)` The table this column belongs to
132	pub attrelid: Str,
133	/// `name`  The column name
134	pub attname: Str,
135	/// `oid` `(references pg_type.oid)` The data type of this column (zero for a dropped column)
136	pub atttypid: Str,
137	// attlen int2  A copy of pg_type.typlen of this column's type
138	/// `int2`  The number of the column. Ordinary columns are numbered from 1 up. System columns, such as ctid, have (arbitrary) negative numbers.
139	pub attnum: u16,
140	// attcacheoff int4  Always -1 in storage, but when loaded into a row descriptor in memory this might be updated to cache the offset of the attribute within the row
141	/// `int4`  atttypmod records type-specific data supplied at table creation time (for example, the maximum length of a varchar column). It is passed to type-specific input functions and length coercion functions. The value will generally be -1 for types that do not need atttypmod.
142	pub atttypmod: Option<u32>,
143	/// `int2`  Number of dimensions, if the column is an array type; otherwise 0. (Presently, the number of dimensions of an array is not enforced, so any nonzero value effectively means “it's an array”.)
144	pub attndims: u16,
145	// attbyval bool  A copy of pg_type.typbyval of this column's type
146	// attalign char  A copy of pg_type.typalign of this column's type
147	// attstorage char  Normally a copy of pg_type.typstorage of this column's type. For TOAST-able data types, this can be altered after column creation to control storage policy.
148	/// `char`  The current compression method of the column. Typically this is '\0' to specify use of the current default setting (see default_toast_compression). Otherwise, 'p' selects pglz compression, while 'l' selects LZ4 compression. However, this field is ignored whenever attstorage does not allow compression.
149	pub attcompression: Option<PgAttributeAttcompression>,
150	/// `bool`  This represents a not-null constraint.
151	pub attnotnull: bool,
152	/// `bool`  This column has a default expression or generation expression, in which case there will be a corresponding entry in the pg_attrdef catalog that actually defines the expression. (Check attgenerated to determine whether this is a default or a generation expression.)
153	pub atthasdef: bool,
154	// atthasmissing bool  This column has a value which is used where the column is entirely missing from the row, as happens when a column is added with a non-volatile DEFAULT value after the row is created. The actual value used is stored in the attmissingval column.
155	/// `char`  If a zero byte (''), then not an identity column. Otherwise, a = generated always, d = generated by default.
156	pub attidentity: Option<PgAttributeAttidentity>,
157	/// `char`  If a zero byte (''), then not a generated column. Otherwise, s = stored. (Other values might be added in the future.)
158	pub attgenerated: Option<PgAttributeAttgenerated>,
159	/// `bool`  This column has been dropped and is no longer valid. A dropped column is still physically present in the table, but is ignored by the parser and so cannot be accessed via SQL.
160	pub attisdropped: bool,
161	/// `bool`  This column is defined locally in the relation. Note that a column can be locally defined and inherited simultaneously.
162	pub attislocal: bool,
163	/// `int2`  The number of direct ancestors this column has. A column with a nonzero number of ancestors cannot be dropped nor renamed.
164	pub attinhcount: u16,
165	/// `oid` `(references pg_collation.oid)` The defined collation of the column, or zero if the column is not of a collatable data type
166	pub attcollation: Option<Str>,
167	/// `int2`  attstattarget controls the level of detail of statistics accumulated for this column by ANALYZE. A zero value indicates that no statistics should be collected. A null value says to use the system default statistics target. The exact meaning of positive values is data type-dependent. For scalar data types, attstattarget is both the target number of “most common values” to collect, and the target number of histogram bins to create.
168	pub attstattarget: Option<u16>,
169	/// `aclitem[]`  Column-level access privileges, if any have been granted specifically on this column
170	pub attacl: Option<Vec<TableColumnAclItem>>,
171	/// `text[]`  Attribute-level options, as “keyword=value” strings
172	pub attoptions: Option<Vec<Str>>,
173	/// `text[]`  Attribute-level foreign data wrapper options, as “keyword=value” strings
174	pub attfdwoptions: Option<Vec<Str>>,
175	// attmissingval anyarray  This column has a one element array containing the value used when the column is entirely missing from the row, as happens when the column is added with a non-volatile DEFAULT value after the row is created. The value is only used when atthasmissing is true. If there is no value the column is null.
176	/// `text`  The comment from pg_description
177	pub description: Option<Str>,
178	/// `text`  The seclabel from pg_seclabel
179	pub seclabel: Option<Str>,
180	/// `text`  The provider from pg_seclabel
181	pub seclabel_provider: Option<Str>,
182	/// `aclitem[]`  The initial access privileges from pg_init_privs.
183	pub initprivs: Option<Vec<TableColumnAclItem>>,
184	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
185	pub initprivs_type: Option<PgAttributeInitprivsType>,
186}
187
188pg_char_enum!(PgAttributeAttcompression { 'p' => PGLZ, 'l'=> LZ4 });
189pg_char_enum!(PgAttributeAttidentity { 'a' => GeneratedAlways, 'd' => GenertedByDefault });
190pg_char_enum!(PgAttributeAttgenerated { 's' => Stored });
191pg_char_enum!(PgAttributeInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
192
193
194/// The DDL-only contents of [`pg_roles`](https://www.postgresql.org/docs/17/view-pg-roles.html)
195#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
196pub struct PgRoles {
197	/// `name`  Role name
198	pub rolname: Str,
199	/// `bool`  Role has superuser privileges
200	pub rolsuper: bool,
201	/// `bool`  Role automatically inherits privileges of roles it is a member of
202	pub rolinherit: bool,
203	/// `bool`  Role can create more roles
204	pub rolcreaterole: bool,
205	/// `bool`  Role can create databases
206	pub rolcreatedb: bool,
207	/// `bool`  Role can log in. That is, this role can be given as the initial session authorization identifier
208	pub rolcanlogin: bool,
209	/// `bool`  Role is a replication role. A replication role can initiate replication connections and create and drop replication slots.
210	pub rolreplication: bool,
211	/// `int4`  For roles that can log in, this sets maximum number of concurrent connections this role can make. -1 means no limit.
212	pub rolconnlimit: Option<u32>,
213	// rolpassword text  Not the password (always reads as ********)
214	/// `timestamptz`  Password expiry time (only used for password authentication); null if no expiration
215	pub rolvaliduntil: Option<chrono::DateTime<chrono::FixedOffset>>,
216	/// `bool`  Role bypasses every row-level security policy, see Section 5.9 for more information.
217	pub rolbypassrls: bool,
218	/// `text[]`  Role-specific defaults for run-time configuration variables
219	pub rolconfig: Option<Vec<Str>>,
220	// oid oid (references pg_authid.oid) ID of role
221	/// `text`  The comment from pg_shdescription
222	pub description: Option<Str>,
223	/// `text`  The seclabel from pg_shseclabel
224	pub seclabel: Option<Str>,
225	/// `text`  The provider from pg_shseclabel
226	pub seclabel_provider: Option<Str>,
227}
228impl_hash_and_equivalent!(PgRoles, rolname);
229
230
231/// The DDL-only contents of [`pg_auth_members`](https://www.postgresql.org/docs/17/catalog-pg-auth-members.html)
232#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
233pub struct PgAuthMembers {
234	// oid oid  Row identifier
235	/// `oid` `(references pg_authid.oid)` ID of a role that has a member
236	pub roleid: Str,
237	/// `oid` `(references pg_authid.oid)` ID of a role that is a member of roleid
238	pub member: Str,
239	/// `oid` `(references pg_authid.oid)` ID of the role that granted this membership
240	pub grantor: Str,
241	/// `bool`  True if member can grant membership in roleid to others
242	pub admin_option: bool,
243	/// `bool`  True if the member automatically inherits the privileges of the granted role
244	pub inherit_option: bool,
245	/// `bool`  True if the member can SET ROLE to the granted role
246	pub set_option: bool,
247}
248
249
250/// The DDL-only contents of [`pg_cast`](https://www.postgresql.org/docs/17/catalog-pg-cast.html)
251#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
252pub struct PgCast {
253	// oid oid  Row identifier
254	/// `oid` `(references pg_type.oid)` OID of the source data type
255	pub castsource: Str,
256	/// `oid` `(references pg_type.oid)` OID of the target data type
257	pub casttarget: Str,
258	/// `oid` `(references pg_proc.oid)` The OID of the function to use to perform this cast. Zero is stored if the cast method doesn't require a function.
259	pub castfunc: Option<Str>,
260	/// `char`  Indicates what contexts the cast can be invoked in. e means only as an explicit cast (using CAST or :: syntax). a means implicitly in assignment to a target column, as well as explicitly. i means implicitly in expressions, as well as the other cases.
261	pub castcontext: PgCastCastcontext,
262	/// `char`  Indicates how the cast is performed. f means that the function specified in the castfunc field is used. i means that the input/output functions are used. b means that the types are binary-coercible, thus no conversion is required.
263	pub castmethod: PgCastCastmethod,
264	/// `text`  The comment from pg_description
265	pub description: Option<Str>,
266}
267
268pg_char_enum!(PgCastCastcontext { 'e' => Explicit, 'a' => ImplicitAssignment, 'i' => Implicit });
269pg_char_enum!(PgCastCastmethod { 'f' => Castfunc, 'i' => IOFunc, 'b' => BinaryCoercible });
270
271
272/// The DDL-only contents of [`pg_class`](https://www.postgresql.org/docs/17/catalog-pg-class.html)
273#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
274pub struct PgClass {
275	/// `oid`  Row identifier
276	pub oid: Str,
277	/// `name`  Name of the table, index, view, etc.
278	pub relname: Str,
279	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this relation
280	pub relnamespace: Str,
281	/// `oid` `(references pg_type.oid)` The OID of the data type that corresponds to this table's row type, if any; zero for indexes, sequences, and toast tables, which have no pg_type entry
282	pub reltype: Option<Str>,
283	/// `oid` `(references pg_type.oid)` For typed tables, the OID of the underlying composite type; zero for all other relations
284	pub reloftype: Option<Str>,
285	/// `oid` `(references pg_authid.oid)` Owner of the relation
286	pub relowner: Str,
287	/// `oid` `(references pg_am.oid)` The access method used to access this table or index. Not meaningful if the relation is a sequence or has no on-disk file, except for partitioned tables, where, if set, it takes precedence over default_table_access_method when determining the access method to use for partitions created when one is not specified in the creation command.
288	pub relam: Option<Str>,
289	// relfilenode oid  Name of the on-disk file of this relation; zero means this is a “mapped” relation whose disk file name is determined by low-level state
290	// reltablespace oid (references pg_tablespace.oid) The tablespace in which this relation is stored. If zero, the database's default tablespace is implied. Not meaningful if the relation has no on-disk file, except for partitioned tables, where this is the tablespace in which partitions will be created when one is not specified in the creation command.
291	// relpages int4  Size of the on-disk representation of this table in pages (of size BLCKSZ). This is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and a few DDL commands such as CREATE INDEX.
292	// reltuples float4  Number of live rows in the table. This is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and a few DDL commands such as CREATE INDEX. If the table has never yet been vacuumed or analyzed, reltuples contains -1 indicating that the row count is unknown.
293	// relallvisible int4  Number of pages that are marked all-visible in the table's visibility map. This is only an estimate used by the planner. It is updated by VACUUM, ANALYZE, and a few DDL commands such as CREATE INDEX.
294	// reltoastrelid oid (references pg_class.oid) OID of the TOAST table associated with this table, zero if none. The TOAST table stores large attributes “out of line” in a secondary table.
295	// relhasindex bool  True if this is a table and it has (or recently had) any indexes
296	/// `bool`  True if this table is shared across all databases in the cluster. Only certain system catalogs (such as pg_database) are shared.
297	pub relisshared: bool,
298	/// `char`  p = permanent table/sequence, u = unlogged table/sequence, t = temporary table/sequence
299	pub relpersistence: PgClassRelpersistence,
300	/// `char`  r = ordinary table, i = index, S = sequence, t = TOAST table, v = view, m = materialized view, c = composite type, f = foreign table, p = partitioned table, I = partitioned index
301	pub relkind: PgClassRelkind,
302	/// `int2`  Number of user columns in the relation (system columns not counted). There must be this many corresponding entries in pg_attribute. See also pg_attribute.attnum.
303	pub relnatts: u16,
304	/// `int2`  Number of CHECK constraints on the table; see pg_constraint catalog
305	pub relchecks: u16,
306	// relhasrules bool  True if table has (or once had) rules; see pg_rewrite catalog
307	// relhastriggers bool  True if table has (or once had) triggers; see pg_trigger catalog
308	// relhassubclass bool  True if table or index has (or once had) any inheritance children or partitions
309	/// `bool`  True if table has row-level security enabled; see pg_policy catalog
310	pub relrowsecurity: bool,
311	/// `bool`  True if row-level security (when enabled) will also apply to table owner; see pg_policy catalog
312	pub relforcerowsecurity: bool,
313	// relispopulated bool  True if relation is populated (this is true for all relations other than some materialized views)
314	/// `char`  Columns used to form “replica identity” for rows: d = default (primary key, if any), n = nothing, f = all columns, i = index with indisreplident set (same as nothing if the index used has been dropped)
315	pub relreplident: PgClassRelreplident,
316	/// `bool`  True if table or index is a partition
317	pub relispartition: bool,
318	// relrewrite oid (references pg_class.oid) For new relations being written during a DDL operation that requires a table rewrite, this contains the OID of the original relation; otherwise zero. That state is only visible internally; this field should never contain anything other than zero for a user-visible relation.
319	// relfrozenxid xid  All transaction IDs before this one have been replaced with a permanent (“frozen”) transaction ID in this table. This is used to track whether the table needs to be vacuumed in order to prevent transaction ID wraparound or to allow pg_xact to be shrunk. Zero (InvalidTransactionId) if the relation is not a table.
320	// relminmxid xid  All multixact IDs before this one have been replaced by a transaction ID in this table. This is used to track whether the table needs to be vacuumed in order to prevent multixact ID wraparound or to allow pg_multixact to be shrunk. Zero (InvalidMultiXactId) if the relation is not a table.
321	/// `aclitem[]`  Access privileges; see Section 5.8 for details
322	pub relacl: Option<Vec<TableAclItem>>,
323	/// `text[]`  Access-method-specific options, as “keyword=value” strings
324	pub reloptions: Option<Vec<Str>>,
325	/// `pg_node_tree`  If table is a partition (see relispartition), internal representation of the partition bound
326	pub relpartbound: Option<Str>,
327	/// `text`  The comment from pg_description
328	pub description: Option<Str>,
329	/// `text`  The seclabel from pg_seclabel
330	pub seclabel: Option<Str>,
331	/// `text`  The provider from pg_seclabel
332	pub seclabel_provider: Option<Str>,
333	/// `aclitem[]`  The initial access privileges from pg_init_privs.
334	pub initprivs: Option<Vec<TableAclItem>>,
335	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
336	pub initprivs_type: Option<PgClassInitprivsType>,
337}
338impl_hash_and_equivalent!(PgClass, oid);
339
340pg_char_enum!(PgClassRelpersistence { 'p' => Permanent, 'u' => Unlogged, 't' => Temporary });
341pg_char_enum!(PgClassRelkind { 'r' => Ordinary, 'i' => Index, 'S' => Sequence, 't' => Toast, 'v' => View, 'm' => MaterializedView, 'c' => CompositeType, 'f' => ForeignTable, 'p' => PartitionedTable, 'I' => PartitionedIndex });
342pg_char_enum!(PgClassRelreplident { 'd' => Default, 'n' => Nothing, 'f' => AllColumns, 'i' => Index  });
343pg_char_enum!(PgClassInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
344
345
346/// The DDL-only contents of [`pg_collation`](https://www.postgresql.org/docs/17/catalog-pg-collation.html)
347#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
348pub struct PgCollation {
349	/// `oid`  Row identifier
350	pub oid: Str,
351	/// `name`  Collation name (unique per namespace and encoding)
352	pub collname: Str,
353	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this collation
354	pub collnamespace: Str,
355	/// `oid` `(references pg_authid.oid)` Owner of the collation
356	pub collowner: Str,
357	/// `char`  Provider of the collation: d = database default, b = builtin, c = libc, i = icu
358	pub collprovider: PgCollationCollprovider,
359	/// `bool`  Is the collation deterministic?
360	pub collisdeterministic: bool,
361	/// `int4`  Encoding in which the collation is applicable, or -1 if it works for any encoding
362	pub collencoding: Option<Str>,
363	/// `text`  LC_COLLATE for this collation object. If the provider is not libc, collcollate is NULL and colllocale is used instead.
364	pub collcollate: Option<Str>,
365	/// `text`  LC_CTYPE for this collation object. If the provider is not libc, collctype is NULL and colllocale is used instead.
366	pub collctype: Option<Str>,
367	/// `text`  Collation provider locale name for this collation object. If the provider is libc, colllocale is NULL; collcollate and collctype are used instead.
368	pub colllocale: Option<Str>,
369	/// `text`  ICU collation rules for this collation object
370	pub collicurules: Option<Str>,
371	// collversion text  Provider-specific version of the collation. This is recorded when the collation is created and then checked when it is used, to detect changes in the collation definition that could lead to data corruption.
372	/// `text`  The comment from pg_description
373	pub description: Option<Str>,
374}
375
376pg_char_enum!(PgCollationCollprovider { 'd' => DatabaseDefault, 'b' => Builtin, 'c' => Libc, 'i' => Icu });
377
378
379/// The DDL-only contents of [`pg_constraint`](https://www.postgresql.org/docs/17/catalog-pg-constraint.html)
380#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
381pub struct PgConstraint {
382	// oid oid  Row identifier
383	/// `name`  Constraint name (not necessarily unique!)
384	pub conname: Str,
385	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this constraint
386	pub connamespace: Str,
387	/// `char`  c = check constraint, f = foreign key constraint, n = not-null constraint (domains only), p = primary key constraint, u = unique constraint, t = constraint trigger, x = exclusion constraint
388	pub contype: PgConstraintContype,
389	/// `bool`  Is the constraint deferrable?
390	pub condeferrable: bool,
391	/// `bool`  Is the constraint deferred by default?
392	pub condeferred: bool,
393	/// `bool`  Has the constraint been validated? Currently, can be false only for foreign keys and CHECK constraints
394	pub convalidated: bool,
395	/// `oid` `(references pg_class.oid)` The table this constraint is on; zero if not a table constraint
396	pub conrelid: Option<Str>,
397	/// `oid` `(references pg_type.oid)` The domain this constraint is on; zero if not a domain constraint
398	pub contypid: Option<Str>,
399	/// `oid` `(references pg_class.oid)` The index supporting this constraint, if it's a unique, primary key, foreign key, or exclusion constraint; else zero
400	pub conindid: Option<Str>,
401	/// `oid` `(references pg_constraint.oid)` The corresponding constraint of the parent partitioned table, if this is a constraint on a partition; else zero
402	pub conparentid: Option<Str>,
403	/// `oid` `(references pg_class.oid)` If a foreign key, the referenced table; else zero
404	pub confrelid: Option<Str>,
405	/// `char`  Foreign key update action code: a = no action, r = restrict, c = cascade, n = set null, d = set default
406	pub confupdtype: Option<PgConstraintConfupdtype>,
407	/// `char`  Foreign key deletion action code: a = no action, r = restrict, c = cascade, n = set null, d = set default
408	pub confdeltype: Option<PgConstraintConfdeltype>,
409	/// `char`  Foreign key match type: f = full, p = partial, s = simple
410	pub confmatchtype: Option<PgConstraintConfmatchtype>,
411	/// `bool`  This constraint is defined locally for the relation. Note that a constraint can be locally defined and inherited simultaneously.
412	pub conislocal: bool,
413	/// `int2`  The number of direct inheritance ancestors this constraint has. A constraint with a nonzero number of ancestors cannot be dropped nor renamed.
414	pub coninhcount: u16,
415	/// `bool`  This constraint is defined locally for the relation. It is a non-inheritable constraint.
416	pub connoinherit: bool,
417	/// `int2[]` `(references pg_attribute.attnum)` If a table constraint (including foreign keys, but not constraint triggers), list of the constrained columns
418	pub conkey: Option<Vec<u16>>,
419	/// `int2[]` `(references pg_attribute.attnum)` If a foreign key, list of the referenced columns
420	pub confkey: Option<Vec<u16>>,
421	/// `oid[]` `(references pg_operator.oid)` If a foreign key, list of the equality operators for PK = FK comparisons
422	pub conpfeqop: Option<Vec<Str>>,
423	/// `oid[]` `(references pg_operator.oid)` If a foreign key, list of the equality operators for PK = PK comparisons
424	pub conppeqop: Option<Vec<Str>>,
425	/// `oid[]` `(references pg_operator.oid)` If a foreign key, list of the equality operators for FK = FK comparisons
426	pub conffeqop: Option<Vec<Str>>,
427	/// `int2[]` `(references pg_attribute.attnum)` If a foreign key with a SET NULL or SET DEFAULT delete action, the columns that will be updated. If null, all of the referencing columns will be updated.
428	pub confdelsetcols: Option<Vec<u16>>,
429	/// `oid[]` `(references pg_operator.oid)` If an exclusion constraint, list of the per-column exclusion operators
430	pub conexclop: Option<Vec<Str>>,
431	/// `pg_node_tree`  If a check constraint, an internal representation of the expression. (It's recommended to use pg_get_constraintdef() to extract the definition of a check constraint.)
432	pub conbin: Option<Str>,
433	/// `text`  The comment from pg_description
434	pub description: Option<Str>,
435}
436
437pg_char_enum!(PgConstraintContype { 'c' => Check, 'f' => ForeignKey, 'n' => DomainNotNull, 'p' => PrimaryKey, 'u' => Unique, 't' => Trigger, 'x' => Exclusion });
438pg_char_enum!(PgConstraintConfupdtype { 'a' => NoAction, 'r' => Restrict, 'c' => Cascade, 'n' => SetNull, 'd' => SetDefault });
439pg_char_enum!(PgConstraintConfdeltype { 'a' => NoAction, 'r' => Restrict, 'c' => Cascade, 'n' => SetNull, 'd' => SetDefault });
440pg_char_enum!(PgConstraintConfmatchtype { 'f' => Full, 'p' => Partial, 's' => Simple });
441
442
443/// The DDL-only contents of [`pg_conversion`](https://www.postgresql.org/docs/17/catalog-pg-conversion.html)
444#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
445pub struct PgConversion {
446	// oid oid  Row identifier
447	/// `name`  Conversion name (unique within a namespace)
448	pub conname: Str,
449	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this conversion
450	pub connamespace: Str,
451	/// `oid` `(references pg_authid.oid)` Owner of the conversion
452	pub conowner: Str,
453	/// `int4`  Source encoding ID (pg_encoding_to_char() can translate this number to the encoding name)
454	pub conforencoding: Str,
455	/// `int4`  Destination encoding ID (pg_encoding_to_char() can translate this number to the encoding name)
456	pub contoencoding: Str,
457	/// `regproc` `(references pg_proc.oid)` Conversion function
458	pub conproc: Str,
459	/// `bool`  True if this is the default conversion
460	pub condefault: bool,
461	/// `text`  The comment from pg_description
462	pub description: Option<Str>,
463}
464
465
466/// The DDL-only contents of [`pg_database`](https://www.postgresql.org/docs/17/catalog-pg-database.html)
467#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
468pub struct PgDatabase {
469	// oid oid  Row identifier
470	/// `name`  Database name
471	pub datname: Str,
472	/// `oid` `(references pg_authid.oid)` Owner of the database, usually the user who created it
473	pub datdba: Str,
474	/// `int4`  Character encoding for this database (pg_encoding_to_char() can translate this number to the encoding name)
475	pub encoding: Str,
476	/// `char`  Locale provider for this database: b = builtin, c = libc, i = icu
477	pub datlocprovider: PgDatabaseDatlocprovider,
478	/// `bool`  If true, then this database can be cloned by any user with CREATEDB privileges; if false, then only superusers or the owner of the database can clone it.
479	pub datistemplate: bool,
480	/// `bool`  If false then no one can connect to this database. This is used to protect the template0 database from being altered.
481	pub datallowconn: bool,
482	// dathasloginevt bool  Indicates that there are login event triggers defined for this database. This flag is used to avoid extra lookups on the pg_event_trigger table during each backend startup. This flag is used internally by PostgreSQL and should not be manually altered or read for monitoring purposes.
483	/// `int4`  Sets maximum number of concurrent connections that can be made to this database. -1 means no limit, -2 indicates the database is invalid.
484	pub datconnlimit: Option<u32>,
485	// datfrozenxid xid  All transaction IDs before this one have been replaced with a permanent (“frozen”) transaction ID in this database. This is used to track whether the database needs to be vacuumed in order to prevent transaction ID wraparound or to allow pg_xact to be shrunk. It is the minimum of the per-table pg_class.relfrozenxid values.
486	// datminmxid xid  All multixact IDs before this one have been replaced with a transaction ID in this database. This is used to track whether the database needs to be vacuumed in order to prevent multixact ID wraparound or to allow pg_multixact to be shrunk. It is the minimum of the per-table pg_class.relminmxid values.
487	// dattablespace oid (references pg_tablespace.oid) The default tablespace for the database. Within this database, all tables for which pg_class.reltablespace is zero will be stored in this tablespace; in particular, all the non-shared system catalogs will be there.
488	/// `text`  LC_COLLATE for this database
489	pub datcollate: Option<Str>,
490	/// `text`  LC_CTYPE for this database
491	pub datctype: Option<Str>,
492	/// `text`  Collation provider locale name for this database. If the provider is libc, datlocale is NULL; datcollate and datctype are used instead.
493	pub datlocale: Option<Str>,
494	/// `text`  ICU collation rules for this database
495	pub daticurules: Option<Str>,
496	// datcollversion text  Provider-specific version of the collation. This is recorded when the database is created and then checked when it is used, to detect changes in the collation definition that could lead to data corruption.
497	/// `aclitem[]`  Access privileges; see Section 5.8 for details
498	pub datacl: Option<Vec<DbAclItem>>,
499	/// `text`  The comment from pg_shdescription
500	pub description: Option<Str>,
501	/// `text`  The seclabel from pg_shseclabel
502	pub seclabel: Option<Str>,
503	/// `text`  The provider from pg_shseclabel
504	pub seclabel_provider: Option<Str>,
505}
506impl_hash_and_equivalent!(PgDatabase, datname);
507
508pg_char_enum!(PgDatabaseDatlocprovider { 'b' => Builtin, 'c' => Libc, 'i' => Icu });
509
510
511/// The DDL-only contents of [`pg_default_acl`](https://www.postgresql.org/docs/17/catalog-pg-default-acl.html)
512#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
513pub struct PgDefaultAcl {
514	// oid oid  Row identifier
515	/// `oid` `(references pg_authid.oid)` The OID of the role associated with this entry
516	pub defaclrole: Str,
517	/// `oid` `(references pg_namespace.oid)` The OID of the namespace associated with this entry, or zero if none
518	pub defaclnamespace: Option<Str>,
519	/// `char`  Type of object this entry is for: r = relation (table, view), S = sequence, f = function, T = type, n = schema
520	pub defaclobjtype: PgDefaultAclDefaclobjtype,
521	/// `aclitem[]`  Access privileges that this type of object should have on creation
522	pub defaclacl: Option<Vec<AclDefaultAclItem>>,
523}
524
525pg_char_enum!(PgDefaultAclDefaclobjtype { 'r' => Relation, 'S' => Sequence, 'f' => Function, 'T' => Type, 'n' => Schema });
526
527
528/// The DDL-only contents of [`pg_event_trigger`](https://www.postgresql.org/docs/17/catalog-pg-event-trigger.html)
529#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
530pub struct PgEventTrigger {
531	// oid oid  Row identifier
532	/// `name`  Trigger name (must be unique)
533	pub evtname: Str,
534	/// `name`  Identifies the event for which this trigger fires
535	pub evtevent: Str,
536	/// `oid` `(references pg_authid.oid)` Owner of the event trigger
537	pub evtowner: Str,
538	/// `oid` `(references pg_proc.oid)` The function to be called
539	pub evtfoid: Str,
540	/// `char`  Controls in which session_replication_role modes the event trigger fires. O = trigger fires in “origin” and “local” modes, D = trigger is disabled, R = trigger fires in “replica” mode, A = trigger fires always.
541	pub evtenabled: PgEventTriggerEvtenabled,
542	/// `text[]`  Command tags for which this trigger will fire. If NULL, the firing of this trigger is not restricted on the basis of the command tag.
543	pub evttags: Option<Vec<Str>>,
544	/// `text`  The comment from pg_description
545	pub description: Option<Str>,
546	/// `text`  The seclabel from pg_seclabel
547	pub seclabel: Option<Str>,
548	/// `text`  The provider from pg_seclabel
549	pub seclabel_provider: Option<Str>,
550}
551
552pg_char_enum!(PgEventTriggerEvtenabled { 'O' => OriginLocal, 'D' => Disabled, 'R' => Replica, 'A' => Always });
553
554
555/// The DDL-only contents of [`pg_extension`](https://www.postgresql.org/docs/17/catalog-pg-extension.html)
556#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
557pub struct PgExtension {
558	// oid oid  Row identifier
559	/// `name`  Name of the extension
560	pub extname: Str,
561	/// `oid` `(references pg_authid.oid)` Owner of the extension
562	pub extowner: Str,
563	/// `oid` `(references pg_namespace.oid)` Schema containing the extension's exported objects
564	pub extnamespace: Str,
565	/// `bool`  True if extension can be relocated to another schema
566	pub extrelocatable: bool,
567	/// `text`  Version name for the extension
568	pub extversion: Str,
569	/// `oid[]` `(references pg_class.oid)` Array of regclass OIDs for the extension's configuration table(s), or NULL if none
570	pub extconfig: Option<Vec<Str>>,
571	/// `text[]`  Array of WHERE-clause filter conditions for the extension's configuration table(s), or NULL if none
572	pub extcondition: Option<Vec<Str>>,
573	/// `text`  The comment from pg_description
574	pub description: Option<Str>,
575}
576
577
578/// The DDL-only contents of [`pg_foreign_data_wrapper`](https://www.postgresql.org/docs/17/catalog-pg-foreign-data-wrapper.html)
579#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
580pub struct PgForeignDataWrapper {
581	// oid oid  Row identifier
582	/// `name`  Name of the foreign-data wrapper
583	pub fdwname: Str,
584	/// `oid` `(references pg_authid.oid)` Owner of the foreign-data wrapper
585	pub fdwowner: Str,
586	/// `oid` `(references pg_proc.oid)` References a handler function that is responsible for supplying execution routines for the foreign-data wrapper. Zero if no handler is provided
587	pub fdwhandler: Option<Str>,
588	/// `oid` `(references pg_proc.oid)` References a validator function that is responsible for checking the validity of the options given to the foreign-data wrapper, as well as options for foreign servers and user mappings using the foreign-data wrapper. Zero if no validator is provided
589	pub fdwvalidator: Option<Str>,
590	/// `aclitem[]`  Access privileges; see Section 5.8 for details
591	pub fdwacl: Option<Vec<ForeignDataWrapperAclItem>>,
592	/// `text[]`  Foreign-data wrapper specific options, as “keyword=value” strings
593	pub fdwoptions: Option<Vec<Str>>,
594	/// `text`  The comment from pg_description
595	pub description: Option<Str>,
596	/// `aclitem[]`  The initial access privileges from pg_init_privs.
597	pub initprivs: Option<Vec<ForeignDataWrapperAclItem>>,
598	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
599	pub initprivs_type: Option<PgForeignDataWrapperInitprivsType>,
600}
601
602pg_char_enum!(PgForeignDataWrapperInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
603
604
605/// The DDL-only contents of [`pg_foreign_server`](https://www.postgresql.org/docs/17/catalog-pg-foreign-server.html)
606#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
607pub struct PgForeignServer {
608	// oid oid  Row identifier
609	/// `name`  Name of the foreign server
610	pub srvname: Str,
611	/// `oid` `(references pg_authid.oid)` Owner of the foreign server
612	pub srvowner: Str,
613	/// `oid` `(references pg_foreign_data_wrapper.oid)` OID of the foreign-data wrapper of this foreign server
614	pub srvfdw: Str,
615	/// `text`  Type of the server (optional)
616	pub srvtype: Option<Str>,
617	/// `text`  Version of the server (optional)
618	pub srvversion: Option<Str>,
619	/// `aclitem[]`  Access privileges; see Section 5.8 for details
620	pub srvacl: Option<Vec<ForeignServerAclItem>>,
621	/// `text[]`  Foreign server specific options, as “keyword=value” strings
622	pub srvoptions: Option<Vec<Str>>,
623	/// `text`  The comment from pg_description
624	pub description: Option<Str>,
625	/// `aclitem[]`  The initial access privileges from pg_init_privs.
626	pub initprivs: Option<Vec<ForeignServerAclItem>>,
627	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
628	pub initprivs_type: Option<PgForeignServerInitprivsType>,
629}
630
631pg_char_enum!(PgForeignServerInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
632
633
634/// The DDL-only contents of [`pg_foreign_table`](https://www.postgresql.org/docs/17/catalog-pg-foreign-table.html)
635#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
636pub struct PgForeignTable {
637	/// `oid` `(references pg_class.oid)` The OID of the pg_class entry for this foreign table
638	pub ftrelid: Str,
639	/// `oid` `(references pg_foreign_server.oid)` OID of the foreign server for this foreign table
640	pub ftserver: Str,
641	/// `text[]`  Foreign table options, as “keyword=value” strings
642	pub ftoptions: Option<Vec<Str>>,
643}
644
645
646/// The DDL-only contents of [`pg_index`](https://www.postgresql.org/docs/17/catalog-pg-index.html)
647#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
648pub struct PgIndex {
649	/// `oid` `(references pg_class.oid)` The OID of the pg_class entry for this index
650	pub indexrelid: Str,
651	/// `oid` `(references pg_class.oid)` The OID of the pg_class entry for the table this index is for
652	pub indrelid: Str,
653	/// `int2`  The total number of columns in the index (duplicates pg_class.relnatts); this number includes both key and included attributes
654	pub indnatts: u16,
655	/// `int2`  The number of key columns in the index, not counting any included columns, which are merely stored and do not participate in the index semantics
656	pub indnkeyatts: u16,
657	/// `bool`  If true, this is a unique index
658	pub indisunique: bool,
659	/// `bool`  This value is only used for unique indexes. If false, this unique index will consider null values distinct (so the index can contain multiple null values in a column, the default PostgreSQL behavior). If it is true, it will consider null values to be equal (so the index can only contain one null value in a column).
660	pub indnullsnotdistinct: bool,
661	/// `bool`  If true, this index represents the primary key of the table (indisunique should always be true when this is true)
662	pub indisprimary: bool,
663	/// `bool`  If true, this index supports an exclusion constraint
664	pub indisexclusion: bool,
665	/// `bool`  If true, the uniqueness check is enforced immediately on insertion (irrelevant if indisunique is not true)
666	pub indimmediate: bool,
667	// indisclustered bool  If true, the table was last clustered on this index
668	// indisvalid bool  If true, the index is currently valid for queries. False means the index is possibly incomplete: it must still be modified by INSERT/UPDATE operations, but it cannot safely be used for queries. If it is unique, the uniqueness property is not guaranteed true either.
669	// indcheckxmin bool  If true, queries must not use the index until the xmin of this pg_index row is below their TransactionXmin event horizon, because the table may contain broken HOT chains with incompatible rows that they can see
670	// indisready bool  If true, the index is currently ready for inserts. False means the index must be ignored by INSERT/UPDATE operations.
671	// indislive bool  If false, the index is in process of being dropped, and should be ignored for all purposes (including HOT-safety decisions)
672	/// `bool`  If true this index has been chosen as “replica identity” using ALTER TABLE ... REPLICA IDENTITY USING INDEX ...
673	pub indisreplident: bool,
674	/// `int2vector` `(references pg_attribute.attnum)` This is an array of indnatts values that indicate which table columns this index indexes. For example, a value of 1 3 would mean that the first and the third table columns make up the index entries. Key columns come before non-key (included) columns. A zero in this array indicates that the corresponding index attribute is an expression over the table columns, rather than a simple column reference.
675	pub indkey: Vec<u16>,
676	/// `oidvector` `(references pg_collation.oid)` For each column in the index key (indnkeyatts values), this contains the OID of the collation to use for the index, or zero if the column is not of a collatable data type.
677	pub indcollation: Vec<Option<Str>>,
678	/// `oidvector` `(references pg_opclass.oid)` For each column in the index key (indnkeyatts values), this contains the OID of the operator class to use. See pg_opclass for details.
679	pub indclass: Vec<Str>,
680	/// `int2vector`  This is an array of indnkeyatts values that store per-column flag bits. The meaning of the bits is defined by the index's access method.
681	pub indoption: Vec<i16>,
682	/// `pg_node_tree`  Expression trees (in nodeToString() representation) for index attributes that are not simple column references. This is a list with one element for each zero entry in indkey. Null if all index attributes are simple references.
683	pub indexprs: Option<Str>,
684	/// `pg_node_tree`  Expression tree (in nodeToString() representation) for partial index predicate. Null if not a partial index.
685	pub indpred: Option<Str>,
686}
687
688
689/// The DDL-only contents of [`pg_inherits`](https://www.postgresql.org/docs/17/catalog-pg-inherits.html)
690#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
691pub struct PgInherits {
692	/// `oid` `(references pg_class.oid)` The OID of the child table or index
693	pub inhrelid: Str,
694	/// `oid` `(references pg_class.oid)` The OID of the parent table or index
695	pub inhparent: Str,
696	/// `int4`  If there is more than one direct parent for a child table (multiple inheritance), this number tells the order in which the inherited columns are to be arranged. The count starts at 1. Indexes cannot have multiple inheritance, since they can only inherit when using declarative partitioning.
697	pub inhseqno: u32,
698	// inhdetachpending bool  true for a partition that is in the process of being detached; false otherwise.
699}
700
701
702/// The DDL-only contents of [`pg_language`](https://www.postgresql.org/docs/17/catalog-pg-language.html)
703#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
704pub struct PgLanguage {
705	// oid oid  Row identifier
706	/// `name`  Name of the language
707	pub lanname: Str,
708	/// `oid` `(references pg_authid.oid)` Owner of the language
709	pub lanowner: Str,
710	/// `bool`  This is false for internal languages (such as SQL) and true for user-defined languages. Currently, pg_dump still uses this to determine which languages need to be dumped, but this might be replaced by a different mechanism in the future.
711	pub lanispl: bool,
712	/// `bool`  True if this is a trusted language, which means that it is believed not to grant access to anything outside the normal SQL execution environment. Only superusers can create functions in untrusted languages.
713	pub lanpltrusted: bool,
714	/// `oid` `(references pg_proc.oid)` For noninternal languages this references the language handler, which is a special function that is responsible for executing all functions that are written in the particular language. Zero for internal languages.
715	pub lanplcallfoid: Option<Str>,
716	/// `oid` `(references pg_proc.oid)` This references a function that is responsible for executing “inline” anonymous code blocks (DO blocks). Zero if inline blocks are not supported.
717	pub laninline: Option<Str>,
718	/// `oid` `(references pg_proc.oid)` This references a language validator function that is responsible for checking the syntax and validity of new functions when they are created. Zero if no validator is provided.
719	pub lanvalidator: Option<Str>,
720	/// `aclitem[]`  Access privileges; see Section 5.8 for details
721	pub lanacl: Option<Vec<LanguageAclItem>>,
722	/// `text`  The comment from pg_description
723	pub description: Option<Str>,
724	/// `text`  The seclabel from pg_seclabel
725	pub seclabel: Option<Str>,
726	/// `text`  The provider from pg_seclabel
727	pub seclabel_provider: Option<Str>,
728	/// `aclitem[]`  The initial access privileges from pg_init_privs.
729	pub initprivs: Option<Vec<LanguageAclItem>>,
730	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
731	pub initprivs_type: Option<PgLanguageInitprivsType>,
732}
733impl_hash_and_equivalent!(PgLanguage, lanname);
734
735pg_char_enum!(PgLanguageInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
736
737
738/// The DDL-only contents of [`pg_namespace`](https://www.postgresql.org/docs/17/catalog-pg-namespace.html)
739#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
740pub struct PgNamespace {
741	// oid oid  Row identifier
742	/// `name`  Name of the namespace
743	pub nspname: Str,
744	/// `oid` `(references pg_authid.oid)` Owner of the namespace
745	pub nspowner: Str,
746	/// `aclitem[]`  Access privileges; see Section 5.8 for details
747	pub nspacl: Option<Vec<SchemaAclItem>>,
748	/// `text`  The comment from pg_description
749	pub description: Option<Str>,
750	/// `text`  The seclabel from pg_seclabel
751	pub seclabel: Option<Str>,
752	/// `text`  The provider from pg_seclabel
753	pub seclabel_provider: Option<Str>,
754	/// `aclitem[]`  The initial access privileges from pg_init_privs.
755	pub initprivs: Option<Vec<SchemaAclItem>>,
756	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
757	pub initprivs_type: Option<PgNamespaceInitprivsType>,
758}
759impl_hash_and_equivalent!(PgNamespace, nspname);
760
761pg_char_enum!(PgNamespaceInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
762
763
764/// The DDL-only contents of [`pg_opclass`](https://www.postgresql.org/docs/17/catalog-pg-opclass.html)
765#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
766pub struct PgOpclass {
767	// oid oid  Row identifier
768	/// `oid` `(references pg_am.oid)` Index access method operator class is for
769	pub opcmethod: Str,
770	/// `name`  Name of this operator class
771	pub opcname: Str,
772	/// `oid` `(references pg_namespace.oid)` Namespace of this operator class
773	pub opcnamespace: Str,
774	/// `oid` `(references pg_authid.oid)` Owner of the operator class
775	pub opcowner: Str,
776	/// `oid` `(references pg_opfamily.oid)` Operator family containing the operator class
777	pub opcfamily: Str,
778	/// `oid` `(references pg_type.oid)` Data type that the operator class indexes
779	pub opcintype: Str,
780	/// `bool`  True if this operator class is the default for opcintype
781	pub opcdefault: bool,
782	/// `oid` `(references pg_type.oid)` Type of data stored in index, or zero if same as opcintype
783	pub opckeytype: Option<Str>,
784	/// `text`  The comment from pg_description
785	pub description: Option<Str>,
786}
787
788
789/// The DDL-only contents of [`pg_operator`](https://www.postgresql.org/docs/17/catalog-pg-operator.html)
790#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
791pub struct PgOperator {
792	/// `oid`  Row identifier
793	pub oid: Str,
794	/// `name`  Name of the operator
795	pub oprname: Str,
796	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this operator
797	pub oprnamespace: Str,
798	/// `oid` `(references pg_authid.oid)` Owner of the operator
799	pub oprowner: Str,
800	/// `char`  b = infix operator (“both”), or l = prefix operator (“left”)
801	pub oprkind: PgOperatorOprkind,
802	/// `bool`  This operator supports merge joins
803	pub oprcanmerge: bool,
804	/// `bool`  This operator supports hash joins
805	pub oprcanhash: bool,
806	/// `oid` `(references pg_type.oid)` Type of the left operand (zero for a prefix operator)
807	pub oprleft: Option<Str>,
808	/// `oid` `(references pg_type.oid)` Type of the right operand
809	pub oprright: Str,
810	/// `oid` `(references pg_type.oid)` Type of the result (zero for a not-yet-defined “shell” operator)
811	pub oprresult: Option<Str>,
812	/// `oid` `(references pg_operator.oid)` Commutator of this operator (zero if none)
813	pub oprcom: Option<Str>,
814	/// `oid` `(references pg_operator.oid)` Negator of this operator (zero if none)
815	pub oprnegate: Option<Str>,
816	/// `regproc` `(references pg_proc.oid)` Function that implements this operator (zero for a not-yet-defined “shell” operator)
817	pub oprcode: Option<Str>,
818	/// `regproc` `(references pg_proc.oid)` Restriction selectivity estimation function for this operator (zero if none)
819	pub oprrest: Option<Str>,
820	/// `regproc` `(references pg_proc.oid)` Join selectivity estimation function for this operator (zero if none)
821	pub oprjoin: Option<Str>,
822	/// `text`  The comment from pg_description
823	pub description: Option<Str>,
824}
825impl_hash_and_equivalent!(PgOperator, oid);
826
827pg_char_enum!(PgOperatorOprkind { 'b' => InfixOperatorBoth, 'l' => PrefixOperatorLeft });
828
829
830/// The DDL-only contents of [`pg_opfamily`](https://www.postgresql.org/docs/17/catalog-pg-opfamily.html)
831#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
832pub struct PgOpfamily {
833	// oid oid  Row identifier
834	/// `oid` `(references pg_am.oid)` Index access method operator family is for
835	pub opfmethod: Str,
836	/// `name`  Name of this operator family
837	pub opfname: Str,
838	/// `oid` `(references pg_namespace.oid)` Namespace of this operator family
839	pub opfnamespace: Str,
840	/// `oid` `(references pg_authid.oid)` Owner of the operator family
841	pub opfowner: Str,
842	/// `text`  The comment from pg_description
843	pub description: Option<Str>,
844}
845
846
847/// The DDL-only contents of [`pg_parameter_acl`](https://www.postgresql.org/docs/17/catalog-pg-parameter-acl.html)
848#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
849pub struct PgParameterAcl {
850	// oid oid  Row identifier
851	/// `text`  The name of a configuration parameter for which privileges are granted
852	pub parname: Str,
853	/// `aclitem[]`  Access privileges; see Section 5.8 for details
854	pub paracl: Option<Vec<ParameterAclItem>>,
855	/// `aclitem[]`  The initial access privileges from pg_init_privs.
856	pub initprivs: Option<Vec<ParameterAclItem>>,
857	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
858	pub initprivs_type: Option<PgParameterAclInitprivsType>,
859}
860
861pg_char_enum!(PgParameterAclInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
862
863
864/// The DDL-only contents of [`pg_partitioned_table`](https://www.postgresql.org/docs/17/catalog-pg-partitioned-table.html)
865#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
866pub struct PgPartitionedTable {
867	/// `oid` `(references pg_class.oid)` The OID of the pg_class entry for this partitioned table
868	pub partrelid: Str,
869	/// `char`  Partitioning strategy; h = hash partitioned table, l = list partitioned table, r = range partitioned table
870	pub partstrat: PgPartitionedTablePartstrat,
871	/// `int2`  The number of columns in the partition key
872	pub partnatts: u16,
873	/// `oid` `(references pg_class.oid)` The OID of the pg_class entry for the default partition of this partitioned table, or zero if this partitioned table does not have a default partition
874	pub partdefid: Option<Str>,
875	/// `int2vector` `(references pg_attribute.attnum)` This is an array of partnatts values that indicate which table columns are part of the partition key. For example, a value of 1 3 would mean that the first and the third table columns make up the partition key. A zero in this array indicates that the corresponding partition key column is an expression, rather than a simple column reference.
876	pub partattrs: Vec<u16>,
877	/// `oidvector` `(references pg_opclass.oid)` For each column in the partition key, this contains the OID of the operator class to use. See pg_opclass for details.
878	pub partclass: Vec<Str>,
879	/// `oidvector` `(references pg_collation.oid)` For each column in the partition key, this contains the OID of the collation to use for partitioning, or zero if the column is not of a collatable data type.
880	pub partcollation: Vec<Option<Str>>,
881	/// `pg_node_tree`  Expression trees (in nodeToString() representation) for partition key columns that are not simple column references. This is a list with one element for each zero entry in partattrs. Null if all partition key columns are simple references.
882	pub partexprs: Option<Str>,
883}
884
885pg_char_enum!(PgPartitionedTablePartstrat { 'h' => HashPartitionedTable, 'l' => ListPartitionedTable, 'r' => RangePartitionedTable });
886
887
888/// The DDL-only contents of [`pg_policy`](https://www.postgresql.org/docs/17/catalog-pg-policy.html)
889#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
890pub struct PgPolicy {
891	// oid oid  Row identifier
892	/// `name`  The name of the policy
893	pub polname: Str,
894	/// `oid` `(references pg_class.oid)` The table to which the policy applies
895	pub polrelid: Str,
896	/// `char`  The command type to which the policy is applied: r for SELECT, a for INSERT, w for UPDATE, d for DELETE, or * for all
897	pub polcmd: PgPolicyPolcmd,
898	/// `bool`  Is the policy permissive or restrictive?
899	pub polpermissive: bool,
900	/// `oid[]` `(references pg_authid.oid)` The roles to which the policy is applied; zero means PUBLIC (and normally appears alone in the array)
901	pub polroles: Vec<Option<Str>>,
902	/// `pg_node_tree`  The expression tree to be added to the security barrier qualifications for queries that use the table
903	pub polqual: Option<Str>,
904	/// `pg_node_tree`  The expression tree to be added to the WITH CHECK qualifications for queries that attempt to add rows to the table
905	pub polwithcheck: Option<Str>,
906	/// `text`  The comment from pg_description
907	pub description: Option<Str>,
908}
909
910pg_char_enum!(PgPolicyPolcmd { 'r' => Select, 'a' => Insert, 'w' => Update, 'd' => Delete, '*' => All });
911
912
913/// The DDL-only contents of [`pg_publication`](https://www.postgresql.org/docs/17/catalog-pg-publication.html)
914#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
915pub struct PgPublication {
916	// oid oid  Row identifier
917	/// `name`  Name of the publication
918	pub pubname: Str,
919	/// `oid` `(references pg_authid.oid)` Owner of the publication
920	pub pubowner: Str,
921	/// `bool`  If true, this publication automatically includes all tables in the database, including any that will be created in the future.
922	pub puballtables: bool,
923	/// `bool`  If true, INSERT operations are replicated for tables in the publication.
924	pub pubinsert: bool,
925	/// `bool`  If true, UPDATE operations are replicated for tables in the publication.
926	pub pubupdate: bool,
927	/// `bool`  If true, DELETE operations are replicated for tables in the publication.
928	pub pubdelete: bool,
929	/// `bool`  If true, TRUNCATE operations are replicated for tables in the publication.
930	pub pubtruncate: bool,
931	/// `bool`  If true, operations on a leaf partition are replicated using the identity and schema of its topmost partitioned ancestor mentioned in the publication instead of its own.
932	pub pubviaroot: bool,
933	/// `text`  The comment from pg_description
934	pub description: Option<Str>,
935	/// `text`  The seclabel from pg_seclabel
936	pub seclabel: Option<Str>,
937	/// `text`  The provider from pg_seclabel
938	pub seclabel_provider: Option<Str>,
939}
940impl_hash_and_equivalent!(PgPublication, pubname);
941
942
943/// The DDL-only contents of [`pg_publication_namespace`](https://www.postgresql.org/docs/17/catalog-pg-publication-namespace.html)
944#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
945pub struct PgPublicationNamespace {
946	// oid oid  Row identifier
947	/// `oid` `(references pg_publication.oid)` Reference to publication
948	pub pnpubid: Str,
949	/// `oid` `(references pg_namespace.oid)` Reference to schema
950	pub pnnspid: Str,
951}
952
953
954/// The DDL-only contents of [`pg_publication_rel`](https://www.postgresql.org/docs/17/catalog-pg-publication-rel.html)
955#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
956pub struct PgPublicationRel {
957	// oid oid  Row identifier
958	/// `oid` `(references pg_publication.oid)` Reference to publication
959	pub prpubid: Str,
960	/// `oid` `(references pg_class.oid)` Reference to relation
961	pub prrelid: Str,
962	/// `pg_node_tree`  Expression tree (in nodeToString() representation) for the relation's publication qualifying condition. Null if there is no publication qualifying condition.
963	pub prqual: Option<Str>,
964	/// `int2vector` `(references pg_attribute.attnum)` This is an array of values that indicates which table columns are part of the publication. For example, a value of 1 3 would mean that the first and the third table columns are published. A null value indicates that all columns are published.
965	pub prattrs: Option<Vec<u16>>,
966}
967
968
969/// The DDL-only contents of [`pg_range`](https://www.postgresql.org/docs/17/catalog-pg-range.html)
970#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
971pub struct PgRange {
972	/// `oid` `(references pg_type.oid)` OID of the range type
973	pub rngtypid: Str,
974	/// `oid` `(references pg_type.oid)` OID of the element type (subtype) of this range type
975	pub rngsubtype: Str,
976	/// `oid` `(references pg_type.oid)` OID of the multirange type for this range type
977	pub rngmultitypid: Str,
978	/// `oid` `(references pg_collation.oid)` OID of the collation used for range comparisons, or zero if none
979	pub rngcollation: Option<Str>,
980	/// `oid` `(references pg_opclass.oid)` OID of the subtype's operator class used for range comparisons
981	pub rngsubopc: Str,
982	/// `regproc` `(references pg_proc.oid)` OID of the function to convert a range value into canonical form, or zero if none
983	pub rngcanonical: Option<Str>,
984	/// `regproc` `(references pg_proc.oid)` OID of the function to return the difference between two element values as double precision, or zero if none
985	pub rngsubdiff: Option<Str>,
986}
987
988
989/// The DDL-only contents of [`pg_rules`](https://www.postgresql.org/docs/17/view-pg-rules.html)
990#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
991pub struct PgRules {
992	/// `name` `(references pg_namespace.nspname)` Name of schema containing table
993	pub schemaname: Str,
994	/// `name` `(references pg_class.relname)` Name of table the rule is for
995	pub tablename: Str,
996	/// `name` `(references pg_rewrite.rulename)` Name of rule
997	pub rulename: Str,
998	/// `text`  Rule definition (a reconstructed creation command)
999	pub definition: Str,
1000	/// `text`  The comment from pg_description
1001	pub description: Option<Str>,
1002}
1003
1004
1005/// The DDL-only contents of [`pg_views`](https://www.postgresql.org/docs/17/view-pg-views.html)
1006#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1007pub struct PgViews {
1008	/// `name` `(references pg_namespace.nspname)` Name of schema containing view
1009	pub schemaname: Str,
1010	/// `name` `(references pg_class.relname)` Name of view
1011	pub viewname: Str,
1012	/// `name` `(references pg_authid.rolname)` Name of view's owner
1013	pub viewowner: Str,
1014	/// `text`  View definition (a reconstructed SELECT query)
1015	pub definition: Str,
1016}
1017
1018
1019/// The DDL-only contents of [`pg_matviews`](https://www.postgresql.org/docs/17/view-pg-matviews.html)
1020#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1021pub struct PgMatviews {
1022	/// `name` `(references pg_namespace.nspname)` Name of schema containing materialized view
1023	pub schemaname: Str,
1024	/// `name` `(references pg_class.relname)` Name of materialized view
1025	pub matviewname: Str,
1026	/// `name` `(references pg_authid.rolname)` Name of materialized view's owner
1027	pub matviewowner: Str,
1028	// tablespace name (references pg_tablespace.spcname) Name of tablespace containing materialized view (null if default for database)
1029	// hasindexes bool  True if materialized view has (or recently had) any indexes
1030	// ispopulated bool  True if materialized view is currently populated
1031	/// `text`  Materialized view definition (a reconstructed SELECT query)
1032	pub definition: Str,
1033}
1034
1035
1036/// The DDL-only contents of [`pg_sequence`](https://www.postgresql.org/docs/17/catalog-pg-sequence.html)
1037#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1038pub struct PgSequence {
1039	/// `oid` `(references pg_class.oid)` The OID of the pg_class entry for this sequence
1040	pub seqrelid: Str,
1041	/// `oid` `(references pg_type.oid)` Data type of the sequence
1042	pub seqtypid: Str,
1043	/// `int8`  Start value of the sequence
1044	pub seqstart: i64,
1045	/// `int8`  Increment value of the sequence
1046	pub seqincrement: i64,
1047	/// `int8`  Maximum value of the sequence
1048	pub seqmax: i64,
1049	/// `int8`  Minimum value of the sequence
1050	pub seqmin: i64,
1051	/// `int8`  Cache size of the sequence
1052	pub seqcache: i64,
1053	/// `bool`  Whether the sequence cycles
1054	pub seqcycle: bool,
1055}
1056
1057
1058/// The DDL-only contents of [`pg_statistic_ext`](https://www.postgresql.org/docs/17/catalog-pg-statistic-ext.html)
1059#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1060pub struct PgStatisticExt {
1061	// oid oid  Row identifier
1062	/// `oid` `(references pg_class.oid)` Table containing the columns described by this object
1063	pub stxrelid: Str,
1064	/// `name`  Name of the statistics object
1065	pub stxname: Str,
1066	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this statistics object
1067	pub stxnamespace: Str,
1068	/// `oid` `(references pg_authid.oid)` Owner of the statistics object
1069	pub stxowner: Str,
1070	/// `int2vector` `(references pg_attribute.attnum)` An array of attribute numbers, indicating which table columns are covered by this statistics object; for example a value of 1 3 would mean that the first and the third table columns are covered
1071	pub stxkeys: Vec<u16>,
1072	/// `int2`  stxstattarget controls the level of detail of statistics accumulated for this statistics object by ANALYZE. A zero value indicates that no statistics should be collected. A null value says to use the maximum of the statistics targets of the referenced columns, if set, or the system default statistics target. Positive values of stxstattarget determine the target number of “most common values” to collect.
1073	pub stxstattarget: Option<u16>,
1074	/// `char[]`  An array containing codes for the enabled statistics kinds; valid values are: d for n-distinct statistics, f for functional dependency statistics, m for most common values (MCV) list statistics, and e for expression statistics
1075	pub stxkind: Vec<PgStatisticExtStxkind>,
1076	/// `pg_node_tree`  Expression trees (in nodeToString() representation) for statistics object attributes that are not simple column references. This is a list with one element per expression. Null if all statistics object attributes are simple references.
1077	pub stxexprs: Option<Str>,
1078	/// `text`  The comment from pg_description
1079	pub description: Option<Str>,
1080}
1081
1082pg_char_enum!(PgStatisticExtStxkind { 'd' => NDistinct, 'f' => FunctionalDependency, 'm' => MostCommonValuesList, 'e' => Expression });
1083
1084
1085/// The DDL-only contents of [`pg_subscription`](https://www.postgresql.org/docs/17/catalog-pg-subscription.html)
1086#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1087pub struct PgSubscription {
1088	// oid oid  Row identifier
1089	// subdbid oid (references pg_database.oid) OID of the database that the subscription resides in
1090	// subskiplsn pg_lsn  Finish LSN of the transaction whose changes are to be skipped, if a valid LSN; otherwise 0/0.
1091	/// `name`  Name of the subscription
1092	pub subname: Str,
1093	/// `oid` `(references pg_authid.oid)` Owner of the subscription
1094	pub subowner: Str,
1095	/// `bool`  If true, the subscription is enabled and should be replicating
1096	pub subenabled: bool,
1097	/// `bool`  If true, the subscription will request that the publisher send data in binary format
1098	pub subbinary: bool,
1099	/// `char`  Controls how to handle the streaming of in-progress transactions: f = disallow streaming of in-progress transactions, t = spill the changes of in-progress transactions to disk and apply at once after the transaction is committed on the publisher and received by the subscriber, p = apply changes directly using a parallel apply worker if available (same as t if no worker is available)
1100	pub substream: PgSubscriptionSubstream,
1101	/// `char`  State codes for two-phase mode: d = disabled, p = pending enablement, e = enabled
1102	pub subtwophasestate: PgSubscriptionSubtwophasestate,
1103	/// `bool`  If true, the subscription will be disabled if one of its workers detects an error
1104	pub subdisableonerr: bool,
1105	/// `bool`  If true, the subscription will be required to specify a password for authentication
1106	pub subpasswordrequired: bool,
1107	/// `bool`  If true, the subscription will be run with the permissions of the subscription owner
1108	pub subrunasowner: bool,
1109	/// `bool`  If true, the associated replication slots (i.e. the main slot and the table sync slots) in the upstream database are enabled to be synchronized to the standbys
1110	pub subfailover: bool,
1111	/// `text`  Connection string to the upstream database
1112	pub subconninfo: Str,
1113	/// `name`  Name of the replication slot in the upstream database (also used for the local replication origin name); null represents NONE
1114	pub subslotname: Option<Str>,
1115	/// `text`  The synchronous_commit setting for the subscription's workers to use
1116	pub subsynccommit: Str,
1117	/// `text[]`  Array of subscribed publication names. These reference publications defined in the upstream database. For more on publications see Section 29.1.
1118	pub subpublications: Vec<Str>,
1119	/// `text`  The origin value must be either none or any. The default is any. If none, the subscription will request the publisher to only send changes that don't have an origin. If any, the publisher sends changes regardless of their origin.
1120	pub suborigin: Option<Str>,
1121	/// `text`  The comment from pg_description
1122	pub description: Option<Str>,
1123	/// `text`  The seclabel from pg_seclabel
1124	pub seclabel: Option<Str>,
1125	/// `text`  The provider from pg_seclabel
1126	pub seclabel_provider: Option<Str>,
1127}
1128
1129pg_char_enum!(PgSubscriptionSubstream { 'f' => DisallowStreamingInProgress, 't' => SpillApplyAfterCommitted, 'p' => ApplyDirectlyParallel });
1130pg_char_enum!(PgSubscriptionSubtwophasestate { 'd' => Disabled, 'p' => PendingEnablement, 'e' => Enabled });
1131
1132
1133/// The DDL-only contents of [`pg_transform`](https://www.postgresql.org/docs/17/catalog-pg-transform.html)
1134#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1135pub struct PgTransform {
1136	// oid oid  Row identifier
1137	/// `oid` `(references pg_type.oid)` OID of the data type this transform is for
1138	pub trftype: Str,
1139	/// `oid` `(references pg_language.oid)` OID of the language this transform is for
1140	pub trflang: Str,
1141	/// `regproc` `(references pg_proc.oid)` The OID of the function to use when converting the data type for input to the procedural language (e.g., function parameters). Zero is stored if the default behavior should be used.
1142	pub trffromsql: Option<Str>,
1143	/// `regproc` `(references pg_proc.oid)` The OID of the function to use when converting output from the procedural language (e.g., return values) to the data type. Zero is stored if the default behavior should be used.
1144	pub trftosql: Option<Str>,
1145}
1146
1147
1148/// The DDL-only contents of [`pg_trigger`](https://www.postgresql.org/docs/17/catalog-pg-trigger.html)
1149#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1150pub struct PgTrigger {
1151	// oid oid  Row identifier
1152	/// `oid` `(references pg_class.oid)` The table this trigger is on
1153	pub tgrelid: Str,
1154	/// `oid` `(references pg_trigger.oid)` Parent trigger that this trigger is cloned from (this happens when partitions are created or attached to a partitioned table); zero if not a clone
1155	pub tgparentid: Option<Str>,
1156	/// `name`  Trigger name (must be unique among triggers of same table)
1157	pub tgname: Str,
1158	/// `oid` `(references pg_proc.oid)` The function to be called
1159	pub tgfoid: Str,
1160	/// `int2`  Bit mask identifying trigger firing conditions
1161	pub tgtype: i16,
1162	/// `char`  Controls in which session_replication_role modes the trigger fires. O = trigger fires in “origin” and “local” modes, D = trigger is disabled, R = trigger fires in “replica” mode, A = trigger fires always.
1163	pub tgenabled: PgTriggerTgenabled,
1164	/// `bool`  True if trigger is internally generated (usually, to enforce the constraint identified by tgconstraint)
1165	pub tgisinternal: bool,
1166	/// `oid` `(references pg_class.oid)` The table referenced by a referential integrity constraint (zero if trigger is not for a referential integrity constraint)
1167	pub tgconstrrelid: Option<Str>,
1168	/// `oid` `(references pg_class.oid)` The index supporting a unique, primary key, referential integrity, or exclusion constraint (zero if trigger is not for one of these types of constraint)
1169	pub tgconstrindid: Option<Str>,
1170	/// `oid` `(references pg_constraint.oid)` The pg_constraint entry associated with the trigger (zero if trigger is not for a constraint)
1171	pub tgconstraint: Option<Str>,
1172	/// `bool`  True if constraint trigger is deferrable
1173	pub tgdeferrable: bool,
1174	/// `bool`  True if constraint trigger is initially deferred
1175	pub tginitdeferred: bool,
1176	/// `int2`  Number of argument strings passed to trigger function
1177	pub tgnargs: u16,
1178	/// `int2vector` `(references pg_attribute.attnum)` Column numbers, if trigger is column-specific; otherwise an empty array
1179	pub tgattr: Vec<u16>,
1180	/// `bytea`  Argument strings to pass to trigger, each NULL-terminated
1181	pub tgargs: Vec<u8>,
1182	/// `pg_node_tree`  Expression tree (in nodeToString() representation) for the trigger's WHEN condition, or null if none
1183	pub tgqual: Option<Str>,
1184	/// `name`  REFERENCING clause name for OLD TABLE, or null if none
1185	pub tgoldtable: Option<Str>,
1186	/// `name`  REFERENCING clause name for NEW TABLE, or null if none
1187	pub tgnewtable: Option<Str>,
1188	/// `text`  The comment from pg_description
1189	pub description: Option<Str>,
1190	/// `text`  The seclabel from pg_seclabel
1191	pub seclabel: Option<Str>,
1192	/// `text`  The provider from pg_seclabel
1193	pub seclabel_provider: Option<Str>,
1194}
1195
1196pg_char_enum!(PgTriggerTgenabled { 'O' => OriginAndLocalMode, 'D' => Disabled, 'R' => ReplicaMode, 'A' => Always });
1197
1198
1199/// The DDL-only contents of [`pg_ts_config`](https://www.postgresql.org/docs/17/catalog-pg-ts-config.html)
1200#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1201pub struct PgTsConfig {
1202	/// `oid`  Row identifier
1203	pub oid: Str,
1204	/// `name`  Text search configuration name
1205	pub cfgname: Str,
1206	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this configuration
1207	pub cfgnamespace: Str,
1208	/// `oid` `(references pg_authid.oid)` Owner of the configuration
1209	pub cfgowner: Str,
1210	// cfgparser oid (references pg_ts_parser.oid) The OID of the text search parser for this configuration
1211	/// `text`  The comment from pg_description
1212	pub description: Option<Str>,
1213	/// `text`  The seclabel from pg_seclabel
1214	pub seclabel: Option<Str>,
1215	/// `text`  The provider from pg_seclabel
1216	pub seclabel_provider: Option<Str>,
1217}
1218impl_hash_and_equivalent!(PgTsConfig, oid);
1219
1220
1221/// The DDL-only contents of [`pg_ts_config_map`](https://www.postgresql.org/docs/17/catalog-pg-ts-config-map.html)
1222#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1223pub struct PgTsConfigMap {
1224	/// `oid` `(references pg_ts_config.oid)` The OID of the pg_ts_config entry owning this map entry
1225	pub mapcfg: Str,
1226	/// `int4`  A token type emitted by the configuration's parser
1227	pub maptokentype: i32,
1228	/// `int4`  Order in which to consult this entry (lower mapseqnos first)
1229	pub mapseqno: i32,
1230	/// `oid` `(references pg_ts_dict.oid)` The OID of the text search dictionary to consult
1231	pub mapdict: Str,
1232}
1233
1234
1235/// The DDL-only contents of [`pg_ts_dict`](https://www.postgresql.org/docs/17/catalog-pg-ts-dict.html)
1236#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1237pub struct PgTsDict {
1238	/// `oid`  Row identifier
1239	pub oid: Str,
1240	/// `name`  Text search dictionary name
1241	pub dictname: Str,
1242	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this dictionary
1243	pub dictnamespace: Str,
1244	/// `oid` `(references pg_authid.oid)` Owner of the dictionary
1245	pub dictowner: Str,
1246	// dicttemplate oid (references pg_ts_template.oid) The OID of the text search template for this dictionary
1247	/// `text`  Initialization option string for the template
1248	pub dictinitoption: Option<Str>,
1249	/// `text`  The comment from pg_description
1250	pub description: Option<Str>,
1251	/// `text`  The seclabel from pg_seclabel
1252	pub seclabel: Option<Str>,
1253	/// `text`  The provider from pg_seclabel
1254	pub seclabel_provider: Option<Str>,
1255}
1256impl_hash_and_equivalent!(PgTsDict, oid);
1257
1258
1259/// The DDL-only contents of [`pg_ts_parser`](https://www.postgresql.org/docs/17/catalog-pg-ts-parser.html)
1260#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1261pub struct PgTsParser {
1262	// oid oid  Row identifier
1263	/// `name`  Text search parser name
1264	pub prsname: Str,
1265	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this parser
1266	pub prsnamespace: Str,
1267	/// `regproc` `(references pg_proc.oid)` OID of the parser's startup function
1268	pub prsstart: Str,
1269	/// `regproc` `(references pg_proc.oid)` OID of the parser's next-token function
1270	pub prstoken: Str,
1271	/// `regproc` `(references pg_proc.oid)` OID of the parser's shutdown function
1272	pub prsend: Str,
1273	/// `regproc` `(references pg_proc.oid)` OID of the parser's headline function (zero if none)
1274	pub prsheadline: Option<Str>,
1275	/// `regproc` `(references pg_proc.oid)` OID of the parser's lextype function
1276	pub prslextype: Str,
1277}
1278
1279
1280/// The DDL-only contents of [`pg_ts_template`](https://www.postgresql.org/docs/17/catalog-pg-ts-template.html)
1281#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1282pub struct PgTsTemplate {
1283	// oid oid  Row identifier
1284	/// `name`  Text search template name
1285	pub tmplname: Str,
1286	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this template
1287	pub tmplnamespace: Str,
1288	/// `regproc` `(references pg_proc.oid)` OID of the template's initialization function (zero if none)
1289	pub tmplinit: Option<Str>,
1290	/// `regproc` `(references pg_proc.oid)` OID of the template's lexize function
1291	pub tmpllexize: Str,
1292}
1293
1294
1295/// The DDL-only contents of [`pg_type`](https://www.postgresql.org/docs/17/catalog-pg-type.html)
1296#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1297pub struct PgType {
1298	/// `oid`  Row identifier
1299	pub oid: Str,
1300	/// `name`  Data type name
1301	pub typname: Str,
1302	/// `oid` `(references pg_namespace.oid)` The OID of the namespace that contains this type
1303	pub typnamespace: Str,
1304	/// `oid` `(references pg_authid.oid)` Owner of the type
1305	pub typowner: Str,
1306	/// `int2`  For a fixed-size type, typlen is the number of bytes in the internal representation of the type. But for a variable-length type, typlen is negative. -1 indicates a “varlena” type (one that has a length word), -2 indicates a null-terminated C string.
1307	pub typlen: i16,
1308	/// `bool`  typbyval determines whether internal routines pass a value of this type by value or by reference. typbyval had better be false if typlen is not 1, 2, or 4 (or 8 on machines where Datum is 8 bytes). Variable-length types are always passed by reference. Note that typbyval can be false even if the length would allow pass-by-value.
1309	pub typbyval: bool,
1310	/// `char`  typtype is b for a base type, c for a composite type (e.g., a table's row type), d for a domain, e for an enum type, p for a pseudo-type, r for a range type, or m for a multirange type. See also typrelid and typbasetype.
1311	pub typtype: PgTypeTyptype,
1312	// typcategory char  typcategory is an arbitrary classification of data types that is used by the parser to determine which implicit casts should be “preferred”. See Table 51.65.
1313	/// `bool`  True if the type is a preferred cast target within its typcategory
1314	pub typispreferred: bool,
1315	/// `bool`  True if the type is defined, false if this is a placeholder entry for a not-yet-defined type. When typisdefined is false, nothing except the type name, namespace, and OID can be relied on.
1316	pub typisdefined: bool,
1317	/// `char`  Character that separates two values of this type when parsing array input. Note that the delimiter is associated with the array element data type, not the array data type.
1318	pub typdelim: i8,
1319	/// `oid` `(references pg_class.oid)` If this is a composite type (see typtype), then this column points to the pg_class entry that defines the corresponding table. (For a free-standing composite type, the pg_class entry doesn't really represent a table, but it is needed anyway for the type's pg_attribute entries to link to.) Zero for non-composite types.
1320	pub typrelid: Option<Str>,
1321	/// `regproc` `(references pg_proc.oid)` Subscripting handler function's OID, or zero if this type doesn't support subscripting. Types that are “true” array types have typsubscript = array_subscript_handler, but other types may have other handler functions to implement specialized subscripting behavior.
1322	pub typsubscript: Option<Str>,
1323	/// `oid` `(references pg_type.oid)` If typelem is not zero then it identifies another row in pg_type, defining the type yielded by subscripting. This should be zero if typsubscript is zero. However, it can be zero when typsubscript isn't zero, if the handler doesn't need typelem to determine the subscripting result type. Note that a typelem dependency is considered to imply physical containment of the element type in this type; so DDL changes on the element type might be restricted by the presence of this type.
1324	pub typelem: Option<Str>,
1325	/// `oid` `(references pg_type.oid)` If typarray is not zero then it identifies another row in pg_type, which is the “true” array type having this type as element
1326	pub typarray: Option<Str>,
1327	/// `regproc` `(references pg_proc.oid)` Input conversion function (text format)
1328	pub typinput: Str,
1329	/// `regproc` `(references pg_proc.oid)` Output conversion function (text format)
1330	pub typoutput: Str,
1331	/// `regproc` `(references pg_proc.oid)` Input conversion function (binary format), or zero if none
1332	pub typreceive: Option<Str>,
1333	/// `regproc` `(references pg_proc.oid)` Output conversion function (binary format), or zero if none
1334	pub typsend: Option<Str>,
1335	/// `regproc` `(references pg_proc.oid)` Type modifier input function, or zero if type does not support modifiers
1336	pub typmodin: Option<Str>,
1337	/// `regproc` `(references pg_proc.oid)` Type modifier output function, or zero to use the standard format
1338	pub typmodout: Option<Str>,
1339	/// `regproc` `(references pg_proc.oid)` Custom ANALYZE function, or zero to use the standard function
1340	pub typanalyze: Option<Str>,
1341	/// `char`  typalign is the alignment required when storing a value of this type. It applies to storage on disk as well as most representations of the value inside PostgreSQL. When multiple values are stored consecutively, such as in the representation of a complete row on disk, padding is inserted before a datum of this type so that it begins on the specified boundary. The alignment reference is the beginning of the first datum in the sequence. Possible values are: c = char alignment, i.e., no alignment needed. s = short alignment (2 bytes on most machines). i = int alignment (4 bytes on most machines). d = double alignment (8 bytes on many machines, but by no means all).
1342	pub typalign: PgTypeTypalign,
1343	/// `char`  typstorage tells for varlena types (those with typlen = -1) if the type is prepared for toasting and what the default strategy for attributes of this type should be. Possible values are: p (plain): Values must always be stored plain (non-varlena types always use this value). e (external): Values can be stored in a secondary “TOAST” relation (if relation has one, see pg_class.reltoastrelid). m (main): Values can be compressed and stored inline. x (extended): Values can be compressed and/or moved to a secondary relation. x is the usual choice for toast-able types. Note that m values can also be moved out to secondary storage, but only as a last resort (e and x values are moved first).
1344	pub typstorage: PgTypeTypstorage,
1345	/// `bool`  typnotnull represents a not-null constraint on a type. Used for domains only.
1346	pub typnotnull: bool,
1347	/// `oid` `(references pg_type.oid)` If this is a domain (see typtype), then typbasetype identifies the type that this one is based on. Zero if this type is not a domain.
1348	pub typbasetype: Option<Str>,
1349	/// `int4`  Domains use typtypmod to record the typmod to be applied to their base type (-1 if base type does not use a typmod). -1 if this type is not a domain.
1350	pub typtypmod: Option<u32>,
1351	/// `int4`  typndims is the number of array dimensions for a domain over an array (that is, typbasetype is an array type). Zero for types other than domains over array types.
1352	pub typndims: u32,
1353	/// `oid` `(references pg_collation.oid)` typcollation specifies the collation of the type. If the type does not support collations, this will be zero. A base type that supports collations will have a nonzero value here, typically DEFAULT_COLLATION_OID. A domain over a collatable type can have a collation OID different from its base type's, if one was specified for the domain.
1354	pub typcollation: Option<Str>,
1355	/// `pg_node_tree`  If typdefaultbin is not null, it is the nodeToString() representation of a default expression for the type. This is only used for domains.
1356	pub typdefaultbin: Option<Str>,
1357	/// `text`  typdefault is null if the type has no associated default value. If typdefaultbin is not null, typdefault must contain a human-readable version of the default expression represented by typdefaultbin. If typdefaultbin is null and typdefault is not, then typdefault is the external representation of the type's default value, which can be fed to the type's input converter to produce a constant.
1358	pub typdefault: Option<Str>,
1359	/// `aclitem[]`  Access privileges; see Section 5.8 for details
1360	pub typacl: Option<Vec<TypeAclItem>>,
1361	/// `text`  The comment from pg_description
1362	pub description: Option<Str>,
1363	/// `text`  The seclabel from pg_seclabel
1364	pub seclabel: Option<Str>,
1365	/// `text`  The provider from pg_seclabel
1366	pub seclabel_provider: Option<Str>,
1367	/// `aclitem[]`  The initial access privileges from pg_init_privs.
1368	pub initprivs: Option<Vec<TypeAclItem>>,
1369	/// `char`  A code defining the type of initial privilege of this object from pg_init_privs. 'i' if set by initdb, 'e' if set by CREATE EXTENSION.
1370	pub initprivs_type: Option<PgTypeInitprivsType>,
1371}
1372impl_hash_and_equivalent!(PgType, oid);
1373
1374pg_char_enum!(PgTypeTyptype { 'b' => Base, 'c' => Composite, 'd' => Domain, 'e' => Enum, 'p' => Pseudo, 'r' => Range, 'm' => Multirange });
1375pg_char_enum!(PgTypeTypalign { 'c' => Char, 's' => Short, 'i' => Int, 'd' => Double });
1376pg_char_enum!(PgTypeTypstorage { 'p' => Plain, 'e' => External, 'm' => Main, 'x' => Extended });
1377pg_char_enum!(PgTypeInitprivsType { 'i' => InitDb, 'e' => CreateExtension });
1378
1379
1380/// The DDL-only contents of [`pg_user_mappings`](https://www.postgresql.org/docs/17/view-pg-user-mappings.html)
1381#[derive(Debug, serde::Serialize, serde::Deserialize, PartialEq, Eq, Clone)]
1382pub struct PgUserMappings {
1383	// umid oid (references pg_user_mapping.oid) OID of the user mapping
1384	// srvid oid (references pg_foreign_server.oid) The OID of the foreign server that contains this mapping
1385	/// `name` `(references pg_foreign_server.srvname)` Name of the foreign server
1386	pub srvname: Str,
1387	/// `oid` `(references pg_authid.oid)` OID of the local role being mapped, or zero if the user mapping is public
1388	pub umuser: Option<Str>,
1389	/// `name`  Name of the local user to be mapped
1390	pub usename: Str,
1391	/// `text[]`  User mapping specific options, as “keyword=value” strings
1392	pub umoptions: Option<Vec<Str>>,
1393}
1394