1998-05-09 19:31:34 -04:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
|
*
|
|
|
|
|
* parse_coerce.h
|
|
|
|
|
*
|
2000-01-16 19:14:49 -05:00
|
|
|
* Routines for type coercion.
|
1998-05-09 19:31:34 -04:00
|
|
|
*
|
2001-01-24 14:43:33 -05:00
|
|
|
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
2000-01-26 00:58:53 -05:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1998-05-09 19:31:34 -04:00
|
|
|
*
|
2002-04-11 16:00:18 -04:00
|
|
|
* $Id: parse_coerce.h,v 1.42 2002/04/11 20:00:15 tgl Exp $
|
1998-05-09 19:31:34 -04:00
|
|
|
*
|
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
|
*/
|
|
|
|
|
#ifndef PARSE_COERCE_H
|
|
|
|
|
#define PARSE_COERCE_H
|
|
|
|
|
|
1999-07-15 11:21:54 -04:00
|
|
|
#include "catalog/pg_type.h"
|
1999-07-16 13:07:40 -04:00
|
|
|
#include "parser/parse_node.h"
|
1999-07-13 21:20:30 -04:00
|
|
|
|
1998-09-01 00:40:42 -04:00
|
|
|
typedef enum CATEGORY
|
|
|
|
|
{
|
2001-10-28 01:26:15 -05:00
|
|
|
INVALID_TYPE,
|
|
|
|
|
UNKNOWN_TYPE,
|
|
|
|
|
BOOLEAN_TYPE,
|
|
|
|
|
STRING_TYPE,
|
|
|
|
|
BITSTRING_TYPE,
|
|
|
|
|
NUMERIC_TYPE,
|
|
|
|
|
DATETIME_TYPE,
|
|
|
|
|
TIMESPAN_TYPE,
|
|
|
|
|
GEOMETRIC_TYPE,
|
|
|
|
|
NETWORK_TYPE,
|
|
|
|
|
USER_TYPE,
|
|
|
|
|
MIXED_TYPE
|
1999-05-25 18:43:53 -04:00
|
|
|
} CATEGORY;
|
1998-05-09 19:31:34 -04:00
|
|
|
|
|
|
|
|
|
2002-03-20 14:45:13 -05:00
|
|
|
extern bool IsBinaryCompatible(Oid type1, Oid type2);
|
1998-05-09 19:31:34 -04:00
|
|
|
extern bool IsPreferredType(CATEGORY category, Oid type);
|
|
|
|
|
extern CATEGORY TypeCategory(Oid type);
|
|
|
|
|
|
2002-04-11 16:00:18 -04:00
|
|
|
extern bool can_coerce_type(int nargs, Oid *input_typeids, Oid *func_typeids,
|
|
|
|
|
bool isExplicit);
|
1999-05-22 00:12:29 -04:00
|
|
|
extern Node *coerce_type(ParseState *pstate, Node *node, Oid inputTypeId,
|
2002-04-11 16:00:18 -04:00
|
|
|
Oid targetTypeId, int32 atttypmod, bool isExplicit);
|
2000-01-16 19:14:49 -05:00
|
|
|
extern Node *coerce_type_typmod(ParseState *pstate, Node *node,
|
2000-04-12 13:17:23 -04:00
|
|
|
Oid targetTypeId, int32 atttypmod);
|
1998-05-09 19:31:34 -04:00
|
|
|
|
2001-06-19 18:39:12 -04:00
|
|
|
extern bool coerce_to_boolean(ParseState *pstate, Node **pnode);
|
|
|
|
|
|
2001-03-21 23:01:46 -05:00
|
|
|
extern Oid select_common_type(List *typeids, const char *context);
|
2000-10-05 15:11:39 -04:00
|
|
|
extern Node *coerce_to_common_type(ParseState *pstate, Node *node,
|
2001-03-21 23:01:46 -05:00
|
|
|
Oid targetTypeId,
|
|
|
|
|
const char *context);
|
2001-10-28 01:26:15 -05:00
|
|
|
|
2001-11-05 12:46:40 -05:00
|
|
|
#endif /* PARSE_COERCE_H */
|