#[non_exhaustive]pub enum TableFunctionForm {
PostgreSql,
DuckDb,
GoogleSql,
TSql,
ClickHouse,
Snowflake,
Databricks,
Unsupported(&'static str),
}Expand description
Which table-valued function grammar this engine speaks — the routine a
query selects FROM, returning columns rather than one value.
The default is TableFunctionForm::PostgreSql, which is what an unlisted
dialect has always been handed. Four engines in Razeri’s own set have no
table-valued function they can render, and each says so in its own words
through TableFunctionForm::Unsupported — because a refusal written once
per kind tells a Redshift author about MySQL, and the sentence that
helps is the one about their engine.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
PostgreSql
CREATE FUNCTION … RETURNS TABLE(…) / RETURNS SETOF … over a
dollar-quoted body — PostgreSQL, Citus, and Razeri’s agnostic
renderer.
DuckDb
DuckDB’s table MACRO: CREATE MACRO f(x) AS TABLE SELECT …. There
is no RETURNS clause at all, which is why riding the PostgreSQL arm
was Parser Error: syntax error at or near "RETURNS".
GoogleSql
GoogleSQL’s CREATE TABLE FUNCTION — BigQuery’s.
TSql
T-SQL’s two shapes: the inline TVF (RETURNS TABLE AS RETURN (…)) and
the multi-statement one (RETURNS @t TABLE(…) BEGIN … RETURN END).
ClickHouse
ClickHouse’s parameterized view, addressed with {param:Type}.
Snowflake
Snowflake’s UDTF, including the staged-handler registration.
Databricks
Databricks SQL’s CREATE FUNCTION … RETURNS TABLE … RETURN <query>.
Unsupported(&'static str)
This engine has no table-valued function.
The string is the orientation an author reads — at build time, when
Razeri refuses to write the routine, and again in the rendered refusal
if anything asks the renderer directly. Write it fix-first: say what
this engine offers instead before saying what it lacks, name the
artifact: values a designer would reach for, and name the near form if
there is one, because a near form the author will find on their own is
the thing that costs them a day.
It is prose that lands inside a SQL comment, so it must never spell a complete statement.
Implementations§
Source§impl TableFunctionForm
impl TableFunctionForm
Sourcepub const fn refusal(self) -> Option<&'static str>
pub const fn refusal(self) -> Option<&'static str>
The dialect’s own refusal wording, or None where this engine has the
form.
The one accessor both surfaces read — the build door that declines to write the routine, and the renderer that would otherwise emit DDL — so neither one carries a second copy of the words.
Trait Implementations§
Source§impl Clone for TableFunctionForm
impl Clone for TableFunctionForm
Source§fn clone(&self) -> TableFunctionForm
fn clone(&self) -> TableFunctionForm
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more