diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-03-10 11:28:23 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2020-03-10 11:28:23 -0300 |
commit | 40b3e2c201af10c27a2c4c5bfcd029026b4cdff3 (patch) | |
tree | c19e65a9b38c3ed42c26d58a25a349d0049a8606 /src/include | |
parent | 0a42a2e9ce8481a024d085f2cc526a366db8df59 (diff) | |
download | postgresql-40b3e2c201af10c27a2c4c5bfcd029026b4cdff3.tar.gz postgresql-40b3e2c201af10c27a2c4c5bfcd029026b4cdff3.zip |
Split out CreateCast into src/backend/catalog/pg_cast.c
This catalog-handling code was previously together with the rest of
CastCreate() in src/backend/commands/functioncmds.c. A future patch
will need a way to add casts internally, so this will be useful to have
separate.
Also, move the nearby get_cast_oid() function from functioncmds.c to
lsyscache.c, which seems a more natural place for it.
Author: Paul Jungwirth, minor edits by Álvaro
Discussion: https://postgr.es/m/20200309210003.GA19992@alvherre.pgsql
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/catalog/pg_cast.h | 9 | ||||
-rw-r--r-- | src/include/commands/defrem.h | 1 | ||||
-rw-r--r-- | src/include/utils/lsyscache.h | 1 |
3 files changed, 10 insertions, 1 deletions
diff --git a/src/include/catalog/pg_cast.h b/src/include/catalog/pg_cast.h index 1b81b52df6b..2620ff40f05 100644 --- a/src/include/catalog/pg_cast.h +++ b/src/include/catalog/pg_cast.h @@ -20,6 +20,7 @@ #ifndef PG_CAST_H #define PG_CAST_H +#include "catalog/dependency.h" #include "catalog/genbki.h" #include "catalog/pg_cast_d.h" @@ -87,4 +88,12 @@ typedef enum CoercionMethod #endif /* EXPOSE_TO_CLIENT_CODE */ + +extern ObjectAddress CastCreate(Oid sourcetypeid, + Oid targettypeid, + Oid funcid, + char castcontext, + char castmethod, + DependencyType behavior); + #endif /* PG_CAST_H */ diff --git a/src/include/commands/defrem.h b/src/include/commands/defrem.h index 08ca6ac31e8..c77c9a6ed5a 100644 --- a/src/include/commands/defrem.h +++ b/src/include/commands/defrem.h @@ -64,7 +64,6 @@ extern void IsThereFunctionInNamespace(const char *proname, int pronargs, extern void ExecuteDoStmt(DoStmt *stmt, bool atomic); extern void ExecuteCallStmt(CallStmt *stmt, ParamListInfo params, bool atomic, DestReceiver *dest); extern TupleDesc CallStmtResultDesc(CallStmt *stmt); -extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); extern Oid get_transform_oid(Oid type_id, Oid lang_id, bool missing_ok); extern void interpret_function_parameter_list(ParseState *pstate, List *parameters, diff --git a/src/include/utils/lsyscache.h b/src/include/utils/lsyscache.h index 131d10eab07..6e93590befc 100644 --- a/src/include/utils/lsyscache.h +++ b/src/include/utils/lsyscache.h @@ -90,6 +90,7 @@ extern char get_attgenerated(Oid relid, AttrNumber attnum); extern Oid get_atttype(Oid relid, AttrNumber attnum); extern void get_atttypetypmodcoll(Oid relid, AttrNumber attnum, Oid *typid, int32 *typmod, Oid *collid); +extern Oid get_cast_oid(Oid sourcetypeid, Oid targettypeid, bool missing_ok); extern char *get_collation_name(Oid colloid); extern bool get_collation_isdeterministic(Oid colloid); extern char *get_constraint_name(Oid conoid); |