Skip to main content

quote_ident

Function quote_ident 

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

One Postgres identifier, quoted so that nothing inside it can be syntax.

The whole of this crate’s defence against a hostile table name. Postgres’ rule is that a double-quoted identifier ends at the next unpaired ", so doubling every " in the input makes the result exactly one identifier whatever the input was.

A NUL is the one byte this cannot neutralise, and it does not have to: Postgres rejects it in an identifier, so the statement fails at parse with the endpoint’s own error rather than executing something else.