Skip to main content

Crate rupg_types

Crate rupg_types 

Source
Expand description

The value model, Datum, Vector of 1024 values, TypeId, the text and binary forms of the 197 types, numeric, date and time, JSON, arrays, ranges, multiranges, tsvector.

See spec/07-sql-types-and-catalog.md and spec/22-crate-layout.md section 22.4.

A client reads the type of a column from the OID and the typmod in RowDescription, and it parses each value with the rules of that type. So each input function here takes what the function of PostgreSQL takes and refuses what it refuses, with the same SQLSTATE and the same message, and each output function writes the same bytes. The server at the pin is the reference.

§What is here

oid, one constant for each type in pg_type.dat at the pin and for its array type, and TypeInfo, the row of pg_type that the protocol needs. PgType is an OID with a typmod, and typmod encodes and decodes the typmod of varchar, numeric and interval. The row types of the shared catalogs, such as pg_database, come from the catalog headers and not from pg_type.dat, so they are not here.

Value, one value of any type in the engine. The expression that gives a value has its type, so the value does not carry it.

The text forms of bool, "char", name, int2, int4, int8, oid, float4, float8, bytea and uuid. An input function takes the string and gives the value or a TypeError. An output function appends to a buffer, so the row encoder can write a whole row into one buffer with no allocation per value. float8_out and float4_out take extra_float_digits: above zero they give the shortest text that reads back to the same value, and at zero or below they give the %g text of old servers.

text, varchar(n), character(n) and json. The text form of text is the string. varchar_in and bpchar_in take the typmod, refuse a value that is too long, and remove the spaces after the length. bpchar_in also pads a short value with spaces. varchar_coerce and bpchar_coerce are the length casts, which cut with no error when the cast is explicit. json_in checks the syntax with the error details of PostgreSQL and gives the string. Recv::text is the encoding check of the receive function of each string type.

Numeric, a numeric value in the layout of PostgreSQL, with numeric_in, numeric_out, numeric_recv and numeric_send. The input and the receive function take the typmod and round to it as PostgreSQL does. decimal_out and decimal_send write a numeric(p, s) value with p up to 38 that is kept as a scaled i128, with no allocation. numeric_layout packs a value into bytes that sort as the numbers do.

date, time, timetz, timestamp, timestamptz and interval in the layout of PostgreSQL: days or microseconds since 2000-01-01, with the infinities at the ends of the integer range. The output functions take the DateStyle as a DateFormat and the IntervalStyle as an IntervalStyle, and timestamptz_out takes a TimeZone that gives the offset and the abbreviation at an instant. The receive functions check the range and round to the typmod. date2j and j2date convert between a calendar date and a Julian day.

The text input of the same types, date_in, time_in, timetz_in, timestamp_in, timestamptz_in and interval_in, is a port of the decoder in datetime.c. It reads the session state from a DateTimeInput: the field order, the time zone, the zone names, the time zone abbreviations and the time of the transaction start. ZoneAbbrevs reads a file of src/timezone/tznames, and ZoneAbbrevs::postgres_default is the Default set from vendor/postgres-19.

Array, an array of any element type with up to MAXDIM dimensions and any lower bounds. array_in, array_out, array_recv and array_send take the function of the element type as a closure and give the errors of PostgreSQL, also the error of the element. The binary input refuses an element type that is not the expected type, and format_type gives the names in that error. int2vector and oidvector are arrays with the lower bound 0 and a text form with spaces, in int2vector_in, oidvector_in and the functions beside them.

cash_in, cash_out and cash_words for money, a count of cents in an i64, with the symbols of the C locale. tid_in and tid_out for tid, and uint64_in for xid8 and oid8. macaddr_in, macaddr8_in and the other functions of macaddr and macaddr8, with the bytes of the address in a u64. bit_in, bit_coerce, bit_recv and bit_send for bit and bit varying, a string of 0 and 1. geo_in, geo_out and geo_recv for the geometric types, the bytes of the binary form. pg_lsn_in and pg_lsn_out for pg_lsn, a u64. snapshot_in, snapshot_out and snapshot_recv for pg_snapshot and txid_snapshot, with the binary form of a Snapshot as the value.

Inet, a value of inet or cidr, with inet_in, inet_out, inet_recv and inet_send, which take a flag for cidr. network_cmp is the order of the B-tree operator class.

RegKind, the OID alias types such as regclass and regtype. reg_in reads a number or - as PostgreSQL does and gives any other string as a name, and reg_out_oid writes OID 0 and an OID with no object. The catalog finds the names: it splits a name such as schema.table with qualified_name_list and writes the names of the objects.

Recv, the binary input of a Bind parameter, with the errors of PostgreSQL when the value is too short or too long. The binary output of the other types is the value in big-endian bytes.

Lexeme, one lexeme of a tsvector with its positions, with tsvector_parse, tsvector_deparse, tsvector_recv and tsvector_send. tsvector_cmp is the order of the B-tree operator class, and unique_positions puts positions in order as the input function does. QueryItem, one operand or operator of a tsquery, with tsquery_parse, tsquery_parse_with for the functions of text search that make a query, tsquery_deparse, tsquery_recv and tsquery_send. tsquery_cmp is the order of the B-tree operator class. JsonPath, a value of jsonpath, with jsonpath_parse, jsonpath_deparse, jsonpath_recv and jsonpath_send.

xml_in checks that the text of an xml value is well formed, as libxml2 2.9.14 checks it for PostgreSQL, and gives the same errors and warnings. xml_out writes the value with the XML declaration of PostgreSQL, and xml_encoding reads the encoding in the declaration for the receive function.

unicode, the four Unicode normalization forms, and tz, the time zones of the IANA data.

§Known differences

The input functions take a string in the server encoding, which is UTF-8. The caller converts from the client encoding first.

tz::Zone implements TimeZone with the rules of the IANA data, and tz::TzDatabase implements ZoneLookup. FixedZone and NoZones are for the tests and for a caller without the data.

pg_ndistinct_in and pg_dependencies_in read the JSON text of the types of the extended statistics with the details of the errors of PostgreSQL, and give the bytes of the value. pg_ndistinct_out and pg_dependencies_out write the text from the bytes.

PostgreSQL parses json by recursion and stops a deep value with stack depth limit exceeded when it reaches max_stack_depth. json_in uses no recursion and takes a value at any depth. PostgreSQL stops a deep tsquery in the same way. tsquery_parse gives the same error for a query with 1000 levels, as the analyzer does for an expression. jsonpath_parse has the same limit for a path.

The text and binary forms are lifted from crates/rudb-pgtypes of tamnd/rudb at f5f7065a (spec/04 section 4.9). The DataRow encoder and the Bind decoder of that crate need the executor, so they come with rupg-server.

Modules§

numeric_layout
The values of NUMERIC, the decimal number of PostgreSQL with no fixed width and no fixed scale, as the bytes that a vector holds.
oid
The built-in types of PostgreSQL: one for each entry of pg_type.dat, and one for each array type that an entry asks for with array_type_oid, as genbki.pl makes them.
prng
Prng, the generator of pg_prng.c: xoroshiro128** with a seed from splitmix64. random, setseed and the random functions of the other types use it, so a session after setseed gives the same numbers as PostgreSQL.
typmod
The typmod of each type that has one, as RowDescription and pg_attribute.atttypmod give it.
tz
The time zones of the vendored IANA data (spec/07 section 7.9).
unicode
The Unicode normalization forms NFC, NFD, NFKC and NFKD (Unicode Standard Annex 15), the code points that Unicode assigns, and the characters with no display width.

Structs§

Array
An array value. The elements are in row-major order, and None is a null element. An empty array has no dimensions.
ArrayDim
One dimension of an array: the number of elements and the lower bound.
DateFormat
The DateStyle setting. The default of initdb is ISO, MDY.
DateTimeInput
The session state that the text input of the date and time types reads.
FixedZone
A zone with one offset at all instants, such as UTC.
Inet
A value of inet or cidr. The bytes of addr after the size of the family are 0.
Interval
An interval: months, days and microseconds, which do not convert into each other.
JsonNode
A node and the place of its text in the input.
JsonPath
A value of jsonpath.
JsonTokens
The tokens of a value, in the order of JsonbIteratorNext with no nested values skipped.
JsonTree
A parsed value. The root is node 0.
Lexeme
One lexeme of a tsvector, with its positions. A lexeme with no positions has an empty list.
NoZones
A ZoneLookup that knows no zone, until the tz database is here.
Numeric
A numeric value as PostgreSQL stores it. The digits have no zero at either end. A zero has no digits, a weight of 0 and a positive sign, and it keeps its display scale. A special value has only its sign.
PgType
The PostgreSQL type of a value: the OID that RowDescription and ParameterDescription send, and the typmod. A typmod of -1 means that the type has no modifier. rupg carries it beside its own crate::TypeId (spec/07 section 7.9).
Range
A value of a range type: the flags of rangetypes.h and the two bounds. A bound that is infinite is Value::Null, and so are both bounds of an empty range.
RangeText
A range as range_parse reads it: the flags, and the text of each bound that is not infinite.
Record
The value of a composite type or of record, as a HeapTupleHeader datum. As that datum keeps the type of the row, a record keeps the type of each field, so that the output of an anonymous record can show the fields.
Recv
A binary parameter value and how much of it a receive function has read.
Snapshot
A snapshot: the first transaction that is still in progress, the first transaction that did not start, and the transactions in progress between them, in order and with no duplicates.
TsQueryPush
The items of a query in postfix order, as pushValue, pushOperator and pushStop add them. The function for the operands of tsquery_parse_with adds the items of each operand here.
TypeError
A value that a type cannot read. The text is the text of PostgreSQL for the same input, so the server can send it in ErrorResponse as it is.
TypeId
A type, by its OID in pg_type of the PostgreSQL pin.
TypeInfo
The columns of pg_type that the wire format and the type rules read.
ZoneAbbrevs
The time zone abbreviations of the timezone_abbreviations setting, sorted by the lower case abbreviation.

Enums§

Abbrev
One line of a timezone_abbreviations file.
AbbrevMeaning
The meaning of a time zone abbreviation in the zone that uses it.
ByteaOutput
The setting bytea_output.
DateOrder
The field order part of DateStyle. The output uses it only to put the day before the month.
DateStyle
The output part of DateStyle.
DateUnit
A unit of EXTRACT, date_part and date_trunc.
Datum
One value. Null has no type.
GeoKind
A geometric type.
IntervalStyle
The IntervalStyle setting. The default is Postgres.
JsonItem
The kind of a node, with its children.
JsonPathOp
An operation of JsonTree::set_path, as the flags JB_PATH_* of jsonfuncs.c give it.
JsonToken
A token of JsonTree::tokens.
NetFamily
The family of an address. IPv4 sorts before IPv6.
NumericSign
The sign of a value, which also marks the special values.
PathItem
One item of a path. The items that follow an item, its next items in PostgreSQL, are the items after it in its Chain.
PathOp
An operator or a method of a path, as JsonPathItemType has it.
QueryItem
One item of a tsquery.
RegInput
What the text input of an OID alias type found.
RegKind
One of the OID alias types.
TsQueryMode
The tokenizer of parse_tsquery.
Value
One value of the engine.
XmlStandalone
The STANDALONE clause of XMLROOT, as XmlStandaloneType.
ZoneName
What DecodeTimezoneName makes of the name of a zone.

Constants§

BIT_MAX_LEN
VARBITMAXLEN: the most bits in a value.
DATE_INFINITY
DATE_NEGATIVE_INFINITY
DATEVAL_NOBEGIN and DATEVAL_NOEND, the dates -infinity and infinity.
JSONPATH_LAST
The last bound of .**{}, as PG_UINT32_MAX.
JSONPATH_REGEX_DOTALL
JSP_REGEX_DOTALL: the flag s of like_regex.
JSONPATH_REGEX_ICASE
JSP_REGEX_ICASE: the flag i of like_regex.
JSONPATH_REGEX_MLINE
JSP_REGEX_MLINE: the flag m of like_regex.
JSONPATH_REGEX_QUOTE
JSP_REGEX_QUOTE: the flag q of like_regex.
JSONPATH_REGEX_WSPACE
JSP_REGEX_WSPACE: the flag x of like_regex.
MAXDIM
The maximum number of dimensions of an array.
MAX_ARRAY_SIZE
The maximum number of elements of an array, MaxArraySize.
NAME_MAX_BYTES
The longest name in bytes, which is NAMEDATALEN less the terminator.
POSTGRES_EPOCH_JDATE
The Julian day of 2000-01-01, the epoch of PostgreSQL.
RANGE_EMPTY
RANGE_EMPTY: the range has no points.
RANGE_LB_INC
RANGE_LB_INC: the lower bound is part of the range.
RANGE_LB_INF
RANGE_LB_INF: the range has no lower bound.
RANGE_UB_INC
RANGE_UB_INC: the upper bound is part of the range.
RANGE_UB_INF
RANGE_UB_INF: the range has no upper bound.
TIMESTAMP_INFINITY
TIMESTAMP_NEGATIVE_INFINITY
DT_NOBEGIN and DT_NOEND, the timestamps -infinity and infinity.
TSQUERY_AND
OP_AND: the operator &.
TSQUERY_MAX_DISTANCE
MAXENTRYPOS: the largest distance of the operator <N>.
TSQUERY_NOT
OP_NOT: the operator !.
TSQUERY_OR
OP_OR: the operator |.
TSQUERY_PHRASE
OP_PHRASE: the operator <N>, which <-> writes when the distance is 1.
TSVECTOR_MAX_DATA
MAXSTRPOS: the maximum number of bytes in the lexemes and the positions of a value.
TSVECTOR_MAX_POSITIONS
MAXNUMPOS: the maximum number of positions of a lexeme.
TSVECTOR_MAX_WORD
MAXSTRLEN: the maximum number of bytes in a lexeme.
UNIX_EPOCH_JDATE
The Julian day of 1970-01-01, the epoch of the engine.
UNIX_TO_POSTGRES_DAYS
Add this to days since 1970-01-01 to get days since 2000-01-01.
UNIX_TO_POSTGRES_USECS
Add this to microseconds since 1970-01-01 to get microseconds since 2000-01-01.
USECS_PER_DAY
USECS_PER_SEC

Traits§

TimeZone
The rules of a time zone: the offset east of UTC in seconds and the abbreviation, at an instant in seconds since 1970-01-01 UTC, as pg_localtime gives them.
ZoneLookup
The zones that a name in the input can give, as pg_tzset finds them. The name is in lower case, as the input has it.

Functions§

adjust_interval
AdjustIntervalForTypmod: the interval with the fields and the precision of the typmod.
adjust_time
AdjustTimeForTypmod: the time rounded to the precision of the typmod.
adjust_timestamp
AdjustTimestampForTypmod: the timestamp rounded to the precision of the typmod.
array_in
The text input of an array: {1,2,3}, {{1,2},{3,4}} or [0:1]={a,b}. delim is the typdelim of the element type, and array_nulls is the setting of the same name: when it is off, an unquoted NULL is the string and not a null. element is the input function of the element type. It does not get the null elements.
array_out
The text output of an array. element is the output function of the element type. The function quotes an element that is empty, that is NULL in any case, or that has a quote, a backslash, a brace, the delimiter or white space.
array_recv
The binary input of an array. elem is the element type that the column or the parameter has, and element is the receive function of that type, which gets the bytes of one element.
array_send
The binary output of an array. elem is the OID of the element type, and element is the send function of that type.
bit_bytes
The bits in bytes, from the high bit of the first byte, with the last byte padded with zero bits.
bit_coerce
bit and varbit, the length casts: an explicit cast pads bit(n) with zeros or cuts it to n bits and cuts bit varying(n) to n bits. Other casts give the error of the input.
bit_in
bit_in and varbit_in: the bits after a B, the hex digits after an X, or the bits with no prefix. The length check comes before the check of the digits, and the length of a value with no prefix is its length in bytes.
bit_recv
bit_recv and varbit_recv: the number of bits as an int4, then the bits in bytes, with the last byte padded with zero bits.
bit_send
bit_send and varbit_send.
bitncmp
bitncmp: the order of the first n bits of two addresses. PostgreSQL compares the whole bytes with memcmp, which gives the difference of the first bytes that differ on the reference server, and then the bits of the last byte, which give 1 or -1.
bitncommon
bitncommon: the number of leading bits, up to n, that two addresses have in common.
bool_in
The text input of bool. It takes true, yes, on and 1 and the matching words for false, in any case, with white space around them, and any prefix of a word that is not ambiguous. o is ambiguous, so on and off need two letters.
bool_out
The text output of bool.
bpchar_coerce
The length cast of character, the function bpchar(bpchar, int4, bool). It pads as the input does, and an explicit cast cuts a long value with no error.
bpchar_in
The text input of character(n), also the receive function after the encoding check. A short value gets spaces at the end up to the length. A long value is an error, unless the extra characters are spaces, which the input removes. With no length the value is the string.
bytea_in
The text input of bytea. A string that starts with \x is hex, with white space allowed between the pairs of digits. Any other string is the escape format.
bytea_out
The text output of bytea.
cash_in
The text input of money, as cash_in reads it. Digits after the second decimal place round the value half away from zero by the next digit, and the other digits are ignored.
cash_out
The text output of money, as cash_out writes it in the C locale: a minus sign for a negative value, $, the whole part with a , between groups of 3 digits, . and 2 decimal places.
cash_words
cash_words: the amount in English words, such as One hundred dollars and zero cents.
char_in
The text input of "char": a backslash and three octal digits is that byte, else the first byte, and an empty string is 0. A character of more than one byte gives its first byte.
char_out
The text output of "char": a byte above 127 is a backslash and three octal digits, and 0 is the empty string.
cidr_abbrev
pg_inet_cidr_ntop, the text of abbrev(cidr): only the octets or the groups of the network part, then the mask length.
date2j
date2j: the Julian day of a date in the proleptic Gregorian calendar. The year before 1 is 0.
date_from_unix
A date of the engine as PostgreSQL holds it. The engine counts days from 1970-01-01 and has i32::MAX and -i32::MAX for the infinities. PostgreSQL counts days from 2000-01-01 and has DATE_INFINITY and DATE_NEGATIVE_INFINITY. A date that PostgreSQL cannot hold is an error.
date_in
date_in: the days since 2000-01-01.
date_out
The text output of date.
date_recv
date_recv: the range is the range that date_in takes, and the infinities.
decimal_out
The text output of value / 10^scale from a numeric(p, s) column of the engine. It is the text that numeric_out gives for the same value with scale as its display scale.
decimal_send
The binary output of value / 10^scale. It is the bytes that numeric_send gives for the same value with scale as its display scale.
decode_numeric_timezone
DecodeTimezone as parse_sane_timezone uses it: the offset in seconds west of UTC of a numeric zone, or None for a name that is not a numeric zone.
decode_timezone_abbrev_prefix
DecodeTimezoneAbbrevPrefix: the longest abbreviation at the start of the text, in up to 10 letters of any case, as DecodeTimezoneAbbrev finds it, and its length in bytes. A dynamic abbreviation whose zone is not in the data does not match.
decode_timezone_name
DecodeTimezoneName: the abbreviations first, as DecodeTimezoneAbbrev finds them, and then the zones of the data. The abbreviations use the first 63 bytes of the name in lower case.
escape_xml
escape_xml: the text with &, <, > and carriage return as references.
float4_in
The text input of float4.
float4_out
The text output of float4.
float8_in
The text input of float8.
float8_out
The text output of float8.
format_type
The name of a type as format_type(oid, NULL) gives it: the SQL name of a type that has one, such as integer for int4, the element type and [] for an array, - for OID 0 and ??? for an OID that is not a type. The row types of the catalogs that have a fixed OID are not in TypeInfo::all, but they have their name here.
geo_in
The text input functions of the geometric types, from point_in to circle_in. The value is the bytes of the binary form.
geo_out
The text output functions of the geometric types, from point_out to circle_out. digits is extra_float_digits.
geo_recv
The receive functions of the geometric types, from point_recv to circle_recv. The corners of a box are put in order and the flag of a path is 0 or 1.
inet_in
The text input of inet and cidr. A value with a colon is IPv6. The input of inet takes an IPv4 address with no mask length only when it has the four octets, and the input of cidr takes fewer octets and finds the mask length from the class of the address.
inet_out
inet_out and cidr_out: the text of net_ntop, and for a cidr the mask length when the text has none.
inet_recv
inet_recv and cidr_recv: the family, the mask length, a flag of cidr that the function does not read, the length of the address and the address.
inet_send
inet_send and cidr_send.
int2_in
The text input of int2.
int2vector_in
The text input of int2vector: integers between white space. The input reads each number with strtol, and an error shows the rest of the string from the bad number.
int2vector_out
The text output of int2vector: the numbers with a space between them.
int2vector_recv
The binary input of int2vector: an array of int2 with one dimension, the lower bound 0 and no null. An empty value is an error, because it has no dimension.
int2vector_send
The binary output of int2vector.
int4_in
The text input of int4.
int8_in
The text input of int8.
int_out
The text output of int2, int4 and int8: the digits with a - for a negative value.
interval_in
interval_in: the PostgreSQL, SQL and ISO 8601 forms. The typmod gives the unit of a number with no unit, and the result is cut and rounded to it.
interval_out
The text output of interval.
interval_recv
interval_recv: the fields after the last field of the typmod are cleared, and the microseconds are rounded to the precision.
interval_send
The binary output of interval.
j2date
j2date: the year, the month and the day of a Julian day.
json_escape
escape_json: a string in quotes, with the escapes that PostgreSQL writes.
json_in
The text input of json: the string, after a check of the syntax.
json_index
strtoint in base 10 with nothing after the number, as the functions of jsonfuncs.c read an index in a path. The leading white space of isspace and a sign are permitted.
jsonb_in
The text input of jsonb: the text of the value in the one form that PostgreSQL prints.
jsonb_recv
The binary input of jsonb: the version byte and then the text. pq_getmsgtext checks the encoding of the text before the parser reads it, so a zero byte is an error of the encoding and not of the syntax.
jsonb_send
The binary output of jsonb: the version byte and then the text.
jsonpath_deparse
jsonpath_out: the text form of a path.
jsonpath_parse
jsonpath_in: a path from its text. soft is true for the soft input of pg_input_is_valid, and regex checks the pattern of like_regex.
jsonpath_recv
jsonpath_recv: a path from the version 1 and the text form. Each error is a hard error.
jsonpath_regex_flags
jspConvertRegexFlags: the cflags of the regular expression of like_regex with the flags flags.
jsonpath_send
jsonpath_send: the version 1 and the text form.
legacy_crc32
COMP_LEGACY_CRC32, the first key of the order of two operands. It uses the table of CRC-32 with the steps of the other bit order, so it is not the CRC-32 of zlib.
limit_position
LIMITPOS: a position above the maximum is the maximum.
local_offset
The part of DetermineTimeZoneOffsetInternal after the fields: the offset west of UTC of a local time in seconds since 1970-01-01 in a zone, and the instant. In a gap the local time is in the offset before the change, and in an overlap it is in the offset after the change.
macaddr8_in
macaddr8_in: 6 or 8 bytes of 2 hex digits, with the same :, - or . between them or with nothing between them. White space can come before and after the address. A 6-byte address gets ff:fe as the 4th and 5th bytes.
macaddr8_out
macaddr8_out: 08:00:2b:01:02:03:04:05.
macaddr8_recv
macaddr8_recv: the 8 bytes, or 6 bytes that get ff:fe as the 4th and 5th bytes.
macaddr8_to_macaddr
macaddr8tomacaddr: the address without the 4th and 5th bytes, or None when they are not ff:fe.
macaddr_in
macaddr_in: six numbers in hex with one of the formats of sscanf in mac.c, such as 08:00:2b:01:02:03, 08002b-010203 or 0800.2b01.0203.
macaddr_out
macaddr_out: 08:00:2b:01:02:03.
macaddr_recv
macaddr_recv: the 6 bytes.
macaddr_to_macaddr8
macaddrtomacaddr8: ff:fe as the 4th and 5th bytes.
multirange_deparse
multirange_out: the ranges in braces with a comma between them.
multirange_parse
multirange_in: a left brace, zero or more ranges with commas between them, and a right brace. White space can be before and after each part. The parse gives the text of each range that is not the key word empty to range when it finds the end of that range, so the error of a range comes before the errors of the text after it.
multirange_recv
multirange_recv: the number of ranges, then the length and the bytes of each range. The parse gives the bytes of each range to range in order.
multirange_send
multirange_send: the number of ranges, then the length and the bytes of each range.
name_in
The text input of name: the string cut to 63 bytes at the end of a character, with no error.
name_recv
namerecv: unlike the text input, the binary input refuses a name that is too long. The caller checks the encoding first, as pq_getmsgtext does.
net_ntop
pg_inet_net_ntop: the address, then /bits when bits is not the length of the whole address. IPv4 always has the four octets.
network_cmp
network_cmp_internal, the result of network_cmp: the common bits of the network parts, then the mask lengths, then the whole addresses. IPv4 comes before IPv6. Only the sign of the result is the order.
numeric_in
The text input of numeric with the typmod of the target, -1 for none.
numeric_out
The text output of numeric: the digits with exactly the display scale after the point.
numeric_out_sci
numeric_out_sci: the value as a significand with scale digits after the point, e, a sign and at least two digits of the exponent, as to_char with EEEE writes it. The exponent is the power of ten of the first digit. The significand is the value divided by that power and rounded half away from zero, so it can be 10.0 after the rounding, as in get_str_from_var_sci.
numeric_recv
numeric_recv. Digits hidden by the display scale are dropped, and the typmod is applied.
numeric_send
numeric_send. PostgreSQL reads the display scale of an infinity from bits of the header that the short format uses for the scale, so it sends 32 there. Clients do not look at it, but the bytes are the same.
oid_in
The text input of oid. A negative number from -2147483648 to -1 is the OID with the same bits, so -1 is 4294967295.
oid_out
The text output of oid, which is unsigned.
oidvector_in
The text input of oidvector. Each number is read as the input of oid reads it, but the next number can follow with no space.
oidvector_out
The text output of oidvector.
oidvector_recv
The binary input of oidvector, with the rules of int2vector_recv.
oidvector_send
The binary output of oidvector.
pg_dependencies_in
pg_dependencies_in: the bytes of the value.
pg_dependencies_out
pg_dependencies_out: the items as JSON, with the degree in the format %f of the snprintf of PostgreSQL.
pg_lsn_in
pg_lsn_in: two groups of 1 to 8 hex digits with a / between them. The text has no spaces and nothing after the second group.
pg_lsn_out
pg_lsn_out: the high and the low 32 bits in hex, with 8 digits for the low bits, as %X/%08X gives them.
pg_ndistinct_in
pg_ndistinct_in: the bytes of the value.
pg_ndistinct_out
pg_ndistinct_out: the items as JSON, with the number of distinct values as an integer.
position_of
WEP_GETPOS: the position of a WordEntryPos.
qualified_name_list
stringToQualifiedNameList: the parts of a name such as schema.table, with 42602 and invalid name syntax when the syntax is not correct or there is no name.
range_deparse
range_deparse: the text of a range from the flags and the output of each bound that the range has.
range_parse
range_parse: the key word empty, or a bracket or a parenthesis, the lower bound, a comma, the upper bound and a bracket or a parenthesis. White space before and after the range is not part of it. A bound with no characters is infinite. A bound can have characters in double quotes, and a backslash takes the next character as it is.
range_recv
range_recv: the flags, then the length and the bytes of each bound that the flags give. The flags lose the bits that are not flags of a range.
range_send
range_send: the flags, then the length and the bytes of each bound that the range has.
reg_in
The first step of the text input of an OID alias type, parseDashOrOid and parseNumericOid.
reg_out_oid
The text output of an OID alias type when the catalog has no object with the OID: the text of OID 0 for the kind, or the number.
snapshot_in
pg_snapshot_in: xmin:xmax: and the transactions in progress with a , between them. xmin is not 0, xmax is not before xmin, and each transaction in progress is in order from xmin up to xmax. A duplicate is skipped. The error names pg_snapshot also for txid_snapshot.
snapshot_out
pg_snapshot_out: xmin:xmax: and the transactions in progress with a , between them.
snapshot_recv
pg_snapshot_recv: the binary form, with the checks of the text input. A transaction in progress can be equal to xmax here, as in PostgreSQL.
split_identifier_string
SplitIdentifierString: the identifiers in s with separator between them, or None when the syntax is not correct.
sql_name
map_xml_name_to_sql_identifier: the SQL name for an XML name, with the character for each _xHHHH_.
tid_in
The text input of tid, as tidin reads it: the block number and the offset after the first ( or ,, and after the next ,. The block number must end at a , and the offset must end at a ). The text before the ( and after the ) is ignored.
tid_out
The text output of tid, as tidout writes it: (block,offset).
time_in
time_in: the microseconds since midnight, rounded to the typmod.
time_out
The text output of time, microseconds since midnight. 24:00:00 is a valid time.
time_recv
time_recv.
timestamp_from_unix
A timestamp or a timestamptz of the engine as PostgreSQL holds it. The engine counts microseconds from 1970-01-01 and has i64::MAX and -i64::MAX for the infinities. A value that PostgreSQL cannot hold is an error.
timestamp_in
timestamp_in: the microseconds since 2000-01-01 in local time, rounded to the typmod.
timestamp_out
The text output of timestamp. A value before 4714-11-24 BC has no Julian day and is an error, as in PostgreSQL.
timestamp_recv
timestamp_recv and timestamptz_recv: the range is the range that the input takes, and the value is rounded to the precision of the typmod.
timestamptz_in
timestamptz_in: the microseconds since 2000-01-01 UTC, rounded to the typmod. A value with no zone is in the session zone.
timestamptz_out
The text output of timestamptz in the session time zone.
timetz_in
timetz_in: the time and the zone in seconds west of UTC.
timetz_out
The text output of timetz. The zone is in seconds west of UTC, as PostgreSQL stores it.
timetz_recv
timetz_recv: the time and the zone in seconds west of UTC.
ts_compare_string
tsCompareString with no prefix match: the bytes of the two lexemes. The result is the difference of the first two bytes that are not equal, as the memcmp of the C library gives for one byte, or -1 or 1 when one lexeme starts with the other.
tsquery_bad_distance
The error of a distance of <N> that is out of range.
tsquery_cmp
CompareTSQ, the order of the B-tree operator class: the number of items, the size of the value, then the trees.
tsquery_contains
tsq_mcontains: true when each lexeme of ex is a lexeme of query. The operators, the weights and the prefix flags do not count.
tsquery_deparse
tsqueryout: the query with the operators between their operands, each lexeme in quotes, and parentheses where the order of the operators needs them. An empty query is an empty string.
tsquery_join
join_tsqueries and QTN2QT: the query left op right, or !right for TSQUERY_NOT with an empty left.
tsquery_parse
tsqueryin: lexemes with the operators !, &, |, <-> and <N> and parentheses. A lexeme can be in quotes, as in a tsvector, and can have weights and * after a colon. A query with no lexemes is empty, and the caller sends the notice of PostgreSQL for it.
tsquery_parse_with
parse_tsquery: the items of a query in the syntax of the mode. pushval adds the items of each operand: one lexeme, a query of lexemes, or the place of a stop word. The places of the stop words go out of the query at the end, as cleanup_tsquery_stopwords takes them out. The flag is true when the query had only stop words, so nothing is left. The caller sends the notice of PostgreSQL for an empty query.
tsquery_recv
tsqueryrecv: the binary form of tsquery_send.
tsquery_send
tsquerysend: the number of items, then each item in prefix order. An operand is the type 1, its weights, its prefix flag and the lexeme with a zero byte after it. An operator is the type 2 and the operator, with the distance as two bytes for <N>.
tsquery_tree
tsquerytree: the text of the query with no !, as an index uses it. T when nothing is left, and an empty string for an empty query.
tsvector_cmp
silly_cmp_tsvector: the size, the number of lexemes, then for each lexeme in order whether it has positions, the bytes, the number of positions, each position and each weight. A lexeme with positions, more positions, a larger position and a larger weight come first. The result is the value of tsvector_cmp.
tsvector_data_len
The number of bytes after the lexeme entries of a value: the bytes of each lexeme and, for a lexeme with positions, a pad byte to an even offset, a count and the positions.
tsvector_deparse
tsvectorout: each lexeme in quotes with a quote and a backslash written twice, then a colon and the positions with their weights, with spaces between the lexemes.
tsvector_parse
tsvectorin: lexemes with spaces between them. A lexeme in quotes can have spaces, two quotes are one quote, and a backslash takes the next character as it is. After a colon come the positions with commas between them, each a number from 1 with an optional weight A, B, C or D. A position above 16383 is 16383.
tsvector_recv
tsvectorrecv: the binary form of tsvector_send. The lexemes are put in order, and two equal lexemes stay as they are.
tsvector_send
tsvectorsend: the number of lexemes, then each lexeme with a zero byte after it, the number of its positions and the positions.
tsvector_size
VARSIZE of a value: the header of 4 bytes, the count, an entry of 4 bytes for each lexeme and the data.
u64_out
Writes the decimal digits of n.
uint32_in
uint32in_subr for all of s: the text input of oid, xid and cid. The errors show type_name.
uint64_in
uint64in_subr for all of s: the text input of xid8 and oid8. The errors show type_name.
unique_positions
uniquePos: the positions in order with no two equal positions. Of two equal positions the larger weight stays. The list stops at 256 positions or at the maximum position.
uuid_in
The text input of uuid: 32 hex digits in any case, with an optional pair of braces around them and an optional hyphen after any group of four digits.
uuid_out
The text output of uuid: lowercase, in groups of 8, 4, 4, 4 and 12 digits.
varchar_coerce
The length cast of varchar, the function varchar(varchar, int4, bool). An explicit cast cuts a long value with no error. An implicit or an assignment cast is the same as the input.
varchar_in
The text input of varchar(n), also the receive function after the encoding check. A value longer than the length is an error, unless the extra characters are spaces, which the input removes.
weight_of
WEP_GETWEIGHT: the weight of a WordEntryPos, 3 for A down to 0 for D.
with_weight
WEP_SETWEIGHT: the WordEntryPos with a different weight.
word_too_long
The error of a lexeme that is too long.
xml_base64
xmlTextWriterWriteBase64 of libxml2: base64 with a line break after each 72 characters.
xml_binhex
xmlTextWriterWriteBinHex of libxml2: two hexadecimal digits in upper case for each byte.
xml_comment
xmlcomment: the comment with the text.
xml_concat
xmlconcat: the values after their XML declarations, with one declaration for all. The declaration has the version when all the values have the same version, and the standalone part when all the values have it.
xml_element
xmlelement: the element with the attributes that have a value, and the content as it is. An element with no content is an empty element tag.
xml_encoding
The encoding name in the XML declaration of the bytes of xml_recv, if there is one. A declaration that is not valid has no encoding here, because xml_recv does not check it.
xml_in
xml_in, which checks that the text is a well formed document when document is true, or well formed content when it is false. The text ends at the first zero byte, as libxml2 sees it. warn gets the text of each warning of libxml2, which PostgreSQL reports with the SQLSTATE 01000 before the error.
xml_name
map_sql_identifier_to_xml_name: the XML name for a SQL name, with _xHHHH_ for each character that the name cannot have. fully_escaped also escapes each : and a name that starts with xml, and escape_period escapes each ..
xml_out
xml_out_internal for a client in UTF-8: the text with a declaration only if it has a version that is not 1.0 or a standalone part. The encoding is not written. If the declaration does not parse, the text is written as it is and the result is the warning XX001 of PostgreSQL.
xml_pi
xmlpi: the processing instruction, or None when the argument is null. The check of the target comes before the check for null, as the standard says.
xml_root
xmlroot: the value with a new XML declaration. A version of None is NO VALUE.
xml_text
xmlEncodeSpecialChars of libxml2, for xmltext: the text with &, <, >, " and carriage return as references.

Type Aliases§

Chain
An item and the items that follow it. A chain is never empty.
Oid
The object ID of a type, as in pg_type.oid. It is the plain u32 of rupg_common::Oid, as the tables and the protocol use it.
RangeBytes
The flags and the bytes of each bound of a range in the binary form.
RegexCheck
The check of a regular expression: the pattern and the cflags, and the message of pg_regerror for a pattern that is not valid.
TsQueryPushVal
The function that adds the items of an operand of a query: the text of the operand, its weights and its prefix flag.