1 /*-------------------------------------------------------------------------
4 * Routines for type coercion.
7 * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * $PostgreSQL: pgsql/src/include/parser/parse_coerce.h,v 1.69 2007/01/05 22:19:57 momjian Exp $
12 *-------------------------------------------------------------------------
14 #ifndef PARSE_COERCE_H
15 #define PARSE_COERCE_H
17 #include "parser/parse_node.h"
37 extern bool IsBinaryCoercible(Oid srctype, Oid targettype);
38 extern bool IsPreferredType(CATEGORY category, Oid type);
39 extern CATEGORY TypeCategory(Oid type);
41 extern Node *coerce_to_target_type(ParseState *pstate,
42 Node *expr, Oid exprtype,
43 Oid targettype, int32 targettypmod,
44 CoercionContext ccontext,
45 CoercionForm cformat);
46 extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
47 CoercionContext ccontext);
48 extern Node *coerce_type(ParseState *pstate, Node *node,
49 Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod,
50 CoercionContext ccontext, CoercionForm cformat);
51 extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod,
53 CoercionForm cformat, bool hideInputCoercion,
54 bool lengthCoercionDone);
56 extern Node *coerce_to_boolean(ParseState *pstate, Node *node,
57 const char *constructName);
58 extern Node *coerce_to_specific_type(ParseState *pstate, Node *node,
60 const char *constructName);
62 extern Oid select_common_type(List *typeids, const char *context);
63 extern Node *coerce_to_common_type(ParseState *pstate, Node *node,
67 extern bool check_generic_type_consistency(Oid *actual_arg_types,
68 Oid *declared_arg_types,
70 extern Oid enforce_generic_type_consistency(Oid *actual_arg_types,
71 Oid *declared_arg_types,
74 extern Oid resolve_generic_type(Oid declared_type,
75 Oid context_actual_type,
76 Oid context_declared_type);
78 extern bool find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
79 CoercionContext ccontext,
81 extern Oid find_typmod_coercion_function(Oid typeId);
83 #endif /* PARSE_COERCE_H */