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); |
24 | extern Type LookupTypeNameExtended(ParseState *pstate, |
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 */ |
61 | |