1/*-------------------------------------------------------------------------
4 * definition of the "type casts" system catalog (pg_cast)
6 * As of Postgres 8.0, pg_cast describes not only type coercion functions
7 * but also length coercion functions.
9 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
10 * Portions Copyright (c) 1994, Regents of the University of California
12 * src/include/catalog/pg_cast.h
15 * The Catalog.pm module reads this file and derives schema
18 *-------------------------------------------------------------------------
25#include "catalog/pg_cast_d.h" /* IWYU pragma: export */
28 * pg_cast definition. cpp turns this into
29 * typedef struct FormData_pg_cast
36 /* source datatype for cast */
39 /* destination datatype for cast */
42 /* cast function; 0 = binary coercible */
45 /* contexts in which cast can be used */
53 * Form_pg_cast corresponds to a pointer to a tuple with
54 * the format of pg_cast relation.
60 DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, CastSourceTargetIndexId, pg_cast, btree(castsource oid_ops, casttarget oid_ops));
64#ifdef EXPOSE_TO_CLIENT_CODE
67 * The allowable values for pg_cast.castcontext are specified by this enum.
68 * Since castcontext is stored as a "char", we use ASCII codes for human
69 * convenience in reading the table. Note that internally to the backend,
70 * these values are converted to the CoercionContext enum (see primnodes.h),
71 * which is defined to sort in a convenient order; the ASCII codes don't
72 * have to sort in any special order.
75typedef enum CoercionCodes
77 COERCION_CODE_IMPLICIT =
'i',
/* coercion in context of expression */
78 COERCION_CODE_ASSIGNMENT =
'a',
/* coercion in context of assignment */
79 COERCION_CODE_EXPLICIT =
'e',
/* explicit cast operation */
83 * The allowable values for pg_cast.castmethod are specified by this enum.
84 * Since castmethod is stored as a "char", we use ASCII codes for human
85 * convenience in reading the table.
87typedef enum CoercionMethod
89 COERCION_METHOD_FUNCTION =
'f',
/* use a function */
90 COERCION_METHOD_BINARY =
'b',
/* types are binary-compatible */
91 COERCION_METHOD_INOUT =
'i',
/* use input/output functions */
94#endif /* EXPOSE_TO_CLIENT_CODE */
106#endif /* PG_CAST_H */
#define BKI_LOOKUP(catalog)
#define BKI_LOOKUP_OPT(catalog)
CATALOG(pg_cast, 2605, CastRelationId)
DECLARE_UNIQUE_INDEX_PKEY(pg_cast_oid_index, 2660, CastOidIndexId, pg_cast, btree(oid oid_ops))
DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, CastSourceTargetIndexId, pg_cast, btree(castsource oid_ops, casttarget oid_ops))
ObjectAddress CastCreate(Oid sourcetypeid, Oid targettypeid, Oid funcid, Oid incastid, Oid outcastid, char castcontext, char castmethod, DependencyType behavior)
MAKE_SYSCACHE(CASTSOURCETARGET, pg_cast_source_target_index, 256)
FormData_pg_cast * Form_pg_cast