pub enum SidPrerequisiteHome {
Ambient,
Schema(&'static str),
}Expand description
Where the objects a prerequisite installs actually live, so that something calling them from another schema can name them.
Most engines need no answer. Their prerequisite installs nothing with a
name — a session setting, an extension registered for the whole database, a
server-global function — or installs the key function itself, which Razeri
already creates and calls in a known schema. Those say Ambient and their
scripts are what they were, byte for byte.
Schema is for an engine where a routine resolves an unqualified name in
the schema that OWNS the routine rather than in the session’s. There, a hash
installed wherever the deploy happened to sign in is invisible to every key
function created in a design’s own schema — measured on Oracle as
ORA-00904: "RAZERI_XXH64": invalid identifier, once, with every function
beneath it then ORA-06575 … in an invalid state. Naming the home fixes the
helper in one place and lets every call site spell it.
Variants§
Ambient
Wherever the deploy runs — the default, and the honest answer for an engine with no schema for a function at all.
SQLite loads a library into each connection; MySQL and MariaDB
register a library for the whole server; ClickHouse’s CREATE FUNCTION takes no
qualifier; DuckDB loads an extension into the session. None of them
has a schema to put a helper in, and a call site that invented one would
name an object that does not exist.
Schema(&'static str)
A schema Razeri owns, named here, which the prerequisite creates and installs into and which every call site then qualifies with.
Use RAZERI_HELPER_SCHEMA unless your engine reserves that word: one
home for one engine-level helper is the point, and two dialects naming
two homes would be two places to look.
What answering this promises. The prerequisite’s own text creates
its objects IN that schema, and makes them callable from outside it —
on an engine with privileges, that means the grant travels with the
install. Razeri writes the schema’s own creation in front of the
install, in whatever this engine’s CREATE SCHEMA spelling is, and
qualifies the hash in every key function it composes.