Skip to main content

TableFunctionForm

Enum TableFunctionForm 

Source
#[non_exhaustive]
pub enum TableFunctionForm { PostgreSql, DuckDb, GoogleSql, TSql, ClickHouse, Snowflake, Databricks, Unsupported(&'static str), Custom(&'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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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.

§

Custom(&'static str)

This engine has a table-valued function and spells it in a grammar Razeri does not carry. The string is the grammar’s own name.

Your dialect renders the whole CREATE, through SqlRenderer::render_table_function. It is the opposite claim to Unsupported: the build door writes the routine rather than declining it, because this engine has one.

Implementations§

Source§

impl TableFunctionForm

Source

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.

Custom answers None here, and that is the whole point of it: an engine whose grammar Razeri cannot spell still has a table-valued function, so the door that asks may I write this at all gets a yes.

Source

pub const fn custom_grammar(self) -> Option<&'static str>

The name of the grammar this dialect renders itself, or None where Razeri renders the function.

Trait Implementations§

Source§

impl Clone for TableFunctionForm

Source§

fn clone(&self) -> TableFunctionForm

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for TableFunctionForm

Source§

impl Debug for TableFunctionForm

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for TableFunctionForm

Source§

fn default() -> TableFunctionForm

Returns the “default value” for a type. Read more
Source§

impl Eq for TableFunctionForm

Source§

impl PartialEq for TableFunctionForm

Source§

fn eq(&self, other: &TableFunctionForm) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TableFunctionForm

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.