Parser in sqlparser::parser - Rust
Source
Create a parser for a Dialect
See also Parser::parse_sql
Example:
let dialect = GenericDialect{};
let statements = Parser::new(&dialect)
.try_with_sql("SELECT * FROM foo")?
.parse_statements()?;Source
Specify the maximum recursion limit while parsing.
Parser prevents stack overflows by returning
ParserError::RecursionLimitExceeded if the parser exceeds
this depth while processing the query.
Example:
let dialect = GenericDialect{};
let result = Parser::new(&dialect)
.with_recursion_limit(1)
.try_with_sql("SELECT * FROM foo WHERE (a OR (b OR (c OR d)))")?
.parse_statements();
assert_eq!(result, Err(ParserError::RecursionLimitExceeded));Note: when “recursive-protection” feature is enabled, this crate uses additional stack overflow protection
Source
Specify additional parser options
Parser supports additional options (ParserOptions)
that allow you to mix & match behavior otherwise constrained
to certain dialects (e.g. trailing commas).
Example:
let dialect = GenericDialect{};
let options = ParserOptions::new()
.with_trailing_commas(true)
.with_unescape(false);
let result = Parser::new(&dialect)
.with_options(options)
.try_with_sql("SELECT a, b, COUNT(*), FROM foo GROUP BY a, b,")?
.parse_statements();
assert!(matches!(result, Ok(_)));Source
Reset this parser to parse the specified token stream
Source
Reset this parser state to parse the specified tokens
Source
Tokenize the sql string and sets this Parser’s state to
parse the resulting tokens
Returns an error if there was an error tokenizing the SQL string.
See example on Parser::new() for an example
Source
Parse potentially multiple statements
Example
let dialect = GenericDialect{};
let statements = Parser::new(&dialect)
// Parse a SQL string with 2 separate statements
.try_with_sql("SELECT * FROM foo; SELECT * FROM bar;")?
.parse_statements()?;
assert_eq!(statements.len(), 2);Source
Convenience method to parse a string with one or more SQL statements into produce an Abstract Syntax Tree (AST).
Example
let dialect = GenericDialect{};
let statements = Parser::parse_sql(
&dialect, "SELECT * FROM foo"
)?;
assert_eq!(statements.len(), 1);Parses the given sql into an Abstract Syntax Tree (AST), returning
also encountered source code comments.
See Parser::parse_sql.
Source
Parse a single top-level statement (such as SELECT, INSERT, CREATE, etc.), stopping before the statement separator, if any.
Source
Parse FLUSH statement.
Source
Parse MSCK statement.
Source
Parse TRUNCATE statement.
Source
Parse options for ATTACH DUCKDB DATABASE statement.
Source
Parse ATTACH DUCKDB DATABASE statement.
Source
Parse DETACH DUCKDB DATABASE statement.
Source
Parse ATTACH DATABASE statement.
Source
Parse ANALYZE statement.
Source
Parse a new expression including wildcard & qualified wildcard.
Source
Parse a new expression.
Source
Parse expression with optional alias and order by.
Source
Parse tokens until the precedence changes.
Source
Parse ASSERT statement.
Source
Parse SAVEPOINT statement.
Source
Parse RELEASE statement.
Source
Parse LISTEN statement.
Source
Parse UNLISTEN statement.
Source
Parse NOTIFY statement.
Source
Parse an expression prefix.
Source
Try to parse an Expr::CompoundFieldAccess like a.b.c or a.b[1].c.
If all the fields are Expr::Identifiers, return an Expr::CompoundIdentifier instead.
If only the root exists, return the root.
Parses compound expressions which may be delimited by period
or bracket notation.
For example: a.b.c, a.b[1].
Source
Parse utility options in the form of (option1, option2 arg2, option3 arg3, ...)
Source
Parse a function call expression named by name and return it as an Expr.
Source
Parse time-related function name possibly followed by (...) arguments.
Source
Parse window frame UNITS clause: ROWS, RANGE, or GROUPS.
Source
Parse a WINDOW frame definition (units and bounds).
Source
Parse a window frame bound: CURRENT ROW or <n> PRECEDING|FOLLOWING.
Source
Parse a CASE expression and return an Expr::Case.
Source
Parse an optional FORMAT clause for CAST expressions.
Source
Parse an optional AT TIME ZONE clause.
Source
Parse a SQL CONVERT function:
CONVERT('héhé' USING utf8mb4)(MySQL)CONVERT('héhé', CHAR CHARACTER SET utf8mb4)(MySQL)CONVERT(DECIMAL(10, 5), 42)(MSSQL) - the type comes first
Source
Parse a SQL CAST function e.g. CAST(expr AS FLOAT)
Source
Parse a SQL EXISTS expression e.g. WHERE EXISTS(SELECT ...).
Parse a SQL EXTRACT expression e.g. EXTRACT(YEAR FROM date).
Source
Parse a CEIL or FLOOR expression.
Source
Parse a POSITION expression.
Source
Parse SUBSTRING/SUBSTR expressions: SUBSTRING(expr FROM start FOR length) or SUBSTR(expr, start, length).
Source
TRIM ([WHERE] ['text' FROM] 'text')
TRIM ('text')
TRIM(<expr>, [, characters]) -- only Snowflake or BigQuerySource
Parses an array expression [ex1, ex2, ..]
if named is true, came from an expression like ARRAY[ex1, ex2]
Source
Parse a date/time field for EXTRACT, interval qualifiers, and ceil/floor operations.
EXTRACT supports a wider set of date/time fields than interval qualifiers,
so this function may need to be split in two.
See DateTimeField
Source
Parse a NOT expression.
Represented in the AST as Expr::UnaryOp with UnaryOperator::Not.
Source
Parses fulltext expressions sqlparser::ast::Expr::MatchAgainst
§Errors
This method will raise an error if the column list is empty or with invalid identifiers, the match expression is not a literal string, or if the search modifier is not valid.
Source
Parse an INTERVAL expression.
Some syntactically valid intervals:
1. INTERVAL '1' DAY
2. INTERVAL '1-1' YEAR TO MONTH
3. INTERVAL '1' SECOND
4. INTERVAL '1:1:1.1' HOUR (5) TO SECOND (5)
5. INTERVAL '1.1' SECOND (2, 2)
6. INTERVAL '1:1' HOUR (5) TO MINUTE (5)
7. (MySql & BigQuery only): INTERVAL 1 DAYNote that we do not currently attempt to parse the quoted value.
Source
Peek at the next token and determine if it is a temporal unit
like second.
Source
Parse an operator following an expression
Source
Parse the ESCAPE CHAR portion of LIKE, ILIKE, and SIMILAR TO
Source
Parse a multi-dimension array accessing like [1:3][1][1]
Source
Parses the parens following the [ NOT ] IN operator.
Source
Parses BETWEEN <low> AND <high>, assuming the BETWEEN keyword was already consumed.
Source
Parse a PostgreSQL casting style which is in the form of expr::datatype.
Source
Get the precedence of the next token
Source
Return the token at the given location, or EOF if the index is beyond the length of the current set of tokens.
Source
Return the first non-whitespace token that has not yet been processed or Token::EOF
See Self::peek_token_ref to avoid the copy.
Source
Return a reference to the first non-whitespace token that has not yet been processed or Token::EOF
Source
Returns the N next non-whitespace tokens that have not yet been
processed.
Example:
let dialect = GenericDialect {};
let mut parser = Parser::new(&dialect).try_with_sql("ORDER BY foo, bar").unwrap();
// Note that Rust infers the number of tokens to peek based on the
// length of the slice pattern!
assert!(matches!(
parser.peek_tokens(),
[
Token::Word(Word { keyword: Keyword::ORDER, .. }),
Token::Word(Word { keyword: Keyword::BY, .. }),
]
));Source
Returns the N next non-whitespace tokens with locations that have not
yet been processed.
See Self::peek_token for an example.
Source
Returns references to the N next non-whitespace tokens
that have not yet been processed.
See Self::peek_tokens for an example.
Source
Return nth non-whitespace token that has not yet been processed
Source
Return nth non-whitespace token that has not yet been processed
Source
Return the first token, possibly whitespace, that has not yet been processed (or None if reached end-of-file).
Source
Return nth token, possibly whitespace, that has not yet been processed.
Source
Returns the index of the current token
This can be used with APIs that expect an index, such as
Self::token_at
Source
Return the next unprocessed token, possibly whitespace.
Source
Advances the current token to the next non-whitespace token
See Self::get_current_token to get the current token after advancing
Source
Returns a reference to the current token
Does not advance the current token.
Source
Returns a reference to the previous token
Does not advance the current token.
Source
Returns a reference to the next token
Does not advance the current token.
Source
Seek back the last one non-whitespace token.
Must be called after next_token(), otherwise might panic. OK to call
after next_token() indicates an EOF.
Source
Report found was encountered instead of expected
Source
report found was encountered instead of expected
Source
Report that the token at index was found instead of expected.
Source
If the current token is the expected keyword, consume it and returns
true. Otherwise, no tokens are consumed and returns false.
Source
Check if the current token is the expected keyword without consuming it.
Returns true if the current token matches the expected keyword.
Source
If the current token is the expected keyword followed by
specified tokens, consume them and returns true.
Otherwise, no tokens are consumed and returns false.
Note that if the length of tokens is too long, this function will
not be efficient as it does a loop on the tokens with peek_nth_token
each time.
Source
If the current and subsequent tokens exactly match the keywords
sequence, consume them and returns true. Otherwise, no tokens are
consumed and returns false
Source
If the current token is one of the given keywords, returns the keyword
that matches, without consuming the token. Otherwise, returns None.
Source
If the current token is one of the given keywords, consume the token
and return the keyword that matches. Otherwise, no tokens are consumed
and returns None.
Source
If the current token is one of the expected keywords, consume the token and return the keyword that matches. Otherwise, return an error.
Source
If the current token is the expected keyword, consume the token.
Otherwise, return an error.
Source
If the current token is the expected keyword, consume the token.
Otherwise, return an error.
This differs from expect_keyword only in that the matched keyword token is not returned.
Source
If the current and subsequent tokens exactly match the keywords
sequence, consume them and returns Ok. Otherwise, return an Error.
Source
Consume the next token if it matches the expected token, otherwise return false
See Self::advance_token to consume the token unconditionally
Source
If the current and subsequent tokens exactly match the tokens
sequence, consume them and returns true. Otherwise, no tokens are
consumed and returns false
Source
Bail out if the current token is not an expected keyword, or consume it if it is
Source
Parse a comma-separated list of 1+ SelectItem
Source
Parse a list of actions for GRANT statements.
Source
Parse a comma-separated list of 1+ items accepted by F
Source
Parse a keyword-separated list of 1+ items accepted by F
Source
Parse an expression enclosed in parentheses.
Source
Parse a comma-separated list of 0+ items accepted by F
end_token- expected end token for the closure (e.g. Token::RParen, Token::RBrace …)
Source
Run a parser method f, reverting back to the current position if unsuccessful.
Returns ParserError::RecursionLimitExceeded if f returns a RecursionLimitExceeded.
Returns Ok(None) if f returns any other error.
Source
Run a parser method f, reverting back to the current position if unsuccessful.
Source
Parse either ALL, DISTINCT or DISTINCT ON (...). Returns None if ALL is parsed
and results in a ParserError if both ALL and DISTINCT are found.
Source
Parse a SQL CREATE statement
Source
Parse a CACHE TABLE statement
Source
Parse ‘AS’ before as query,such as WITH XXX AS SELECT XXX oer CACHE TABLE AS SELECT XXX
Source
Parse a UNCACHE TABLE statement
Source
SQLite-specific CREATE VIRTUAL TABLE
Source
Parse a CREATE SCHEMA statement.
Source
Parse a CREATE DATABASE statement.
Source
Parse an optional USING clause for CREATE FUNCTION.
Source
Parse a CREATE FUNCTION statement.
Source
Parse statements of the DropTrigger type such as:
DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ]Source
Parse a CREATE TRIGGER statement.
Source
Parse the period part of a trigger (BEFORE, AFTER, etc.).
Source
Parse the event part of a trigger (INSERT, UPDATE, etc.).
Source
Parse the REFERENCING clause of a trigger.
Source
Parse the execution body of a trigger (FUNCTION or PROCEDURE).
Source
Parse a CREATE MACRO statement.
Source
Parse a CREATE EXTERNAL TABLE statement.
Source
Parse a file format for external tables.
Source
Parse an ANALYZE FORMAT.
Source
Parse a CREATE VIEW statement.
Source
Parse a CREATE ROLE statement.
Source
Parse an OWNER clause.
Source
CREATE POLICY name ON table_name [ AS { PERMISSIVE | RESTRICTIVE } ]
[ FOR { ALL | SELECT | INSERT | UPDATE | DELETE } ]
[ TO { role_name | PUBLIC | CURRENT_USER | CURRENT_ROLE | SESSION_USER } [, ...] ]
[ USING ( using_expression ) ]
[ WITH CHECK ( with_check_expression ) ]Source
CREATE CONNECTOR [IF NOT EXISTS] connector_name
[TYPE datasource_type]
[URL datasource_url]
[COMMENT connector_comment]
[WITH DCPROPERTIES(property_name=property_value, ...)]Source
Parse a DROP statement.
Source
Parse a DECLARE statement.
DECLARE name [ BINARY ] [ ASENSITIVE | INSENSITIVE ] [ [ NO ] SCROLL ]
CURSOR [ { WITH | WITHOUT } HOLD ] FOR queryThe syntax can vary significantly between warehouses. See the grammar on the warehouse specific function in such cases.
Source
Parse a BigQuery DECLARE statement.
Syntax:
DECLARE variable_name[, ...] [{ <variable_type> | <DEFAULT expression> }];Source
Parse a Snowflake DECLARE statement.
Syntax:
DECLARE
[{ <variable_declaration>
| <cursor_declaration>
| <resultset_declaration>
| <exception_declaration> }; ... ]
<variable_declaration>
<variable_name> [<type>] [ { DEFAULT | := } <expression>]
<cursor_declaration>
<cursor_name> CURSOR FOR <query>
<resultset_declaration>
<resultset_name> RESULTSET [ { DEFAULT | := } ( <query> ) ] ;
<exception_declaration>
<exception_name> EXCEPTION [ ( <exception_number> , '<exception_message>' ) ] ;Source
Parses the assigned expression in a variable declaration.
Syntax:
Source
Parse FETCH [direction] { FROM | IN } cursor INTO target; statement.
Source
Parse a DISCARD statement.
Source
Parse a CREATE INDEX statement.
Source
Parse a CREATE EXTENSION statement.
Source
Parse Hive distribution style.
TODO: Support parsing for SKEWED distribution style.
Source
Parse Hive formats.
Source
Parse Hive row format.
Source
Parse CREATE TABLE statement.
Source
Parse plain options.
Parse optional inline comment.
Parse comment value.
Source
Parse optional procedure parameters.
Source
Parse columns and constraints.
Source
Parse procedure parameter.
Source
Parse column definition.
Source
Parse optional column option.
Source
Parse optional CLUSTERED BY clause for Hive/Generic dialects.
Source
Parse a referential action used in foreign key clauses.
Recognized forms: RESTRICT, CASCADE, SET NULL, NO ACTION, SET DEFAULT.
Source
Parse a MATCH kind for constraint references: FULL, PARTIAL, or SIMPLE.
Source
Parse optional constraint characteristics such as DEFERRABLE, INITIALLY and ENFORCED.
Source
Parse an optional table constraint (e.g. PRIMARY KEY, UNIQUE, FOREIGN KEY, CHECK).
Source
Optionally parse a parenthesized list of SqlOptions introduced by keyword.
Source
Parse a parenthesized list of SqlOptions following keyword, or return an empty vec.
Source
Parse options introduced by one of keywords followed by a parenthesized list.
Source
Parse an index type token (e.g. BTREE, HASH, or a custom identifier).
Source
Optionally parse the USING keyword, followed by an IndexType
Example:
Optionally parse USING <index_type> and return the parsed IndexType if present.
Source
Parse [ident], mostly ident is name, like:
window_name, index_name, …
Parse an optional identifier, returning Some(Ident) if present.
Source
Parse optional KEY or INDEX display tokens used in index/constraint declarations.
Source
Parse an optional index option such as USING <type> or COMMENT <string>.
Source
Parse zero or more index options and return them as a vector.
Source
Parse a single SqlOption used by various dialect-specific DDL statements.
Source
Parse a CLUSTERED table option (MSSQL-specific syntaxes supported).
Source
Parse a PARTITION(...) FOR VALUES(...) table option.
Source
Parse a parenthesized list of partition expressions and return a Partition value.
Source
Parse a parenthesized SELECT projection used for projection-based operations.
Source
Parse ALTER TABLE ... ADD PROJECTION ... operation.
Source
Parse a single ALTER TABLE operation and return an AlterTableOperation.
Source
Parse an ALTER <object> statement and dispatch to the appropriate alter handler.
Source
Parse an ALTER VIEW statement.
Source
Parse an ALTER OPERATOR CLASS statement.
Handles operations like RENAME TO, OWNER TO, and SET SCHEMA.
Source
Parse an ALTER SCHEMA statement.
Supports operations such as setting options, renaming, adding/dropping replicas, and changing owner.
Source
Parse a CALL procedure_name(arg1, arg2, ...)
or CALL procedure_name statement
Source
Parse a copy statement
Source
Parse a CLOSE cursor statement.
Source
Parse a tab separated values in COPY payload
Source
Parse a single tab-separated value row used by COPY payload parsing.
Source
Parse a literal value (numbers, strings, date/time, booleans)
Source
Parse an unsigned numeric literal
Source
Parse a numeric literal as an expression. Returns a Expr::UnaryOp if the number is signed,
otherwise returns a Expr::Value
Source
Parse an unsigned literal integer/long
Source
Parse a literal string
Source
Parse a literal unicode normalization clause
Source
Parse parenthesized enum members, used with ENUM(...) type definitions.
Source
Parse a SQL datatype (in the context of a CREATE TABLE statement for example)
Source
Parse a parenthesized, comma-separated list of single-quoted strings.
Source
Strictly parse identifier AS identifier
Source
Optionally parses an alias for a table like in ... FROM generate_series(1, 10) AS t (col).
In this case, the alias is allowed to optionally name the columns in the table, in
addition to the table itself.
Source
Wrapper for parse_optional_alias_inner, left for backwards-compatibility
but new flows should use the context-specific methods such as maybe_parse_select_item_alias
and maybe_parse_table_alias.
Source
Parse an optional GROUP BY clause, returning Some(GroupByExpr) when present.
Source
Parse an optional ORDER BY clause, returning Some(OrderBy) when present.
Source
Parse a table object for insertion
e.g. some_database.some_table or FUNCTION some_table_func(...)
Source
Parse a possibly qualified, possibly quoted identifier, e.g.
foo or `myschema.“table”
The in_table_clause parameter indicates whether the object name is a table in a FROM, JOIN,
or similar table clause. Currently, this is used only to support unquoted hyphenated identifiers
in this context on BigQuery.
Source
Parse identifiers
Source
Parse identifiers of form ident1[.identN]*
Similar in functionality to parse_identifiers, with difference being this function is much more strict about parsing a valid multipart identifier, not allowing extraneous tokens to be parsed, otherwise it fails.
For example:
use sqlparser::ast::Ident;
use sqlparser::dialect::GenericDialect;
use sqlparser::parser::Parser;
let dialect = GenericDialect {};
let expected = vec![Ident::new("one"), Ident::new("two")];
// expected usage
let sql = "one.two";
let mut parser = Parser::new(&dialect).try_with_sql(sql).unwrap();
let actual = parser.parse_multipart_identifier().unwrap();
assert_eq!(&actual, &expected);
// parse_identifiers is more loose on what it allows, parsing successfully
let sql = "one + two";
let mut parser = Parser::new(&dialect).try_with_sql(sql).unwrap();
let actual = parser.parse_identifiers().unwrap();
assert_eq!(&actual, &expected);
// expected to strictly fail due to + separator
let sql = "one + two";
let mut parser = Parser::new(&dialect).try_with_sql(sql).unwrap();
let actual = parser.parse_multipart_identifier().unwrap_err();
assert_eq!(
actual.to_string(),
"sql parser error: Unexpected token in identifier: +"
);Source
Parse a simple one-word identifier (possibly quoted, possibly a keyword)
Source
Parses a parenthesized comma-separated list of unqualified, possibly quoted identifiers.
For example: (col1, "col 2", ...)
Source
Parse a parenthesized list of compound identifiers as expressions.
Source
Parses a parenthesized comma-separated list of qualified, possibly quoted identifiers.
For example: (db1.sc1.tbl1.col1, db1.sc1.tbl1."col 2", ...)
Source
Parse an unsigned precision value enclosed in parentheses, e.g. (10).
Source
Parse an optional precision (n) and return it as Some(n) when present.
Source
Parse an optional character length specification (n | MAX [CHARACTERS|OCTETS]).
Source
Parse an optional binary length specification like (n).
Source
Parse a character length, handling MAX or integer lengths with optional units.
Source
Parse a binary length specification, returning BinaryLength.
Source
Parse an optional (precision[, scale]) and return (Option<precision>, Option<scale>).
Source
Parse exact-number precision/scale info like (precision[, scale]) for decimal types.
Source
Parse optional type modifiers appearing in parentheses e.g. (UNSIGNED, ZEROFILL).
Source
Parse a DELETE statement and return Statement::Delete.
Source
Parse a KILL statement, optionally specifying CONNECTION, QUERY, or MUTATION.
KILL [CONNECTION | QUERY | MUTATION] processlist_id
Source
Parse an EXPLAIN statement, handling dialect-specific options and modifiers.
Source
Parse a query expression, i.e. a SELECT statement optionally
preceded with some WITH CTE declarations and optionally followed
by ORDER BY. Unlike some other parse_… methods, this one doesn’t
expect the initial keyword to be already consumed
Source
Parse a mssql FOR [XML | JSON | BROWSE] clause
Source
Parse a mssql FOR XML clause
Source
Parse a mssql FOR JSON clause
Source
Parse a CTE (alias [( col1, col2, ... )] AS (subquery))
Source
Parse a “query body”, which is an expression with roughly the following grammar:
query_body ::= restricted_select | '(' subquery ')' | set_operation
restricted_select ::= 'SELECT' [expr_list] [ from ] [ where ] [ groupby_having ]
subquery ::= query_body [ order_by_limit ]
set_operation ::= query_body { 'UNION' | 'EXCEPT' | 'INTERSECT' } [ 'ALL' ] query_bodySource
Parse a set operator token into its SetOperator variant.
Source
Parse a set quantifier (e.g., ALL, DISTINCT BY NAME) for the given set operator.
Source
Parse a restricted SELECT statement (no CTEs / UNION / ORDER BY)
Source
Parse a CONNECT BY clause (Oracle-style hierarchical query support).
Source
Parse CREATE TABLE x AS TABLE y
Source
Parse session parameter assignments after SET when no = or TO is present.
Source
Parse a SHOW statement and dispatch to specific SHOW handlers.
Source
Parse SHOW CREATE <object> returning the corresponding ShowCreate statement.
Source
Parse SHOW COLUMNS/SHOW FIELDS and return a ShowColumns statement.
Source
Parse SHOW FUNCTIONS and optional filter.
Source
Parse SHOW COLLATION and optional filter.
Source
Parse an optional filter used by SHOW statements (LIKE, ILIKE, WHERE, or literal).
Source
Parse a USE statement (database/catalog/schema/warehouse/role selection).
Source
Parse a table factor followed by any join clauses, returning TableWithJoins.
Source
A table name or a parenthesized subquery, followed by optional [AS] alias
Source
Parses a the timestamp version specifier (i.e. query historical data)
Source
Parses MySQL’s JSON_TABLE column definition.
For example: id INT EXISTS PATH '$' DEFAULT '0' ON EMPTY ERROR ON ERROR
Source
Parse a derived table factor (a parenthesized subquery), handling optional LATERAL.
Source
Parses an expression with an optional alias
Examples:
SUM(price) AS total_priceExample
let sql = r#"SUM("a") as "b""#;
let mut parser = Parser::new(&GenericDialect).try_with_sql(sql)?;
let expr_with_alias = parser.parse_expr_with_alias()?;
assert_eq!(Some("b".to_string()), expr_with_alias.alias.map(|x|x.value));Source
Parse a PIVOT table factor (ClickHouse/Oracle style pivot), returning a TableFactor.
Source
Parse an UNPIVOT table factor, returning a TableFactor.
Source
Parse a JOIN constraint (NATURAL, ON <expr>, USING (...), or no constraint).
Source
Parse a GRANT statement.
Source
Parse privileges and optional target objects for GRANT/DENY/REVOKE statements.
Source
Parse a single grantable permission/action (used within GRANT statements).
Source
Parse a grantee name, possibly with a host qualifier (user@host).
Source
Parse a REVOKE statement
Source
Parse an REPLACE statement
Source
Parse an INSERT statement
Source
Parse an optional PARTITION (...) clause for INSERT statements.
Source
Parse optional Hive INPUTFORMAT ... SERDE ... clause used by LOAD DATA.
Source
Parse an UPDATE statement and return Statement::Update.
Source
Parse a var = expr assignment, used in an UPDATE statement
Source
Parse the left-hand side of an assignment, used in an UPDATE statement
Source
Parse a single function argument, handling named and unnamed variants.
Source
Parse an optional, comma-separated list of function arguments (consumes closing paren).
Source
Parse a comma-delimited list of projections after SELECT
Source
Parse an WildcardAdditionalOptions information for wildcard select items.
If it is not possible to parse it, will return an option.
Source
Parse an Ilike information for wildcard select items.
If it is not possible to parse it, will return an option.
Source
Parse an Exclude information for wildcard select items.
If it is not possible to parse it, will return an option.
Source
Parse an Except information for wildcard select items.
If it is not possible to parse it, will return an option.
Source
Parse a single element of a REPLACE (...) select-item clause.
Source
Parse ASC or DESC, returns an Option with true if ASC, false of DESC or None if none of
them.
Source
Parse a WITH FILL clause used in ORDER BY (ClickHouse dialect).
Source
Parse a set of comma separated INTERPOLATE expressions (ClickHouse dialect) that follow the INTERPOLATE keyword in an ORDER BY clause with the WITH FILL modifier
Source
Parse a INTERPOLATE expression (ClickHouse dialect)
Source
Parse a TOP clause, MSSQL equivalent of LIMIT,
that follows after SELECT [DISTINCT].
Source
Parse a LIMIT clause
Source
Parse an OFFSET clause
Source
Parse a FETCH clause
Source
Parse a FOR UPDATE/FOR SHARE clause
Source
Parse a VALUES clause
Source
Parse a ‘START TRANSACTION’ statement
Source
Parse a ‘BEGIN’ statement
Source
Parse a ‘BEGIN … EXCEPTION … END’ block
Source
Parse an ‘END’ statement
Source
Parse a list of transaction modes
Source
Parse a ‘COMMIT’ statement
Source
Parse a ‘ROLLBACK’ statement
Source
Parse an optional AND [NO] CHAIN clause for COMMIT and ROLLBACK statements
Source
Parse an optional ‘TO SAVEPOINT savepoint_name’ clause for ROLLBACK statements
Source
Parse a ‘RAISERROR’ statement
Source
Parse a single RAISERROR option
Source
Parse a SQL DEALLOCATE statement
Source
Parse a SQL EXECUTE statement
Source
Parse a SQL PREPARE statement
Source
Parse a SQL UNLOAD statement
Source
PRAGMA [schema-name ‘.’] pragma-name [(‘=’ pragma-value) | ‘(’ pragma-value ‘)’]
Source
INSTALL [extension_name]
Source
Parse a SQL LOAD statement
Source
OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE [BY expression]]Source
CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] <sequence_name>See Postgres docs for more details.
Source
The index of the first unprocessed token.
Source
Parse a named window definition.
Source
Parse CREATE PROCEDURE statement.
Source
Parse a window specification.
Source
Parse CREATE TYPE statement.
Source
Consume the parser and return its underlying token buffer