Documentation
¶
Overview ¶
Package builtinstubs registers metadata-only stubs for CockroachDB builtin functions into the parser's builtins registry. The stubs contain function signatures (parameter types, return type, volatility, function class) but no execution closures, enabling function-name validation, overload resolution, and type-checking of function call arguments without a live database connection.
Stubs are generated from CockroachDB source by cmd/extract-builtins (which dumps a JSON catalog) and cmd/gen-builtins (which emits Go registration code). Multiple CRDB versions can be compiled in; the caller selects one via Init before any SQL is parsed.
Typical usage from cmd/crdb-sql/main.go:
builtinstubs.Init("") // registers the default version (matches parser)
Index ¶
Constants ¶
const DefaultVersion = "v26.2"
DefaultVersion is the CRDB version whose stubs are registered when Init is called with an empty string. It should match the cockroachdb-parser module version pinned in go.mod.
Variables ¶
This section is empty.
Functions ¶
func ActiveVersion ¶
func ActiveVersion() string
ActiveVersion returns the version that was registered by Init, or "" if Init has not been called.
func Init ¶
func Init(version string)
Init registers builtin stubs for the given CRDB version. It must be called exactly once, before any SQL parsing occurs. Pass "" to use DefaultVersion. Panics if the version is not compiled in.
func SupportedVersions ¶
func SupportedVersions() []string
SupportedVersions returns all compiled-in stub versions, sorted.
Types ¶
This section is empty.