Skip to main content

Module postgres

Module postgres 

Source
Expand description

PostgreSQL 18’s values: their input and output functions, comparisons, arithmetic and casts.

Structs§

ArrayDim
One dimension of an array, its lower bound and its length.
CharLength
The length of a varchar(n) or char(n) type, in characters.
InputContext
The session state PostgreSQL’s input functions read, which the caller supplies.
IntervalSum
The running state of PostgreSQL’s sum(interval) and avg(interval).
IntervalTypmod
The modifier of an interval type, the fields it keeps and the fractional-second digits it rounds to, where the default is plain interval.
NonFiniteNumeric
Why a numeric has no BigDecimal, which holds finite values alone.
NumericTypmod
The modifier of a numeric(p, s) type, the precision and scale it rounds to.
PgArray
An array of PgValues over its dimensions, in row-major order, equal, ordered and hashed as array_eq and btarraycmp compare it, and printed as array_out prints it under the default DateStyle of ISO.
PgBpchar
A bpchar or char(n) value, held as written or as a row image carries it, blank-padded to its length.
PgBytea
A PostgreSQL bytea, ordered as byteacmp orders it and printed as byteaout prints it under the default bytea_output of hex.
PgDate
A PostgreSQL date, days from 2000-01-01, from 4714-11-24 BC to 5874897-12-31 and the two infinities, ordered as PostgreSQL orders it.
PgFloat8
A PostgreSQL double precision, equal, ordered and hashed as float8_cmp_internal compares it, with NaN equal to itself and above Infinity, and -0 equal to 0.
PgInterval
A PostgreSQL interval as months, days and microseconds, equal, ordered and hashed by PostgreSQL’s span with a month as 30 days and a day as 24 hours.
PgJsonb
A PostgreSQL jsonb value, its object keys in jsonb’s storage order with the last of duplicate keys kept, equal, ordered and hashed as jsonb’s btree operator class compares it.
PgNumeric
A PostgreSQL numeric, equal, ordered and hashed by value as cmp_numerics compares it, with NaN equal to itself and above Infinity.
PgTime
A PostgreSQL time, microseconds from midnight to 24:00:00 inclusive.
PgTimeTz
A PostgreSQL timetz, a time of day with the offset east of UTC it was written with, ordered by the instant and then by the offset, as timetz_cmp orders it.
PgTimeZone
A time zone as PostgreSQL’s TimeZone setting reads it, equal to another when SHOW timezone names both alike.
PgTimestamp
A PostgreSQL timestamp, microseconds from 2000-01-01 00:00:00, from 4714-11-24 BC to 294276-12-31 23:59:59.999999 and the two infinities.
PgTimestampTz
A PostgreSQL timestamptz, the instant as microseconds from 2000-01-01 00:00:00 UTC, over the range of PgTimestamp, printed as under TimeZone UTC.
TimeZoneAbbreviations
A timezone_abbreviations set, the abbreviations a literal may write for its zone.

Enums§

ByteaError
Why byteain refuses a text, one variant per message it raises.
CastError
Why PostgreSQL refuses a cast, one variant per message it raises, or why this crate declines to answer for it.
CastTarget
The type a literal or value is cast to, with its modifier.
CastValue
The value a cast produces or takes, printed by Display as the type’s output function prints it under the default DateStyle of ISO.
DateArithmeticError
Why PostgreSQL refuses date arithmetic or the cast of a date to timestamp, one variant per message it raises.
DateOrder
DateOrder, the field order of DateStyle for a date written in numbers alone.
DateTimeError
Why PostgreSQL refuses a date or time, one variant per message it raises, or why this crate cannot answer for it without more session state or a wider zone database.
Float8Error
Why float8in refuses a text, one variant per message it raises.
IntegerType
A PostgreSQL integer type, ordered from the narrowest to the widest.
IntervalError
Why PostgreSQL refuses to read an interval or to compute one, one variant per message it raises.
IntervalFields
The fields an interval type keeps, as in interval day to second.
JsonbError
Why jsonb_in refuses a text, one variant per detail PostgreSQL gives, each printed as PostgreSQL’s message and detail without the token it quotes.
JsonbKind
The kind of a top-level jsonb value, as cannotCastJsonbValue names it when a cast to a scalar type refuses it.
Literal
A literal as written before ::, its quotes and escapes already decoded.
NumericError
Why PostgreSQL refuses to read or compute a numeric, one variant per message it raises.
PgType
A type PostgreSQL names in a cast’s error, printed as format_type names it.
PgValue
A known boolean, integer, numeric, text, date, timestamp, jsonb or array value, equal, ordered and hashed as PostgreSQL’s comparison operators compare it.
ShiftError
Why a timestamp or time shifted by an interval has no value here.
TimeZoneAbbreviationsError
Why PostgreSQL refuses a time zone abbreviation file, one variant per message tzparser.c raises.
TimeZoneError
Why PostgreSQL refuses a TimeZone setting, one variant per message or detail it raises.

Functions§

cast_literal
The value PostgreSQL 18’s explicit cast literal::target produces, or the error it raises, with a database encoding of UTF-8.
cast_value
The value PostgreSQL 18’s explicit cast value::target produces, None for NULL, or the error it raises.
number_constant
The value PostgreSQL 18 makes of a numeric constant, written as Literal::Number takes it, as its lexer and make_const type it. An integer is an integer when it fits, else a bigint when it fits, else a numeric, and a constant with a point or an exponent is a numeric.
parse_date
Parse a YYYY-MM-DD date with a year of four or more digits and PostgreSQL’s trailing BC, or infinity and -infinity. Year 0000, as MySQL and SQLite print 1 BC, is year 0.
parse_interval
Parse an interval as PostgreSQL 18’s interval_in reads it under the default IntervalStyle.
parse_interval_typmod
Parse an interval literal of a restricted type as interval '…' <fields> reads it, which differs from casting a text value to that type.
parse_time
Parse HH:MM:SS[.f] with one to nine fraction digits, rounded to the microsecond, up to 24:00:00.
parse_timestamp
Parse YYYY-MM-DD HH:MM:SS[.f] with a space or T separator, a year of four or more digits, PostgreSQL’s trailing BC, and infinity and -infinity, the fraction rounded to the microsecond. Year 0000, as MySQL and SQLite print 1 BC, is year 0.
parse_timestamp_tz
Parse a parse_timestamp layout followed by a Z, ±HH, ±HHMM, ±HH:MM or ±HH:MM:SS offset, then PostgreSQL’s optional BC, or infinity and -infinity.