PostgreSQL type input functions (pg_type.typinput) for the scalar types whose text form has one meaning: bool, the integers, oid, float4/float8, numeric and uuid. Ported from boolin (bool.c), pg_strtoint16/32/64_safe and uint32in_subr (numutils.c), float4in/float8in (float.c), numeric_in and uuid_in.
Every path that turns text into one of these types -- an untyped
literal meeting a typed operand, a cast from text or unknown, a text
parameter (PgParamCodec calls in), an array element, COPY -- goes
through parse. Invalid
input raises 22P02 and out-of-range input 22003, with PostgreSQL's
messages; nothing returns the text it could not parse.
Carriers: bool -> Boolean; int2/int4/int8/oid -> Long; float4 -> Float; float8 -> Double; numeric -> BigDecimal (or the NaN/Infinity carrier); uuid -> java.util.UUID.
PostgreSQL type input functions (pg_type.typinput) for the scalar types whose text form has one meaning: bool, the integers, oid, float4/float8, numeric and uuid. Ported from boolin (bool.c), pg_strtoint16/32/64_safe and uint32in_subr (numutils.c), float4in/float8in (float.c), numeric_in and uuid_in. Every path that turns text into one of these types -- an untyped literal meeting a typed operand, a cast from text or unknown, a text parameter (PgParamCodec calls in), an array element, COPY -- goes through `parse`. Invalid input raises 22P02 and out-of-range input 22003, with PostgreSQL's messages; nothing returns the text it could not parse. Carriers: bool -> Boolean; int2/int4/int8/oid -> Long; float4 -> Float; float8 -> Double; numeric -> BigDecimal (or the NaN/Infinity carrier); uuid -> java.util.UUID.
(float8-prefix s from)float8in_internal with a non-NULL endptr: read one float starting at
from (after any leading whitespace) and return [value end-index],
or nil when no float starts there. end-index is past any TRAILING
whitespace, which is what makes '( 1 , 2 )'::point legal -- the
structural comma is found after the spaces.
Out of range still raises 22003: strtod reports ERANGE wherever the
number sits, so '(1e400,2)'::point is an error and not
(Infinity,2).
`float8in_internal` with a non-NULL endptr: read one float starting at `from` (after any leading whitespace) and return `[value end-index]`, or nil when no float starts there. `end-index` is past any TRAILING whitespace, which is what makes `'( 1 , 2 )'::point` legal -- the structural comma is found after the spaces. Out of range still raises 22003: strtod reports ERANGE wherever the number sits, so `'(1e400,2)'::point` is an error and not `(Infinity,2)`.
(parse oid s)Read s as a value of type oid with PostgreSQL's input function,
raising its error on invalid input. nil for nil.
Read `s` as a value of type `oid` with PostgreSQL's input function, raising its error on invalid input. nil for nil.
(parse-bool s)boolin: surrounding whitespace ignored; any prefix of true/false/yes/no, on/off (at least two characters: 'o' alone is ambiguous), 1 or 0, case insensitive.
boolin: surrounding whitespace ignored; any prefix of true/false/yes/no, on/off (at least two characters: 'o' alone is ambiguous), 1 or 0, case insensitive.
(parse-float4 s)float4in: parsed as a double (strtod), then range-checked for real.
float4in: parsed as a double (strtod), then range-checked for real.
(parse-float8 s)float8in: strtod over the trimmed input; out of range (overflow to infinity, or underflow to zero) raises 22003.
float8in: strtod over the trimmed input; out of range (overflow to infinity, or underflow to zero) raises 22003.
(parse-oid s)oidin (uint32in_subr): strtoul with base 0 -- 0x hex, a leading 0 for
octal -- and surrounding whitespace. A minus sign is accepted for
backward compatibility when the negated value fits int32, and wraps
into uint32: -1 is 4294967295.
oidin (uint32in_subr): strtoul with base 0 -- 0x hex, a leading 0 for octal -- and surrounding whitespace. A minus sign is accepted for backward compatibility when the negated value fits int32, and wraps into uint32: `-1` is 4294967295.
(parse-uuid s)uuid_in: 32 hex digits, optionally in braces, with an optional hyphen after any group of four; no surrounding whitespace.
uuid_in: 32 hex digits, optionally in braces, with an optional hyphen after any group of four; no surrounding whitespace.
(parser oid)The input function for oid, or nil when that type's input is not
handled here.
The input function for `oid`, or nil when that type's input is not handled here.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |