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-2019, 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);
25  const TypeName *typeName, int32 *typmod_p,
26  bool temp_ok, bool missing_ok);
27 extern Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName,
28  bool missing_ok);
29 extern Type typenameType(ParseState *pstate, const TypeName *typeName,
30  int32 *typmod_p);
31 extern Oid typenameTypeId(ParseState *pstate, const TypeName *typeName);
32 extern void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName,
33  Oid *typeid_p, int32 *typmod_p);
34 
35 extern char *TypeNameToString(const TypeName *typeName);
36 extern char *TypeNameListToString(List *typenames);
37 
38 extern Oid LookupCollation(ParseState *pstate, List *collnames, int location);
39 extern Oid GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid);
40 
41 extern Type typeidType(Oid id);
42 
43 extern Oid typeTypeId(Type tp);
44 extern int16 typeLen(Type t);
45 extern bool typeByVal(Type t);
46 extern char *typeTypeName(Type t);
47 extern Oid typeTypeRelid(Type typ);
48 extern Oid typeTypeCollation(Type typ);
49 extern Datum stringTypeDatum(Type tp, char *string, int32 atttypmod);
50 
51 extern Oid typeidTypeRelid(Oid type_id);
52 extern Oid typeOrDomainTypeRelid(Oid type_id);
53 
54 extern TypeName *typeStringToTypeName(const char *str);
55 extern void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, bool missing_ok);
56 
57 /* true if typeid is composite, or domain over composite, but not RECORD */
58 #define ISCOMPLEX(typeid) (typeOrDomainTypeRelid(typeid) != InvalidOid)
59 
60 #endif /* PARSE_TYPE_H */
signed short int16
Definition: c.h:345
Oid typeidTypeRelid(Oid type_id)
Definition: parse_type.c:667
char * TypeNameToString(const TypeName *typeName)
Definition: parse_type.c:477
Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, bool missing_ok)
Definition: parse_type.c:233
Datum stringTypeDatum(Type tp, char *string, int32 atttypmod)
Definition: parse_type.c:653
Oid typeTypeRelid(Type typ)
Definition: parse_type.c:629
unsigned int Oid
Definition: postgres_ext.h:31
signed int int32
Definition: c.h:346
int16 typeLen(Type t)
Definition: parse_type.c:598
Oid LookupCollation(ParseState *pstate, List *collnames, int location)
Definition: parse_type.c:514
Type typeidType(Oid id)
Definition: parse_type.c:577
Oid typeTypeId(Type tp)
Definition: parse_type.c:589
char * typeTypeName(Type t)
Definition: parse_type.c:618
Oid typenameTypeId(ParseState *pstate, const TypeName *typeName)
Definition: parse_type.c:292
Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool missing_ok)
Definition: parse_type.c:39
TypeName * typeStringToTypeName(const char *str)
Definition: parse_type.c:739
void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p)
Definition: parse_type.c:311
uintptr_t Datum
Definition: postgres.h:367
char * TypeNameListToString(List *typenames)
Definition: parse_type.c:491
HeapTuple Type
Definition: parse_type.h:20
Oid GetColumnDefCollation(ParseState *pstate, ColumnDef *coldef, Oid typeOid)
Definition: parse_type.c:539
Type LookupTypeNameExtended(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool temp_ok, bool missing_ok)
Definition: parse_type.c:74
bool typeByVal(Type t)
Definition: parse_type.c:608
Oid typeOrDomainTypeRelid(Oid type_id)
Definition: parse_type.c:688
Type typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p)
Definition: parse_type.c:265
void parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, bool missing_ok)
Definition: parse_type.c:833
Oid typeTypeCollation(Type typ)
Definition: parse_type.c:639
Definition: pg_list.h:50