Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes14kdownloads
pg_cast.h105 linesDownload Raw Back to catalog
1/*-------------------------------------------------------------------------2 *3 * pg_cast.h4 *	  definition of the "type casts" system catalog (pg_cast)5 *6 * As of Postgres 8.0, pg_cast describes not only type coercion functions7 * but also length coercion functions.8 *9 * Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group10 * Portions Copyright (c) 1994, Regents of the University of California11 *12 * src/include/catalog/pg_cast.h13 *14 * NOTES15 *	  The Catalog.pm module reads this file and derives schema16 *	  information.17 *18 *-------------------------------------------------------------------------19 */20#ifndef PG_CAST_H21#define PG_CAST_H22 23#include "catalog/dependency.h"24#include "catalog/genbki.h"25#include "catalog/pg_cast_d.h"26 27/* ----------------28 *		pg_cast definition.  cpp turns this into29 *		typedef struct FormData_pg_cast30 * ----------------31 */32CATALOG(pg_cast,2605,CastRelationId)33{34	Oid			oid;			/* oid */35 36	/* source datatype for cast */37	Oid			castsource BKI_LOOKUP(pg_type);38 39	/* destination datatype for cast */40	Oid			casttarget BKI_LOOKUP(pg_type);41 42	/* cast function; 0 = binary coercible */43	Oid			castfunc BKI_LOOKUP_OPT(pg_proc);44 45	/* contexts in which cast can be used */46	char		castcontext;47 48	/* cast method */49	char		castmethod;50} FormData_pg_cast;51 52/* ----------------53 *		Form_pg_cast corresponds to a pointer to a tuple with54 *		the format of pg_cast relation.55 * ----------------56 */57typedef FormData_pg_cast *Form_pg_cast;58 59DECLARE_UNIQUE_INDEX_PKEY(pg_cast_oid_index, 2660, CastOidIndexId, on pg_cast using btree(oid oid_ops));60DECLARE_UNIQUE_INDEX(pg_cast_source_target_index, 2661, CastSourceTargetIndexId, on pg_cast using btree(castsource oid_ops, casttarget oid_ops));61 62#ifdef EXPOSE_TO_CLIENT_CODE63 64/*65 * The allowable values for pg_cast.castcontext are specified by this enum.66 * Since castcontext is stored as a "char", we use ASCII codes for human67 * convenience in reading the table.  Note that internally to the backend,68 * these values are converted to the CoercionContext enum (see primnodes.h),69 * which is defined to sort in a convenient order; the ASCII codes don't70 * have to sort in any special order.71 */72 73typedef enum CoercionCodes74{75	COERCION_CODE_IMPLICIT = 'i',	/* coercion in context of expression */76	COERCION_CODE_ASSIGNMENT = 'a', /* coercion in context of assignment */77	COERCION_CODE_EXPLICIT = 'e'	/* explicit cast operation */78} CoercionCodes;79 80/*81 * The allowable values for pg_cast.castmethod are specified by this enum.82 * Since castmethod is stored as a "char", we use ASCII codes for human83 * convenience in reading the table.84 */85typedef enum CoercionMethod86{87	COERCION_METHOD_FUNCTION = 'f', /* use a function */88	COERCION_METHOD_BINARY = 'b',	/* types are binary-compatible */89	COERCION_METHOD_INOUT = 'i' /* use input/output functions */90} CoercionMethod;91 92#endif							/* EXPOSE_TO_CLIENT_CODE */93 94 95extern ObjectAddress CastCreate(Oid sourcetypeid,96								Oid targettypeid,97								Oid funcid,98								Oid incastid,99								Oid outcastid,100								char castcontext,101								char castmethod,102								DependencyType behavior);103 104#endif							/* PG_CAST_H */105 
codekingpro/portable-devtools · Team Ai