Expand description
A value written as text reads the same on every engine.
Razeri writes values as text in two places a reader compares across
engines: a load that refuses its rows names the values it refused, and a
reconciliation writes each measurement as text so it can be compared with
the source’s by string equality. An engine’s plain cast to text is not
enough for either. Some engines write a date by a format the session sets,
some drop a decimal’s trailing zeros, some write every digit of a
timestamp’s declared precision, some write a zoned moment in the session’s
zone, a floating ten as 10.0 or a truth value as 1. CanonicalText says what the text is for
each type, and ExpressionRenderer::render_value_text is how an engine
writes it.
Structs§
- Float
Arithmetic - How an engine with no
printfspells the arithmeticcomputed_float_textdoes. Each closure is handed the SQL of its operand. - Float
Parts - The pieces of a floating number’s text an engine computes for
float_text, each an expression over the value’s magnitude. - Text
Functions - How an engine spells the text functions
float_textuses. Each closure is handed the SQL of its operand. - Value
Text Functions - The functions an engine writes a value’s text through, as
ExpressionRenderer::value_text_functionsanswers them.
Enums§
- Canonical
Text - What a value’s text is, by its type.
Constants§
- DOUBLE_
DIGITS - The significant digits a double is written with: the most a decimal keeps
through a double and back (C’s
DBL_DIG). - FLOAT_
TEXT_ FUNCTION - The function an engine with no
printfwrites a double’s text through: fifteen significant digits, as%.15gwrites them. - SINGLE_
DIGITS - The significant digits a single-precision number is written with: the most
a decimal keeps through one and back (C’s
FLT_DIG). - SINGLE_
FLOAT_ TEXT_ FUNCTION - The function an engine with no
printfwrites a single-precision number’s text through: six significant digits, as%.6gwrites them. - UTC_
OFFSET - What a zoned moment’s text ends with: its offset from UTC, which is none.
Functions§
- computed_
float_ text - A floating number as
%.{significant}gwrites it, computed on an engine with noprintf. - float_
text - A floating number’s magnitude laid out as
%.{significant}glays it out, from the pieces an engine computed. - float_
text_ function - Which function writes a floating number rounded to
significantdigits:SINGLE_FLOAT_TEXT_FUNCTIONforSINGLE_DIGITS, andFLOAT_TEXT_FUNCTIONfor every other count. - in_
short_ lines - An expression laid out one
WHENto a line, so a function body built fromcomputed_float_textreads in a terminal and reaches the engine through a client that misreads a very long line. - rtrim_
fraction - A timestamp written with six digits of fraction, with the trailing zeros
and then a bare point removed, on an engine whose
RTRIMtakes the characters to remove. - signed_
float_ text - A floating number’s text from its magnitude’s:
NULLforNULL,0for a zero of either sign, and a minus sign before a negative value’s magnitude. - truth_
text - A truth value as
trueorfalse, on an engine that takes the value itself as a condition.