Skip to main content

parameter_reference

Function parameter_reference 

Source
pub fn parameter_reference(name: &str) -> String
Expand description

Renders a parameter reference $name for text that must stay collision-free across every spelling (plan-cache templates, expression text, plan-node details): the $ sigil plus the shaped name — bare when has_plain_identifier_shape holds, otherwise the backtick-quoted form. The domain is names: the empty string is the $(expr) dynamic-opener sentinel, never a parameter’s name — callers bail on the sentinel before rendering (asserted in debug builds). The gate is the one identifier shape [A-Za-z_][A-Za-z0-9_]*, deliberately reused here and therefore narrower than the parameter-name grammar (which also admits a digit start, ADR-0182): a digit-start name over-quotes to $1x`` — a conservative render that still round-trips — and a name that is not identifier-shaped at all (a space, an embedded backtick) must quote to re-parse as itself. Two different names never render alike, and one name always re-parses as itself (LABS-1602’s backtick-quoted names).