1 /*-------------------------------------------------------------------------
4 * Routines for type coercion.
7 * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $Id: parse_coerce.h,v 1.53 2003/07/03 19:07:54 tgl Exp $
12 *-------------------------------------------------------------------------
14 #ifndef PARSE_COERCE_H
15 #define PARSE_COERCE_H
17 #include "catalog/pg_type.h"
18 #include "parser/parse_node.h"
38 extern bool IsBinaryCoercible(Oid srctype, Oid targettype);
39 extern bool IsPreferredType(CATEGORY category, Oid type);
40 extern CATEGORY TypeCategory(Oid type);
42 extern Node *coerce_to_target_type(ParseState *pstate,
43 Node *expr, Oid exprtype,
44 Oid targettype, int32 targettypmod,
45 CoercionContext ccontext,
46 CoercionForm cformat);
47 extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
48 CoercionContext ccontext);
49 extern Node *coerce_type(ParseState *pstate, Node *node,
50 Oid inputTypeId, Oid targetTypeId,
51 CoercionContext ccontext, CoercionForm cformat);
52 extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, Oid typeId,
53 CoercionForm cformat);
55 extern Node *coerce_to_boolean(ParseState *pstate, Node *node,
56 const char *constructName);
57 extern Node *coerce_to_integer(ParseState *pstate, Node *node,
58 const char *constructName);
60 extern Oid select_common_type(List *typeids, const char *context);
61 extern Node *coerce_to_common_type(ParseState *pstate, Node *node,
65 extern bool check_generic_type_consistency(Oid *actual_arg_types,
66 Oid *declared_arg_types,
68 extern Oid enforce_generic_type_consistency(Oid *actual_arg_types,
69 Oid *declared_arg_types,
72 extern Oid resolve_generic_type(Oid declared_type,
73 Oid context_actual_type,
74 Oid context_declared_type);
76 extern bool find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
77 CoercionContext ccontext,
79 extern Oid find_typmod_coercion_function(Oid typeId, int *nargs);
81 #endif /* PARSE_COERCE_H */