diff --git a/Cargo.toml b/Cargo.toml index 77f0a537..88d2a38e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,8 +8,8 @@ repository = "https://github.com/sfackler/rust-postgres" documentation = "https://sfackler.github.io/rust-postgres/doc/v0.11.3/postgres" readme = "README.md" keywords = ["database", "postgres", "postgresql", "sql"] -build = "build.rs" -include = ["src/*", "build.rs", "errcodes.txt", "Cargo.toml", "LICENSE", "README.md", "THIRD_PARTY"] +build = "build/main.rs" +include = ["src/*", "build/*", "Cargo.toml", "LICENSE", "README.md", "THIRD_PARTY"] [lib] name = "postgres" @@ -23,6 +23,7 @@ path = "tests/test.rs" [build-dependencies] phf_codegen = "0.7" +regex = "0.1" [dependencies] bufstream = "0.1" diff --git a/errcodes.txt b/build/errcodes.txt similarity index 100% rename from errcodes.txt rename to build/errcodes.txt diff --git a/build/main.rs b/build/main.rs new file mode 100644 index 00000000..816d668f --- /dev/null +++ b/build/main.rs @@ -0,0 +1,35 @@ +extern crate phf_codegen; +extern crate regex; + +use std::ascii::AsciiExt; + +mod sqlstate; +mod types; + +fn main() { + sqlstate::build(); + types::build(); + + println!("cargo:rerun-if-changed=build"); +} + +fn snake_to_camel(s: &str) -> String { + let mut out = String::new(); + + let mut upper = true; + for ch in s.chars() { + if ch == '_' { + upper = true; + } else { + let ch = if upper { + upper = false; + ch.to_ascii_uppercase() + } else { + ch + }; + out.push(ch); + } + } + + out +} diff --git a/build/pg_range.h b/build/pg_range.h new file mode 100644 index 00000000..9a158903 --- /dev/null +++ b/build/pg_range.h @@ -0,0 +1,85 @@ +/*------------------------------------------------------------------------- + * + * pg_range.h + * definition of the system "range" relation (pg_range) + * along with the relation's initial contents. + * + * + * Portions Copyright (c) 1996-2015, 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 */ diff --git a/build/pg_type.h b/build/pg_type.h new file mode 100644 index 00000000..7dc95c8d --- /dev/null +++ b/build/pg_type.h @@ -0,0 +1,738 @@ +/*------------------------------------------------------------------------- + * + * pg_type.h + * definition of the system "type" relation (pg_type) + * along with the relation's initial contents. + * + * + * Portions Copyright (c) 1996-2015, 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 = 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 b 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 + +/* 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 = 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("@ , 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 = 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 */ diff --git a/build.rs b/build/sqlstate.rs similarity index 86% rename from build.rs rename to build/sqlstate.rs index f831cb5b..052df048 100644 --- a/build.rs +++ b/build/sqlstate.rs @@ -1,11 +1,11 @@ -extern crate phf_codegen; - -use std::ascii::AsciiExt; use std::env; use std::fs::File; use std::io::{Write, BufWriter}; use std::path::Path; use std::convert::AsRef; +use phf_codegen; + +use snake_to_camel; const ERRCODES_TXT: &'static str = include_str!("errcodes.txt"); @@ -14,7 +14,7 @@ struct Code { variant: String, } -fn main() { +pub fn build() { let path = env::var_os("OUT_DIR").unwrap(); let path: &Path = path.as_ref(); let path = path.join("sqlstate.rs"); @@ -25,9 +25,6 @@ fn main() { make_enum(&codes, &mut file); make_map(&codes, &mut file); make_impl(&codes, &mut file); - - println!("cargo:rerun-if-changed=build.rs"); - println!("cargo:rerun-if-changed=errcodes.txt"); } fn parse_codes() -> Vec { @@ -61,27 +58,6 @@ fn parse_codes() -> Vec { codes } -fn snake_to_camel(s: &str) -> String { - let mut out = String::new(); - - let mut upper = true; - for ch in s.chars() { - if ch == '_' { - upper = true; - } else { - let ch = if upper { - upper = false; - ch.to_ascii_uppercase() - } else { - ch - }; - out.push(ch); - } - } - - out -} - fn variant_name(code: &str) -> Option { match code { "01004" => Some("WarningStringDataRightTruncation".to_owned()), @@ -161,3 +137,4 @@ impl SqlState {{ "# ).unwrap(); } + diff --git a/build/types.rs b/build/types.rs new file mode 100644 index 00000000..d2e3d5a8 --- /dev/null +++ b/build/types.rs @@ -0,0 +1,257 @@ +use regex::Regex; +use std::ascii::AsciiExt; +use std::collections::BTreeMap; +use std::env; +use std::fs::File; +use std::io::{Write, BufWriter}; +use std::path::Path; + +use snake_to_camel; + +const PG_TYPE_H: &'static str = include_str!("pg_type.h"); +const PG_RANGE_H: &'static str = include_str!("pg_range.h"); + +struct Type { + name: &'static str, + variant: String, + kind: &'static str, + element: u32, + doc: String, +} + +pub fn build() { + let path = env::var_os("OUT_DIR").unwrap(); + let path: &Path = path.as_ref(); + let path = path.join("type.rs"); + let mut file = BufWriter::new(File::create(&path).unwrap()); + + let ranges = parse_ranges(); + let types = parse_types(&ranges); + + make_enum(&mut file, &types); + make_display_impl(&mut file); + make_impl(&mut file, &types); +} + +fn parse_ranges() -> BTreeMap { + let mut ranges = BTreeMap::new(); + + for line in PG_RANGE_H.lines() { + if !line.starts_with("DATA") { + continue; + } + + let split = line.split_whitespace().collect::>(); + + let oid = split[2].parse().unwrap(); + let element = split[3].parse().unwrap(); + + ranges.insert(oid, element); + } + + ranges +} + +fn parse_types(ranges: &BTreeMap) -> BTreeMap { + let doc_re = Regex::new(r#"DESCR\("([^"]+)"\)"#).unwrap(); + 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; + } + + let split = line.split_whitespace().collect::>(); + + let oid = split[3].parse().unwrap(); + + let name = split[5]; + + let variant = match name { + "anyrange" => "Anyrange".to_owned(), + name => { + let variant = range_vector_re.replace(name, "_$1"); + let variant = array_re.replace(&variant, "$1_array"); + snake_to_camel(&variant) + } + }; + + let kind = split[11]; + // 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 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 type_ = Type { + name: name, + variant: variant, + kind: kind, + element: element, + doc: doc, + }; + + types.insert(oid, type_); + } + + types +} + +fn make_enum(w: &mut BufWriter, types: &BTreeMap) { + write!(w, +r#"/// A Postgres type. +#[derive(PartialEq, Eq, Clone, Debug)] +pub enum Type {{ +"# + ).unwrap(); + + for type_ in types.values() { + write!(w, +r" /// {} + {}, +" + , type_.doc, type_.variant).unwrap(); + } + + write!(w, +r" /// An unknown type. + Other(Other), +}} + +" ).unwrap(); +} + +fn make_display_impl(w: &mut BufWriter) { + write!(w, +r#"impl fmt::Display for Type {{ + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {{ + match self.schema() {{ + "public" | "pg_catalog" => {{}} + schema => try!(write!(fmt, "{{}}.", schema)), + }} + fmt.write_str(self.name()) + }} +}} + +"#, + ).unwrap(); +} + +fn make_impl(w: &mut BufWriter, types: &BTreeMap) { + write!(w, +"impl Type {{ + /// Returns the `Type` corresponding to the provided `Oid` if it + /// corresponds to a built-in type. + pub fn from_oid(oid: Oid) -> Option {{ + match oid {{ +", + ).unwrap(); + + for (oid, type_) in types { + write!(w, +" {} => Some(Type::{}), +", + oid, type_.variant).unwrap(); + } + + write!(w, +" _ => None, + }} + }} + + /// Returns the OID of the `Type`. + pub fn oid(&self) -> Oid {{ + match *self {{ +", + ).unwrap(); + + + for (oid, type_) in types { + write!(w, +" Type::{} => {}, +", + type_.variant, oid).unwrap(); + } + + write!(w, +" Type::Other(ref u) => u.oid(), + }} + }} + + /// Returns the kind of this type. + pub fn kind(&self) -> &Kind {{ + match *self {{ +", + ).unwrap(); + + for type_ in types.values() { + let kind = match type_.kind { + "P" => "Pseudo".to_owned(), + "A" => format!("Array(Type::{})", types[&type_.element].variant), + "R" => format!("Range(Type::{})", types[&type_.element].variant), + _ => "Simple".to_owned(), + }; + + write!(w, +" Type::{} => {{ + const V: &'static Kind = &Kind::{}; + V + }} +", + type_.variant, kind).unwrap(); + } + + write!(w, +r#" Type::Other(ref u) => u.kind(), + }} + }} + + /// Returns the schema of this type. + pub fn schema(&self) -> &str {{ + match *self {{ + Type::Other(ref u) => u.schema(), + _ => "pg_catalog", + }} + }} + + /// Returns the name of this type. + pub fn name(&self) -> &str {{ + match *self {{ +"#, + ).unwrap(); + + for type_ in types.values() { + write!(w, +r#" Type::{} => "{}", +"#, + type_.variant, type_.name).unwrap(); + } + + write!(w, +" Type::Other(ref u) => u.name(), + }} + }} +}} +" + ).unwrap(); +} diff --git a/src/types/mod.rs b/src/types/mod.rs index 1fddbff1..7964c6ca 100644 --- a/src/types/mod.rs +++ b/src/types/mod.rs @@ -149,414 +149,7 @@ impl FieldNew for Field { } } -macro_rules! as_pat { - ($p:pat) => ($p) -} - -macro_rules! as_expr { - ($e:expr) => ($e) -} - -macro_rules! make_postgres_type { - ($(#[$doc:meta] $oid:tt: $name:expr => $variant:ident: $kind:expr),+) => ( - /// A Postgres type. - #[derive(PartialEq, Eq, Clone)] - pub enum Type { - $( - #[$doc] - $variant, - )+ - /// An unknown type. - Other(Other), - } - - impl fmt::Debug for Type { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - let s = match *self { - $(Type::$variant => stringify!($variant),)+ - Type::Other(ref u) => return fmt::Debug::fmt(u, fmt), - }; - fmt.write_str(s) - } - } - - impl fmt::Display for Type { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - match self.schema() { - "public" | "pg_catalog" => {} - schema => try!(write!(fmt, "{}.", schema)), - } - fmt.write_str(self.name()) - } - } - - impl Type { - /// Returns the `Type` corresponding to the provided `Oid` if it - /// corresponds to a built-in type. - pub fn from_oid(oid: Oid) -> Option { - match oid { - $(as_pat!($oid) => Some(Type::$variant),)+ - _ => None - } - } - - /// Returns the OID of the `Type`. - pub fn oid(&self) -> Oid { - match *self { - $(Type::$variant => as_expr!($oid),)+ - Type::Other(ref u) => u.oid(), - } - } - - /// Returns the kind of this type. - pub fn kind(&self) -> &Kind { - match *self { - $( - Type::$variant => { - const V: &'static Kind = &$kind; - V - } - )+ - Type::Other(ref u) => u.kind(), - } - } - - /// Returns the schema of this type. - pub fn schema(&self) -> &str { - match *self { - Type::Other(ref u) => u.schema(), - _ => "pg_catalog", - } - } - - /// Returns the name of this type. - pub fn name(&self) -> &str { - match *self { - $( - Type::$variant => $name, - )+ - Type::Other(ref u) => u.name(), - } - } - } - ) -} - -// Values from pg_type.h -make_postgres_type! { - /// BOOL - boolean, 'true'/'false' - 16: "bool" => Bool: Kind::Simple, - /// BYTEA - variable-length string, binary values escaped - 17: "bytea" => Bytea: Kind::Simple, - /// "char" - single character - 18: "char" => Char: Kind::Simple, - /// NAME - 63-byte type for storing system identifiers - 19: "name" => Name: Kind::Simple, - /// INT8/BIGINT - ~18 digit integer, 8-byte storage - 20: "int8" => Int8: Kind::Simple, - /// INT2/SMALLINT - -32 thousand to 32 thousand, 2-byte storage - 21: "int2" => Int2: Kind::Simple, - /// INT2VECTOR - array of int2, used in system tables - 22: "int2vector" => Int2Vector: Kind::Array(Type::Int2), - /// INT4/INT - -2 billion to 2 billion integer, 4-byte storage - 23: "int4" => Int4: Kind::Simple, - /// REGPROC - registered procedure - 24: "regproc" => Regproc: Kind::Simple, - /// TEXT - variable-length string, no limit specified - 25: "text" => Text: Kind::Simple, - /// OID - object identifier(oid), maximum 4 billion - 26: "oid" => Oid: Kind::Simple, - /// TID - (block, offset), physical location of tuple - 27: "tid" => Tid: Kind::Simple, - /// XID - transaction id - 28: "xid" => Xid: Kind::Simple, - /// CID - command identifier type, sequence in transaction id - 29: "cid" => Cid: Kind::Simple, - /// OIDVECTOR - array of oids, used in system tables - 30: "oidvector" => OidVector: Kind::Array(Type::Oid), - /// PG_TYPE - 71: "pg_type" => PgType: Kind::Simple, - /// PG_ATTRIBUTE - 75: "pg_attribute" => PgAttribute: Kind::Simple, - /// PG_PROC - 81: "pg_proc" => PgProc: Kind::Simple, - /// PG_CLASS - 83: "pg_class" => PgClass: Kind::Simple, - /// JSON - 114: "json" => Json: Kind::Simple, - /// XML - XML content - 142: "xml" => Xml: Kind::Simple, - /// XML[] - 143: "_xml" => XmlArray: Kind::Array(Type::Xml), - /// PG_NODE_TREE - string representing an internal node tree - 194: "pg_node_tree" => PgNodeTree: Kind::Simple, - /// JSON[] - 199: "_json" => JsonArray: Kind::Array(Type::Json), - /// SMGR - storage manager - 210: "smgr" => Smgr: Kind::Simple, - /// POINT - geometric point '(x, y)' - 600: "point" => Point: Kind::Simple, - /// LSEG - geometric line segment '(pt1,pt2)' - 601: "lseg" => Lseg: Kind::Simple, - /// PATH - geometric path '(pt1,...)' - 602: "path" => Path: Kind::Simple, - /// BOX - geometric box '(lower left,upper right)' - 603: "box" => Box: Kind::Simple, - /// POLYGON - geometric polygon '(pt1,...)' - 604: "polygon" => Polygon: Kind::Simple, - /// LINE - geometric line - 628: "line" => Line: Kind::Simple, - /// LINE[] - 629: "_line" => LineArray: Kind::Array(Type::Line), - /// CIDR - network IP address/netmask, network address - 650: "cidr" => Cidr: Kind::Simple, - /// CIDR[] - 651: "_cidr" => CidrArray: Kind::Array(Type::Cidr), - /// FLOAT4/REAL - single-precision floating point number, 4-byte storage - 700: "float4" => Float4: Kind::Simple, - /// FLOAT8/DOUBLE PRECISION - double-precision floating point number, 8-byte storage - 701: "float8" => Float8: Kind::Simple, - /// ABSTIME - absolute, limited-range date and time (Unix system time) - 702: "abstime" => Abstime: Kind::Simple, - /// RELTIME - relative, limited-range date and time (Unix delta time) - 703: "reltime" => Reltime: Kind::Simple, - /// TINTERVAL - (abstime,abstime), time interval - 704: "tinterval" => Tinterval: Kind::Simple, - /// UNKNOWN - 705: "unknown" => Unknown: Kind::Simple, - /// CIRCLE - geometric circle '(center,radius)' - 718: "circle" => Circle: Kind::Simple, - /// CIRCLE[] - 719: "_circle" => CircleArray: Kind::Array(Type::Circle), - /// MONEY - monetary amounts, $d,ddd.cc - 790: "money" => Money: Kind::Simple, - /// MONEY[] - 791: "_money" => MoneyArray: Kind::Array(Type::Money), - /// MACADDR - XX:XX:XX:XX:XX:XX, MAC address - 829: "macaddr" => Macaddr: Kind::Simple, - /// INET - IP address/netmask, host address, netmask optional - 869: "inet" => Inet: Kind::Simple, - /// BOOL[] - 1000: "_bool" => BoolArray: Kind::Array(Type::Bool), - /// BYTEA[] - 1001: "_bytea" => ByteaArray: Kind::Array(Type::Bytea), - /// "char"[] - 1002: "_char" => CharArray: Kind::Array(Type::Char), - /// NAME[] - 1003: "_name" => NameArray: Kind::Array(Type::Name), - /// INT2[] - 1005: "_int2" => Int2Array: Kind::Array(Type::Int2), - /// INT2VECTOR[] - 1006: "_int2vector" => Int2VectorArray: Kind::Array(Type::Int2Vector), - /// INT4[] - 1007: "_int4" => Int4Array: Kind::Array(Type::Int4), - /// REGPROC[] - 1008: "_regproc" => RegprocArray: Kind::Array(Type::Regproc), - /// TEXT[] - 1009: "_text" => TextArray: Kind::Array(Type::Text), - /// TID[] - 1010: "_tid" => TidArray: Kind::Array(Type::Tid), - /// XID[] - 1011: "_xid" => XidArray: Kind::Array(Type::Xid), - /// CID[] - 1012: "_cid" => CidArray: Kind::Array(Type::Cid), - /// OIDVECTOR[] - 1013: "_oidvector" => OidVectorArray: Kind::Array(Type::OidVector), - /// BPCHAR[] - 1014: "_bpchar" => BpcharArray: Kind::Array(Type::Bpchar), - /// VARCHAR[] - 1015: "_varchar" => VarcharArray: Kind::Array(Type::Varchar), - /// INT8[] - 1016: "_int8" => Int8Array: Kind::Array(Type::Int8), - /// POINT[] - 1017: "_point" => PointArray: Kind::Array(Type::Point), - /// LSEG[] - 1018: "_lseg" => LsegArray: Kind::Array(Type::Lseg), - /// PATH[] - 1019: "_path" => PathArray: Kind::Array(Type::Path), - /// BOX[] - 1020: "_box" => BoxArray: Kind::Array(Type::Box), - /// FLOAT4[] - 1021: "_float4" => Float4Array: Kind::Array(Type::Float4), - /// FLOAT8[] - 1022: "_float8" => Float8Array: Kind::Array(Type::Float8), - /// ABSTIME[] - 1023: "_abstime" => AbstimeArray: Kind::Array(Type::Abstime), - /// RELTIME[] - 1024: "_reltime" => ReltimeArray: Kind::Array(Type::Reltime), - /// TINTERVAL[] - 1025: "_tinterval" => TintervalArray: Kind::Array(Type::Tinterval), - /// POLYGON[] - 1027: "_polygon" => PolygonArray: Kind::Array(Type::Polygon), - /// OID[] - 1028: "_oid" => OidArray: Kind::Array(Type::Oid), - /// ACLITEM - access control list - 1033: "aclitem" => Aclitem: Kind::Simple, - /// ACLITEM[] - 1034: "_aclitem" => AclitemArray: Kind::Array(Type::Aclitem), - /// MACADDR[] - 1040: "_macaddr" => MacaddrArray: Kind::Array(Type::Macaddr), - /// INET[] - 1041: "_inet" => InetArray: Kind::Array(Type::Inet), - /// BPCHAR - char(length), blank-padded string, fixed storage length - 1042: "bpchar" => Bpchar: Kind::Simple, - /// VARCHAR - varchar(length), non-blank-padded string, variable storage length - 1043: "varchar" => Varchar: Kind::Simple, - /// DATE - date - 1082: "date" => Date: Kind::Simple, - /// TIME - time of day - 1083: "time" => Time: Kind::Simple, - /// TIMESTAMP - date and time - 1114: "timestamp" => Timestamp: Kind::Simple, - /// TIMESTAMP[] - 1115: "_timestamp" => TimestampArray: Kind::Array(Type::Timestamp), - /// DATE[] - 1182: "_date" => DateArray: Kind::Array(Type::Date), - /// TIME[] - 1183: "_time" => TimeArray: Kind::Array(Type::Time), - /// TIMESTAMPTZ - date and time with time zone - 1184: "timestamptz" => TimestampTZ: Kind::Simple, - /// TIMESTAMPTZ[] - 1185: "_timestamptz" => TimestampTZArray: Kind::Array(Type::TimestampTZ), - /// INTERVAL - @ <number> <units>, time interval - 1186: "interval" => Interval: Kind::Simple, - /// INTERVAL[] - 1187: "_interval" => IntervalArray: Kind::Array(Type::Interval), - /// NUMERIC[] - 1231: "_numeric" => NumericArray: Kind::Array(Type::Numeric), - /// CSTRING[] - 1263: "_cstring" => CstringArray: Kind::Array(Type::Cstring), - /// TIMETZ - time of day with time zone - 1266: "timetz" => Timetz: Kind::Simple, - /// TIMETZ[] - 1270: "_timetz" => TimetzArray: Kind::Array(Type::Timetz), - /// BIT - fixed-length bit string - 1560: "bit" => Bit: Kind::Simple, - /// BIT[] - 1561: "_bit" => BitArray: Kind::Array(Type::Bit), - /// VARBIT - variable-length bit string - 1562: "varbit" => Varbit: Kind::Simple, - /// VARBIT[] - 1563: "_varbit" => VarbitArray: Kind::Array(Type::Varbit), - /// NUMERIC - numeric(precision, decimal), arbitrary precision number - 1700: "numeric" => Numeric: Kind::Simple, - /// REFCURSOR - reference to cursor (portal name) - 1790: "refcursor" => Refcursor: Kind::Simple, - /// REFCURSOR[] - 2201: "_refcursor" => RefcursorArray: Kind::Array(Type::Refcursor), - /// REGPROCEDURE - registered procedure (with args) - 2202: "regprocedure" => Regprocedure: Kind::Simple, - /// REGOPER - registered operator - 2203: "regoper" => Regoper: Kind::Simple, - /// REGOPERATOR - registered operator (with args) - 2204: "regoperator" => Regoperator: Kind::Simple, - /// REGCLASS - registered class - 2205: "regclass" => Regclass: Kind::Simple, - /// REGTYPE - registered type - 2206: "regtype" => Regtype: Kind::Simple, - /// REGPROCEDURE[] - 2207: "_regprocedure" => RegprocedureArray: Kind::Array(Type::Regprocedure), - /// REGOPER[] - 2208: "_regoper" => RegoperArray: Kind::Array(Type::Regoper), - /// REGOPERATOR[] - 2209: "_regoperator" => RegoperatorArray: Kind::Array(Type::Regoperator), - /// REGCLASS[] - 2210: "_regclass" => RegclassArray: Kind::Array(Type::Regclass), - /// REGTYPE[] - 2211: "_regtype" => RegtypeArray: Kind::Array(Type::Regtype), - /// RECORD - 2249: "record" => Record: Kind::Pseudo, - /// CSTRING - 2275: "cstring" => Cstring: Kind::Pseudo, - /// ANY - 2276: "any" => Any: Kind::Pseudo, - /// ANYARRAY - 2277: "anyarray" => AnyArray: Kind::Pseudo, - /// VOID - 2278: "void" => Void: Kind::Pseudo, - /// TRIGGER - 2279: "trigger" => Trigger: Kind::Pseudo, - /// LANGUAGE_HANDLER - 2280: "language_handler" => LanguageHandler: Kind::Pseudo, - /// INTERNAL - 2281: "internal" => Internal: Kind::Pseudo, - /// OPAQUE - 2282: "opaque" => Opaque: Kind::Pseudo, - /// ANYELEMENT - 2283: "anyelement" => Anyelement: Kind::Pseudo, - /// RECORD[] - 2287: "_record" => RecordArray: Kind::Pseudo, - /// ANYNONARRAY - 2776: "anynonarray" => Anynonarray: Kind::Pseudo, - /// TXID_SNAPSHOT[] - 2949: "_txid_snapshot" => TxidSnapshotArray: Kind::Array(Type::TxidSnapshot), - /// UUID - UUID datatype - 2950: "uuid" => Uuid: Kind::Simple, - /// TXID_SNAPSHOT - txid snapshot - 2970: "txid_snapshot" => TxidSnapshot: Kind::Simple, - /// UUID[] - 2951: "_uuid" => UuidArray: Kind::Array(Type::Uuid), - /// FDW_HANDLER - 3115: "fdw_handler" => FdwHandler: Kind::Pseudo, - /// PG_LSN - PostgreSQL LSN datatype - 3220: "pg_lsn" => PgLsn: Kind::Simple, - /// PG_LSN[] - 3221: "_pg_lsn" => PgLsnArray: Kind::Array(Type::PgLsn), - /// ANYENUM - 3500: "anyenum" => Anyenum: Kind::Pseudo, - /// TSVECTOR - text representation for text search - 3614: "tsvector" => Tsvector: Kind::Simple, - /// TSQUERY - query representation for text search - 3615: "tsquery" => Tsquery: Kind::Simple, - /// GTSVECTOR - GiST index internal text representation for text search - 3642: "gtsvector" => Gtsvector: Kind::Simple, - /// TSVECTOR[] - 3643: "_tsvector" => TsvectorArray: Kind::Array(Type::Tsvector), - /// GTSVECTOR[] - 3644: "_gtsvector" => GtsvectorArray: Kind::Array(Type::Gtsvector), - /// TSQUERY[] - 3645: "_tsquery" => TsqueryArray: Kind::Array(Type::Tsquery), - /// REGCONFIG - registered text search configuration - 3734: "regconfig" => Regconfig: Kind::Simple, - /// REGCONFIG[] - 3735: "_regconfig" => RegconfigArray: Kind::Array(Type::Regconfig), - /// REGDICTIONARY - registered text search dictionary - 3769: "regdictionary" => Regdictionary: Kind::Simple, - /// REGDICTIONARY[] - 3770: "_regdictionary" => RegdictionaryArray: Kind::Array(Type::Regdictionary), - /// JSONB - 3802: "jsonb" => Jsonb: Kind::Simple, - /// ANYRANGE - 3831: "anyrange" => Anyrange: Kind::Pseudo, - /// JSONB[] - 3807: "_jsonb" => JsonbArray: Kind::Array(Type::Jsonb), - /// INT4RANGE - range of integers - 3904: "int4range" => Int4Range: Kind::Range(Type::Int4), - /// INT4RANGE[] - 3905: "_int4range" => Int4RangeArray: Kind::Array(Type::Int4Range), - /// NUMRANGE - range of numerics - 3906: "numrange" => NumRange: Kind::Range(Type::Numeric), - /// NUMRANGE[] - 3907: "_numrange" => NumRangeArray: Kind::Array(Type::NumRange), - /// TSRANGE - range of timestamps without time zone - 3908: "tsrange" => TsRange: Kind::Range(Type::Timestamp), - /// TSRANGE[] - 3909: "_tsrange" => TsRangeArray: Kind::Array(Type::TsRange), - /// TSTZRANGE - range of timestamps with time zone - 3910: "tstzrange" => TstzRange: Kind::Range(Type::TimestampTZ), - /// TSTZRANGE[] - 3911: "_tstzrange" => TstzRangeArray: Kind::Array(Type::TstzRange), - /// DATERANGE - range of dates - 3912: "daterange" => DateRange: Kind::Range(Type::Date), - /// DATERANGE[] - 3913: "_daterange" => DateRangeArray: Kind::Array(Type::DateRange), - /// INT8RANGE - range of bigints - 3926: "int8range" => Int8Range: Kind::Range(Type::Int8), - /// INT8RANGE[] - 3927: "_int8range" => Int8RangeArray: Kind::Array(Type::Int8Range), - /// EVENT_TRIGGER - 3838: "event_trigger" => EventTrigger: Kind::Pseudo -} +include!(concat!(env!("OUT_DIR"), "/type.rs")); /// Information about an unknown type. #[derive(PartialEq, Eq, Clone)]