~ubuntu-branches/ubuntu/oneiric/postgresql-9.1/oneiric-security

« back to all changes in this revision

Viewing changes to src/include/parser/parse_coerce.h

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2011-05-11 10:41:53 UTC
  • Revision ID: james.westby@ubuntu.com-20110511104153-psbh2o58553fv1m0
Tags: upstream-9.1~beta1
ImportĀ upstreamĀ versionĀ 9.1~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*-------------------------------------------------------------------------
 
2
 *
 
3
 * parse_coerce.h
 
4
 *      Routines for type coercion.
 
5
 *
 
6
 *
 
7
 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
 
8
 * Portions Copyright (c) 1994, Regents of the University of California
 
9
 *
 
10
 * src/include/parser/parse_coerce.h
 
11
 *
 
12
 *-------------------------------------------------------------------------
 
13
 */
 
14
#ifndef PARSE_COERCE_H
 
15
#define PARSE_COERCE_H
 
16
 
 
17
#include "parser/parse_node.h"
 
18
 
 
19
 
 
20
/* Type categories (see TYPCATEGORY_xxx symbols in catalog/pg_type.h) */
 
21
typedef char TYPCATEGORY;
 
22
 
 
23
/* Result codes for find_coercion_pathway */
 
24
typedef enum CoercionPathType
 
25
{
 
26
        COERCION_PATH_NONE,                     /* failed to find any coercion pathway */
 
27
        COERCION_PATH_FUNC,                     /* apply the specified coercion function */
 
28
        COERCION_PATH_RELABELTYPE,      /* binary-compatible cast, no function */
 
29
        COERCION_PATH_ARRAYCOERCE,      /* need an ArrayCoerceExpr node */
 
30
        COERCION_PATH_COERCEVIAIO       /* need a CoerceViaIO node */
 
31
} CoercionPathType;
 
32
 
 
33
 
 
34
extern bool IsBinaryCoercible(Oid srctype, Oid targettype);
 
35
extern bool IsPreferredType(TYPCATEGORY category, Oid type);
 
36
extern TYPCATEGORY TypeCategory(Oid type);
 
37
 
 
38
extern Node *coerce_to_target_type(ParseState *pstate,
 
39
                                          Node *expr, Oid exprtype,
 
40
                                          Oid targettype, int32 targettypmod,
 
41
                                          CoercionContext ccontext,
 
42
                                          CoercionForm cformat,
 
43
                                          int location);
 
44
extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *target_typeids,
 
45
                                CoercionContext ccontext);
 
46
extern Node *coerce_type(ParseState *pstate, Node *node,
 
47
                        Oid inputTypeId, Oid targetTypeId, int32 targetTypeMod,
 
48
                        CoercionContext ccontext, CoercionForm cformat, int location);
 
49
extern Node *coerce_to_domain(Node *arg, Oid baseTypeId, int32 baseTypeMod,
 
50
                                 Oid typeId,
 
51
                                 CoercionForm cformat, int location,
 
52
                                 bool hideInputCoercion,
 
53
                                 bool lengthCoercionDone);
 
54
 
 
55
extern Node *coerce_to_boolean(ParseState *pstate, Node *node,
 
56
                                  const char *constructName);
 
57
extern Node *coerce_to_specific_type(ParseState *pstate, Node *node,
 
58
                                                Oid targetTypeId,
 
59
                                                const char *constructName);
 
60
 
 
61
extern int parser_coercion_errposition(ParseState *pstate,
 
62
                                                        int coerce_location,
 
63
                                                        Node *input_expr);
 
64
 
 
65
extern Oid select_common_type(ParseState *pstate, List *exprs,
 
66
                                   const char *context, Node **which_expr);
 
67
extern Node *coerce_to_common_type(ParseState *pstate, Node *node,
 
68
                                          Oid targetTypeId,
 
69
                                          const char *context);
 
70
 
 
71
extern bool check_generic_type_consistency(Oid *actual_arg_types,
 
72
                                                           Oid *declared_arg_types,
 
73
                                                           int nargs);
 
74
extern Oid enforce_generic_type_consistency(Oid *actual_arg_types,
 
75
                                                                 Oid *declared_arg_types,
 
76
                                                                 int nargs,
 
77
                                                                 Oid rettype,
 
78
                                                                 bool allow_poly);
 
79
extern Oid resolve_generic_type(Oid declared_type,
 
80
                                         Oid context_actual_type,
 
81
                                         Oid context_declared_type);
 
82
 
 
83
extern CoercionPathType find_coercion_pathway(Oid targetTypeId,
 
84
                                          Oid sourceTypeId,
 
85
                                          CoercionContext ccontext,
 
86
                                          Oid *funcid);
 
87
extern CoercionPathType find_typmod_coercion_function(Oid typeId,
 
88
                                                          Oid *funcid);
 
89
 
 
90
#endif   /* PARSE_COERCE_H */