gizmodel/sql/catalog/records
The catalog objects whose text has parts: each has one record type, one reader and one writer here. The parser writes them and the session, the binder and the catalog views read them; none of them splits the text itself. Parts stand between "\u0001", the items of a part between "\u0002".
import * as Records from "gizmodel/sql/catalog/records";Types
DomainCheck
type DomainCheck = { name: string; check: string; }A CHECK of a domain: its name and its condition over VALUE.
name:stringcheck:string
Domain
type Domain = { base: string; notNull: bool; fill: string; checks: Vec<DomainCheck>; over: string; }A domain as its catalog object ("domain") holds it: its base type, whether it refuses NULL, its default ("" for none), its CHECK constraints in order, and the domain it is declared over ("" when over a plain type).
base:stringnotNull:boolfill:stringchecks:Vec<M197.DomainCheck>over:string
PartitionKey
type PartitionKey = { strategy: string; keys: Vec<string>; support: Vec<string>; }The key of a partitioned table ("partkey"): its strategy (list, range or hash), its key expressions, and one support name for each key or none. The parser gives each key's operator class there ("" for none); the stored object of a hash key holds the class's extended hash function ("" for the type's own), and other strategies store none.
strategy:stringkeys:Vec<string>support:Vec<string>
PartitionBound
type PartitionBound = { kind: string; values: Vec<string>; upper: Vec<string>; modulus: string; remainder: string; }The bound of a partition ("partbound"), by kind: "default" takes the rows no other partition takes; "in" takes
the rows whose key is one of values; "range" those from values (included) to upper (excluded), one bound for
each key column; "hash" those whose key hash has remainder after division by modulus (both as the statement gave
them). kind is "" for a table that is no partition.
kind:stringvalues:Vec<string>upper:Vec<string>modulus:stringremainder:string
Statistics
type Statistics = { table: string; kinds: string; items: Vec<string>; }Extended statistics ("pg statistics"): the table, the kinds as CREATE STATISTICS named them ("ndistinct,mcv"; "" for every kind), and the items: a column name, or an expression in parentheses.
table:stringkinds:stringitems:Vec<string>
RuleRecord
type RuleRecord = { event: string; instead: bool; condition: string; commands: string; disabled: bool; }A rule ("pg rule", named "r on t"): the event it answers (select, insert, update or delete), whether it runs INSTEAD of the statement (else ALSO), its WHERE condition ("" for none), its commands ("" for NOTHING), and whether ALTER TABLE ... DISABLE RULE turned it off.
event:stringinstead:boolcondition:stringcommands:stringdisabled:bool
Functions
domainRecord
function domainRecord(domain: string, text: string): DomainThe reader of a domain object's text: the base type, "0" for NOT NULL, the default, one unnamed check (the form before named checks; its name is DOMAIN_check), the named checks ("name\u0003check", "\u0004" between), and the parent domain.
Effects: fail, alloc.
domainText
function domainText(d: Domain): stringThe writer of a domain object's text (domainRecord reads it); every check is written as a named one.
Effects: fail, alloc.
partitionKeyRecord
function partitionKeyRecord(text: string): PartitionKeyThe reader of a partition key's text; no keys for the text of a table that is not partitioned ("").
Effects: fail, alloc.
partitionKeyText
function partitionKeyText(k: PartitionKey): stringThe writer of a partition key's text (partitionKeyRecord reads it).
Effects: fail, alloc.
listBound
function listBound(items: Vec<string>): stringThe text of FOR VALUES IN (items).
Effects: fail, alloc.
rangeBound
function rangeBound(lower: Vec<string>, upper: Vec<string>): stringThe text of FOR VALUES FROM (lower) TO (upper).
Effects: fail, alloc.
hashBound
function hashBound(modulus: string, remainder: string): stringThe text of FOR VALUES WITH (MODULUS modulus, REMAINDER remainder).
Effects: fail, alloc.
partitionBoundRecord
function partitionBoundRecord(text: string): PartitionBoundThe reader of a partition bound's text (DEFAULT_BOUND, listBound, rangeBound and hashBound write it).
Effects: fail, alloc.
checksOf
function checksOf(text: string): Vec<string>The CHECK conditions of a table ("check"), in order: a "c" entry of the table's constraint object names one by its position here.
Effects: fail, alloc.
checksText
function checksText(checks: Vec<string>): stringThe writer of a table's CHECK conditions (checksOf reads it): "\u0001" ends each.
Effects: fail, alloc.
statisticsRecord
function statisticsRecord(text: string): Option<Statistics>The reader of extended statistics' text; none for a text of another shape.
Effects: fail, alloc.
statisticsText
function statisticsText(s: Statistics): stringThe writer of extended statistics' text (statisticsRecord reads it).
Effects: fail, alloc.
ruleRecord
function ruleRecord(text: string): Option<RuleRecord>The reader of a rule's text; none for a text of another shape.
Effects: fail, alloc.
ruleText
function ruleText(r: RuleRecord): stringThe writer of a rule's text (ruleRecord reads it).
Effects: fail, alloc.
Constants
DEFAULT_BOUND
const DEFAULT_BOUND = "default"The text of the default partition's bound.