GizStack
View .mdOpen in ChatGPTOpen in Claude

gizmodel/core/names

Quoted names that keep their case. The engine compares names after lowercasing them, so "Foo", "foo" and foo would be one name. A dialect that keeps the case of a quoted name (PostgreSQL: unquoted folds to lower; Oracle: to upper, stored lower here) spells each quoted name its folding cannot reach in a lowercase-stable form (SQL lexer, foldQuoted): NAME_MARK first, each uppercase letter X as NAME_UPPER and lower(X). Every other name keeps its text. decodeNames undoes it wherever a name is shown: result labels, catalogs, error texts.

gizlang
import * as Names from "gizmodel/core/names";

Functions

decodeNames

gizlang
function decodeNames(text: string): string

text with the encoded names in it shown as written ("Foo" for MARK NAME_UPPER f o o).

Effects: fail, alloc.

encodeName

gizlang
function encodeName(text: string): string

The lowercase-stable spelling of the quoted name text.

Effects: fail, alloc.

sameColumnName

gizlang
function sameColumnName(stored: string, reference: string): bool

Whether a column stored as STORED is the one a statement names as REFERENCE. Names compare without case. A quoted reference that keeps its case (encoded) also names a column that a case-insensitive dialect stored as written (a StarRocks copy's createdAt): SELECT, INSERT and UPDATE then read "createdAt" alike. PostgreSQL and Oracle store a plain name folded, so only a stored name with capitals, which no folding makes, is one.

Effects: fail, alloc.

Constants

NAME_MARK

gizlang
const NAME_MARK = "\u0014"

The first character of an encoded name (see decodeNames).