Update codegen to Postgres 12

They've removed the old header files so some updates were required
This commit is contained in:
Steven Fackler 2019-10-07 16:37:25 -07:00
parent d8b5412602
commit 42f1f9675c
6 changed files with 878 additions and 966 deletions

31
codegen/src/pg_range.dat Normal file
View File

@ -0,0 +1,31 @@
#----------------------------------------------------------------------
#
# pg_range.dat
# Initial contents of the pg_range system catalog.
#
# Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# src/include/catalog/pg_range.dat
#
#----------------------------------------------------------------------
[
{ rngtypid => 'int4range', rngsubtype => 'int4', rngsubopc => 'btree/int4_ops',
rngcanonical => 'int4range_canonical', rngsubdiff => 'int4range_subdiff' },
{ rngtypid => 'numrange', rngsubtype => 'numeric',
rngsubopc => 'btree/numeric_ops', rngcanonical => '-',
rngsubdiff => 'numrange_subdiff' },
{ rngtypid => 'tsrange', rngsubtype => 'timestamp',
rngsubopc => 'btree/timestamp_ops', rngcanonical => '-',
rngsubdiff => 'tsrange_subdiff' },
{ rngtypid => 'tstzrange', rngsubtype => 'timestamptz',
rngsubopc => 'btree/timestamptz_ops', rngcanonical => '-',
rngsubdiff => 'tstzrange_subdiff' },
{ rngtypid => 'daterange', rngsubtype => 'date', rngsubopc => 'btree/date_ops',
rngcanonical => 'daterange_canonical', rngsubdiff => 'daterange_subdiff' },
{ rngtypid => 'int8range', rngsubtype => 'int8', rngsubopc => 'btree/int8_ops',
rngcanonical => 'int8range_canonical', rngsubdiff => 'int8range_subdiff' },
]

View File

@ -1,85 +0,0 @@
/*-------------------------------------------------------------------------
*
* pg_range.h
* definition of the system "range" relation (pg_range)
* along with the relation's initial contents.
*
*
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_range.h
*
* NOTES
* the genbki.pl script reads this file and generates .bki
* information from the DATA() statements.
*
* XXX do NOT break up DATA() statements into multiple lines!
* the scripts are not as smart as you might think...
*
*-------------------------------------------------------------------------
*/
#ifndef PG_RANGE_H
#define PG_RANGE_H
#include "catalog/genbki.h"
/* ----------------
* pg_range definition. cpp turns this into
* typedef struct FormData_pg_range
* ----------------
*/
#define RangeRelationId 3541
CATALOG(pg_range,3541) BKI_WITHOUT_OIDS
{
Oid rngtypid; /* OID of owning range type */
Oid rngsubtype; /* OID of range's element type (subtype) */
Oid rngcollation; /* collation for this range type, or 0 */
Oid rngsubopc; /* subtype's btree opclass */
regproc rngcanonical; /* canonicalize range, or 0 */
regproc rngsubdiff; /* subtype difference as a float8, or 0 */
} FormData_pg_range;
/* ----------------
* Form_pg_range corresponds to a pointer to a tuple with
* the format of pg_range relation.
* ----------------
*/
typedef FormData_pg_range *Form_pg_range;
/* ----------------
* compiler constants for pg_range
* ----------------
*/
#define Natts_pg_range 6
#define Anum_pg_range_rngtypid 1
#define Anum_pg_range_rngsubtype 2
#define Anum_pg_range_rngcollation 3
#define Anum_pg_range_rngsubopc 4
#define Anum_pg_range_rngcanonical 5
#define Anum_pg_range_rngsubdiff 6
/* ----------------
* initial contents of pg_range
* ----------------
*/
DATA(insert ( 3904 23 0 1978 int4range_canonical int4range_subdiff));
DATA(insert ( 3906 1700 0 3125 - numrange_subdiff));
DATA(insert ( 3908 1114 0 3128 - tsrange_subdiff));
DATA(insert ( 3910 1184 0 3127 - tstzrange_subdiff));
DATA(insert ( 3912 1082 0 3122 daterange_canonical daterange_subdiff));
DATA(insert ( 3926 20 0 3124 int8range_canonical int8range_subdiff));
/*
* prototypes for functions in pg_range.c
*/
extern void RangeCreate(Oid rangeTypeOid, Oid rangeSubType, Oid rangeCollation,
Oid rangeSubOpclass, RegProcedure rangeCanonical,
RegProcedure rangeSubDiff);
extern void RangeDelete(Oid rangeTypeOid);
#endif /* PG_RANGE_H */

598
codegen/src/pg_type.dat Normal file
View File

@ -0,0 +1,598 @@
#----------------------------------------------------------------------
#
# pg_type.dat
# Initial contents of the pg_type system catalog.
#
# Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
# src/include/catalog/pg_type.dat
#
#----------------------------------------------------------------------
[
# For types used in the system catalogs, make sure the values here match
# TypInfo[] in bootstrap.c.
# OID symbol macro names for pg_type OIDs are generated by genbki.pl
# according to the following rule, so you don't need to specify them
# here:
# foo_bar -> FOO_BAROID
# _foo_bar -> FOO_BARARRAYOID
#
# The only oid_symbol entries in this file are for names that don't match
# this rule, and are grandfathered in.
# To autogenerate an array type, add 'array_type_oid => 'nnnn' to the element
# type, which will instruct genbki.pl to generate a BKI entry for it.
# In a few cases, the array type's properties don't match the normal pattern
# so it can't be autogenerated; in such cases do not write array_type_oid.
# Once upon a time these entries were ordered by OID. Lately it's often
# been the custom to insert new entries adjacent to related older entries.
# Try to do one or the other though, don't just insert entries at random.
# OIDS 1 - 99
{ oid => '16', array_type_oid => '1000',
descr => 'boolean, \'true\'/\'false\'',
typname => 'bool', typlen => '1', typbyval => 't', typcategory => 'B',
typispreferred => 't', typinput => 'boolin', typoutput => 'boolout',
typreceive => 'boolrecv', typsend => 'boolsend', typalign => 'c' },
{ oid => '17', array_type_oid => '1001',
descr => 'variable-length string, binary values escaped',
typname => 'bytea', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'byteain', typoutput => 'byteaout', typreceive => 'bytearecv',
typsend => 'byteasend', typalign => 'i', typstorage => 'x' },
{ oid => '18', array_type_oid => '1002', descr => 'single character',
typname => 'char', typlen => '1', typbyval => 't', typcategory => 'S',
typinput => 'charin', typoutput => 'charout', typreceive => 'charrecv',
typsend => 'charsend', typalign => 'c' },
{ oid => '19', array_type_oid => '1003',
descr => '63-byte type for storing system identifiers',
typname => 'name', typlen => 'NAMEDATALEN', typbyval => 'f',
typcategory => 'S', typelem => 'char', typinput => 'namein',
typoutput => 'nameout', typreceive => 'namerecv', typsend => 'namesend',
typalign => 'c', typcollation => 'C' },
{ oid => '20', array_type_oid => '1016',
descr => '~18 digit integer, 8-byte storage',
typname => 'int8', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
typcategory => 'N', typinput => 'int8in', typoutput => 'int8out',
typreceive => 'int8recv', typsend => 'int8send', typalign => 'd' },
{ oid => '21', array_type_oid => '1005',
descr => '-32 thousand to 32 thousand, 2-byte storage',
typname => 'int2', typlen => '2', typbyval => 't', typcategory => 'N',
typinput => 'int2in', typoutput => 'int2out', typreceive => 'int2recv',
typsend => 'int2send', typalign => 's' },
{ oid => '22', array_type_oid => '1006',
descr => 'array of int2, used in system tables',
typname => 'int2vector', typlen => '-1', typbyval => 'f', typcategory => 'A',
typelem => 'int2', typinput => 'int2vectorin', typoutput => 'int2vectorout',
typreceive => 'int2vectorrecv', typsend => 'int2vectorsend',
typalign => 'i' },
{ oid => '23', array_type_oid => '1007',
descr => '-2 billion to 2 billion integer, 4-byte storage',
typname => 'int4', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'int4in', typoutput => 'int4out', typreceive => 'int4recv',
typsend => 'int4send', typalign => 'i' },
{ oid => '24', array_type_oid => '1008', descr => 'registered procedure',
typname => 'regproc', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regprocin', typoutput => 'regprocout',
typreceive => 'regprocrecv', typsend => 'regprocsend', typalign => 'i' },
{ oid => '25', array_type_oid => '1009',
descr => 'variable-length string, no limit specified',
typname => 'text', typlen => '-1', typbyval => 'f', typcategory => 'S',
typispreferred => 't', typinput => 'textin', typoutput => 'textout',
typreceive => 'textrecv', typsend => 'textsend', typalign => 'i',
typstorage => 'x', typcollation => 'default' },
{ oid => '26', array_type_oid => '1028',
descr => 'object identifier(oid), maximum 4 billion',
typname => 'oid', typlen => '4', typbyval => 't', typcategory => 'N',
typispreferred => 't', typinput => 'oidin', typoutput => 'oidout',
typreceive => 'oidrecv', typsend => 'oidsend', typalign => 'i' },
{ oid => '27', array_type_oid => '1010',
descr => '(block, offset), physical location of tuple',
typname => 'tid', typlen => '6', typbyval => 'f', typcategory => 'U',
typinput => 'tidin', typoutput => 'tidout', typreceive => 'tidrecv',
typsend => 'tidsend', typalign => 's' },
{ oid => '28', array_type_oid => '1011', descr => 'transaction id',
typname => 'xid', typlen => '4', typbyval => 't', typcategory => 'U',
typinput => 'xidin', typoutput => 'xidout', typreceive => 'xidrecv',
typsend => 'xidsend', typalign => 'i' },
{ oid => '29', array_type_oid => '1012',
descr => 'command identifier type, sequence in transaction id',
typname => 'cid', typlen => '4', typbyval => 't', typcategory => 'U',
typinput => 'cidin', typoutput => 'cidout', typreceive => 'cidrecv',
typsend => 'cidsend', typalign => 'i' },
{ oid => '30', array_type_oid => '1013',
descr => 'array of oids, used in system tables',
typname => 'oidvector', typlen => '-1', typbyval => 'f', typcategory => 'A',
typelem => 'oid', typinput => 'oidvectorin', typoutput => 'oidvectorout',
typreceive => 'oidvectorrecv', typsend => 'oidvectorsend', typalign => 'i' },
# hand-built rowtype entries for bootstrapped catalogs
# NB: OIDs assigned here must match the BKI_ROWTYPE_OID declarations
{ oid => '71',
typname => 'pg_type', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => 'pg_type', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
{ oid => '75',
typname => 'pg_attribute', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => 'pg_attribute', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
{ oid => '81',
typname => 'pg_proc', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => 'pg_proc', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
{ oid => '83',
typname => 'pg_class', typlen => '-1', typbyval => 'f', typtype => 'c',
typcategory => 'C', typrelid => 'pg_class', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
# OIDS 100 - 199
{ oid => '114', array_type_oid => '199', descr => 'JSON stored as text',
typname => 'json', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'json_in', typoutput => 'json_out', typreceive => 'json_recv',
typsend => 'json_send', typalign => 'i', typstorage => 'x' },
{ oid => '142', array_type_oid => '143', descr => 'XML content',
typname => 'xml', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'xml_in', typoutput => 'xml_out', typreceive => 'xml_recv',
typsend => 'xml_send', typalign => 'i', typstorage => 'x' },
{ oid => '194', oid_symbol => 'PGNODETREEOID',
descr => 'string representing an internal node tree',
typname => 'pg_node_tree', typlen => '-1', typbyval => 'f',
typcategory => 'S', typinput => 'pg_node_tree_in',
typoutput => 'pg_node_tree_out', typreceive => 'pg_node_tree_recv',
typsend => 'pg_node_tree_send', typalign => 'i', typstorage => 'x',
typcollation => 'default' },
{ oid => '3361', oid_symbol => 'PGNDISTINCTOID',
descr => 'multivariate ndistinct coefficients',
typname => 'pg_ndistinct', typlen => '-1', typbyval => 'f',
typcategory => 'S', typinput => 'pg_ndistinct_in',
typoutput => 'pg_ndistinct_out', typreceive => 'pg_ndistinct_recv',
typsend => 'pg_ndistinct_send', typalign => 'i', typstorage => 'x',
typcollation => 'default' },
{ oid => '3402', oid_symbol => 'PGDEPENDENCIESOID',
descr => 'multivariate dependencies',
typname => 'pg_dependencies', typlen => '-1', typbyval => 'f',
typcategory => 'S', typinput => 'pg_dependencies_in',
typoutput => 'pg_dependencies_out', typreceive => 'pg_dependencies_recv',
typsend => 'pg_dependencies_send', typalign => 'i', typstorage => 'x',
typcollation => 'default' },
{ oid => '5017', oid_symbol => 'PGMCVLISTOID',
descr => 'multivariate MCV list',
typname => 'pg_mcv_list', typlen => '-1', typbyval => 'f', typcategory => 'S',
typinput => 'pg_mcv_list_in', typoutput => 'pg_mcv_list_out',
typreceive => 'pg_mcv_list_recv', typsend => 'pg_mcv_list_send',
typalign => 'i', typstorage => 'x', typcollation => 'default' },
{ oid => '32', oid_symbol => 'PGDDLCOMMANDOID',
descr => 'internal type for passing CollectedCommand',
typname => 'pg_ddl_command', typlen => 'SIZEOF_POINTER', typbyval => 't',
typtype => 'p', typcategory => 'P', typinput => 'pg_ddl_command_in',
typoutput => 'pg_ddl_command_out', typreceive => 'pg_ddl_command_recv',
typsend => 'pg_ddl_command_send', typalign => 'ALIGNOF_POINTER' },
# OIDS 600 - 699
{ oid => '600', array_type_oid => '1017',
descr => 'geometric point \'(x, y)\'',
typname => 'point', typlen => '16', typbyval => 'f', typcategory => 'G',
typelem => 'float8', typinput => 'point_in', typoutput => 'point_out',
typreceive => 'point_recv', typsend => 'point_send', typalign => 'd' },
{ oid => '601', array_type_oid => '1018',
descr => 'geometric line segment \'(pt1,pt2)\'',
typname => 'lseg', typlen => '32', typbyval => 'f', typcategory => 'G',
typelem => 'point', typinput => 'lseg_in', typoutput => 'lseg_out',
typreceive => 'lseg_recv', typsend => 'lseg_send', typalign => 'd' },
{ oid => '602', array_type_oid => '1019',
descr => 'geometric path \'(pt1,...)\'',
typname => 'path', typlen => '-1', typbyval => 'f', typcategory => 'G',
typinput => 'path_in', typoutput => 'path_out', typreceive => 'path_recv',
typsend => 'path_send', typalign => 'd', typstorage => 'x' },
{ oid => '603', array_type_oid => '1020',
descr => 'geometric box \'(lower left,upper right)\'',
typname => 'box', typlen => '32', typbyval => 'f', typcategory => 'G',
typdelim => ';', typelem => 'point', typinput => 'box_in',
typoutput => 'box_out', typreceive => 'box_recv', typsend => 'box_send',
typalign => 'd' },
{ oid => '604', array_type_oid => '1027',
descr => 'geometric polygon \'(pt1,...)\'',
typname => 'polygon', typlen => '-1', typbyval => 'f', typcategory => 'G',
typinput => 'poly_in', typoutput => 'poly_out', typreceive => 'poly_recv',
typsend => 'poly_send', typalign => 'd', typstorage => 'x' },
{ oid => '628', array_type_oid => '629', descr => 'geometric line',
typname => 'line', typlen => '24', typbyval => 'f', typcategory => 'G',
typelem => 'float8', typinput => 'line_in', typoutput => 'line_out',
typreceive => 'line_recv', typsend => 'line_send', typalign => 'd' },
# OIDS 700 - 799
{ oid => '700', array_type_oid => '1021',
descr => 'single-precision floating point number, 4-byte storage',
typname => 'float4', typlen => '4', typbyval => 'FLOAT4PASSBYVAL',
typcategory => 'N', typinput => 'float4in', typoutput => 'float4out',
typreceive => 'float4recv', typsend => 'float4send', typalign => 'i' },
{ oid => '701', array_type_oid => '1022',
descr => 'double-precision floating point number, 8-byte storage',
typname => 'float8', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
typcategory => 'N', typispreferred => 't', typinput => 'float8in',
typoutput => 'float8out', typreceive => 'float8recv', typsend => 'float8send',
typalign => 'd' },
{ oid => '705', descr => 'pseudo-type representing an undetermined type',
typname => 'unknown', typlen => '-2', typbyval => 'f', typtype => 'p',
typcategory => 'X', typinput => 'unknownin', typoutput => 'unknownout',
typreceive => 'unknownrecv', typsend => 'unknownsend', typalign => 'c' },
{ oid => '718', array_type_oid => '719',
descr => 'geometric circle \'(center,radius)\'',
typname => 'circle', typlen => '24', typbyval => 'f', typcategory => 'G',
typinput => 'circle_in', typoutput => 'circle_out',
typreceive => 'circle_recv', typsend => 'circle_send', typalign => 'd' },
{ oid => '790', oid_symbol => 'CASHOID', array_type_oid => '791',
descr => 'monetary amounts, $d,ddd.cc',
typname => 'money', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
typcategory => 'N', typinput => 'cash_in', typoutput => 'cash_out',
typreceive => 'cash_recv', typsend => 'cash_send', typalign => 'd' },
# OIDS 800 - 899
{ oid => '829', array_type_oid => '1040',
descr => 'XX:XX:XX:XX:XX:XX, MAC address',
typname => 'macaddr', typlen => '6', typbyval => 'f', typcategory => 'U',
typinput => 'macaddr_in', typoutput => 'macaddr_out',
typreceive => 'macaddr_recv', typsend => 'macaddr_send', typalign => 'i' },
{ oid => '869', array_type_oid => '1041',
descr => 'IP address/netmask, host address, netmask optional',
typname => 'inet', typlen => '-1', typbyval => 'f', typcategory => 'I',
typispreferred => 't', typinput => 'inet_in', typoutput => 'inet_out',
typreceive => 'inet_recv', typsend => 'inet_send', typalign => 'i',
typstorage => 'm' },
{ oid => '650', array_type_oid => '651',
descr => 'network IP address/netmask, network address',
typname => 'cidr', typlen => '-1', typbyval => 'f', typcategory => 'I',
typinput => 'cidr_in', typoutput => 'cidr_out', typreceive => 'cidr_recv',
typsend => 'cidr_send', typalign => 'i', typstorage => 'm' },
{ oid => '774', array_type_oid => '775',
descr => 'XX:XX:XX:XX:XX:XX:XX:XX, MAC address',
typname => 'macaddr8', typlen => '8', typbyval => 'f', typcategory => 'U',
typinput => 'macaddr8_in', typoutput => 'macaddr8_out',
typreceive => 'macaddr8_recv', typsend => 'macaddr8_send', typalign => 'i' },
# OIDS 1000 - 1099
{ oid => '1033', array_type_oid => '1034', descr => 'access control list',
typname => 'aclitem', typlen => '12', typbyval => 'f', typcategory => 'U',
typinput => 'aclitemin', typoutput => 'aclitemout', typreceive => '-',
typsend => '-', typalign => 'i' },
{ oid => '1042', array_type_oid => '1014',
descr => 'char(length), blank-padded string, fixed storage length',
typname => 'bpchar', typlen => '-1', typbyval => 'f', typcategory => 'S',
typinput => 'bpcharin', typoutput => 'bpcharout', typreceive => 'bpcharrecv',
typsend => 'bpcharsend', typmodin => 'bpchartypmodin',
typmodout => 'bpchartypmodout', typalign => 'i', typstorage => 'x',
typcollation => 'default' },
{ oid => '1043', array_type_oid => '1015',
descr => 'varchar(length), non-blank-padded string, variable storage length',
typname => 'varchar', typlen => '-1', typbyval => 'f', typcategory => 'S',
typinput => 'varcharin', typoutput => 'varcharout',
typreceive => 'varcharrecv', typsend => 'varcharsend',
typmodin => 'varchartypmodin', typmodout => 'varchartypmodout',
typalign => 'i', typstorage => 'x', typcollation => 'default' },
{ oid => '1082', array_type_oid => '1182', descr => 'date',
typname => 'date', typlen => '4', typbyval => 't', typcategory => 'D',
typinput => 'date_in', typoutput => 'date_out', typreceive => 'date_recv',
typsend => 'date_send', typalign => 'i' },
{ oid => '1083', array_type_oid => '1183', descr => 'time of day',
typname => 'time', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
typcategory => 'D', typinput => 'time_in', typoutput => 'time_out',
typreceive => 'time_recv', typsend => 'time_send', typmodin => 'timetypmodin',
typmodout => 'timetypmodout', typalign => 'd' },
# OIDS 1100 - 1199
{ oid => '1114', array_type_oid => '1115', descr => 'date and time',
typname => 'timestamp', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
typcategory => 'D', typinput => 'timestamp_in', typoutput => 'timestamp_out',
typreceive => 'timestamp_recv', typsend => 'timestamp_send',
typmodin => 'timestamptypmodin', typmodout => 'timestamptypmodout',
typalign => 'd' },
{ oid => '1184', array_type_oid => '1185',
descr => 'date and time with time zone',
typname => 'timestamptz', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
typcategory => 'D', typispreferred => 't', typinput => 'timestamptz_in',
typoutput => 'timestamptz_out', typreceive => 'timestamptz_recv',
typsend => 'timestamptz_send', typmodin => 'timestamptztypmodin',
typmodout => 'timestamptztypmodout', typalign => 'd' },
{ oid => '1186', array_type_oid => '1187',
descr => '@ <number> <units>, time interval',
typname => 'interval', typlen => '16', typbyval => 'f', typcategory => 'T',
typispreferred => 't', typinput => 'interval_in', typoutput => 'interval_out',
typreceive => 'interval_recv', typsend => 'interval_send',
typmodin => 'intervaltypmodin', typmodout => 'intervaltypmodout',
typalign => 'd' },
# OIDS 1200 - 1299
{ oid => '1266', array_type_oid => '1270',
descr => 'time of day with time zone',
typname => 'timetz', typlen => '12', typbyval => 'f', typcategory => 'D',
typinput => 'timetz_in', typoutput => 'timetz_out',
typreceive => 'timetz_recv', typsend => 'timetz_send',
typmodin => 'timetztypmodin', typmodout => 'timetztypmodout',
typalign => 'd' },
# OIDS 1500 - 1599
{ oid => '1560', array_type_oid => '1561', descr => 'fixed-length bit string',
typname => 'bit', typlen => '-1', typbyval => 'f', typcategory => 'V',
typinput => 'bit_in', typoutput => 'bit_out', typreceive => 'bit_recv',
typsend => 'bit_send', typmodin => 'bittypmodin', typmodout => 'bittypmodout',
typalign => 'i', typstorage => 'x' },
{ oid => '1562', array_type_oid => '1563',
descr => 'variable-length bit string',
typname => 'varbit', typlen => '-1', typbyval => 'f', typcategory => 'V',
typispreferred => 't', typinput => 'varbit_in', typoutput => 'varbit_out',
typreceive => 'varbit_recv', typsend => 'varbit_send',
typmodin => 'varbittypmodin', typmodout => 'varbittypmodout', typalign => 'i',
typstorage => 'x' },
# OIDS 1700 - 1799
{ oid => '1700', array_type_oid => '1231',
descr => 'numeric(precision, decimal), arbitrary precision number',
typname => 'numeric', typlen => '-1', typbyval => 'f', typcategory => 'N',
typinput => 'numeric_in', typoutput => 'numeric_out',
typreceive => 'numeric_recv', typsend => 'numeric_send',
typmodin => 'numerictypmodin', typmodout => 'numerictypmodout',
typalign => 'i', typstorage => 'm' },
{ oid => '1790', array_type_oid => '2201',
descr => 'reference to cursor (portal name)',
typname => 'refcursor', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'textin', typoutput => 'textout', typreceive => 'textrecv',
typsend => 'textsend', typalign => 'i', typstorage => 'x' },
# OIDS 2200 - 2299
{ oid => '2202', array_type_oid => '2207',
descr => 'registered procedure (with args)',
typname => 'regprocedure', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regprocedurein', typoutput => 'regprocedureout',
typreceive => 'regprocedurerecv', typsend => 'regproceduresend',
typalign => 'i' },
{ oid => '2203', array_type_oid => '2208', descr => 'registered operator',
typname => 'regoper', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regoperin', typoutput => 'regoperout',
typreceive => 'regoperrecv', typsend => 'regopersend', typalign => 'i' },
{ oid => '2204', array_type_oid => '2209',
descr => 'registered operator (with args)',
typname => 'regoperator', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regoperatorin', typoutput => 'regoperatorout',
typreceive => 'regoperatorrecv', typsend => 'regoperatorsend',
typalign => 'i' },
{ oid => '2205', array_type_oid => '2210', descr => 'registered class',
typname => 'regclass', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regclassin', typoutput => 'regclassout',
typreceive => 'regclassrecv', typsend => 'regclasssend', typalign => 'i' },
{ oid => '2206', array_type_oid => '2211', descr => 'registered type',
typname => 'regtype', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regtypein', typoutput => 'regtypeout',
typreceive => 'regtyperecv', typsend => 'regtypesend', typalign => 'i' },
{ oid => '4096', array_type_oid => '4097', descr => 'registered role',
typname => 'regrole', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regrolein', typoutput => 'regroleout',
typreceive => 'regrolerecv', typsend => 'regrolesend', typalign => 'i' },
{ oid => '4089', array_type_oid => '4090', descr => 'registered namespace',
typname => 'regnamespace', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regnamespacein', typoutput => 'regnamespaceout',
typreceive => 'regnamespacerecv', typsend => 'regnamespacesend',
typalign => 'i' },
# uuid
{ oid => '2950', array_type_oid => '2951', descr => 'UUID datatype',
typname => 'uuid', typlen => '16', typbyval => 'f', typcategory => 'U',
typinput => 'uuid_in', typoutput => 'uuid_out', typreceive => 'uuid_recv',
typsend => 'uuid_send', typalign => 'c' },
# pg_lsn
{ oid => '3220', oid_symbol => 'LSNOID', array_type_oid => '3221',
descr => 'PostgreSQL LSN datatype',
typname => 'pg_lsn', typlen => '8', typbyval => 'FLOAT8PASSBYVAL',
typcategory => 'U', typinput => 'pg_lsn_in', typoutput => 'pg_lsn_out',
typreceive => 'pg_lsn_recv', typsend => 'pg_lsn_send', typalign => 'd' },
# text search
{ oid => '3614', array_type_oid => '3643',
descr => 'text representation for text search',
typname => 'tsvector', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'tsvectorin', typoutput => 'tsvectorout',
typreceive => 'tsvectorrecv', typsend => 'tsvectorsend',
typanalyze => 'ts_typanalyze', typalign => 'i', typstorage => 'x' },
{ oid => '3642', array_type_oid => '3644',
descr => 'GiST index internal text representation for text search',
typname => 'gtsvector', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'gtsvectorin', typoutput => 'gtsvectorout', typreceive => '-',
typsend => '-', typalign => 'i' },
{ oid => '3615', array_type_oid => '3645',
descr => 'query representation for text search',
typname => 'tsquery', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'tsqueryin', typoutput => 'tsqueryout',
typreceive => 'tsqueryrecv', typsend => 'tsquerysend', typalign => 'i' },
{ oid => '3734', array_type_oid => '3735',
descr => 'registered text search configuration',
typname => 'regconfig', typlen => '4', typbyval => 't', typcategory => 'N',
typinput => 'regconfigin', typoutput => 'regconfigout',
typreceive => 'regconfigrecv', typsend => 'regconfigsend', typalign => 'i' },
{ oid => '3769', array_type_oid => '3770',
descr => 'registered text search dictionary',
typname => 'regdictionary', typlen => '4', typbyval => 't',
typcategory => 'N', typinput => 'regdictionaryin',
typoutput => 'regdictionaryout', typreceive => 'regdictionaryrecv',
typsend => 'regdictionarysend', typalign => 'i' },
# jsonb
{ oid => '3802', array_type_oid => '3807', descr => 'Binary JSON',
typname => 'jsonb', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'jsonb_in', typoutput => 'jsonb_out', typreceive => 'jsonb_recv',
typsend => 'jsonb_send', typalign => 'i', typstorage => 'x' },
{ oid => '4072', array_type_oid => '4073', descr => 'JSON path',
typname => 'jsonpath', typlen => '-1', typbyval => 'f', typcategory => 'U',
typinput => 'jsonpath_in', typoutput => 'jsonpath_out',
typreceive => 'jsonpath_recv', typsend => 'jsonpath_send', typalign => 'i',
typstorage => 'x' },
{ oid => '2970', array_type_oid => '2949', descr => 'txid snapshot',
typname => 'txid_snapshot', typlen => '-1', typbyval => 'f',
typcategory => 'U', typinput => 'txid_snapshot_in',
typoutput => 'txid_snapshot_out', typreceive => 'txid_snapshot_recv',
typsend => 'txid_snapshot_send', typalign => 'd', typstorage => 'x' },
# range types
{ oid => '3904', array_type_oid => '3905', descr => 'range of integers',
typname => 'int4range', typlen => '-1', typbyval => 'f', typtype => 'r',
typcategory => 'R', typinput => 'range_in', typoutput => 'range_out',
typreceive => 'range_recv', typsend => 'range_send',
typanalyze => 'range_typanalyze', typalign => 'i', typstorage => 'x' },
{ oid => '3906', array_type_oid => '3907', descr => 'range of numerics',
typname => 'numrange', typlen => '-1', typbyval => 'f', typtype => 'r',
typcategory => 'R', typinput => 'range_in', typoutput => 'range_out',
typreceive => 'range_recv', typsend => 'range_send',
typanalyze => 'range_typanalyze', typalign => 'i', typstorage => 'x' },
{ oid => '3908', array_type_oid => '3909',
descr => 'range of timestamps without time zone',
typname => 'tsrange', typlen => '-1', typbyval => 'f', typtype => 'r',
typcategory => 'R', typinput => 'range_in', typoutput => 'range_out',
typreceive => 'range_recv', typsend => 'range_send',
typanalyze => 'range_typanalyze', typalign => 'd', typstorage => 'x' },
{ oid => '3910', array_type_oid => '3911',
descr => 'range of timestamps with time zone',
typname => 'tstzrange', typlen => '-1', typbyval => 'f', typtype => 'r',
typcategory => 'R', typinput => 'range_in', typoutput => 'range_out',
typreceive => 'range_recv', typsend => 'range_send',
typanalyze => 'range_typanalyze', typalign => 'd', typstorage => 'x' },
{ oid => '3912', array_type_oid => '3913', descr => 'range of dates',
typname => 'daterange', typlen => '-1', typbyval => 'f', typtype => 'r',
typcategory => 'R', typinput => 'range_in', typoutput => 'range_out',
typreceive => 'range_recv', typsend => 'range_send',
typanalyze => 'range_typanalyze', typalign => 'i', typstorage => 'x' },
{ oid => '3926', array_type_oid => '3927', descr => 'range of bigints',
typname => 'int8range', typlen => '-1', typbyval => 'f', typtype => 'r',
typcategory => 'R', typinput => 'range_in', typoutput => 'range_out',
typreceive => 'range_recv', typsend => 'range_send',
typanalyze => 'range_typanalyze', typalign => 'd', typstorage => 'x' },
# pseudo-types
# types with typtype='p' represent various special cases in the type system.
# These cannot be used to define table columns, but are valid as function
# argument and result types (if supported by the function's implementation
# language).
# Note: cstring is a borderline case; it is still considered a pseudo-type,
# but there is now support for it in records and arrays. Perhaps we should
# just treat it as a regular base type?
{ oid => '2249', descr => 'pseudo-type representing any composite type',
typname => 'record', typlen => '-1', typbyval => 'f', typtype => 'p',
typcategory => 'P', typarray => '_record', typinput => 'record_in',
typoutput => 'record_out', typreceive => 'record_recv',
typsend => 'record_send', typalign => 'd', typstorage => 'x' },
# Arrays of records have typcategory P, so they can't be autogenerated.
{ oid => '2287',
typname => '_record', typlen => '-1', typbyval => 'f', typtype => 'p',
typcategory => 'P', typelem => 'record', typinput => 'array_in',
typoutput => 'array_out', typreceive => 'array_recv', typsend => 'array_send',
typanalyze => 'array_typanalyze', typalign => 'd', typstorage => 'x' },
{ oid => '2275', array_type_oid => '1263', descr => 'C-style string',
typname => 'cstring', typlen => '-2', typbyval => 'f', typtype => 'p',
typcategory => 'P', typinput => 'cstring_in', typoutput => 'cstring_out',
typreceive => 'cstring_recv', typsend => 'cstring_send', typalign => 'c' },
{ oid => '2276', descr => 'pseudo-type representing any type',
typname => 'any', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'any_in', typoutput => 'any_out',
typreceive => '-', typsend => '-', typalign => 'i' },
{ oid => '2277', descr => 'pseudo-type representing a polymorphic array type',
typname => 'anyarray', typlen => '-1', typbyval => 'f', typtype => 'p',
typcategory => 'P', typinput => 'anyarray_in', typoutput => 'anyarray_out',
typreceive => 'anyarray_recv', typsend => 'anyarray_send', typalign => 'd',
typstorage => 'x' },
{ oid => '2278',
descr => 'pseudo-type for the result of a function with no real result',
typname => 'void', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'void_in', typoutput => 'void_out',
typreceive => 'void_recv', typsend => 'void_send', typalign => 'i' },
{ oid => '2279', descr => 'pseudo-type for the result of a trigger function',
typname => 'trigger', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'trigger_in', typoutput => 'trigger_out',
typreceive => '-', typsend => '-', typalign => 'i' },
{ oid => '3838', oid_symbol => 'EVTTRIGGEROID',
descr => 'pseudo-type for the result of an event trigger function',
typname => 'event_trigger', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'event_trigger_in',
typoutput => 'event_trigger_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '2280',
descr => 'pseudo-type for the result of a language handler function',
typname => 'language_handler', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'language_handler_in',
typoutput => 'language_handler_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '2281',
descr => 'pseudo-type representing an internal data structure',
typname => 'internal', typlen => 'SIZEOF_POINTER', typbyval => 't',
typtype => 'p', typcategory => 'P', typinput => 'internal_in',
typoutput => 'internal_out', typreceive => '-', typsend => '-',
typalign => 'ALIGNOF_POINTER' },
{ oid => '2282', descr => 'obsolete, deprecated pseudo-type',
typname => 'opaque', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'opaque_in', typoutput => 'opaque_out',
typreceive => '-', typsend => '-', typalign => 'i' },
{ oid => '2283', descr => 'pseudo-type representing a polymorphic base type',
typname => 'anyelement', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'anyelement_in',
typoutput => 'anyelement_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '2776',
descr => 'pseudo-type representing a polymorphic base type that is not an array',
typname => 'anynonarray', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'anynonarray_in',
typoutput => 'anynonarray_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '3500',
descr => 'pseudo-type representing a polymorphic base type that is an enum',
typname => 'anyenum', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'anyenum_in', typoutput => 'anyenum_out',
typreceive => '-', typsend => '-', typalign => 'i' },
{ oid => '3115',
descr => 'pseudo-type for the result of an FDW handler function',
typname => 'fdw_handler', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'fdw_handler_in',
typoutput => 'fdw_handler_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '325',
descr => 'pseudo-type for the result of an index AM handler function',
typname => 'index_am_handler', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'index_am_handler_in',
typoutput => 'index_am_handler_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '3310',
descr => 'pseudo-type for the result of a tablesample method function',
typname => 'tsm_handler', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'tsm_handler_in',
typoutput => 'tsm_handler_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '269',
typname => 'table_am_handler', typlen => '4', typbyval => 't', typtype => 'p',
typcategory => 'P', typinput => 'table_am_handler_in',
typoutput => 'table_am_handler_out', typreceive => '-', typsend => '-',
typalign => 'i' },
{ oid => '3831',
descr => 'pseudo-type representing a polymorphic base type that is a range',
typname => 'anyrange', typlen => '-1', typbyval => 'f', typtype => 'p',
typcategory => 'P', typinput => 'anyrange_in', typoutput => 'anyrange_out',
typreceive => '-', typsend => '-', typalign => 'd', typstorage => 'x' },
]

View File

@ -1,752 +0,0 @@
/*-------------------------------------------------------------------------
*
* pg_type.h
* definition of the system "type" relation (pg_type)
* along with the relation's initial contents.
*
*
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/catalog/pg_type.h
*
* NOTES
* the genbki.pl script reads this file and generates .bki
* information from the DATA() statements.
*
*-------------------------------------------------------------------------
*/
#ifndef PG_TYPE_H
#define PG_TYPE_H
#include "catalog/genbki.h"
/* ----------------
* pg_type definition. cpp turns this into
* typedef struct FormData_pg_type
*
* Some of the values in a pg_type instance are copied into
* pg_attribute instances. Some parts of Postgres use the pg_type copy,
* while others use the pg_attribute copy, so they must match.
* See struct FormData_pg_attribute for details.
* ----------------
*/
#define TypeRelationId 1247
#define TypeRelation_Rowtype_Id 71
CATALOG(pg_type,1247) BKI_BOOTSTRAP BKI_ROWTYPE_OID(71) BKI_SCHEMA_MACRO
{
NameData typname; /* type name */
Oid typnamespace; /* OID of namespace containing this type */
Oid typowner; /* type owner */
/*
* For a fixed-size type, typlen is the number of bytes we use to
* represent a value of this type, e.g. 4 for an int4. But for a
* variable-length type, typlen is negative. We use -1 to indicate a
* "varlena" type (one that has a length word), -2 to indicate a
* null-terminated C string.
*/
int16 typlen;
/*
* typbyval determines whether internal Postgres routines pass a value of
* this type by value or by reference. typbyval had better be FALSE if
* the length is not 1, 2, or 4 (or 8 on 8-byte-Datum machines).
* Variable-length types are always passed by reference. Note that
* typbyval can be false even if the length would allow pass-by-value;
* this is currently true for type float4, for example.
*/
bool typbyval;
/*
* typtype is 'b' for a base type, 'c' for a composite type (e.g., a
* table's rowtype), 'd' for a domain, 'e' for an enum type, 'p' for a
* pseudo-type, or 'r' for a range type. (Use the TYPTYPE macros below.)
*
* If typtype is 'c', typrelid is the OID of the class' entry in pg_class.
*/
char typtype;
/*
* typcategory and typispreferred help the parser distinguish preferred
* and non-preferred coercions. The category can be any single ASCII
* character (but not \0). The categories used for built-in types are
* identified by the TYPCATEGORY macros below.
*/
char typcategory; /* arbitrary type classification */
bool typispreferred; /* is type "preferred" within its category? */
/*
* If typisdefined is false, the entry is only a placeholder (forward
* reference). We know the type name, but not yet anything else about it.
*/
bool typisdefined;
char typdelim; /* delimiter for arrays of this type */
Oid typrelid; /* 0 if not a composite type */
/*
* If typelem is not 0 then it identifies another row in pg_type. The
* current type can then be subscripted like an array yielding values of
* type typelem. A non-zero typelem does not guarantee this type to be a
* "real" array type; some ordinary fixed-length types can also be
* subscripted (e.g., name, point). Variable-length types can *not* be
* turned into pseudo-arrays like that. Hence, the way to determine
* whether a type is a "true" array type is if:
*
* typelem != 0 and typlen == -1.
*/
Oid typelem;
/*
* If there is a "true" array type having this type as element type,
* typarray links to it. Zero if no associated "true" array type.
*/
Oid typarray;
/*
* I/O conversion procedures for the datatype.
*/
regproc typinput; /* text format (required) */
regproc typoutput;
regproc typreceive; /* binary format (optional) */
regproc typsend;
/*
* I/O functions for optional type modifiers.
*/
regproc typmodin;
regproc typmodout;
/*
* Custom ANALYZE procedure for the datatype (0 selects the default).
*/
regproc typanalyze;
/* ----------------
* typalign is the alignment required when storing a value of this
* type. It applies to storage on disk as well as most
* representations of the value inside Postgres. When multiple values
* are stored consecutively, such as in the representation of a
* complete row on disk, padding is inserted before a datum of this
* type so that it begins on the specified boundary. The alignment
* reference is the beginning of the first datum in the sequence.
*
* 'c' = CHAR alignment, ie no alignment needed.
* 's' = SHORT alignment (2 bytes on most machines).
* 'i' = INT alignment (4 bytes on most machines).
* 'd' = DOUBLE alignment (8 bytes on many machines, but by no means all).
*
* See include/access/tupmacs.h for the macros that compute these
* alignment requirements. Note also that we allow the nominal alignment
* to be violated when storing "packed" varlenas; the TOAST mechanism
* takes care of hiding that from most code.
*
* NOTE: for types used in system tables, it is critical that the
* size and alignment defined in pg_type agree with the way that the
* compiler will lay out the field in a struct representing a table row.
* ----------------
*/
char typalign;
/* ----------------
* typstorage tells if the type is prepared for toasting and what
* the default strategy for attributes of this type should be.
*
* 'p' PLAIN type not prepared for toasting
* 'e' EXTERNAL external storage possible, don't try to compress
* 'x' EXTENDED try to compress and store external if required
* 'm' MAIN like 'x' but try to keep in main tuple
* ----------------
*/
char typstorage;
/*
* This flag represents a "NOT NULL" constraint against this datatype.
*
* If true, the attnotnull column for a corresponding table column using
* this datatype will always enforce the NOT NULL constraint.
*
* Used primarily for domain types.
*/
bool typnotnull;
/*
* Domains use typbasetype to show the base (or domain) type that the
* domain is based on. Zero if the type is not a domain.
*/
Oid typbasetype;
/*
* Domains use typtypmod to record the typmod to be applied to their base
* type (-1 if base type does not use a typmod). -1 if this type is not a
* domain.
*/
int32 typtypmod;
/*
* typndims is the declared number of dimensions for an array domain type
* (i.e., typbasetype is an array type). Otherwise zero.
*/
int32 typndims;
/*
* Collation: 0 if type cannot use collations, DEFAULT_COLLATION_OID for
* collatable base types, possibly other OID for domains
*/
Oid typcollation;
#ifdef CATALOG_VARLEN /* variable-length fields start here */
/*
* If typdefaultbin is not NULL, it is the nodeToString representation of
* a default expression for the type. Currently this is only used for
* domains.
*/
pg_node_tree typdefaultbin;
/*
* typdefault is NULL if the type has no associated default value. If
* typdefaultbin is not NULL, typdefault must contain a human-readable
* version of the default expression represented by typdefaultbin. If
* typdefaultbin is NULL and typdefault is not, then typdefault is the
* external representation of the type's default value, which may be fed
* to the type's input converter to produce a constant.
*/
text typdefault;
/*
* Access permissions
*/
aclitem typacl[1];
#endif
} FormData_pg_type;
/* ----------------
* Form_pg_type corresponds to a pointer to a row with
* the format of pg_type relation.
* ----------------
*/
typedef FormData_pg_type *Form_pg_type;
/* ----------------
* compiler constants for pg_type
* ----------------
*/
#define Natts_pg_type 30
#define Anum_pg_type_typname 1
#define Anum_pg_type_typnamespace 2
#define Anum_pg_type_typowner 3
#define Anum_pg_type_typlen 4
#define Anum_pg_type_typbyval 5
#define Anum_pg_type_typtype 6
#define Anum_pg_type_typcategory 7
#define Anum_pg_type_typispreferred 8
#define Anum_pg_type_typisdefined 9
#define Anum_pg_type_typdelim 10
#define Anum_pg_type_typrelid 11
#define Anum_pg_type_typelem 12
#define Anum_pg_type_typarray 13
#define Anum_pg_type_typinput 14
#define Anum_pg_type_typoutput 15
#define Anum_pg_type_typreceive 16
#define Anum_pg_type_typsend 17
#define Anum_pg_type_typmodin 18
#define Anum_pg_type_typmodout 19
#define Anum_pg_type_typanalyze 20
#define Anum_pg_type_typalign 21
#define Anum_pg_type_typstorage 22
#define Anum_pg_type_typnotnull 23
#define Anum_pg_type_typbasetype 24
#define Anum_pg_type_typtypmod 25
#define Anum_pg_type_typndims 26
#define Anum_pg_type_typcollation 27
#define Anum_pg_type_typdefaultbin 28
#define Anum_pg_type_typdefault 29
#define Anum_pg_type_typacl 30
/* ----------------
* initial contents of pg_type
* ----------------
*/
/*
* Keep the following ordered by OID so that later changes can be made more
* easily.
*
* For types used in the system catalogs, make sure the values here match
* TypInfo[] in bootstrap.c.
*/
/* OIDS 1 - 99 */
DATA(insert OID = 16 ( bool PGNSP PGUID 1 t b B t t \054 0 0 1000 boolin boolout boolrecv boolsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("boolean, 'true'/'false'");
#define BOOLOID 16
DATA(insert OID = 17 ( bytea PGNSP PGUID -1 f b U f t \054 0 0 1001 byteain byteaout bytearecv byteasend - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("variable-length string, binary values escaped");
#define BYTEAOID 17
DATA(insert OID = 18 ( char PGNSP PGUID 1 t b S f t \054 0 0 1002 charin charout charrecv charsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("single character");
#define CHAROID 18
DATA(insert OID = 19 ( name PGNSP PGUID NAMEDATALEN f b S f t \054 0 18 1003 namein nameout namerecv namesend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("63-byte type for storing system identifiers");
#define NAMEOID 19
DATA(insert OID = 20 ( int8 PGNSP PGUID 8 FLOAT8PASSBYVAL b N f t \054 0 0 1016 int8in int8out int8recv int8send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("~18 digit integer, 8-byte storage");
#define INT8OID 20
DATA(insert OID = 21 ( int2 PGNSP PGUID 2 t b N f t \054 0 0 1005 int2in int2out int2recv int2send - - - s p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("-32 thousand to 32 thousand, 2-byte storage");
#define INT2OID 21
DATA(insert OID = 22 ( int2vector PGNSP PGUID -1 f b A f t \054 0 21 1006 int2vectorin int2vectorout int2vectorrecv int2vectorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("array of int2, used in system tables");
#define INT2VECTOROID 22
DATA(insert OID = 23 ( int4 PGNSP PGUID 4 t b N f t \054 0 0 1007 int4in int4out int4recv int4send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("-2 billion to 2 billion integer, 4-byte storage");
#define INT4OID 23
DATA(insert OID = 24 ( regproc PGNSP PGUID 4 t b N f t \054 0 0 1008 regprocin regprocout regprocrecv regprocsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered procedure");
#define REGPROCOID 24
DATA(insert OID = 25 ( text PGNSP PGUID -1 f b S t t \054 0 0 1009 textin textout textrecv textsend - - - i x f 0 -1 0 100 _null_ _null_ _null_ ));
DESCR("variable-length string, no limit specified");
#define TEXTOID 25
DATA(insert OID = 26 ( oid PGNSP PGUID 4 t b N t t \054 0 0 1028 oidin oidout oidrecv oidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("object identifier(oid), maximum 4 billion");
#define OIDOID 26
DATA(insert OID = 27 ( tid PGNSP PGUID 6 f b U f t \054 0 0 1010 tidin tidout tidrecv tidsend - - - s p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("(block, offset), physical location of tuple");
#define TIDOID 27
DATA(insert OID = 28 ( xid PGNSP PGUID 4 t b U f t \054 0 0 1011 xidin xidout xidrecv xidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("transaction id");
#define XIDOID 28
DATA(insert OID = 29 ( cid PGNSP PGUID 4 t b U f t \054 0 0 1012 cidin cidout cidrecv cidsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("command identifier type, sequence in transaction id");
#define CIDOID 29
DATA(insert OID = 30 ( oidvector PGNSP PGUID -1 f b A f t \054 0 26 1013 oidvectorin oidvectorout oidvectorrecv oidvectorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("array of oids, used in system tables");
#define OIDVECTOROID 30
/* hand-built rowtype entries for bootstrapped catalogs */
/* NB: OIDs assigned here must match the BKI_ROWTYPE_OID declarations */
DATA(insert OID = 71 ( pg_type PGNSP PGUID -1 f c C f t \054 1247 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 75 ( pg_attribute PGNSP PGUID -1 f c C f t \054 1249 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 81 ( pg_proc PGNSP PGUID -1 f c C f t \054 1255 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 83 ( pg_class PGNSP PGUID -1 f c C f t \054 1259 0 0 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
/* OIDS 100 - 199 */
DATA(insert OID = 114 ( json PGNSP PGUID -1 f b U f t \054 0 0 199 json_in json_out json_recv json_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
#define JSONOID 114
DATA(insert OID = 142 ( xml PGNSP PGUID -1 f b U f t \054 0 0 143 xml_in xml_out xml_recv xml_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("XML content");
#define XMLOID 142
DATA(insert OID = 143 ( _xml PGNSP PGUID -1 f b A f t \054 0 142 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 199 ( _json PGNSP PGUID -1 f b A f t \054 0 114 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 194 ( pg_node_tree PGNSP PGUID -1 f b S f t \054 0 0 0 pg_node_tree_in pg_node_tree_out pg_node_tree_recv pg_node_tree_send - - - i x f 0 -1 0 100 _null_ _null_ _null_ ));
DESCR("string representing an internal node tree");
#define PGNODETREEOID 194
DATA(insert OID = 3361 ( pg_ndistinct PGNSP PGUID -1 f b S f t \054 0 0 0 pg_ndistinct_in pg_ndistinct_out pg_ndistinct_recv pg_ndistinct_send - - - i x f 0 -1 0 100 _null_ _null_ _null_ ));
DESCR("multivariate ndistinct coefficients");
#define PGNDISTINCTOID 3361
DATA(insert OID = 3402 ( pg_dependencies PGNSP PGUID -1 f b S f t \054 0 0 0 pg_dependencies_in pg_dependencies_out pg_dependencies_recv pg_dependencies_send - - - i x f 0 -1 0 100 _null_ _null_ _null_ ));
DESCR("multivariate dependencies");
#define PGDEPENDENCIESOID 3402
DATA(insert OID = 32 ( pg_ddl_command PGNSP PGUID SIZEOF_POINTER t p P f t \054 0 0 0 pg_ddl_command_in pg_ddl_command_out pg_ddl_command_recv pg_ddl_command_send - - - ALIGNOF_POINTER p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("internal type for passing CollectedCommand");
#define PGDDLCOMMANDOID 32
/* OIDS 200 - 299 */
DATA(insert OID = 210 ( smgr PGNSP PGUID 2 t b U f t \054 0 0 0 smgrin smgrout - - - - - s p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("storage manager");
/* OIDS 300 - 399 */
/* OIDS 400 - 499 */
/* OIDS 500 - 599 */
/* OIDS 600 - 699 */
DATA(insert OID = 600 ( point PGNSP PGUID 16 f b G f t \054 0 701 1017 point_in point_out point_recv point_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("geometric point '(x, y)'");
#define POINTOID 600
DATA(insert OID = 601 ( lseg PGNSP PGUID 32 f b G f t \054 0 600 1018 lseg_in lseg_out lseg_recv lseg_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("geometric line segment '(pt1,pt2)'");
#define LSEGOID 601
DATA(insert OID = 602 ( path PGNSP PGUID -1 f b G f t \054 0 0 1019 path_in path_out path_recv path_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("geometric path '(pt1,...)'");
#define PATHOID 602
DATA(insert OID = 603 ( box PGNSP PGUID 32 f b G f t \073 0 600 1020 box_in box_out box_recv box_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("geometric box '(lower left,upper right)'");
#define BOXOID 603
DATA(insert OID = 604 ( polygon PGNSP PGUID -1 f b G f t \054 0 0 1027 poly_in poly_out poly_recv poly_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("geometric polygon '(pt1,...)'");
#define POLYGONOID 604
DATA(insert OID = 628 ( line PGNSP PGUID 24 f b G f t \054 0 701 629 line_in line_out line_recv line_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("geometric line");
#define LINEOID 628
DATA(insert OID = 629 ( _line PGNSP PGUID -1 f b A f t \054 0 628 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
/* OIDS 700 - 799 */
DATA(insert OID = 700 ( float4 PGNSP PGUID 4 FLOAT4PASSBYVAL b N f t \054 0 0 1021 float4in float4out float4recv float4send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("single-precision floating point number, 4-byte storage");
#define FLOAT4OID 700
DATA(insert OID = 701 ( float8 PGNSP PGUID 8 FLOAT8PASSBYVAL b N t t \054 0 0 1022 float8in float8out float8recv float8send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("double-precision floating point number, 8-byte storage");
#define FLOAT8OID 701
DATA(insert OID = 702 ( abstime PGNSP PGUID 4 t b D f t \054 0 0 1023 abstimein abstimeout abstimerecv abstimesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("absolute, limited-range date and time (Unix system time)");
#define ABSTIMEOID 702
DATA(insert OID = 703 ( reltime PGNSP PGUID 4 t b T f t \054 0 0 1024 reltimein reltimeout reltimerecv reltimesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("relative, limited-range time interval (Unix delta time)");
#define RELTIMEOID 703
DATA(insert OID = 704 ( tinterval PGNSP PGUID 12 f b T f t \054 0 0 1025 tintervalin tintervalout tintervalrecv tintervalsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("(abstime,abstime), time interval");
#define TINTERVALOID 704
DATA(insert OID = 705 ( unknown PGNSP PGUID -2 f p X f t \054 0 0 0 unknownin unknownout unknownrecv unknownsend - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("");
#define UNKNOWNOID 705
DATA(insert OID = 718 ( circle PGNSP PGUID 24 f b G f t \054 0 0 719 circle_in circle_out circle_recv circle_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("geometric circle '(center,radius)'");
#define CIRCLEOID 718
DATA(insert OID = 719 ( _circle PGNSP PGUID -1 f b A f t \054 0 718 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 790 ( money PGNSP PGUID 8 FLOAT8PASSBYVAL b N f t \054 0 0 791 cash_in cash_out cash_recv cash_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("monetary amounts, $d,ddd.cc");
#define CASHOID 790
DATA(insert OID = 791 ( _money PGNSP PGUID -1 f b A f t \054 0 790 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
/* OIDS 800 - 899 */
DATA(insert OID = 829 ( macaddr PGNSP PGUID 6 f b U f t \054 0 0 1040 macaddr_in macaddr_out macaddr_recv macaddr_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("XX:XX:XX:XX:XX:XX, MAC address");
#define MACADDROID 829
DATA(insert OID = 869 ( inet PGNSP PGUID -1 f b I t t \054 0 0 1041 inet_in inet_out inet_recv inet_send - - - i m f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("IP address/netmask, host address, netmask optional");
#define INETOID 869
DATA(insert OID = 650 ( cidr PGNSP PGUID -1 f b I f t \054 0 0 651 cidr_in cidr_out cidr_recv cidr_send - - - i m f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("network IP address/netmask, network address");
#define CIDROID 650
DATA(insert OID = 774 ( macaddr8 PGNSP PGUID 8 f b U f t \054 0 0 775 macaddr8_in macaddr8_out macaddr8_recv macaddr8_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("XX:XX:XX:XX:XX:XX:XX:XX, MAC address");
#define MACADDR8OID 774
/* OIDS 900 - 999 */
/* OIDS 1000 - 1099 */
DATA(insert OID = 1000 ( _bool PGNSP PGUID -1 f b A f t \054 0 16 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1001 ( _bytea PGNSP PGUID -1 f b A f t \054 0 17 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1002 ( _char PGNSP PGUID -1 f b A f t \054 0 18 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1003 ( _name PGNSP PGUID -1 f b A f t \054 0 19 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1005 ( _int2 PGNSP PGUID -1 f b A f t \054 0 21 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
#define INT2ARRAYOID 1005
DATA(insert OID = 1006 ( _int2vector PGNSP PGUID -1 f b A f t \054 0 22 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1007 ( _int4 PGNSP PGUID -1 f b A f t \054 0 23 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
#define INT4ARRAYOID 1007
DATA(insert OID = 1008 ( _regproc PGNSP PGUID -1 f b A f t \054 0 24 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1009 ( _text PGNSP PGUID -1 f b A f t \054 0 25 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ ));
#define TEXTARRAYOID 1009
DATA(insert OID = 1028 ( _oid PGNSP PGUID -1 f b A f t \054 0 26 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
#define OIDARRAYOID 1028
DATA(insert OID = 1010 ( _tid PGNSP PGUID -1 f b A f t \054 0 27 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1011 ( _xid PGNSP PGUID -1 f b A f t \054 0 28 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1012 ( _cid PGNSP PGUID -1 f b A f t \054 0 29 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1013 ( _oidvector PGNSP PGUID -1 f b A f t \054 0 30 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1014 ( _bpchar PGNSP PGUID -1 f b A f t \054 0 1042 0 array_in array_out array_recv array_send bpchartypmodin bpchartypmodout array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ ));
DATA(insert OID = 1015 ( _varchar PGNSP PGUID -1 f b A f t \054 0 1043 0 array_in array_out array_recv array_send varchartypmodin varchartypmodout array_typanalyze i x f 0 -1 0 100 _null_ _null_ _null_ ));
DATA(insert OID = 1016 ( _int8 PGNSP PGUID -1 f b A f t \054 0 20 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1017 ( _point PGNSP PGUID -1 f b A f t \054 0 600 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1018 ( _lseg PGNSP PGUID -1 f b A f t \054 0 601 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1019 ( _path PGNSP PGUID -1 f b A f t \054 0 602 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1020 ( _box PGNSP PGUID -1 f b A f t \073 0 603 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1021 ( _float4 PGNSP PGUID -1 f b A f t \054 0 700 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
#define FLOAT4ARRAYOID 1021
DATA(insert OID = 1022 ( _float8 PGNSP PGUID -1 f b A f t \054 0 701 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1023 ( _abstime PGNSP PGUID -1 f b A f t \054 0 702 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1024 ( _reltime PGNSP PGUID -1 f b A f t \054 0 703 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1025 ( _tinterval PGNSP PGUID -1 f b A f t \054 0 704 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1027 ( _polygon PGNSP PGUID -1 f b A f t \054 0 604 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1033 ( aclitem PGNSP PGUID 12 f b U f t \054 0 0 1034 aclitemin aclitemout - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("access control list");
#define ACLITEMOID 1033
DATA(insert OID = 1034 ( _aclitem PGNSP PGUID -1 f b A f t \054 0 1033 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1040 ( _macaddr PGNSP PGUID -1 f b A f t \054 0 829 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 775 ( _macaddr8 PGNSP PGUID -1 f b A f t \054 0 774 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1041 ( _inet PGNSP PGUID -1 f b A f t \054 0 869 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 651 ( _cidr PGNSP PGUID -1 f b A f t \054 0 650 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1263 ( _cstring PGNSP PGUID -1 f b A f t \054 0 2275 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
#define CSTRINGARRAYOID 1263
DATA(insert OID = 1042 ( bpchar PGNSP PGUID -1 f b S f t \054 0 0 1014 bpcharin bpcharout bpcharrecv bpcharsend bpchartypmodin bpchartypmodout - i x f 0 -1 0 100 _null_ _null_ _null_ ));
DESCR("char(length), blank-padded string, fixed storage length");
#define BPCHAROID 1042
DATA(insert OID = 1043 ( varchar PGNSP PGUID -1 f b S f t \054 0 0 1015 varcharin varcharout varcharrecv varcharsend varchartypmodin varchartypmodout - i x f 0 -1 0 100 _null_ _null_ _null_ ));
DESCR("varchar(length), non-blank-padded string, variable storage length");
#define VARCHAROID 1043
DATA(insert OID = 1082 ( date PGNSP PGUID 4 t b D f t \054 0 0 1182 date_in date_out date_recv date_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("date");
#define DATEOID 1082
DATA(insert OID = 1083 ( time PGNSP PGUID 8 FLOAT8PASSBYVAL b D f t \054 0 0 1183 time_in time_out time_recv time_send timetypmodin timetypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("time of day");
#define TIMEOID 1083
/* OIDS 1100 - 1199 */
DATA(insert OID = 1114 ( timestamp PGNSP PGUID 8 FLOAT8PASSBYVAL b D f t \054 0 0 1115 timestamp_in timestamp_out timestamp_recv timestamp_send timestamptypmodin timestamptypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("date and time");
#define TIMESTAMPOID 1114
DATA(insert OID = 1115 ( _timestamp PGNSP PGUID -1 f b A f t \054 0 1114 0 array_in array_out array_recv array_send timestamptypmodin timestamptypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1182 ( _date PGNSP PGUID -1 f b A f t \054 0 1082 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1183 ( _time PGNSP PGUID -1 f b A f t \054 0 1083 0 array_in array_out array_recv array_send timetypmodin timetypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1184 ( timestamptz PGNSP PGUID 8 FLOAT8PASSBYVAL b D t t \054 0 0 1185 timestamptz_in timestamptz_out timestamptz_recv timestamptz_send timestamptztypmodin timestamptztypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("date and time with time zone");
#define TIMESTAMPTZOID 1184
DATA(insert OID = 1185 ( _timestamptz PGNSP PGUID -1 f b A f t \054 0 1184 0 array_in array_out array_recv array_send timestamptztypmodin timestamptztypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1186 ( interval PGNSP PGUID 16 f b T t t \054 0 0 1187 interval_in interval_out interval_recv interval_send intervaltypmodin intervaltypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("@ <number> <units>, time interval");
#define INTERVALOID 1186
DATA(insert OID = 1187 ( _interval PGNSP PGUID -1 f b A f t \054 0 1186 0 array_in array_out array_recv array_send intervaltypmodin intervaltypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
/* OIDS 1200 - 1299 */
DATA(insert OID = 1231 ( _numeric PGNSP PGUID -1 f b A f t \054 0 1700 0 array_in array_out array_recv array_send numerictypmodin numerictypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1266 ( timetz PGNSP PGUID 12 f b D f t \054 0 0 1270 timetz_in timetz_out timetz_recv timetz_send timetztypmodin timetztypmodout - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("time of day with time zone");
#define TIMETZOID 1266
DATA(insert OID = 1270 ( _timetz PGNSP PGUID -1 f b A f t \054 0 1266 0 array_in array_out array_recv array_send timetztypmodin timetztypmodout array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
/* OIDS 1500 - 1599 */
DATA(insert OID = 1560 ( bit PGNSP PGUID -1 f b V f t \054 0 0 1561 bit_in bit_out bit_recv bit_send bittypmodin bittypmodout - i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("fixed-length bit string");
#define BITOID 1560
DATA(insert OID = 1561 ( _bit PGNSP PGUID -1 f b A f t \054 0 1560 0 array_in array_out array_recv array_send bittypmodin bittypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 1562 ( varbit PGNSP PGUID -1 f b V t t \054 0 0 1563 varbit_in varbit_out varbit_recv varbit_send varbittypmodin varbittypmodout - i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("variable-length bit string");
#define VARBITOID 1562
DATA(insert OID = 1563 ( _varbit PGNSP PGUID -1 f b A f t \054 0 1562 0 array_in array_out array_recv array_send varbittypmodin varbittypmodout array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
/* OIDS 1600 - 1699 */
/* OIDS 1700 - 1799 */
DATA(insert OID = 1700 ( numeric PGNSP PGUID -1 f b N f t \054 0 0 1231 numeric_in numeric_out numeric_recv numeric_send numerictypmodin numerictypmodout - i m f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("numeric(precision, decimal), arbitrary precision number");
#define NUMERICOID 1700
DATA(insert OID = 1790 ( refcursor PGNSP PGUID -1 f b U f t \054 0 0 2201 textin textout textrecv textsend - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("reference to cursor (portal name)");
#define REFCURSOROID 1790
/* OIDS 2200 - 2299 */
DATA(insert OID = 2201 ( _refcursor PGNSP PGUID -1 f b A f t \054 0 1790 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 2202 ( regprocedure PGNSP PGUID 4 t b N f t \054 0 0 2207 regprocedurein regprocedureout regprocedurerecv regproceduresend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered procedure (with args)");
#define REGPROCEDUREOID 2202
DATA(insert OID = 2203 ( regoper PGNSP PGUID 4 t b N f t \054 0 0 2208 regoperin regoperout regoperrecv regopersend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered operator");
#define REGOPEROID 2203
DATA(insert OID = 2204 ( regoperator PGNSP PGUID 4 t b N f t \054 0 0 2209 regoperatorin regoperatorout regoperatorrecv regoperatorsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered operator (with args)");
#define REGOPERATOROID 2204
DATA(insert OID = 2205 ( regclass PGNSP PGUID 4 t b N f t \054 0 0 2210 regclassin regclassout regclassrecv regclasssend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered class");
#define REGCLASSOID 2205
DATA(insert OID = 2206 ( regtype PGNSP PGUID 4 t b N f t \054 0 0 2211 regtypein regtypeout regtyperecv regtypesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered type");
#define REGTYPEOID 2206
DATA(insert OID = 4096 ( regrole PGNSP PGUID 4 t b N f t \054 0 0 4097 regrolein regroleout regrolerecv regrolesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered role");
#define REGROLEOID 4096
DATA(insert OID = 4089 ( regnamespace PGNSP PGUID 4 t b N f t \054 0 0 4090 regnamespacein regnamespaceout regnamespacerecv regnamespacesend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered namespace");
#define REGNAMESPACEOID 4089
DATA(insert OID = 2207 ( _regprocedure PGNSP PGUID -1 f b A f t \054 0 2202 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 2208 ( _regoper PGNSP PGUID -1 f b A f t \054 0 2203 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 2209 ( _regoperator PGNSP PGUID -1 f b A f t \054 0 2204 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 2210 ( _regclass PGNSP PGUID -1 f b A f t \054 0 2205 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 2211 ( _regtype PGNSP PGUID -1 f b A f t \054 0 2206 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
#define REGTYPEARRAYOID 2211
DATA(insert OID = 4097 ( _regrole PGNSP PGUID -1 f b A f t \054 0 4096 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 4090 ( _regnamespace PGNSP PGUID -1 f b A f t \054 0 4089 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
/* uuid */
DATA(insert OID = 2950 ( uuid PGNSP PGUID 16 f b U f t \054 0 0 2951 uuid_in uuid_out uuid_recv uuid_send - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("UUID datatype");
#define UUIDOID 2950
DATA(insert OID = 2951 ( _uuid PGNSP PGUID -1 f b A f t \054 0 2950 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
/* pg_lsn */
DATA(insert OID = 3220 ( pg_lsn PGNSP PGUID 8 FLOAT8PASSBYVAL b U f t \054 0 0 3221 pg_lsn_in pg_lsn_out pg_lsn_recv pg_lsn_send - - - d p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("PostgreSQL LSN datatype");
#define LSNOID 3220
DATA(insert OID = 3221 ( _pg_lsn PGNSP PGUID -1 f b A f t \054 0 3220 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
/* text search */
DATA(insert OID = 3614 ( tsvector PGNSP PGUID -1 f b U f t \054 0 0 3643 tsvectorin tsvectorout tsvectorrecv tsvectorsend - - ts_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("text representation for text search");
#define TSVECTOROID 3614
DATA(insert OID = 3642 ( gtsvector PGNSP PGUID -1 f b U f t \054 0 0 3644 gtsvectorin gtsvectorout - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("GiST index internal text representation for text search");
#define GTSVECTOROID 3642
DATA(insert OID = 3615 ( tsquery PGNSP PGUID -1 f b U f t \054 0 0 3645 tsqueryin tsqueryout tsqueryrecv tsquerysend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("query representation for text search");
#define TSQUERYOID 3615
DATA(insert OID = 3734 ( regconfig PGNSP PGUID 4 t b N f t \054 0 0 3735 regconfigin regconfigout regconfigrecv regconfigsend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered text search configuration");
#define REGCONFIGOID 3734
DATA(insert OID = 3769 ( regdictionary PGNSP PGUID 4 t b N f t \054 0 0 3770 regdictionaryin regdictionaryout regdictionaryrecv regdictionarysend - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("registered text search dictionary");
#define REGDICTIONARYOID 3769
DATA(insert OID = 3643 ( _tsvector PGNSP PGUID -1 f b A f t \054 0 3614 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3644 ( _gtsvector PGNSP PGUID -1 f b A f t \054 0 3642 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3645 ( _tsquery PGNSP PGUID -1 f b A f t \054 0 3615 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3735 ( _regconfig PGNSP PGUID -1 f b A f t \054 0 3734 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3770 ( _regdictionary PGNSP PGUID -1 f b A f t \054 0 3769 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
/* jsonb */
DATA(insert OID = 3802 ( jsonb PGNSP PGUID -1 f b U f t \054 0 0 3807 jsonb_in jsonb_out jsonb_recv jsonb_send - - - i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("Binary JSON");
#define JSONBOID 3802
DATA(insert OID = 3807 ( _jsonb PGNSP PGUID -1 f b A f t \054 0 3802 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 2970 ( txid_snapshot PGNSP PGUID -1 f b U f t \054 0 0 2949 txid_snapshot_in txid_snapshot_out txid_snapshot_recv txid_snapshot_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("txid snapshot");
DATA(insert OID = 2949 ( _txid_snapshot PGNSP PGUID -1 f b A f t \054 0 2970 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
/* range types */
DATA(insert OID = 3904 ( int4range PGNSP PGUID -1 f r R f t \054 0 0 3905 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("range of integers");
#define INT4RANGEOID 3904
DATA(insert OID = 3905 ( _int4range PGNSP PGUID -1 f b A f t \054 0 3904 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3906 ( numrange PGNSP PGUID -1 f r R f t \054 0 0 3907 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("range of numerics");
DATA(insert OID = 3907 ( _numrange PGNSP PGUID -1 f b A f t \054 0 3906 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3908 ( tsrange PGNSP PGUID -1 f r R f t \054 0 0 3909 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("range of timestamps without time zone");
DATA(insert OID = 3909 ( _tsrange PGNSP PGUID -1 f b A f t \054 0 3908 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3910 ( tstzrange PGNSP PGUID -1 f r R f t \054 0 0 3911 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("range of timestamps with time zone");
DATA(insert OID = 3911 ( _tstzrange PGNSP PGUID -1 f b A f t \054 0 3910 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3912 ( daterange PGNSP PGUID -1 f r R f t \054 0 0 3913 range_in range_out range_recv range_send - - range_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("range of dates");
DATA(insert OID = 3913 ( _daterange PGNSP PGUID -1 f b A f t \054 0 3912 0 array_in array_out array_recv array_send - - array_typanalyze i x f 0 -1 0 0 _null_ _null_ _null_ ));
DATA(insert OID = 3926 ( int8range PGNSP PGUID -1 f r R f t \054 0 0 3927 range_in range_out range_recv range_send - - range_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
DESCR("range of bigints");
DATA(insert OID = 3927 ( _int8range PGNSP PGUID -1 f b A f t \054 0 3926 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
/*
* pseudo-types
*
* types with typtype='p' represent various special cases in the type system.
*
* These cannot be used to define table columns, but are valid as function
* argument and result types (if supported by the function's implementation
* language).
*
* Note: cstring is a borderline case; it is still considered a pseudo-type,
* but there is now support for it in records and arrays. Perhaps we should
* just treat it as a regular base type?
*/
DATA(insert OID = 2249 ( record PGNSP PGUID -1 f p P f t \054 0 0 2287 record_in record_out record_recv record_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
#define RECORDOID 2249
DATA(insert OID = 2287 ( _record PGNSP PGUID -1 f p P f t \054 0 2249 0 array_in array_out array_recv array_send - - array_typanalyze d x f 0 -1 0 0 _null_ _null_ _null_ ));
#define RECORDARRAYOID 2287
DATA(insert OID = 2275 ( cstring PGNSP PGUID -2 f p P f t \054 0 0 1263 cstring_in cstring_out cstring_recv cstring_send - - - c p f 0 -1 0 0 _null_ _null_ _null_ ));
#define CSTRINGOID 2275
DATA(insert OID = 2276 ( any PGNSP PGUID 4 t p P f t \054 0 0 0 any_in any_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define ANYOID 2276
DATA(insert OID = 2277 ( anyarray PGNSP PGUID -1 f p P f t \054 0 0 0 anyarray_in anyarray_out anyarray_recv anyarray_send - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
#define ANYARRAYOID 2277
DATA(insert OID = 2278 ( void PGNSP PGUID 4 t p P f t \054 0 0 0 void_in void_out void_recv void_send - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define VOIDOID 2278
DATA(insert OID = 2279 ( trigger PGNSP PGUID 4 t p P f t \054 0 0 0 trigger_in trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define TRIGGEROID 2279
DATA(insert OID = 3838 ( event_trigger PGNSP PGUID 4 t p P f t \054 0 0 0 event_trigger_in event_trigger_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define EVTTRIGGEROID 3838
DATA(insert OID = 2280 ( language_handler PGNSP PGUID 4 t p P f t \054 0 0 0 language_handler_in language_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define LANGUAGE_HANDLEROID 2280
DATA(insert OID = 2281 ( internal PGNSP PGUID SIZEOF_POINTER t p P f t \054 0 0 0 internal_in internal_out - - - - - ALIGNOF_POINTER p f 0 -1 0 0 _null_ _null_ _null_ ));
#define INTERNALOID 2281
DATA(insert OID = 2282 ( opaque PGNSP PGUID 4 t p P f t \054 0 0 0 opaque_in opaque_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define OPAQUEOID 2282
DATA(insert OID = 2283 ( anyelement PGNSP PGUID 4 t p P f t \054 0 0 0 anyelement_in anyelement_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define ANYELEMENTOID 2283
DATA(insert OID = 2776 ( anynonarray PGNSP PGUID 4 t p P f t \054 0 0 0 anynonarray_in anynonarray_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define ANYNONARRAYOID 2776
DATA(insert OID = 3500 ( anyenum PGNSP PGUID 4 t p P f t \054 0 0 0 anyenum_in anyenum_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define ANYENUMOID 3500
DATA(insert OID = 3115 ( fdw_handler PGNSP PGUID 4 t p P f t \054 0 0 0 fdw_handler_in fdw_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define FDW_HANDLEROID 3115
DATA(insert OID = 325 ( index_am_handler PGNSP PGUID 4 t p P f t \054 0 0 0 index_am_handler_in index_am_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define INDEX_AM_HANDLEROID 325
DATA(insert OID = 3310 ( tsm_handler PGNSP PGUID 4 t p P f t \054 0 0 0 tsm_handler_in tsm_handler_out - - - - - i p f 0 -1 0 0 _null_ _null_ _null_ ));
#define TSM_HANDLEROID 3310
DATA(insert OID = 3831 ( anyrange PGNSP PGUID -1 f p P f t \054 0 0 0 anyrange_in anyrange_out - - - - - d x f 0 -1 0 0 _null_ _null_ _null_ ));
#define ANYRANGEOID 3831
/*
* macros
*/
#define TYPTYPE_BASE 'b' /* base type (ordinary scalar type) */
#define TYPTYPE_COMPOSITE 'c' /* composite (e.g., table's rowtype) */
#define TYPTYPE_DOMAIN 'd' /* domain over another type */
#define TYPTYPE_ENUM 'e' /* enumerated type */
#define TYPTYPE_PSEUDO 'p' /* pseudo-type */
#define TYPTYPE_RANGE 'r' /* range type */
#define TYPCATEGORY_INVALID '\0' /* not an allowed category */
#define TYPCATEGORY_ARRAY 'A'
#define TYPCATEGORY_BOOLEAN 'B'
#define TYPCATEGORY_COMPOSITE 'C'
#define TYPCATEGORY_DATETIME 'D'
#define TYPCATEGORY_ENUM 'E'
#define TYPCATEGORY_GEOMETRIC 'G'
#define TYPCATEGORY_NETWORK 'I' /* think INET */
#define TYPCATEGORY_NUMERIC 'N'
#define TYPCATEGORY_PSEUDOTYPE 'P'
#define TYPCATEGORY_RANGE 'R'
#define TYPCATEGORY_STRING 'S'
#define TYPCATEGORY_TIMESPAN 'T'
#define TYPCATEGORY_USER 'U'
#define TYPCATEGORY_BITSTRING 'V' /* er ... "varbit"? */
#define TYPCATEGORY_UNKNOWN 'X'
/* Is a type OID a polymorphic pseudotype? (Beware of multiple evaluation) */
#define IsPolymorphicType(typid) \
((typid) == ANYELEMENTOID || \
(typid) == ANYARRAYOID || \
(typid) == ANYNONARRAYOID || \
(typid) == ANYENUMOID || \
(typid) == ANYRANGEOID)
#endif /* PG_TYPE_H */

View File

@ -1,29 +1,30 @@
use marksman_escape::Escape;
use regex::Regex;
use std::collections::BTreeMap;
use std::collections::{BTreeMap, HashMap};
use std::fmt::Write as _;
use std::fs::File;
use std::io::{BufWriter, Write};
use std::iter;
use std::path::Path;
use std::str;
use crate::snake_to_camel;
const PG_TYPE_H: &str = include_str!("pg_type.h");
const PG_RANGE_H: &str = include_str!("pg_range.h");
const PG_TYPE_DAT: &str = include_str!("pg_type.dat");
const PG_RANGE_DAT: &str = include_str!("pg_range.dat");
struct Type {
name: &'static str,
name: String,
variant: String,
ident: String,
kind: &'static str,
kind: String,
element: u32,
doc: String,
}
pub fn build(path: &Path) {
let mut file = BufWriter::new(File::create(path.join("types/type_gen.rs")).unwrap());
let ranges = parse_ranges();
let types = parse_types(&ranges);
let types = parse_types();
make_header(&mut file);
make_enum(&mut file, &types);
@ -31,76 +32,220 @@ pub fn build(path: &Path) {
make_consts(&mut file, &types);
}
fn parse_ranges() -> BTreeMap<u32, u32> {
let mut ranges = BTreeMap::new();
for line in PG_RANGE_H.lines() {
if !line.starts_with("DATA") {
continue;
}
let split = line.split_whitespace().collect::<Vec<_>>();
let oid = split[2].parse().unwrap();
let element = split[3].parse().unwrap();
ranges.insert(oid, element);
}
ranges
struct DatParser<'a> {
it: iter::Peekable<str::CharIndices<'a>>,
s: &'a str,
}
fn parse_types(ranges: &BTreeMap<u32, u32>) -> BTreeMap<u32, Type> {
let doc_re = Regex::new(r#"DESCR\("([^"]+)"\)"#).unwrap();
impl<'a> DatParser<'a> {
fn new(s: &'a str) -> DatParser<'a> {
DatParser {
it: s.char_indices().peekable(),
s,
}
}
fn parse_array(&mut self) -> Vec<HashMap<String, String>> {
self.eat('[');
let mut vec = vec![];
while !self.try_eat(']') {
let object = self.parse_object();
vec.push(object);
}
self.eof();
vec
}
fn parse_object(&mut self) -> HashMap<String, String> {
let mut object = HashMap::new();
self.eat('{');
loop {
let key = self.parse_ident();
self.eat('=');
self.eat('>');
let value = self.parse_string();
object.insert(key, value);
if !self.try_eat(',') {
break;
}
}
self.eat('}');
self.eat(',');
object
}
fn parse_ident(&mut self) -> String {
self.skip_ws();
let start = match self.it.peek() {
Some((i, _)) => *i,
None => return "".to_string(),
};
loop {
match self.it.peek() {
Some((_, 'a'..='z')) | Some((_, '_')) => {
self.it.next();
}
Some((i, _)) => return self.s[start..*i].to_string(),
None => return self.s[start..].to_string(),
}
}
}
fn parse_string(&mut self) -> String {
self.skip_ws();
let mut s = String::new();
self.eat('\'');
loop {
match self.it.next() {
Some((_, '\'')) => return s,
Some((_, '\\')) => {
let (_, ch) = self.it.next().expect("unexpected eof");
s.push(ch);
}
Some((_, ch)) => s.push(ch),
None => panic!("unexpected eof"),
}
}
}
fn eat(&mut self, target: char) {
self.skip_ws();
match self.it.next() {
Some((_, ch)) if ch == target => {}
Some((_, ch)) => panic!("expected {} but got {}", target, ch),
None => panic!("expected {} but got eof", target),
}
}
fn try_eat(&mut self, target: char) -> bool {
if self.peek(target) {
self.eat(target);
true
} else {
false
}
}
fn peek(&mut self, target: char) -> bool {
self.skip_ws();
match self.it.peek() {
Some((_, ch)) if *ch == target => true,
_ => false,
}
}
fn eof(&mut self) {
self.skip_ws();
match self.it.next() {
Some((_, ch)) => panic!("expected eof but got {}", ch),
None => {}
}
}
fn skip_ws(&mut self) {
loop {
match self.it.peek() {
Some(&(_, '#')) => self.skip_to('\n'),
Some(&(_, '\n')) | Some(&(_, ' ')) | Some(&(_, '\t')) => {
self.it.next();
}
_ => break,
}
}
}
fn skip_to(&mut self, target: char) {
for (_, ch) in &mut self.it {
if ch == target {
break;
}
}
}
}
fn parse_types() -> BTreeMap<u32, Type> {
let raw_types = DatParser::new(PG_TYPE_DAT).parse_array();
let raw_ranges = DatParser::new(PG_RANGE_DAT).parse_array();
let oids_by_name = raw_types
.iter()
.map(|m| (m["typname"].clone(), m["oid"].parse::<u32>().unwrap()))
.collect::<HashMap<_, _>>();
let range_elements = raw_ranges
.iter()
.map(|m| {
(
oids_by_name[&*m["rngtypid"]],
oids_by_name[&*m["rngsubtype"]],
)
})
.collect::<HashMap<_, _>>();
let range_vector_re = Regex::new("(range|vector)$").unwrap();
let array_re = Regex::new("^_(.*)").unwrap();
let mut types = BTreeMap::new();
let mut lines = PG_TYPE_H.lines().peekable();
while let Some(line) = lines.next() {
if !line.starts_with("DATA") {
continue;
}
for raw_type in raw_types {
let oid = raw_type["oid"].parse::<u32>().unwrap();
let split = line.split_whitespace().collect::<Vec<_>>();
let name = raw_type["typname"].clone();
let oid = split[3].parse().unwrap();
let name = split[5];
let ident = range_vector_re.replace(name, "_$1");
let ident = range_vector_re.replace(&name, "_$1");
let ident = array_re.replace(&ident, "$1_array");
let variant = snake_to_camel(&ident);
let ident = ident.to_ascii_uppercase();
let kind = split[11];
let kind = raw_type["typcategory"].clone();
// we need to be able to pull composite fields and enum variants at runtime
if kind == "C" || kind == "E" {
continue;
}
let element = if let Some(&element) = ranges.get(&oid) {
element
} else {
split[16].parse().unwrap()
let element = match &*kind {
"R" => range_elements[&oid],
"A" => oids_by_name[&raw_type["typelem"]],
_ => 0,
};
let doc = array_re.replace(name, "$1[]");
let mut doc = doc.to_ascii_uppercase();
let descr = lines
.peek()
.and_then(|line| doc_re.captures(line))
.and_then(|captures| captures.at(1));
if let Some(descr) = descr {
doc.push_str(" - ");
doc.push_str(descr);
let doc_name = array_re.replace(&name, "$1[]").to_ascii_uppercase();
let mut doc = doc_name.clone();
if let Some(descr) = raw_type.get("descr") {
write!(doc, " - {}", descr).unwrap();
}
let doc = Escape::new(doc.as_bytes().iter().cloned()).collect();
let doc = String::from_utf8(doc).unwrap();
if let Some(array_type_oid) = raw_type.get("array_type_oid") {
let array_type_oid = array_type_oid.parse::<u32>().unwrap();
let name = format!("_{}", name);
let variant = format!("{}Array", variant);
let doc = format!("{}&#91;&#93;", doc_name);
let ident = format!("{}_ARRAY", ident);
let type_ = Type {
name,
variant,
ident,
kind: "A".to_string(),
element: oid,
doc,
};
types.insert(array_type_oid, type_);
}
let type_ = Type {
name,
variant,
@ -109,7 +254,6 @@ fn parse_types(ranges: &BTreeMap<u32, u32>) -> BTreeMap<u32, Type> {
element,
doc,
};
types.insert(oid, type_);
}
@ -221,7 +365,7 @@ fn make_impl(w: &mut BufWriter<File>, types: &BTreeMap<u32, Type>) {
.unwrap();
for type_ in types.values() {
let kind = match type_.kind {
let kind = match &*type_.kind {
"P" => "Pseudo".to_owned(),
"A" => format!("Array(Type(Inner::{}))", types[&type_.element].variant),
"R" => format!("Range(Type(Inner::{}))", types[&type_.element].variant),

View File

@ -34,7 +34,7 @@ pub enum Inner {
XmlArray,
PgNodeTree,
JsonArray,
Smgr,
TableAmHandler,
IndexAmHandler,
Point,
Lseg,
@ -47,9 +47,6 @@ pub enum Inner {
CidrArray,
Float4,
Float8,
Abstime,
Reltime,
Tinterval,
Unknown,
Circle,
CircleArray,
@ -81,9 +78,6 @@ pub enum Inner {
BoxArray,
Float4Array,
Float8Array,
AbstimeArray,
ReltimeArray,
TintervalArray,
PolygonArray,
OidArray,
Aclitem,
@ -172,10 +166,13 @@ pub enum Inner {
DateRangeArray,
Int8Range,
Int8RangeArray,
Jsonpath,
JsonpathArray,
Regnamespace,
RegnamespaceArray,
Regrole,
RegroleArray,
PgMcvList,
Other(Arc<Other>),
}
@ -203,7 +200,7 @@ impl Inner {
143 => Some(Inner::XmlArray),
194 => Some(Inner::PgNodeTree),
199 => Some(Inner::JsonArray),
210 => Some(Inner::Smgr),
269 => Some(Inner::TableAmHandler),
325 => Some(Inner::IndexAmHandler),
600 => Some(Inner::Point),
601 => Some(Inner::Lseg),
@ -216,9 +213,6 @@ impl Inner {
651 => Some(Inner::CidrArray),
700 => Some(Inner::Float4),
701 => Some(Inner::Float8),
702 => Some(Inner::Abstime),
703 => Some(Inner::Reltime),
704 => Some(Inner::Tinterval),
705 => Some(Inner::Unknown),
718 => Some(Inner::Circle),
719 => Some(Inner::CircleArray),
@ -250,9 +244,6 @@ impl Inner {
1020 => Some(Inner::BoxArray),
1021 => Some(Inner::Float4Array),
1022 => Some(Inner::Float8Array),
1023 => Some(Inner::AbstimeArray),
1024 => Some(Inner::ReltimeArray),
1025 => Some(Inner::TintervalArray),
1027 => Some(Inner::PolygonArray),
1028 => Some(Inner::OidArray),
1033 => Some(Inner::Aclitem),
@ -341,10 +332,13 @@ impl Inner {
3913 => Some(Inner::DateRangeArray),
3926 => Some(Inner::Int8Range),
3927 => Some(Inner::Int8RangeArray),
4072 => Some(Inner::Jsonpath),
4073 => Some(Inner::JsonpathArray),
4089 => Some(Inner::Regnamespace),
4090 => Some(Inner::RegnamespaceArray),
4096 => Some(Inner::Regrole),
4097 => Some(Inner::RegroleArray),
5017 => Some(Inner::PgMcvList),
_ => None,
}
}
@ -372,7 +366,7 @@ impl Inner {
Inner::XmlArray => 143,
Inner::PgNodeTree => 194,
Inner::JsonArray => 199,
Inner::Smgr => 210,
Inner::TableAmHandler => 269,
Inner::IndexAmHandler => 325,
Inner::Point => 600,
Inner::Lseg => 601,
@ -385,9 +379,6 @@ impl Inner {
Inner::CidrArray => 651,
Inner::Float4 => 700,
Inner::Float8 => 701,
Inner::Abstime => 702,
Inner::Reltime => 703,
Inner::Tinterval => 704,
Inner::Unknown => 705,
Inner::Circle => 718,
Inner::CircleArray => 719,
@ -419,9 +410,6 @@ impl Inner {
Inner::BoxArray => 1020,
Inner::Float4Array => 1021,
Inner::Float8Array => 1022,
Inner::AbstimeArray => 1023,
Inner::ReltimeArray => 1024,
Inner::TintervalArray => 1025,
Inner::PolygonArray => 1027,
Inner::OidArray => 1028,
Inner::Aclitem => 1033,
@ -510,10 +498,13 @@ impl Inner {
Inner::DateRangeArray => 3913,
Inner::Int8Range => 3926,
Inner::Int8RangeArray => 3927,
Inner::Jsonpath => 4072,
Inner::JsonpathArray => 4073,
Inner::Regnamespace => 4089,
Inner::RegnamespaceArray => 4090,
Inner::Regrole => 4096,
Inner::RegroleArray => 4097,
Inner::PgMcvList => 5017,
Inner::Other(ref u) => u.oid,
}
}
@ -541,7 +532,7 @@ impl Inner {
Inner::XmlArray => &Kind::Array(Type(Inner::Xml)),
Inner::PgNodeTree => &Kind::Simple,
Inner::JsonArray => &Kind::Array(Type(Inner::Json)),
Inner::Smgr => &Kind::Simple,
Inner::TableAmHandler => &Kind::Pseudo,
Inner::IndexAmHandler => &Kind::Pseudo,
Inner::Point => &Kind::Simple,
Inner::Lseg => &Kind::Simple,
@ -554,9 +545,6 @@ impl Inner {
Inner::CidrArray => &Kind::Array(Type(Inner::Cidr)),
Inner::Float4 => &Kind::Simple,
Inner::Float8 => &Kind::Simple,
Inner::Abstime => &Kind::Simple,
Inner::Reltime => &Kind::Simple,
Inner::Tinterval => &Kind::Simple,
Inner::Unknown => &Kind::Simple,
Inner::Circle => &Kind::Simple,
Inner::CircleArray => &Kind::Array(Type(Inner::Circle)),
@ -588,9 +576,6 @@ impl Inner {
Inner::BoxArray => &Kind::Array(Type(Inner::Box)),
Inner::Float4Array => &Kind::Array(Type(Inner::Float4)),
Inner::Float8Array => &Kind::Array(Type(Inner::Float8)),
Inner::AbstimeArray => &Kind::Array(Type(Inner::Abstime)),
Inner::ReltimeArray => &Kind::Array(Type(Inner::Reltime)),
Inner::TintervalArray => &Kind::Array(Type(Inner::Tinterval)),
Inner::PolygonArray => &Kind::Array(Type(Inner::Polygon)),
Inner::OidArray => &Kind::Array(Type(Inner::Oid)),
Inner::Aclitem => &Kind::Simple,
@ -679,10 +664,13 @@ impl Inner {
Inner::DateRangeArray => &Kind::Array(Type(Inner::DateRange)),
Inner::Int8Range => &Kind::Range(Type(Inner::Int8)),
Inner::Int8RangeArray => &Kind::Array(Type(Inner::Int8Range)),
Inner::Jsonpath => &Kind::Simple,
Inner::JsonpathArray => &Kind::Array(Type(Inner::Jsonpath)),
Inner::Regnamespace => &Kind::Simple,
Inner::RegnamespaceArray => &Kind::Array(Type(Inner::Regnamespace)),
Inner::Regrole => &Kind::Simple,
Inner::RegroleArray => &Kind::Array(Type(Inner::Regrole)),
Inner::PgMcvList => &Kind::Simple,
Inner::Other(ref u) => &u.kind,
}
}
@ -710,7 +698,7 @@ impl Inner {
Inner::XmlArray => "_xml",
Inner::PgNodeTree => "pg_node_tree",
Inner::JsonArray => "_json",
Inner::Smgr => "smgr",
Inner::TableAmHandler => "table_am_handler",
Inner::IndexAmHandler => "index_am_handler",
Inner::Point => "point",
Inner::Lseg => "lseg",
@ -723,9 +711,6 @@ impl Inner {
Inner::CidrArray => "_cidr",
Inner::Float4 => "float4",
Inner::Float8 => "float8",
Inner::Abstime => "abstime",
Inner::Reltime => "reltime",
Inner::Tinterval => "tinterval",
Inner::Unknown => "unknown",
Inner::Circle => "circle",
Inner::CircleArray => "_circle",
@ -757,9 +742,6 @@ impl Inner {
Inner::BoxArray => "_box",
Inner::Float4Array => "_float4",
Inner::Float8Array => "_float8",
Inner::AbstimeArray => "_abstime",
Inner::ReltimeArray => "_reltime",
Inner::TintervalArray => "_tinterval",
Inner::PolygonArray => "_polygon",
Inner::OidArray => "_oid",
Inner::Aclitem => "aclitem",
@ -848,10 +830,13 @@ impl Inner {
Inner::DateRangeArray => "_daterange",
Inner::Int8Range => "int8range",
Inner::Int8RangeArray => "_int8range",
Inner::Jsonpath => "jsonpath",
Inner::JsonpathArray => "_jsonpath",
Inner::Regnamespace => "regnamespace",
Inner::RegnamespaceArray => "_regnamespace",
Inner::Regrole => "regrole",
Inner::RegroleArray => "_regrole",
Inner::PgMcvList => "pg_mcv_list",
Inner::Other(ref u) => &u.name,
}
}
@ -905,7 +890,7 @@ impl Type {
/// PG_DDL_COMMAND - internal type for passing CollectedCommand
pub const PG_DDL_COMMAND: Type = Type(Inner::PgDdlCommand);
/// JSON
/// JSON - JSON stored as text
pub const JSON: Type = Type(Inner::Json);
/// XML - XML content
@ -920,10 +905,10 @@ impl Type {
/// JSON&#91;&#93;
pub const JSON_ARRAY: Type = Type(Inner::JsonArray);
/// SMGR - storage manager
pub const SMGR: Type = Type(Inner::Smgr);
/// TABLE_AM_HANDLER
pub const TABLE_AM_HANDLER: Type = Type(Inner::TableAmHandler);
/// INDEX_AM_HANDLER
/// INDEX_AM_HANDLER - pseudo-type for the result of an index AM handler function
pub const INDEX_AM_HANDLER: Type = Type(Inner::IndexAmHandler);
/// POINT - geometric point &#39;&#40;x, y&#41;&#39;
@ -959,16 +944,7 @@ impl Type {
/// FLOAT8 - double-precision floating point number, 8-byte storage
pub const FLOAT8: Type = Type(Inner::Float8);
/// ABSTIME - absolute, limited-range date and time &#40;Unix system time&#41;
pub const ABSTIME: Type = Type(Inner::Abstime);
/// RELTIME - relative, limited-range time interval &#40;Unix delta time&#41;
pub const RELTIME: Type = Type(Inner::Reltime);
/// TINTERVAL - &#40;abstime,abstime&#41;, time interval
pub const TINTERVAL: Type = Type(Inner::Tinterval);
/// UNKNOWN
/// UNKNOWN - pseudo-type representing an undetermined type
pub const UNKNOWN: Type = Type(Inner::Unknown);
/// CIRCLE - geometric circle &#39;&#40;center,radius&#41;&#39;
@ -1061,15 +1037,6 @@ impl Type {
/// FLOAT8&#91;&#93;
pub const FLOAT8_ARRAY: Type = Type(Inner::Float8Array);
/// ABSTIME&#91;&#93;
pub const ABSTIME_ARRAY: Type = Type(Inner::AbstimeArray);
/// RELTIME&#91;&#93;
pub const RELTIME_ARRAY: Type = Type(Inner::ReltimeArray);
/// TINTERVAL&#91;&#93;
pub const TINTERVAL_ARRAY: Type = Type(Inner::TintervalArray);
/// POLYGON&#91;&#93;
pub const POLYGON_ARRAY: Type = Type(Inner::PolygonArray);
@ -1187,40 +1154,40 @@ impl Type {
/// REGTYPE&#91;&#93;
pub const REGTYPE_ARRAY: Type = Type(Inner::RegtypeArray);
/// RECORD
/// RECORD - pseudo-type representing any composite type
pub const RECORD: Type = Type(Inner::Record);
/// CSTRING
/// CSTRING - C-style string
pub const CSTRING: Type = Type(Inner::Cstring);
/// ANY
/// ANY - pseudo-type representing any type
pub const ANY: Type = Type(Inner::Any);
/// ANYARRAY
/// ANYARRAY - pseudo-type representing a polymorphic array type
pub const ANYARRAY: Type = Type(Inner::Anyarray);
/// VOID
/// VOID - pseudo-type for the result of a function with no real result
pub const VOID: Type = Type(Inner::Void);
/// TRIGGER
/// TRIGGER - pseudo-type for the result of a trigger function
pub const TRIGGER: Type = Type(Inner::Trigger);
/// LANGUAGE_HANDLER
/// LANGUAGE_HANDLER - pseudo-type for the result of a language handler function
pub const LANGUAGE_HANDLER: Type = Type(Inner::LanguageHandler);
/// INTERNAL
/// INTERNAL - pseudo-type representing an internal data structure
pub const INTERNAL: Type = Type(Inner::Internal);
/// OPAQUE
/// OPAQUE - obsolete, deprecated pseudo-type
pub const OPAQUE: Type = Type(Inner::Opaque);
/// ANYELEMENT
/// ANYELEMENT - pseudo-type representing a polymorphic base type
pub const ANYELEMENT: Type = Type(Inner::Anyelement);
/// RECORD&#91;&#93;
pub const RECORD_ARRAY: Type = Type(Inner::RecordArray);
/// ANYNONARRAY
/// ANYNONARRAY - pseudo-type representing a polymorphic base type that is not an array
pub const ANYNONARRAY: Type = Type(Inner::Anynonarray);
/// TXID_SNAPSHOT&#91;&#93;
@ -1235,7 +1202,7 @@ impl Type {
/// TXID_SNAPSHOT - txid snapshot
pub const TXID_SNAPSHOT: Type = Type(Inner::TxidSnapshot);
/// FDW_HANDLER
/// FDW_HANDLER - pseudo-type for the result of an FDW handler function
pub const FDW_HANDLER: Type = Type(Inner::FdwHandler);
/// PG_LSN - PostgreSQL LSN datatype
@ -1244,7 +1211,7 @@ impl Type {
/// PG_LSN&#91;&#93;
pub const PG_LSN_ARRAY: Type = Type(Inner::PgLsnArray);
/// TSM_HANDLER
/// TSM_HANDLER - pseudo-type for the result of a tablesample method function
pub const TSM_HANDLER: Type = Type(Inner::TsmHandler);
/// PG_NDISTINCT - multivariate ndistinct coefficients
@ -1253,7 +1220,7 @@ impl Type {
/// PG_DEPENDENCIES - multivariate dependencies
pub const PG_DEPENDENCIES: Type = Type(Inner::PgDependencies);
/// ANYENUM
/// ANYENUM - pseudo-type representing a polymorphic base type that is an enum
pub const ANYENUM: Type = Type(Inner::Anyenum);
/// TSVECTOR - text representation for text search
@ -1292,10 +1259,10 @@ impl Type {
/// JSONB&#91;&#93;
pub const JSONB_ARRAY: Type = Type(Inner::JsonbArray);
/// ANYRANGE
/// ANYRANGE - pseudo-type representing a polymorphic base type that is a range
pub const ANY_RANGE: Type = Type(Inner::AnyRange);
/// EVENT_TRIGGER
/// EVENT_TRIGGER - pseudo-type for the result of an event trigger function
pub const EVENT_TRIGGER: Type = Type(Inner::EventTrigger);
/// INT4RANGE - range of integers
@ -1334,6 +1301,12 @@ impl Type {
/// INT8RANGE&#91;&#93;
pub const INT8_RANGE_ARRAY: Type = Type(Inner::Int8RangeArray);
/// JSONPATH - JSON path
pub const JSONPATH: Type = Type(Inner::Jsonpath);
/// JSONPATH&#91;&#93;
pub const JSONPATH_ARRAY: Type = Type(Inner::JsonpathArray);
/// REGNAMESPACE - registered namespace
pub const REGNAMESPACE: Type = Type(Inner::Regnamespace);
@ -1345,4 +1318,7 @@ impl Type {
/// REGROLE&#91;&#93;
pub const REGROLE_ARRAY: Type = Type(Inner::RegroleArray);
/// PG_MCV_LIST - multivariate MCV list
pub const PG_MCV_LIST: Type = Type(Inner::PgMcvList);
}