PostgreSQL Source Code  git master
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-2024, 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
16 #include "access/htup.h"
17 #include "parser/parse_node.h"
20 typedef HeapTuple Type;
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);
35 extern char *TypeNameToString(const TypeName *typeName);
36 extern char *TypeNameListToString(List *typenames);
38 extern Oid LookupCollation(ParseState *pstate, List *collnames, int location);
39 extern Oid GetColumnDefCollation(ParseState *pstate, const ColumnDef *coldef, Oid typeOid);
41 extern Type typeidType(Oid id);
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);
51 extern Oid typeidTypeRelid(Oid type_id);
52 extern Oid typeOrDomainTypeRelid(Oid type_id);
54 extern TypeName *typeStringToTypeName(const char *str, Node *escontext);
55 extern bool parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p,
56  Node *escontext);
58 /* true if typeid is composite, or domain over composite, but not RECORD */
59 #define ISCOMPLEX(typeid) (typeOrDomainTypeRelid(typeid) != InvalidOid)
61 #endif /* PARSE_TYPE_H */
signed short int16
Definition: c.h:493
signed int int32
Definition: c.h:494
const char * str
const char ** typenames
Definition: lexi.c:115
Oid typeTypeRelid(Type typ)
Definition: parse_type.c:630
Oid typeOrDomainTypeRelid(Oid type_id)
Definition: parse_type.c:689
HeapTuple Type
Definition: parse_type.h:20
Type typeidType(Oid id)
Definition: parse_type.c:578
Oid LookupCollation(ParseState *pstate, List *collnames, int location)
Definition: parse_type.c:515
Type LookupTypeNameExtended(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool temp_ok, bool missing_ok)
Definition: parse_type.c:73
Oid typeTypeCollation(Type typ)
Definition: parse_type.c:640
void typenameTypeIdAndMod(ParseState *pstate, const TypeName *typeName, Oid *typeid_p, int32 *typmod_p)
Definition: parse_type.c:310
char * TypeNameListToString(List *typenames)
Definition: parse_type.c:492
bool parseTypeString(const char *str, Oid *typeid_p, int32 *typmod_p, Node *escontext)
Definition: parse_type.c:785
Type LookupTypeName(ParseState *pstate, const TypeName *typeName, int32 *typmod_p, bool missing_ok)
Definition: parse_type.c:38
Oid typeidTypeRelid(Oid type_id)
Definition: parse_type.c:668
char * TypeNameToString(const TypeName *typeName)
Definition: parse_type.c:478
Datum stringTypeDatum(Type tp, char *string, int32 atttypmod)
Definition: parse_type.c:654
Type typenameType(ParseState *pstate, const TypeName *typeName, int32 *typmod_p)
Definition: parse_type.c:264
TypeName * typeStringToTypeName(const char *str, Node *escontext)
Definition: parse_type.c:738
bool typeByVal(Type t)
Definition: parse_type.c:609
Oid GetColumnDefCollation(ParseState *pstate, const ColumnDef *coldef, Oid typeOid)
Definition: parse_type.c:540
Oid typeTypeId(Type tp)
Definition: parse_type.c:590
Oid typenameTypeId(ParseState *pstate, const TypeName *typeName)
Definition: parse_type.c:291
int16 typeLen(Type t)
Definition: parse_type.c:599
Oid LookupTypeNameOid(ParseState *pstate, const TypeName *typeName, bool missing_ok)
Definition: parse_type.c:232
char * typeTypeName(Type t)
Definition: parse_type.c:619
uintptr_t Datum
Definition: postgres.h:64
unsigned int Oid
Definition: postgres_ext.h:31
Definition: pg_list.h:54
Definition: nodes.h:129