PostgreSQL Source Code  git master
parse_type.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * parse_type.h
4  * handle type operations for parser
5  *
6  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
7  * Portions Copyright (c) 1994, Regents of the University of California
8  *
9  * src/include/parser/parse_type.h
10  *
11  *-------------------------------------------------------------------------
12  */
13 #ifndef PARSE_TYPE_H
14 #define PARSE_TYPE_H
15 
16 #include "access/htup.h"
17 #include "parser/parse_node.h"
18 
19 
20 typedef HeapTuple Type;
21 
22 extern Type LookupTypeName(ParseState *pstate, const TypeName *typeName,
23  int32 *typmod_p, bool missing_ok);
24 extern Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName,
25  bool missing_ok);
26 extern Type typenameType(ParseState *pstate, const TypeName *typeName,
27  int32 *typmod_p);
28 extern Oid typenameTypeId(ParseState *pstate, const TypeName *typeName);
29 extern void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName,
30  Oid *typeid_p, int32 *typmod_p);
31 
32 extern char *TypeNameToString(const TypeName *typeName);
33 extern char *TypeNameListToString(List *typenames);
34 
35 extern Oid LookupCollation(ParseState *pstate, List *collnames, int location);
36 extern Oid GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid);
37 
38 extern Type typeidType(Oid id);
39 
40 extern Oid typeTypeId(Type tp);
41 extern int16 typeLen(Type t);
42 extern bool typeByVal(Type t);
43 extern char *typeTypeName(Type t);
44 extern Oid typeTypeRelid(Type typ);
45 extern Oid typeTypeCollation(Type typ);
46 extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod);
47 
48 extern Oid typeidTypeRelid(Oid type_id);
49 extern Oid typeOrDomainTypeRelid(Oid type_id);
50 
51 extern TypeName *typeStringToTypeName(const char *str);
52 extern void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, bool missing_ok);
53 
54 /* true if typeid is composite, or domain over composite, but not RECORD */
55 #define ISCOMPLEX(typeid) (typeOrDomainTypeRelid(typeid) != InvalidOid)
56 
57 #endif /* PARSE_TYPE_H */
signed short int16
Definition: c.h:293
Oid typeidTypeRelid(Oid type_id)
Definition: parse_type.c:649
char * TypeNameToString(const TypeName *typeName)
Definition: parse_type.c:459
Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, bool missing_ok)
Definition: parse_type.c:215
Datum stringTypeDatum(Type tp, char *string, int32 atttypmod)
Definition: parse_type.c:635
Oid typeTypeRelid(Type typ)
Definition: parse_type.c:611
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:294
int16 typeLen(Type t)
Definition: parse_type.c:580
Oid LookupCollation(ParseState *pstate, List *collnames, int location)
Definition: parse_type.c:496
Type typeidType(Oid id)
Definition: parse_type.c:559
Oid typeTypeId(Type tp)
Definition: parse_type.c:571
char * typeTypeName(Type t)
Definition: parse_type.c:600
Oid typenameTypeId(ParseState *pstate, const TypeName *typeName)
Definition: parse_type.c:274
Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool missing_ok)
Definition: parse_type.c:57
TypeName * typeStringToTypeName(const char *str)
Definition: parse_type.c:721
void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p)
Definition: parse_type.c:293
uintptr_t Datum
Definition: postgres.h:372
char * TypeNameListToString(List *typenames)
Definition: parse_type.c:473
HeapTuple Type
Definition: parse_type.h:20
Oid GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid)
Definition: parse_type.c:521
bool typeByVal(Type t)
Definition: parse_type.c:590
Oid typeOrDomainTypeRelid(Oid type_id)
Definition: parse_type.c:670
Type typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p)
Definition: parse_type.c:247
void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, bool missing_ok)
Definition: parse_type.c:815
Oid typeTypeCollation(Type typ)
Definition: parse_type.c:621
Definition: pg_list.h:45