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 witharray_type_oid, asgenbki.plmakes them. - prng
Prng, the generator ofpg_prng.c: xoroshiro128** with a seed from splitmix64.random,setseedand the random functions of the other types use it, so a session aftersetseedgives the same numbers as PostgreSQL.- typmod
- The typmod of each type that has one, as
RowDescriptionandpg_attribute.atttypmodgive 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
Noneis a null element. An empty array has no dimensions. - Array
Dim - One dimension of an array: the number of elements and the lower bound.
- Date
Format - The
DateStylesetting. The default ofinitdbisISO, MDY. - Date
Time Input - The session state that the text input of the date and time types reads.
- Fixed
Zone - A zone with one offset at all instants, such as
UTC. - Inet
- A value of
inetorcidr. The bytes ofaddrafter the size of the family are 0. - Interval
- An
interval: months, days and microseconds, which do not convert into each other. - Json
Node - A node and the place of its text in the input.
- Json
Path - A value of
jsonpath. - Json
Tokens - The tokens of a value, in the order of
JsonbIteratorNextwith no nested values skipped. - Json
Tree - 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
ZoneLookupthat knows no zone, until the tz database is here. - Numeric
- A
numericvalue 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
RowDescriptionandParameterDescriptionsend, and the typmod. A typmod of -1 means that the type has no modifier. rupg carries it beside its owncrate::TypeId(spec/07 section 7.9). - Range
- A value of a range type: the flags of
rangetypes.hand the two bounds. A bound that is infinite isValue::Null, and so are both bounds of an empty range. - Range
Text - A range as
range_parsereads it: the flags, and the text of each bound that is not infinite. - Record
- The value of a composite type or of
record, as aHeapTupleHeaderdatum. As that datum keeps the type of the row, a record keeps the type of each field, so that the output of an anonymousrecordcan 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.
- TsQuery
Push - The items of a query in postfix order, as
pushValue,pushOperatorandpushStopadd them. The function for the operands oftsquery_parse_withadds the items of each operand here. - Type
Error - 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
ErrorResponseas it is. - TypeId
- A type, by its OID in
pg_typeof the PostgreSQL pin. - Type
Info - The columns of
pg_typethat the wire format and the type rules read. - Zone
Abbrevs - The time zone abbreviations of the
timezone_abbreviationssetting, sorted by the lower case abbreviation.
Enums§
- Abbrev
- One line of a
timezone_abbreviationsfile. - Abbrev
Meaning - The meaning of a time zone abbreviation in the zone that uses it.
- Bytea
Output - The setting
bytea_output. - Date
Order - The field order part of
DateStyle. The output uses it only to put the day before the month. - Date
Style - The output part of
DateStyle. - Date
Unit - A unit of
EXTRACT,date_partanddate_trunc. - Datum
- One value.
Nullhas no type. - GeoKind
- A geometric type.
- Interval
Style - The
IntervalStylesetting. The default isPostgres. - Json
Item - The kind of a node, with its children.
- Json
Path Op - An operation of
JsonTree::set_path, as the flagsJB_PATH_*ofjsonfuncs.cgive it. - Json
Token - A token of
JsonTree::tokens. - NetFamily
- The family of an address. IPv4 sorts before IPv6.
- Numeric
Sign - The sign of a value, which also marks the special values.
- Path
Item - One item of a path. The items that follow an item, its
nextitems in PostgreSQL, are the items after it in itsChain. - PathOp
- An operator or a method of a path, as
JsonPathItemTypehas it. - Query
Item - One item of a
tsquery. - RegInput
- What the text input of an OID alias type found.
- RegKind
- One of the OID alias types.
- TsQuery
Mode - The tokenizer of
parse_tsquery. - Value
- One value of the engine.
- XmlStandalone
- The
STANDALONEclause ofXMLROOT, asXmlStandaloneType. - Zone
Name - What
DecodeTimezoneNamemakes of the name of a zone.
Constants§
- BIT_
MAX_ LEN VARBITMAXLEN: the most bits in a value.- DATE_
INFINITY - DATE_
NEGATIVE_ INFINITY DATEVAL_NOBEGINandDATEVAL_NOEND, the dates-infinityandinfinity.- JSONPATH_
LAST - The
lastbound of.**{}, asPG_UINT32_MAX. - JSONPATH_
REGEX_ DOTALL JSP_REGEX_DOTALL: the flagsoflike_regex.- JSONPATH_
REGEX_ ICASE JSP_REGEX_ICASE: the flagioflike_regex.- JSONPATH_
REGEX_ MLINE JSP_REGEX_MLINE: the flagmoflike_regex.- JSONPATH_
REGEX_ QUOTE JSP_REGEX_QUOTE: the flagqoflike_regex.- JSONPATH_
REGEX_ WSPACE JSP_REGEX_WSPACE: the flagxoflike_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
namein bytes, which isNAMEDATALENless 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_NOBEGINandDT_NOEND, the timestamps-infinityandinfinity.- 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§
- Time
Zone - 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_localtimegives them. - Zone
Lookup - The zones that a name in the input can give, as
pg_tzsetfinds 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}.delimis thetypdelimof the element type, andarray_nullsis the setting of the same name: when it is off, an unquotedNULLis the string and not a null.elementis the input function of the element type. It does not get the null elements. - array_
out - The text output of an array.
elementis the output function of the element type. The function quotes an element that is empty, that isNULLin any case, or that has a quote, a backslash, a brace, the delimiter or white space. - array_
recv - The binary input of an array.
elemis the element type that the column or the parameter has, andelementis the receive function of that type, which gets the bytes of one element. - array_
send - The binary output of an array.
elemis the OID of the element type, andelementis 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 bitandvarbit, the length casts: an explicit cast padsbit(n)with zeros or cuts it tonbits and cutsbit varying(n)tonbits. Other casts give the error of the input.- bit_in
bit_inandvarbit_in: the bits after aB, the hex digits after anX, 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_recvandvarbit_recv: the number of bits as anint4, then the bits in bytes, with the last byte padded with zero bits.- bit_
send bit_sendandvarbit_send.- bitncmp
bitncmp: the order of the firstnbits of two addresses. PostgreSQL compares the whole bytes withmemcmp, 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 ton, that two addresses have in common.- bool_in
- The text input of
bool. It takestrue,yes,onand1and the matching words for false, in any case, with white space around them, and any prefix of a word that is not ambiguous.ois ambiguous, soonandoffneed two letters. - bool_
out - The text output of
bool. - bpchar_
coerce - The length cast of
character, the functionbpchar(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\xis 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, ascash_inreads 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, ascash_outwrites it in theClocale: 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 asOne 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 ofabbrev(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::MAXand-i32::MAXfor the infinities. PostgreSQL counts days from 2000-01-01 and hasDATE_INFINITYandDATE_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 thatdate_intakes, and the infinities.- decimal_
out - The text output of
value / 10^scalefrom anumeric(p, s)column of the engine. It is the text thatnumeric_outgives for the same value withscaleas its display scale. - decimal_
send - The binary output of
value / 10^scale. It is the bytes thatnumeric_sendgives for the same value withscaleas its display scale. - decode_
numeric_ timezone DecodeTimezoneasparse_sane_timezoneuses it: the offset in seconds west of UTC of a numeric zone, orNonefor 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, asDecodeTimezoneAbbrevfinds 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, asDecodeTimezoneAbbrevfinds 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 asintegerforint4, 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 inTypeInfo::all, but they have their name here. - geo_in
- The text input functions of the geometric types, from
point_intocircle_in. The value is the bytes of the binary form. - geo_out
- The text output functions of the geometric types, from
point_outtocircle_out.digitsisextra_float_digits. - geo_
recv - The receive functions of the geometric types, from
point_recvtocircle_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
inetandcidr. A value with a colon is IPv6. The input ofinettakes an IPv4 address with no mask length only when it has the four octets, and the input ofcidrtakes fewer octets and finds the mask length from the class of the address. - inet_
out inet_outandcidr_out: the text ofnet_ntop, and for acidrthe mask length when the text has none.- inet_
recv inet_recvandcidr_recv: the family, the mask length, a flag ofcidrthat the function does not read, the length of the address and the address.- inet_
send inet_sendandcidr_send.- int2_in
- The text input of
int2. - int2vector_
in - The text input of
int2vector: integers between white space. The input reads each number withstrtol, 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 ofint2with 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,int4andint8: 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 strtointin base 10 with nothing after the number, as the functions ofjsonfuncs.cread an index in a path. The leading white space ofisspaceand 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_getmsgtextchecks 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.softis true for the soft input ofpg_input_is_valid, andregexchecks the pattern oflike_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: thecflagsof the regular expression oflike_regexwith the flagsflags.- 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
DetermineTimeZoneOffsetInternalafter 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 getsff:feas 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 getff:feas the 4th and 5th bytes.- macaddr8_
to_ macaddr macaddr8tomacaddr: the address without the 4th and 5th bytes, orNonewhen they are notff:fe.- macaddr_
in macaddr_in: six numbers in hex with one of the formats ofsscanfinmac.c, such as08:00:2b:01:02:03,08002b-010203or0800.2b01.0203.- macaddr_
out macaddr_out:08:00:2b:01:02:03.- macaddr_
recv macaddr_recv: the 6 bytes.- macaddr_
to_ macaddr8 macaddrtomacaddr8:ff:feas 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 wordemptytorangewhen 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 torangein 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, aspq_getmsgtextdoes.- net_
ntop pg_inet_net_ntop: the address, then/bitswhenbitsis not the length of the whole address. IPv4 always has the four octets.- network_
cmp network_cmp_internal, the result ofnetwork_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
numericwith 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 withscaledigits after the point,e, a sign and at least two digits of the exponent, asto_charwithEEEEwrites 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 be10.0after the rounding, as inget_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-1is 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 ofoidreads 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 ofint2vector_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%fof thesnprintfof 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/%08Xgives 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 aWordEntryPos.- qualified_
name_ list stringToQualifiedNameList: the parts of a name such asschema.table, with42602andinvalid name syntaxwhen 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 wordempty, 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,
parseDashOrOidandparseNumericOid. - 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.xminis not 0,xmaxis not beforexmin, and each transaction in progress is in order fromxminup toxmax. A duplicate is skipped. The error namespg_snapshotalso fortxid_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 toxmaxhere, as in PostgreSQL.- split_
identifier_ string SplitIdentifierString: the identifiers inswithseparatorbetween them, orNonewhen 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, astidinreads 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, astidoutwrites 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:00is a valid time. - time_
recv time_recv.- timestamp_
from_ unix - A
timestampor atimestamptzof the engine as PostgreSQL holds it. The engine counts microseconds from 1970-01-01 and hasi64::MAXand-i64::MAXfor 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_recvandtimestamptz_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
timestamptzin 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 tsCompareStringwith no prefix match: the bytes of the two lexemes. The result is the difference of the first two bytes that are not equal, as thememcmpof 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 ofexis a lexeme ofquery. 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_tsqueriesandQTN2QT: the queryleft op right, or!rightforTSQUERY_NOTwith an emptyleft.- tsquery_
parse tsqueryin: lexemes with the operators!,&,|,<->and<N>and parentheses. A lexeme can be in quotes, as in atsvector, 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.pushvaladds 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, ascleanup_tsquery_stopwordstakes 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 oftsquery_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.Twhen 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 oftsvector_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 weightA,B,CorD. A position above 16383 is 16383.- tsvector_
recv tsvectorrecv: the binary form oftsvector_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 VARSIZEof 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_subrfor all ofs: the text input ofoid,xidandcid. The errors showtype_name.- uint64_
in uint64in_subrfor all ofs: the text input ofxid8andoid8. The errors showtype_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 functionvarchar(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 aWordEntryPos, 3 forAdown to 0 forD.- with_
weight WEP_SETWEIGHT: theWordEntryPoswith a different weight.- word_
too_ long - The error of a lexeme that is too long.
- xml_
base64 xmlTextWriterWriteBase64of libxml2: base64 with a line break after each 72 characters.- xml_
binhex xmlTextWriterWriteBinHexof 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, becausexml_recvdoes not check it. - xml_in
xml_in, which checks that the text is a well formed document whendocumentis true, or well formed content when it is false. The text ends at the first zero byte, as libxml2 sees it.warngets the text of each warning of libxml2, which PostgreSQL reports with the SQLSTATE01000before 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_escapedalso escapes each:and a name that starts withxml, andescape_periodescapes each..- xml_out
xml_out_internalfor 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 warningXX001of PostgreSQL.- xml_pi
xmlpi: the processing instruction, orNonewhen 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 ofNoneisNO VALUE.- xml_
text xmlEncodeSpecialCharsof libxml2, forxmltext: 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 plainu32ofrupg_common::Oid, as the tables and the protocol use it. - Range
Bytes - The flags and the bytes of each bound of a range in the binary form.
- Regex
Check - The check of a regular expression: the pattern and the
cflags, and the message ofpg_regerrorfor a pattern that is not valid. - TsQuery
Push Val - The function that adds the items of an operand of a query: the text of the operand, its weights and its prefix flag.