From da576183505b4841ea8d9e28938bfbc1901f2cdb Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Wed, 5 Feb 2025 17:44:52 +0100 Subject: [PATCH 01/23] Added first tentative tests --- tests/sqlparser_postgres.rs | 107 ++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index 62da0f574..09d25fcdb 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -2477,6 +2477,113 @@ fn parse_create_anonymous_index() { } } +#[test] +fn parse_create_users_name_trgm_index() { + let sql = "CREATE INDEX users_name_trgm_idx ON users USING gin (concat_users_name(first_name, last_name) gin_trgm_ops);"; + match pg().verified_stmt(sql) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique, + concurrently, + if_not_exists, + include, + nulls_distinct: None, + with, + predicate: None, + }) => { + } + _ => unreachable!(), + } +} + +#[test] +fn parse_create_projects_name_description_trgm_index() { + let sql = "CREATE INDEX projects_name_description_trgm_idx ON projects USING gin (concat_projects_name_description(name, description) gin_trgm_ops);"; + match pg().verified_stmt(sql) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique, + concurrently, + if_not_exists, + include, + nulls_distinct: None, + with, + predicate: None, + }) => {} + _ => unreachable!(), + } +} + +#[test] +fn parse_create_nameplates_barcode_trgm_index() { + let sql = + "CREATE INDEX nameplates_barcode_trgm_idx ON nameplates USING gin (barcode gin_trgm_ops);"; + match pg().verified_stmt(sql) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique, + concurrently, + if_not_exists, + include, + nulls_distinct: None, + with, + predicate: None, + }) => {} + _ => unreachable!(), + } +} + +#[test] +fn parse_create_sample_containers_barcode_trgm_index() { + let sql = "CREATE INDEX sample_containers_barcode_trgm_idx ON sample_containers USING gin (barcode gin_trgm_ops);"; + match pg().verified_stmt(sql) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique, + concurrently, + if_not_exists, + include, + nulls_distinct: None, + with, + predicate: None, + }) => {} + _ => unreachable!(), + } +} + +#[test] +fn parse_create_teams_name_description_trgm_index() { + let sql = "CREATE INDEX teams_name_description_trgm_idx ON teams USING gin (concat_teams_name_description(name, description) gin_trgm_ops);"; + match pg().verified_stmt(sql) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique, + concurrently, + if_not_exists, + include, + nulls_distinct: None, + with, + predicate: None, + }) => {} + _ => unreachable!(), + } +} + #[test] fn parse_create_index_concurrently() { let sql = "CREATE INDEX CONCURRENTLY IF NOT EXISTS my_index ON my_table(col1,col2)"; From 49e001e80c75d419399e25439be840d2708d118e Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Thu, 6 Feb 2025 16:37:11 +0100 Subject: [PATCH 02/23] Added support and test to handle operator classes for indices --- out.rs | 111938 +++++++++++++++++++++++++++++++++ src/ast/ddl.rs | 13 +- src/ast/dml.rs | 39 +- src/ast/mod.rs | 9 +- src/ast/operator_classes.rs | 571 + src/ast/spans.rs | 6 +- src/keywords.rs | 82 + src/parser/mod.rs | 83 +- tests/sqlparser_common.rs | 20 +- tests/sqlparser_postgres.rs | 194 +- 10 files changed, 112902 insertions(+), 53 deletions(-) create mode 100644 out.rs create mode 100644 src/ast/operator_classes.rs diff --git a/out.rs b/out.rs new file mode 100644 index 000000000..253a40015 --- /dev/null +++ b/out.rs @@ -0,0 +1,111938 @@ +#![feature(prelude_import)] +//! # SQL Parser for Rust +//! +//! This crate provides an ANSI:SQL 2011 lexer and parser that can parse SQL +//! into an Abstract Syntax Tree ([`AST`]). See the [sqlparser crates.io page] +//! for more information. +//! +//! For more information: +//! 1. [`Parser::parse_sql`] and [`Parser::new`] for the Parsing API +//! 2. [`ast`] for the AST structure +//! 3. [`Dialect`] for supported SQL dialects +//! 4. [`Spanned`] for source text locations (see "Source Spans" below for details) +//! +//! [`Spanned`]: ast::Spanned +//! +//! # Example parsing SQL text +//! +//! ``` +//! use sqlparser::dialect::GenericDialect; +//! use sqlparser::parser::Parser; +//! +//! let dialect = GenericDialect {}; // or AnsiDialect +//! +//! let sql = "SELECT a, b, 123, myfunc(b) \ +//! FROM table_1 \ +//! WHERE a > b AND b < 100 \ +//! ORDER BY a DESC, b"; +//! +//! let ast = Parser::parse_sql(&dialect, sql).unwrap(); +//! +//! println!("AST: {:?}", ast); +//! ``` +//! +//! # Creating SQL text from AST +//! +//! This crate allows users to recover the original SQL text (with comments +//! removed, normalized whitespace and identifier capitalization), which is +//! useful for tools that analyze and manipulate SQL. +//! +//! ``` +//! # use sqlparser::dialect::GenericDialect; +//! # use sqlparser::parser::Parser; +//! let sql = "SELECT a FROM table_1"; +//! +//! // parse to a Vec +//! let ast = Parser::parse_sql(&GenericDialect, sql).unwrap(); +//! +//! // The original SQL text can be generated from the AST +//! assert_eq!(ast[0].to_string(), sql); +//! ``` +//! [sqlparser crates.io page]: https://crates.io/crates/sqlparser +//! [`Parser::parse_sql`]: crate::parser::Parser::parse_sql +//! [`Parser::new`]: crate::parser::Parser::new +//! [`AST`]: crate::ast +//! [`ast`]: crate::ast +//! [`Dialect`]: crate::dialect::Dialect +//! +//! # Source Spans +//! +//! Starting with version `0.53.0` sqlparser introduced source spans to the +//! AST. This feature provides source information for syntax errors, enabling +//! better error messages. See [issue #1548] for more information and the +//! [`Spanned`] trait to access the spans. +//! +//! [issue #1548]: https://github.com/apache/datafusion-sqlparser-rs/issues/1548 +//! [`Spanned`]: ast::Spanned +//! +//! ## Migration Guide +//! +//! For the next few releases, we will be incrementally adding source spans to the +//! AST nodes, trying to minimize the impact on existing users. Some breaking +//! changes are inevitable, and the following is a summary of the changes: +//! +//! #### New fields for spans (must be added to any existing pattern matches) +//! +//! The primary change is that new fields will be added to AST nodes to store the source `Span` or `TokenWithLocation`. +//! +//! This will require +//! 1. Adding new fields to existing pattern matches. +//! 2. Filling in the proper span information when constructing AST nodes. +//! +//! For example, since `Ident` now stores a `Span`, to construct an `Ident` you +//! must provide now provide one: +//! +//! Previously: +//! ```text +//! # use sqlparser::ast::Ident; +//! Ident { +//! value: "name".into(), +//! quote_style: None, +//! } +//! ``` +//! Now +//! ```rust +//! # use sqlparser::ast::Ident; +//! # use sqlparser::tokenizer::Span; +//! Ident { +//! value: "name".into(), +//! quote_style: None, +//! span: Span::empty(), +//! }; +//! ``` +//! +//! Similarly, when pattern matching on `Ident`, you must now account for the +//! `span` field. +//! +//! #### Misc. +//! - [`TokenWithLocation`] stores a full `Span`, rather than just a source location. +//! Users relying on `token.location` should use `token.location.start` instead. +//! +//![`TokenWithLocation`]: tokenizer::TokenWithLocation +#![allow(clippy::upper_case_acronyms)] +#[prelude_import] +use std::prelude::rust_2021::*; +#[macro_use] +extern crate std; +extern crate self as sqlparser; +pub mod ast { + //! SQL Abstract Syntax Tree (AST) types + use helpers::{attached_token::AttachedToken, stmt_data_loading::FileStagingCommand}; + use core::ops::Deref; + use core::{ + fmt::{self, Display}, + hash, + }; + use crate::tokenizer::Span; + pub use self::data_type::{ + ArrayElemTypeDef, CharLengthUnits, CharacterLength, DataType, EnumMember, + ExactNumberInfo, StructBracketKind, TimezoneInfo, + }; + pub use self::dcl::{ + AlterRoleOperation, ResetConfig, RoleOption, SecondaryRoles, SetConfigValue, Use, + }; + pub use self::ddl::{ + AlterColumnOperation, AlterConnectorOwner, AlterIndexOperation, + AlterPolicyOperation, AlterTableOperation, ClusteredBy, ColumnDef, ColumnOption, + ColumnOptionDef, ColumnPolicy, ColumnPolicyProperty, ConstraintCharacteristics, + CreateConnector, CreateFunction, Deduplicate, DeferrableInitial, DropBehavior, + GeneratedAs, GeneratedExpressionMode, IdentityParameters, IdentityProperty, + IdentityPropertyFormatKind, IdentityPropertyKind, IdentityPropertyOrder, + IndexOption, IndexType, KeyOrIndexDisplay, NullsDistinctOption, Owner, Partition, + ProcedureParam, ReferentialAction, TableConstraint, TagsColumnOption, + UserDefinedTypeCompositeAttributeDef, UserDefinedTypeRepresentation, + ViewColumnDef, + }; + pub use self::dml::{CreateIndex, CreateTable, Delete, IndexColumn, Insert}; + pub use self::operator::{BinaryOperator, UnaryOperator}; + pub use self::query::{ + AfterMatchSkip, ConnectBy, Cte, CteAsMaterialized, Distinct, EmptyMatchesMode, + ExceptSelectItem, ExcludeSelectItem, ExprWithAlias, Fetch, ForClause, ForJson, + ForXml, FormatClause, GroupByExpr, GroupByWithModifier, IdentWithAlias, + IlikeSelectItem, InputFormatClause, Interpolate, InterpolateExpr, Join, + JoinConstraint, JoinOperator, JsonTableColumn, JsonTableColumnErrorHandling, + JsonTableNamedColumn, JsonTableNestedColumn, LateralView, LockClause, LockType, + MatchRecognizePattern, MatchRecognizeSymbol, Measure, NamedWindowDefinition, + NamedWindowExpr, NonBlock, Offset, OffsetRows, OpenJsonTableColumn, OrderBy, + OrderByExpr, PivotValueSource, ProjectionSelect, Query, RenameSelectItem, + RepetitionQuantifier, ReplaceSelectElement, ReplaceSelectItem, RowsPerMatch, + Select, SelectInto, SelectItem, SelectItemQualifiedWildcardKind, SetExpr, + SetOperator, SetQuantifier, Setting, SymbolDefinition, Table, TableAlias, + TableAliasColumnDef, TableFactor, TableFunctionArgs, TableIndexHintForClause, + TableIndexHintType, TableIndexHints, TableIndexType, TableSample, + TableSampleBucket, TableSampleKind, TableSampleMethod, TableSampleModifier, + TableSampleQuantity, TableSampleSeed, TableSampleSeedModifier, TableSampleUnit, + TableVersion, TableWithJoins, Top, TopQuantity, UpdateTableFromKind, + ValueTableMode, Values, WildcardAdditionalOptions, With, WithFill, + }; + pub use self::trigger::{ + TriggerEvent, TriggerExecBody, TriggerExecBodyType, TriggerObject, TriggerPeriod, + TriggerReferencing, TriggerReferencingType, + }; + pub use self::value::{ + escape_double_quote_string, escape_quoted_string, DateTimeField, + DollarQuotedString, NormalizationForm, TrimWhereField, Value, + }; + pub use self::operator_classes::{ + BTreeOperatorClass, BloomOperatorClass, GINOperatorClass, GiSTOperatorClass, + HashOperatorClass, OperatorClass, + }; + use crate::ast::helpers::stmt_data_loading::{ + DataLoadingOptions, StageLoadSelectItem, StageParamsObject, + }; + mod data_type { + use core::fmt; + use crate::ast::{ + display_comma_separated, Expr, ObjectName, StructField, UnionField, + }; + use super::{value::escape_single_quote_string, ColumnDef}; + pub enum EnumMember { + Name(String), + /// ClickHouse allows to specify an integer value for each enum value. + /// + /// [clickhouse](https://clickhouse.com/docs/en/sql-reference/data-types/enum) + NamedValue(String, Expr), + } + #[automatically_derived] + impl ::core::fmt::Debug for EnumMember { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + EnumMember::Name(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Name", + &__self_0, + ) + } + EnumMember::NamedValue(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "NamedValue", + __self_0, + &__self_1, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for EnumMember { + #[inline] + fn clone(&self) -> EnumMember { + match self { + EnumMember::Name(__self_0) => { + EnumMember::Name(::core::clone::Clone::clone(__self_0)) + } + EnumMember::NamedValue(__self_0, __self_1) => { + EnumMember::NamedValue( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for EnumMember {} + #[automatically_derived] + impl ::core::cmp::PartialEq for EnumMember { + #[inline] + fn eq(&self, other: &EnumMember) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + (EnumMember::Name(__self_0), EnumMember::Name(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + EnumMember::NamedValue(__self_0, __self_1), + EnumMember::NamedValue(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for EnumMember { + #[inline] + fn partial_cmp( + &self, + other: &EnumMember, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + (EnumMember::Name(__self_0), EnumMember::Name(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + EnumMember::NamedValue(__self_0, __self_1), + EnumMember::NamedValue(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for EnumMember { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for EnumMember { + #[inline] + fn cmp(&self, other: &EnumMember) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + (EnumMember::Name(__self_0), EnumMember::Name(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + EnumMember::NamedValue(__self_0, __self_1), + EnumMember::NamedValue(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for EnumMember { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + EnumMember::Name(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + EnumMember::NamedValue(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + } + } + } + /// SQL data types + pub enum DataType { + /// Table type in [postgresql]. e.g. CREATE FUNCTION RETURNS TABLE(...) + /// + /// [postgresql]: https://www.postgresql.org/docs/15/sql-createfunction.html + Table(Vec), + /// Fixed-length character type e.g. CHARACTER(10) + Character(Option), + /// Fixed-length char type e.g. CHAR(10) + Char(Option), + /// Character varying type e.g. CHARACTER VARYING(10) + CharacterVarying(Option), + /// Char varying type e.g. CHAR VARYING(10) + CharVarying(Option), + /// Variable-length character type e.g. VARCHAR(10) + Varchar(Option), + /// Variable-length character type e.g. NVARCHAR(10) + Nvarchar(Option), + /// Uuid type + Uuid, + /// Large character object with optional length e.g. CHARACTER LARGE OBJECT, CHARACTER LARGE OBJECT(1000), [standard] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#character-large-object-type + CharacterLargeObject(Option), + /// Large character object with optional length e.g. CHAR LARGE OBJECT, CHAR LARGE OBJECT(1000), [standard] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#character-large-object-type + CharLargeObject(Option), + /// Large character object with optional length e.g. CLOB, CLOB(1000), [standard] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#character-large-object-type + /// [Oracle]: https://docs.oracle.com/javadb/10.10.1.2/ref/rrefclob.html + Clob(Option), + /// Fixed-length binary type with optional length e.g. [standard], [MS SQL Server] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#binary-string-type + /// [MS SQL Server]: https://learn.microsoft.com/pt-br/sql/t-sql/data-types/binary-and-varbinary-transact-sql?view=sql-server-ver16 + Binary(Option), + /// Variable-length binary with optional length type e.g. [standard], [MS SQL Server] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#binary-string-type + /// [MS SQL Server]: https://learn.microsoft.com/pt-br/sql/t-sql/data-types/binary-and-varbinary-transact-sql?view=sql-server-ver16 + Varbinary(Option), + /// Large binary object with optional length e.g. BLOB, BLOB(1000), [standard], [Oracle] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#binary-large-object-string-type + /// [Oracle]: https://docs.oracle.com/javadb/10.8.3.0/ref/rrefblob.html + Blob(Option), + /// [MySQL] blob with up to 2**8 bytes + /// + /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/blob.html + TinyBlob, + /// [MySQL] blob with up to 2**24 bytes + /// + /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/blob.html + MediumBlob, + /// [MySQL] blob with up to 2**32 bytes + /// + /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/blob.html + LongBlob, + /// Variable-length binary data with optional length. + /// + /// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#bytes_type + Bytes(Option), + /// Numeric type with optional precision and scale e.g. NUMERIC(10,2), [standard][1] + /// + /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type + Numeric(ExactNumberInfo), + /// Decimal type with optional precision and scale e.g. DECIMAL(10,2), [standard][1] + /// + /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type + Decimal(ExactNumberInfo), + /// [BigNumeric] type used in BigQuery + /// + /// [BigNumeric]: https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#bignumeric_literals + BigNumeric(ExactNumberInfo), + /// This is alias for `BigNumeric` type used in BigQuery + /// + /// [BigDecimal]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#decimal_types + BigDecimal(ExactNumberInfo), + /// Dec type with optional precision and scale e.g. DEC(10,2), [standard][1] + /// + /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type + Dec(ExactNumberInfo), + /// Floating point with optional precision e.g. FLOAT(8) + Float(Option), + /// Tiny integer with optional display width e.g. TINYINT or TINYINT(3) + TinyInt(Option), + /// Unsigned tiny integer with optional display width e.g. TINYINT UNSIGNED or TINYINT(3) UNSIGNED + UnsignedTinyInt(Option), + /// Int2 as alias for SmallInt in [postgresql] + /// Note: Int2 mean 2 bytes in postgres (not 2 bits) + /// Int2 with optional display width e.g. INT2 or INT2(5) + /// + /// [postgresql]: https://www.postgresql.org/docs/15/datatype.html + Int2(Option), + /// Unsigned Int2 with optional display width e.g. INT2 Unsigned or INT2(5) Unsigned + UnsignedInt2(Option), + /// Small integer with optional display width e.g. SMALLINT or SMALLINT(5) + SmallInt(Option), + /// Unsigned small integer with optional display width e.g. SMALLINT UNSIGNED or SMALLINT(5) UNSIGNED + UnsignedSmallInt(Option), + /// MySQL medium integer ([1]) with optional display width e.g. MEDIUMINT or MEDIUMINT(5) + /// + /// [1]: https://dev.mysql.com/doc/refman/8.0/en/integer-types.html + MediumInt(Option), + /// Unsigned medium integer ([1]) with optional display width e.g. MEDIUMINT UNSIGNED or MEDIUMINT(5) UNSIGNED + /// + /// [1]: https://dev.mysql.com/doc/refman/8.0/en/integer-types.html + UnsignedMediumInt(Option), + /// Int with optional display width e.g. INT or INT(11) + Int(Option), + /// Int4 as alias for Integer in [postgresql] + /// Note: Int4 mean 4 bytes in postgres (not 4 bits) + /// Int4 with optional display width e.g. Int4 or Int4(11) + /// + /// [postgresql]: https://www.postgresql.org/docs/15/datatype.html + Int4(Option), + /// Int8 as alias for Bigint in [postgresql] and integer type in [clickhouse] + /// Note: Int8 mean 8 bytes in [postgresql] (not 8 bits) + /// Int8 with optional display width e.g. INT8 or INT8(11) + /// Note: Int8 mean 8 bits in [clickhouse] + /// + /// [postgresql]: https://www.postgresql.org/docs/15/datatype.html + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + Int8(Option), + /// Integer type in [clickhouse] + /// Note: Int16 mean 16 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + Int16, + /// Integer type in [clickhouse] + /// Note: Int16 mean 32 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + Int32, + /// Integer type in [bigquery], [clickhouse] + /// + /// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#integer_types + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + Int64, + /// Integer type in [clickhouse] + /// Note: Int128 mean 128 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + Int128, + /// Integer type in [clickhouse] + /// Note: Int256 mean 256 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + Int256, + /// Integer with optional display width e.g. INTEGER or INTEGER(11) + Integer(Option), + /// Unsigned int with optional display width e.g. INT UNSIGNED or INT(11) UNSIGNED + UnsignedInt(Option), + /// Unsigned int4 with optional display width e.g. INT4 UNSIGNED or INT4(11) UNSIGNED + UnsignedInt4(Option), + /// Unsigned integer with optional display width e.g. INTEGER UNSIGNED or INTEGER(11) UNSIGNED + UnsignedInteger(Option), + /// Unsigned integer type in [clickhouse] + /// Note: UInt8 mean 8 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + UInt8, + /// Unsigned integer type in [clickhouse] + /// Note: UInt16 mean 16 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + UInt16, + /// Unsigned integer type in [clickhouse] + /// Note: UInt32 mean 32 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + UInt32, + /// Unsigned integer type in [clickhouse] + /// Note: UInt64 mean 64 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + UInt64, + /// Unsigned integer type in [clickhouse] + /// Note: UInt128 mean 128 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + UInt128, + /// Unsigned integer type in [clickhouse] + /// Note: UInt256 mean 256 bits in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/int-uint + UInt256, + /// Big integer with optional display width e.g. BIGINT or BIGINT(20) + BigInt(Option), + /// Unsigned big integer with optional display width e.g. BIGINT UNSIGNED or BIGINT(20) UNSIGNED + UnsignedBigInt(Option), + /// Unsigned Int8 with optional display width e.g. INT8 UNSIGNED or INT8(11) UNSIGNED + UnsignedInt8(Option), + /// Float4 as alias for Real in [postgresql] + /// + /// [postgresql]: https://www.postgresql.org/docs/15/datatype.html + Float4, + /// Floating point in [clickhouse] + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/float + Float32, + /// Floating point in [bigquery] + /// + /// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#floating_point_types + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/float + Float64, + /// Floating point e.g. REAL + Real, + /// Float8 as alias for Double in [postgresql] + /// + /// [postgresql]: https://www.postgresql.org/docs/15/datatype.html + Float8, + /// Double + Double(ExactNumberInfo), + /// Double PRECISION e.g. [standard], [postgresql] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#approximate-numeric-type + /// [postgresql]: https://www.postgresql.org/docs/current/datatype-numeric.html + DoublePrecision, + /// Bool as alias for Boolean in [postgresql] + /// + /// [postgresql]: https://www.postgresql.org/docs/15/datatype.html + Bool, + /// Boolean + Boolean, + /// Date + Date, + /// Date32 with the same range as Datetime64 + /// + /// [1]: https://clickhouse.com/docs/en/sql-reference/data-types/date32 + Date32, + /// Time with optional time precision and time zone information e.g. [standard][1]. + /// + /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#datetime-type + Time(Option, TimezoneInfo), + /// Datetime with optional time precision e.g. [MySQL][1]. + /// + /// [1]: https://dev.mysql.com/doc/refman/8.0/en/datetime.html + Datetime(Option), + /// Datetime with time precision and optional timezone e.g. [ClickHouse][1]. + /// + /// [1]: https://clickhouse.com/docs/en/sql-reference/data-types/datetime64 + Datetime64(u64, Option), + /// Timestamp with optional time precision and time zone information e.g. [standard][1]. + /// + /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#datetime-type + Timestamp(Option, TimezoneInfo), + /// Interval + Interval, + /// JSON type + JSON, + /// Binary JSON type + JSONB, + /// Regclass used in postgresql serial + Regclass, + /// Text + Text, + /// [MySQL] text with up to 2**8 bytes + /// + /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/blob.html + TinyText, + /// [MySQL] text with up to 2**24 bytes + /// + /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/blob.html + MediumText, + /// [MySQL] text with up to 2**32 bytes + /// + /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/blob.html + LongText, + /// String with optional length. + String(Option), + /// A fixed-length string e.g [ClickHouse][1]. + /// + /// [1]: https://clickhouse.com/docs/en/sql-reference/data-types/fixedstring + FixedString(u64), + /// Bytea + Bytea, + /// Bit string, e.g. [Postgres], [MySQL], or [MSSQL] + /// + /// [Postgres]: https://www.postgresql.org/docs/current/datatype-bit.html + /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/bit-type.html + /// [MSSQL]: https://learn.microsoft.com/en-us/sql/t-sql/data-types/bit-transact-sql?view=sql-server-ver16 + Bit(Option), + /// Variable-length bit string e.g. [Postgres] + /// + /// [Postgres]: https://www.postgresql.org/docs/current/datatype-bit.html + BitVarying(Option), + /// Custom type such as enums + Custom(ObjectName, Vec), + /// Arrays + Array(ArrayElemTypeDef), + /// Map + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/map + Map(Box, Box), + /// Tuple + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/tuple + Tuple(Vec), + /// Nested + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/nested-data-structures/nested + Nested(Vec), + /// Enums + Enum(Vec, Option), + /// Set + Set(Vec), + /// Struct + /// + /// [hive]: https://docs.cloudera.com/cdw-runtime/cloud/impala-sql-reference/topics/impala-struct.html + /// [bigquery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#struct_type + Struct(Vec, StructBracketKind), + /// Union + /// + /// [duckdb]: https://duckdb.org/docs/sql/data_types/union.html + Union(Vec), + /// Nullable - special marker NULL represents in ClickHouse as a data type. + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/nullable + Nullable(Box), + /// LowCardinality - changes the internal representation of other data types to be dictionary-encoded. + /// + /// [clickhouse]: https://clickhouse.com/docs/en/sql-reference/data-types/lowcardinality + LowCardinality(Box), + /// No type specified - only used with + /// [`SQLiteDialect`](crate::dialect::SQLiteDialect), from statements such + /// as `CREATE TABLE t1 (a)`. + Unspecified, + /// Trigger data type, returned by functions associated with triggers + /// + /// [postgresql]: https://www.postgresql.org/docs/current/plpgsql-trigger.html + Trigger, + /// Any data type, used in BigQuery UDF definitions for templated parameters + /// + /// [bigquery]: https://cloud.google.com/bigquery/docs/user-defined-functions#templated-sql-udf-parameters + AnyType, + } + #[automatically_derived] + impl ::core::fmt::Debug for DataType { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + DataType::Table(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Table", + &__self_0, + ) + } + DataType::Character(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Character", + &__self_0, + ) + } + DataType::Char(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Char", + &__self_0, + ) + } + DataType::CharacterVarying(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "CharacterVarying", + &__self_0, + ) + } + DataType::CharVarying(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "CharVarying", + &__self_0, + ) + } + DataType::Varchar(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Varchar", + &__self_0, + ) + } + DataType::Nvarchar(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Nvarchar", + &__self_0, + ) + } + DataType::Uuid => ::core::fmt::Formatter::write_str(f, "Uuid"), + DataType::CharacterLargeObject(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "CharacterLargeObject", + &__self_0, + ) + } + DataType::CharLargeObject(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "CharLargeObject", + &__self_0, + ) + } + DataType::Clob(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Clob", + &__self_0, + ) + } + DataType::Binary(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Binary", + &__self_0, + ) + } + DataType::Varbinary(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Varbinary", + &__self_0, + ) + } + DataType::Blob(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Blob", + &__self_0, + ) + } + DataType::TinyBlob => { + ::core::fmt::Formatter::write_str(f, "TinyBlob") + } + DataType::MediumBlob => { + ::core::fmt::Formatter::write_str(f, "MediumBlob") + } + DataType::LongBlob => { + ::core::fmt::Formatter::write_str(f, "LongBlob") + } + DataType::Bytes(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Bytes", + &__self_0, + ) + } + DataType::Numeric(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Numeric", + &__self_0, + ) + } + DataType::Decimal(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Decimal", + &__self_0, + ) + } + DataType::BigNumeric(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "BigNumeric", + &__self_0, + ) + } + DataType::BigDecimal(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "BigDecimal", + &__self_0, + ) + } + DataType::Dec(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Dec", + &__self_0, + ) + } + DataType::Float(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Float", + &__self_0, + ) + } + DataType::TinyInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "TinyInt", + &__self_0, + ) + } + DataType::UnsignedTinyInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedTinyInt", + &__self_0, + ) + } + DataType::Int2(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Int2", + &__self_0, + ) + } + DataType::UnsignedInt2(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedInt2", + &__self_0, + ) + } + DataType::SmallInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "SmallInt", + &__self_0, + ) + } + DataType::UnsignedSmallInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedSmallInt", + &__self_0, + ) + } + DataType::MediumInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "MediumInt", + &__self_0, + ) + } + DataType::UnsignedMediumInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedMediumInt", + &__self_0, + ) + } + DataType::Int(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Int", + &__self_0, + ) + } + DataType::Int4(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Int4", + &__self_0, + ) + } + DataType::Int8(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Int8", + &__self_0, + ) + } + DataType::Int16 => ::core::fmt::Formatter::write_str(f, "Int16"), + DataType::Int32 => ::core::fmt::Formatter::write_str(f, "Int32"), + DataType::Int64 => ::core::fmt::Formatter::write_str(f, "Int64"), + DataType::Int128 => ::core::fmt::Formatter::write_str(f, "Int128"), + DataType::Int256 => ::core::fmt::Formatter::write_str(f, "Int256"), + DataType::Integer(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Integer", + &__self_0, + ) + } + DataType::UnsignedInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedInt", + &__self_0, + ) + } + DataType::UnsignedInt4(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedInt4", + &__self_0, + ) + } + DataType::UnsignedInteger(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedInteger", + &__self_0, + ) + } + DataType::UInt8 => ::core::fmt::Formatter::write_str(f, "UInt8"), + DataType::UInt16 => ::core::fmt::Formatter::write_str(f, "UInt16"), + DataType::UInt32 => ::core::fmt::Formatter::write_str(f, "UInt32"), + DataType::UInt64 => ::core::fmt::Formatter::write_str(f, "UInt64"), + DataType::UInt128 => ::core::fmt::Formatter::write_str(f, "UInt128"), + DataType::UInt256 => ::core::fmt::Formatter::write_str(f, "UInt256"), + DataType::BigInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "BigInt", + &__self_0, + ) + } + DataType::UnsignedBigInt(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedBigInt", + &__self_0, + ) + } + DataType::UnsignedInt8(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "UnsignedInt8", + &__self_0, + ) + } + DataType::Float4 => ::core::fmt::Formatter::write_str(f, "Float4"), + DataType::Float32 => ::core::fmt::Formatter::write_str(f, "Float32"), + DataType::Float64 => ::core::fmt::Formatter::write_str(f, "Float64"), + DataType::Real => ::core::fmt::Formatter::write_str(f, "Real"), + DataType::Float8 => ::core::fmt::Formatter::write_str(f, "Float8"), + DataType::Double(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Double", + &__self_0, + ) + } + DataType::DoublePrecision => { + ::core::fmt::Formatter::write_str(f, "DoublePrecision") + } + DataType::Bool => ::core::fmt::Formatter::write_str(f, "Bool"), + DataType::Boolean => ::core::fmt::Formatter::write_str(f, "Boolean"), + DataType::Date => ::core::fmt::Formatter::write_str(f, "Date"), + DataType::Date32 => ::core::fmt::Formatter::write_str(f, "Date32"), + DataType::Time(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "Time", + __self_0, + &__self_1, + ) + } + DataType::Datetime(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Datetime", + &__self_0, + ) + } + DataType::Datetime64(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "Datetime64", + __self_0, + &__self_1, + ) + } + DataType::Timestamp(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "Timestamp", + __self_0, + &__self_1, + ) + } + DataType::Interval => { + ::core::fmt::Formatter::write_str(f, "Interval") + } + DataType::JSON => ::core::fmt::Formatter::write_str(f, "JSON"), + DataType::JSONB => ::core::fmt::Formatter::write_str(f, "JSONB"), + DataType::Regclass => { + ::core::fmt::Formatter::write_str(f, "Regclass") + } + DataType::Text => ::core::fmt::Formatter::write_str(f, "Text"), + DataType::TinyText => { + ::core::fmt::Formatter::write_str(f, "TinyText") + } + DataType::MediumText => { + ::core::fmt::Formatter::write_str(f, "MediumText") + } + DataType::LongText => { + ::core::fmt::Formatter::write_str(f, "LongText") + } + DataType::String(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "String", + &__self_0, + ) + } + DataType::FixedString(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "FixedString", + &__self_0, + ) + } + DataType::Bytea => ::core::fmt::Formatter::write_str(f, "Bytea"), + DataType::Bit(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Bit", + &__self_0, + ) + } + DataType::BitVarying(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "BitVarying", + &__self_0, + ) + } + DataType::Custom(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "Custom", + __self_0, + &__self_1, + ) + } + DataType::Array(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Array", + &__self_0, + ) + } + DataType::Map(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "Map", + __self_0, + &__self_1, + ) + } + DataType::Tuple(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Tuple", + &__self_0, + ) + } + DataType::Nested(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Nested", + &__self_0, + ) + } + DataType::Enum(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "Enum", + __self_0, + &__self_1, + ) + } + DataType::Set(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Set", + &__self_0, + ) + } + DataType::Struct(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "Struct", + __self_0, + &__self_1, + ) + } + DataType::Union(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Union", + &__self_0, + ) + } + DataType::Nullable(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Nullable", + &__self_0, + ) + } + DataType::LowCardinality(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "LowCardinality", + &__self_0, + ) + } + DataType::Unspecified => { + ::core::fmt::Formatter::write_str(f, "Unspecified") + } + DataType::Trigger => ::core::fmt::Formatter::write_str(f, "Trigger"), + DataType::AnyType => ::core::fmt::Formatter::write_str(f, "AnyType"), + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for DataType { + #[inline] + fn clone(&self) -> DataType { + match self { + DataType::Table(__self_0) => { + DataType::Table(::core::clone::Clone::clone(__self_0)) + } + DataType::Character(__self_0) => { + DataType::Character(::core::clone::Clone::clone(__self_0)) + } + DataType::Char(__self_0) => { + DataType::Char(::core::clone::Clone::clone(__self_0)) + } + DataType::CharacterVarying(__self_0) => { + DataType::CharacterVarying(::core::clone::Clone::clone(__self_0)) + } + DataType::CharVarying(__self_0) => { + DataType::CharVarying(::core::clone::Clone::clone(__self_0)) + } + DataType::Varchar(__self_0) => { + DataType::Varchar(::core::clone::Clone::clone(__self_0)) + } + DataType::Nvarchar(__self_0) => { + DataType::Nvarchar(::core::clone::Clone::clone(__self_0)) + } + DataType::Uuid => DataType::Uuid, + DataType::CharacterLargeObject(__self_0) => { + DataType::CharacterLargeObject( + ::core::clone::Clone::clone(__self_0), + ) + } + DataType::CharLargeObject(__self_0) => { + DataType::CharLargeObject(::core::clone::Clone::clone(__self_0)) + } + DataType::Clob(__self_0) => { + DataType::Clob(::core::clone::Clone::clone(__self_0)) + } + DataType::Binary(__self_0) => { + DataType::Binary(::core::clone::Clone::clone(__self_0)) + } + DataType::Varbinary(__self_0) => { + DataType::Varbinary(::core::clone::Clone::clone(__self_0)) + } + DataType::Blob(__self_0) => { + DataType::Blob(::core::clone::Clone::clone(__self_0)) + } + DataType::TinyBlob => DataType::TinyBlob, + DataType::MediumBlob => DataType::MediumBlob, + DataType::LongBlob => DataType::LongBlob, + DataType::Bytes(__self_0) => { + DataType::Bytes(::core::clone::Clone::clone(__self_0)) + } + DataType::Numeric(__self_0) => { + DataType::Numeric(::core::clone::Clone::clone(__self_0)) + } + DataType::Decimal(__self_0) => { + DataType::Decimal(::core::clone::Clone::clone(__self_0)) + } + DataType::BigNumeric(__self_0) => { + DataType::BigNumeric(::core::clone::Clone::clone(__self_0)) + } + DataType::BigDecimal(__self_0) => { + DataType::BigDecimal(::core::clone::Clone::clone(__self_0)) + } + DataType::Dec(__self_0) => { + DataType::Dec(::core::clone::Clone::clone(__self_0)) + } + DataType::Float(__self_0) => { + DataType::Float(::core::clone::Clone::clone(__self_0)) + } + DataType::TinyInt(__self_0) => { + DataType::TinyInt(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedTinyInt(__self_0) => { + DataType::UnsignedTinyInt(::core::clone::Clone::clone(__self_0)) + } + DataType::Int2(__self_0) => { + DataType::Int2(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedInt2(__self_0) => { + DataType::UnsignedInt2(::core::clone::Clone::clone(__self_0)) + } + DataType::SmallInt(__self_0) => { + DataType::SmallInt(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedSmallInt(__self_0) => { + DataType::UnsignedSmallInt(::core::clone::Clone::clone(__self_0)) + } + DataType::MediumInt(__self_0) => { + DataType::MediumInt(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedMediumInt(__self_0) => { + DataType::UnsignedMediumInt( + ::core::clone::Clone::clone(__self_0), + ) + } + DataType::Int(__self_0) => { + DataType::Int(::core::clone::Clone::clone(__self_0)) + } + DataType::Int4(__self_0) => { + DataType::Int4(::core::clone::Clone::clone(__self_0)) + } + DataType::Int8(__self_0) => { + DataType::Int8(::core::clone::Clone::clone(__self_0)) + } + DataType::Int16 => DataType::Int16, + DataType::Int32 => DataType::Int32, + DataType::Int64 => DataType::Int64, + DataType::Int128 => DataType::Int128, + DataType::Int256 => DataType::Int256, + DataType::Integer(__self_0) => { + DataType::Integer(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedInt(__self_0) => { + DataType::UnsignedInt(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedInt4(__self_0) => { + DataType::UnsignedInt4(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedInteger(__self_0) => { + DataType::UnsignedInteger(::core::clone::Clone::clone(__self_0)) + } + DataType::UInt8 => DataType::UInt8, + DataType::UInt16 => DataType::UInt16, + DataType::UInt32 => DataType::UInt32, + DataType::UInt64 => DataType::UInt64, + DataType::UInt128 => DataType::UInt128, + DataType::UInt256 => DataType::UInt256, + DataType::BigInt(__self_0) => { + DataType::BigInt(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedBigInt(__self_0) => { + DataType::UnsignedBigInt(::core::clone::Clone::clone(__self_0)) + } + DataType::UnsignedInt8(__self_0) => { + DataType::UnsignedInt8(::core::clone::Clone::clone(__self_0)) + } + DataType::Float4 => DataType::Float4, + DataType::Float32 => DataType::Float32, + DataType::Float64 => DataType::Float64, + DataType::Real => DataType::Real, + DataType::Float8 => DataType::Float8, + DataType::Double(__self_0) => { + DataType::Double(::core::clone::Clone::clone(__self_0)) + } + DataType::DoublePrecision => DataType::DoublePrecision, + DataType::Bool => DataType::Bool, + DataType::Boolean => DataType::Boolean, + DataType::Date => DataType::Date, + DataType::Date32 => DataType::Date32, + DataType::Time(__self_0, __self_1) => { + DataType::Time( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + DataType::Datetime(__self_0) => { + DataType::Datetime(::core::clone::Clone::clone(__self_0)) + } + DataType::Datetime64(__self_0, __self_1) => { + DataType::Datetime64( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + DataType::Timestamp(__self_0, __self_1) => { + DataType::Timestamp( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + DataType::Interval => DataType::Interval, + DataType::JSON => DataType::JSON, + DataType::JSONB => DataType::JSONB, + DataType::Regclass => DataType::Regclass, + DataType::Text => DataType::Text, + DataType::TinyText => DataType::TinyText, + DataType::MediumText => DataType::MediumText, + DataType::LongText => DataType::LongText, + DataType::String(__self_0) => { + DataType::String(::core::clone::Clone::clone(__self_0)) + } + DataType::FixedString(__self_0) => { + DataType::FixedString(::core::clone::Clone::clone(__self_0)) + } + DataType::Bytea => DataType::Bytea, + DataType::Bit(__self_0) => { + DataType::Bit(::core::clone::Clone::clone(__self_0)) + } + DataType::BitVarying(__self_0) => { + DataType::BitVarying(::core::clone::Clone::clone(__self_0)) + } + DataType::Custom(__self_0, __self_1) => { + DataType::Custom( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + DataType::Array(__self_0) => { + DataType::Array(::core::clone::Clone::clone(__self_0)) + } + DataType::Map(__self_0, __self_1) => { + DataType::Map( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + DataType::Tuple(__self_0) => { + DataType::Tuple(::core::clone::Clone::clone(__self_0)) + } + DataType::Nested(__self_0) => { + DataType::Nested(::core::clone::Clone::clone(__self_0)) + } + DataType::Enum(__self_0, __self_1) => { + DataType::Enum( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + DataType::Set(__self_0) => { + DataType::Set(::core::clone::Clone::clone(__self_0)) + } + DataType::Struct(__self_0, __self_1) => { + DataType::Struct( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + DataType::Union(__self_0) => { + DataType::Union(::core::clone::Clone::clone(__self_0)) + } + DataType::Nullable(__self_0) => { + DataType::Nullable(::core::clone::Clone::clone(__self_0)) + } + DataType::LowCardinality(__self_0) => { + DataType::LowCardinality(::core::clone::Clone::clone(__self_0)) + } + DataType::Unspecified => DataType::Unspecified, + DataType::Trigger => DataType::Trigger, + DataType::AnyType => DataType::AnyType, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for DataType {} + #[automatically_derived] + impl ::core::cmp::PartialEq for DataType { + #[inline] + fn eq(&self, other: &DataType) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + (DataType::Table(__self_0), DataType::Table(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::Character(__self_0), + DataType::Character(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Char(__self_0), DataType::Char(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::CharacterVarying(__self_0), + DataType::CharacterVarying(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::CharVarying(__self_0), + DataType::CharVarying(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Varchar(__self_0), DataType::Varchar(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Nvarchar(__self_0), DataType::Nvarchar(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::CharacterLargeObject(__self_0), + DataType::CharacterLargeObject(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::CharLargeObject(__self_0), + DataType::CharLargeObject(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Clob(__self_0), DataType::Clob(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Binary(__self_0), DataType::Binary(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::Varbinary(__self_0), + DataType::Varbinary(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Blob(__self_0), DataType::Blob(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Bytes(__self_0), DataType::Bytes(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Numeric(__self_0), DataType::Numeric(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Decimal(__self_0), DataType::Decimal(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::BigNumeric(__self_0), + DataType::BigNumeric(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::BigDecimal(__self_0), + DataType::BigDecimal(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Dec(__self_0), DataType::Dec(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Float(__self_0), DataType::Float(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::TinyInt(__self_0), DataType::TinyInt(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::UnsignedTinyInt(__self_0), + DataType::UnsignedTinyInt(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Int2(__self_0), DataType::Int2(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::UnsignedInt2(__self_0), + DataType::UnsignedInt2(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::SmallInt(__self_0), DataType::SmallInt(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::UnsignedSmallInt(__self_0), + DataType::UnsignedSmallInt(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::MediumInt(__self_0), + DataType::MediumInt(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::UnsignedMediumInt(__self_0), + DataType::UnsignedMediumInt(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Int(__self_0), DataType::Int(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Int4(__self_0), DataType::Int4(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Int8(__self_0), DataType::Int8(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Integer(__self_0), DataType::Integer(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::UnsignedInt(__self_0), + DataType::UnsignedInt(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::UnsignedInt4(__self_0), + DataType::UnsignedInt4(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::UnsignedInteger(__self_0), + DataType::UnsignedInteger(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::BigInt(__self_0), DataType::BigInt(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::UnsignedBigInt(__self_0), + DataType::UnsignedBigInt(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::UnsignedInt8(__self_0), + DataType::UnsignedInt8(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Double(__self_0), DataType::Double(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::Time(__self_0, __self_1), + DataType::Time(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + (DataType::Datetime(__self_0), DataType::Datetime(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::Datetime64(__self_0, __self_1), + DataType::Datetime64(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + DataType::Timestamp(__self_0, __self_1), + DataType::Timestamp(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + (DataType::String(__self_0), DataType::String(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::FixedString(__self_0), + DataType::FixedString(__arg1_0), + ) => __self_0 == __arg1_0, + (DataType::Bit(__self_0), DataType::Bit(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::BitVarying(__self_0), + DataType::BitVarying(__arg1_0), + ) => __self_0 == __arg1_0, + ( + DataType::Custom(__self_0, __self_1), + DataType::Custom(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + (DataType::Array(__self_0), DataType::Array(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::Map(__self_0, __self_1), + DataType::Map(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + (DataType::Tuple(__self_0), DataType::Tuple(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Nested(__self_0), DataType::Nested(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::Enum(__self_0, __self_1), + DataType::Enum(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + (DataType::Set(__self_0), DataType::Set(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::Struct(__self_0, __self_1), + DataType::Struct(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + (DataType::Union(__self_0), DataType::Union(__arg1_0)) => { + __self_0 == __arg1_0 + } + (DataType::Nullable(__self_0), DataType::Nullable(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + DataType::LowCardinality(__self_0), + DataType::LowCardinality(__arg1_0), + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for DataType { + #[inline] + fn partial_cmp( + &self, + other: &DataType, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match (self, other) { + (DataType::Table(__self_0), DataType::Table(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Character(__self_0), + DataType::Character(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Char(__self_0), DataType::Char(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::CharacterVarying(__self_0), + DataType::CharacterVarying(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::CharVarying(__self_0), + DataType::CharVarying(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::Varchar(__self_0), + DataType::Varchar(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::Nvarchar(__self_0), + DataType::Nvarchar(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::CharacterLargeObject(__self_0), + DataType::CharacterLargeObject(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::CharLargeObject(__self_0), + DataType::CharLargeObject(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Clob(__self_0), DataType::Clob(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (DataType::Binary(__self_0), DataType::Binary(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Varbinary(__self_0), + DataType::Varbinary(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Blob(__self_0), DataType::Blob(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (DataType::Bytes(__self_0), DataType::Bytes(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Numeric(__self_0), + DataType::Numeric(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::Decimal(__self_0), + DataType::Decimal(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::BigNumeric(__self_0), + DataType::BigNumeric(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::BigDecimal(__self_0), + DataType::BigDecimal(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Dec(__self_0), DataType::Dec(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (DataType::Float(__self_0), DataType::Float(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::TinyInt(__self_0), + DataType::TinyInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::UnsignedTinyInt(__self_0), + DataType::UnsignedTinyInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Int2(__self_0), DataType::Int2(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::UnsignedInt2(__self_0), + DataType::UnsignedInt2(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::SmallInt(__self_0), + DataType::SmallInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::UnsignedSmallInt(__self_0), + DataType::UnsignedSmallInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::MediumInt(__self_0), + DataType::MediumInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::UnsignedMediumInt(__self_0), + DataType::UnsignedMediumInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Int(__self_0), DataType::Int(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (DataType::Int4(__self_0), DataType::Int4(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (DataType::Int8(__self_0), DataType::Int8(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Integer(__self_0), + DataType::Integer(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInt(__self_0), + DataType::UnsignedInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInt4(__self_0), + DataType::UnsignedInt4(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInteger(__self_0), + DataType::UnsignedInteger(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::BigInt(__self_0), DataType::BigInt(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::UnsignedBigInt(__self_0), + DataType::UnsignedBigInt(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInt8(__self_0), + DataType::UnsignedInt8(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Double(__self_0), DataType::Double(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Time(__self_0, __self_1), + DataType::Time(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_0, + __arg1_0, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + DataType::Datetime(__self_0), + DataType::Datetime(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::Datetime64(__self_0, __self_1), + DataType::Datetime64(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_0, + __arg1_0, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + DataType::Timestamp(__self_0, __self_1), + DataType::Timestamp(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_0, + __arg1_0, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::String(__self_0), DataType::String(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::FixedString(__self_0), + DataType::FixedString(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (DataType::Bit(__self_0), DataType::Bit(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::BitVarying(__self_0), + DataType::BitVarying(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::Custom(__self_0, __self_1), + DataType::Custom(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_0, + __arg1_0, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Array(__self_0), DataType::Array(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Map(__self_0, __self_1), + DataType::Map(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_0, + __arg1_0, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Tuple(__self_0), DataType::Tuple(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (DataType::Nested(__self_0), DataType::Nested(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Enum(__self_0, __self_1), + DataType::Enum(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_0, + __arg1_0, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Set(__self_0), DataType::Set(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Struct(__self_0, __self_1), + DataType::Struct(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_0, + __arg1_0, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Union(__self_0), DataType::Union(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + DataType::Nullable(__self_0), + DataType::Nullable(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + DataType::LowCardinality(__self_0), + DataType::LowCardinality(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) + } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for DataType { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for DataType { + #[inline] + fn cmp(&self, other: &DataType) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + (DataType::Table(__self_0), DataType::Table(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Character(__self_0), + DataType::Character(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Char(__self_0), DataType::Char(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::CharacterVarying(__self_0), + DataType::CharacterVarying(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::CharVarying(__self_0), + DataType::CharVarying(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::Varchar(__self_0), + DataType::Varchar(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::Nvarchar(__self_0), + DataType::Nvarchar(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::CharacterLargeObject(__self_0), + DataType::CharacterLargeObject(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::CharLargeObject(__self_0), + DataType::CharLargeObject(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Clob(__self_0), DataType::Clob(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (DataType::Binary(__self_0), DataType::Binary(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Varbinary(__self_0), + DataType::Varbinary(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Blob(__self_0), DataType::Blob(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (DataType::Bytes(__self_0), DataType::Bytes(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Numeric(__self_0), + DataType::Numeric(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::Decimal(__self_0), + DataType::Decimal(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::BigNumeric(__self_0), + DataType::BigNumeric(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::BigDecimal(__self_0), + DataType::BigDecimal(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Dec(__self_0), DataType::Dec(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (DataType::Float(__self_0), DataType::Float(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::TinyInt(__self_0), + DataType::TinyInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::UnsignedTinyInt(__self_0), + DataType::UnsignedTinyInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Int2(__self_0), DataType::Int2(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::UnsignedInt2(__self_0), + DataType::UnsignedInt2(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::SmallInt(__self_0), + DataType::SmallInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::UnsignedSmallInt(__self_0), + DataType::UnsignedSmallInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::MediumInt(__self_0), + DataType::MediumInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::UnsignedMediumInt(__self_0), + DataType::UnsignedMediumInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Int(__self_0), DataType::Int(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (DataType::Int4(__self_0), DataType::Int4(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (DataType::Int8(__self_0), DataType::Int8(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Integer(__self_0), + DataType::Integer(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInt(__self_0), + DataType::UnsignedInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInt4(__self_0), + DataType::UnsignedInt4(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInteger(__self_0), + DataType::UnsignedInteger(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::BigInt(__self_0), DataType::BigInt(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::UnsignedBigInt(__self_0), + DataType::UnsignedBigInt(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::UnsignedInt8(__self_0), + DataType::UnsignedInt8(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Double(__self_0), DataType::Double(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Time(__self_0, __self_1), + DataType::Time(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + DataType::Datetime(__self_0), + DataType::Datetime(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::Datetime64(__self_0, __self_1), + DataType::Datetime64(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + DataType::Timestamp(__self_0, __self_1), + DataType::Timestamp(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::String(__self_0), DataType::String(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::FixedString(__self_0), + DataType::FixedString(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (DataType::Bit(__self_0), DataType::Bit(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::BitVarying(__self_0), + DataType::BitVarying(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::Custom(__self_0, __self_1), + DataType::Custom(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Array(__self_0), DataType::Array(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Map(__self_0, __self_1), + DataType::Map(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Tuple(__self_0), DataType::Tuple(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (DataType::Nested(__self_0), DataType::Nested(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Enum(__self_0, __self_1), + DataType::Enum(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Set(__self_0), DataType::Set(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Struct(__self_0, __self_1), + DataType::Struct(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + (DataType::Union(__self_0), DataType::Union(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + DataType::Nullable(__self_0), + DataType::Nullable(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + DataType::LowCardinality(__self_0), + DataType::LowCardinality(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for DataType { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + DataType::Table(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Character(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Char(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::CharacterVarying(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::CharVarying(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Varchar(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Nvarchar(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::CharacterLargeObject(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::CharLargeObject(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Clob(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::Binary(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Varbinary(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Blob(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::Bytes(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Numeric(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Decimal(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::BigNumeric(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::BigDecimal(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Dec(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::Float(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::TinyInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedTinyInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Int2(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::UnsignedInt2(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::SmallInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedSmallInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::MediumInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedMediumInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Int(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::Int4(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::Int8(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::Integer(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedInt4(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedInteger(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::BigInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedBigInt(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::UnsignedInt8(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Double(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Time(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + DataType::Datetime(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Datetime64(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + DataType::Timestamp(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + DataType::String(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::FixedString(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Bit(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::BitVarying(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Custom(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + DataType::Array(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Map(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + DataType::Tuple(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Nested(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Enum(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + DataType::Set(__self_0) => ::core::hash::Hash::hash(__self_0, state), + DataType::Struct(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + DataType::Union(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::Nullable(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + DataType::LowCardinality(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + impl fmt::Display for DataType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + DataType::Character(size) => { + format_character_string_type(f, "CHARACTER", size) + } + DataType::Char(size) => format_character_string_type(f, "CHAR", size), + DataType::CharacterVarying(size) => { + format_character_string_type(f, "CHARACTER VARYING", size) + } + DataType::CharVarying(size) => { + format_character_string_type(f, "CHAR VARYING", size) + } + DataType::Varchar(size) => { + format_character_string_type(f, "VARCHAR", size) + } + DataType::Nvarchar(size) => { + format_character_string_type(f, "NVARCHAR", size) + } + DataType::Uuid => f.write_fmt(format_args!("UUID")), + DataType::CharacterLargeObject(size) => { + format_type_with_optional_length( + f, + "CHARACTER LARGE OBJECT", + size, + false, + ) + } + DataType::CharLargeObject(size) => { + format_type_with_optional_length( + f, + "CHAR LARGE OBJECT", + size, + false, + ) + } + DataType::Clob(size) => { + format_type_with_optional_length(f, "CLOB", size, false) + } + DataType::Binary(size) => { + format_type_with_optional_length(f, "BINARY", size, false) + } + DataType::Varbinary(size) => { + format_type_with_optional_length(f, "VARBINARY", size, false) + } + DataType::Blob(size) => { + format_type_with_optional_length(f, "BLOB", size, false) + } + DataType::TinyBlob => f.write_fmt(format_args!("TINYBLOB")), + DataType::MediumBlob => f.write_fmt(format_args!("MEDIUMBLOB")), + DataType::LongBlob => f.write_fmt(format_args!("LONGBLOB")), + DataType::Bytes(size) => { + format_type_with_optional_length(f, "BYTES", size, false) + } + DataType::Numeric(info) => { + f.write_fmt(format_args!("NUMERIC{0}", info)) + } + DataType::Decimal(info) => { + f.write_fmt(format_args!("DECIMAL{0}", info)) + } + DataType::Dec(info) => f.write_fmt(format_args!("DEC{0}", info)), + DataType::BigNumeric(info) => { + f.write_fmt(format_args!("BIGNUMERIC{0}", info)) + } + DataType::BigDecimal(info) => { + f.write_fmt(format_args!("BIGDECIMAL{0}", info)) + } + DataType::Float(size) => { + format_type_with_optional_length(f, "FLOAT", size, false) + } + DataType::TinyInt(zerofill) => { + format_type_with_optional_length(f, "TINYINT", zerofill, false) + } + DataType::UnsignedTinyInt(zerofill) => { + format_type_with_optional_length(f, "TINYINT", zerofill, true) + } + DataType::Int2(zerofill) => { + format_type_with_optional_length(f, "INT2", zerofill, false) + } + DataType::UnsignedInt2(zerofill) => { + format_type_with_optional_length(f, "INT2", zerofill, true) + } + DataType::SmallInt(zerofill) => { + format_type_with_optional_length(f, "SMALLINT", zerofill, false) + } + DataType::UnsignedSmallInt(zerofill) => { + format_type_with_optional_length(f, "SMALLINT", zerofill, true) + } + DataType::MediumInt(zerofill) => { + format_type_with_optional_length(f, "MEDIUMINT", zerofill, false) + } + DataType::UnsignedMediumInt(zerofill) => { + format_type_with_optional_length(f, "MEDIUMINT", zerofill, true) + } + DataType::Int(zerofill) => { + format_type_with_optional_length(f, "INT", zerofill, false) + } + DataType::UnsignedInt(zerofill) => { + format_type_with_optional_length(f, "INT", zerofill, true) + } + DataType::Int4(zerofill) => { + format_type_with_optional_length(f, "INT4", zerofill, false) + } + DataType::Int8(zerofill) => { + format_type_with_optional_length(f, "INT8", zerofill, false) + } + DataType::Int16 => f.write_fmt(format_args!("Int16")), + DataType::Int32 => f.write_fmt(format_args!("Int32")), + DataType::Int64 => f.write_fmt(format_args!("INT64")), + DataType::Int128 => f.write_fmt(format_args!("Int128")), + DataType::Int256 => f.write_fmt(format_args!("Int256")), + DataType::UnsignedInt4(zerofill) => { + format_type_with_optional_length(f, "INT4", zerofill, true) + } + DataType::Integer(zerofill) => { + format_type_with_optional_length(f, "INTEGER", zerofill, false) + } + DataType::UnsignedInteger(zerofill) => { + format_type_with_optional_length(f, "INTEGER", zerofill, true) + } + DataType::BigInt(zerofill) => { + format_type_with_optional_length(f, "BIGINT", zerofill, false) + } + DataType::UnsignedBigInt(zerofill) => { + format_type_with_optional_length(f, "BIGINT", zerofill, true) + } + DataType::UnsignedInt8(zerofill) => { + format_type_with_optional_length(f, "INT8", zerofill, true) + } + DataType::UInt8 => f.write_fmt(format_args!("UInt8")), + DataType::UInt16 => f.write_fmt(format_args!("UInt16")), + DataType::UInt32 => f.write_fmt(format_args!("UInt32")), + DataType::UInt64 => f.write_fmt(format_args!("UInt64")), + DataType::UInt128 => f.write_fmt(format_args!("UInt128")), + DataType::UInt256 => f.write_fmt(format_args!("UInt256")), + DataType::Real => f.write_fmt(format_args!("REAL")), + DataType::Float4 => f.write_fmt(format_args!("FLOAT4")), + DataType::Float32 => f.write_fmt(format_args!("Float32")), + DataType::Float64 => f.write_fmt(format_args!("FLOAT64")), + DataType::Double(info) => { + f.write_fmt(format_args!("DOUBLE{0}", info)) + } + DataType::Float8 => f.write_fmt(format_args!("FLOAT8")), + DataType::DoublePrecision => { + f.write_fmt(format_args!("DOUBLE PRECISION")) + } + DataType::Bool => f.write_fmt(format_args!("BOOL")), + DataType::Boolean => f.write_fmt(format_args!("BOOLEAN")), + DataType::Date => f.write_fmt(format_args!("DATE")), + DataType::Date32 => f.write_fmt(format_args!("Date32")), + DataType::Time(precision, timezone_info) => { + format_datetime_precision_and_tz( + f, + "TIME", + precision, + timezone_info, + ) + } + DataType::Datetime(precision) => { + format_type_with_optional_length(f, "DATETIME", precision, false) + } + DataType::Timestamp(precision, timezone_info) => { + format_datetime_precision_and_tz( + f, + "TIMESTAMP", + precision, + timezone_info, + ) + } + DataType::Datetime64(precision, timezone) => { + format_clickhouse_datetime_precision_and_timezone( + f, + "DateTime64", + precision, + timezone, + ) + } + DataType::Interval => f.write_fmt(format_args!("INTERVAL")), + DataType::JSON => f.write_fmt(format_args!("JSON")), + DataType::JSONB => f.write_fmt(format_args!("JSONB")), + DataType::Regclass => f.write_fmt(format_args!("REGCLASS")), + DataType::Text => f.write_fmt(format_args!("TEXT")), + DataType::TinyText => f.write_fmt(format_args!("TINYTEXT")), + DataType::MediumText => f.write_fmt(format_args!("MEDIUMTEXT")), + DataType::LongText => f.write_fmt(format_args!("LONGTEXT")), + DataType::String(size) => { + format_type_with_optional_length(f, "STRING", size, false) + } + DataType::Bytea => f.write_fmt(format_args!("BYTEA")), + DataType::Bit(size) => { + format_type_with_optional_length(f, "BIT", size, false) + } + DataType::BitVarying(size) => { + format_type_with_optional_length(f, "BIT VARYING", size, false) + } + DataType::Array(ty) => { + match ty { + ArrayElemTypeDef::None => f.write_fmt(format_args!("ARRAY")), + ArrayElemTypeDef::SquareBracket(t, None) => { + f.write_fmt(format_args!("{0}[]", t)) + } + ArrayElemTypeDef::SquareBracket(t, Some(size)) => { + f.write_fmt(format_args!("{0}[{1}]", t, size)) + } + ArrayElemTypeDef::AngleBracket(t) => { + f.write_fmt(format_args!("ARRAY<{0}>", t)) + } + ArrayElemTypeDef::Parenthesis(t) => { + f.write_fmt(format_args!("Array({0})", t)) + } + } + } + DataType::Custom(ty, modifiers) => { + if modifiers.is_empty() { + f.write_fmt(format_args!("{0}", ty)) + } else { + f.write_fmt( + format_args!("{0}({1})", ty, modifiers.join(", ")), + ) + } + } + DataType::Enum(vals, bits) => { + match bits { + Some(bits) => f.write_fmt(format_args!("ENUM{0}", bits)), + None => f.write_fmt(format_args!("ENUM")), + }?; + f.write_fmt(format_args!("("))?; + for (i, v) in vals.iter().enumerate() { + if i != 0 { + f.write_fmt(format_args!(", "))?; + } + match v { + EnumMember::Name(name) => { + f.write_fmt( + format_args!("\'{0}\'", escape_single_quote_string(name)), + )? + } + EnumMember::NamedValue(name, value) => { + f.write_fmt( + format_args!( + "\'{0}\' = {1}", + escape_single_quote_string(name), + value, + ), + )? + } + } + } + f.write_fmt(format_args!(")")) + } + DataType::Set(vals) => { + f.write_fmt(format_args!("SET("))?; + for (i, v) in vals.iter().enumerate() { + if i != 0 { + f.write_fmt(format_args!(", "))?; + } + f.write_fmt( + format_args!("\'{0}\'", escape_single_quote_string(v)), + )?; + } + f.write_fmt(format_args!(")")) + } + DataType::Struct(fields, bracket) => { + if !fields.is_empty() { + match bracket { + StructBracketKind::Parentheses => { + f.write_fmt( + format_args!("STRUCT({0})", display_comma_separated(fields)), + ) + } + StructBracketKind::AngleBrackets => { + f.write_fmt( + format_args!("STRUCT<{0}>", display_comma_separated(fields)), + ) + } + } + } else { + f.write_fmt(format_args!("STRUCT")) + } + } + DataType::Union(fields) => { + f.write_fmt( + format_args!("UNION({0})", display_comma_separated(fields)), + ) + } + DataType::Nullable(data_type) => { + f.write_fmt(format_args!("Nullable({0})", data_type)) + } + DataType::FixedString(character_length) => { + f.write_fmt(format_args!("FixedString({0})", character_length)) + } + DataType::LowCardinality(data_type) => { + f.write_fmt(format_args!("LowCardinality({0})", data_type)) + } + DataType::Map(key_data_type, value_data_type) => { + f.write_fmt( + format_args!("Map({0}, {1})", key_data_type, value_data_type), + ) + } + DataType::Tuple(fields) => { + f.write_fmt( + format_args!("Tuple({0})", display_comma_separated(fields)), + ) + } + DataType::Nested(fields) => { + f.write_fmt( + format_args!("Nested({0})", display_comma_separated(fields)), + ) + } + DataType::Unspecified => Ok(()), + DataType::Trigger => f.write_fmt(format_args!("TRIGGER")), + DataType::AnyType => f.write_fmt(format_args!("ANY TYPE")), + DataType::Table(fields) => { + f.write_fmt( + format_args!("TABLE({0})", display_comma_separated(fields)), + ) + } + } + } + } + fn format_type_with_optional_length( + f: &mut fmt::Formatter, + sql_type: &'static str, + len: &Option, + unsigned: bool, + ) -> fmt::Result { + f.write_fmt(format_args!("{0}", sql_type))?; + if let Some(len) = len { + f.write_fmt(format_args!("({0})", len))?; + } + if unsigned { + f.write_fmt(format_args!(" UNSIGNED"))?; + } + Ok(()) + } + fn format_character_string_type( + f: &mut fmt::Formatter, + sql_type: &str, + size: &Option, + ) -> fmt::Result { + f.write_fmt(format_args!("{0}", sql_type))?; + if let Some(size) = size { + f.write_fmt(format_args!("({0})", size))?; + } + Ok(()) + } + fn format_datetime_precision_and_tz( + f: &mut fmt::Formatter, + sql_type: &'static str, + len: &Option, + time_zone: &TimezoneInfo, + ) -> fmt::Result { + f.write_fmt(format_args!("{0}", sql_type))?; + let len_fmt = len + .as_ref() + .map(|l| ::alloc::__export::must_use({ + let res = ::alloc::fmt::format(format_args!("({0})", l)); + res + })) + .unwrap_or_default(); + match time_zone { + TimezoneInfo::Tz => { + f.write_fmt(format_args!("{0}{1}", time_zone, len_fmt))?; + } + _ => { + f.write_fmt(format_args!("{0}{1}", len_fmt, time_zone))?; + } + } + Ok(()) + } + fn format_clickhouse_datetime_precision_and_timezone( + f: &mut fmt::Formatter, + sql_type: &'static str, + len: &u64, + time_zone: &Option, + ) -> fmt::Result { + f.write_fmt(format_args!("{0}({1}", sql_type, len))?; + if let Some(time_zone) = time_zone { + f.write_fmt(format_args!(", \'{0}\'", time_zone))?; + } + f.write_fmt(format_args!(")"))?; + Ok(()) + } + /// Type of brackets used for `STRUCT` literals. + pub enum StructBracketKind { + /// Example: `STRUCT(a INT, b STRING)` + Parentheses, + /// Example: `STRUCT` + AngleBrackets, + } + #[automatically_derived] + impl ::core::fmt::Debug for StructBracketKind { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + StructBracketKind::Parentheses => "Parentheses", + StructBracketKind::AngleBrackets => "AngleBrackets", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for StructBracketKind { + #[inline] + fn clone(&self) -> StructBracketKind { + match self { + StructBracketKind::Parentheses => StructBracketKind::Parentheses, + StructBracketKind::AngleBrackets => StructBracketKind::AngleBrackets, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for StructBracketKind {} + #[automatically_derived] + impl ::core::cmp::PartialEq for StructBracketKind { + #[inline] + fn eq(&self, other: &StructBracketKind) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for StructBracketKind { + #[inline] + fn partial_cmp( + &self, + other: &StructBracketKind, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for StructBracketKind { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for StructBracketKind { + #[inline] + fn cmp(&self, other: &StructBracketKind) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for StructBracketKind { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + /// Timestamp and Time data types information about TimeZone formatting. + /// + /// This is more related to a display information than real differences between each variant. To + /// guarantee compatibility with the input query we must maintain its exact information. + pub enum TimezoneInfo { + /// No information about time zone. E.g., TIMESTAMP + None, + /// Temporal type 'WITH TIME ZONE'. E.g., TIMESTAMP WITH TIME ZONE, [standard], [Oracle] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#datetime-type + /// [Oracle]: https://docs.oracle.com/en/database/oracle/oracle-database/12.2/nlspg/datetime-data-types-and-time-zone-support.html#GUID-3F1C388E-C651-43D5-ADBC-1A49E5C2CA05 + WithTimeZone, + /// Temporal type 'WITHOUT TIME ZONE'. E.g., TIME WITHOUT TIME ZONE, [standard], [Postgresql] + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#datetime-type + /// [Postgresql]: https://www.postgresql.org/docs/current/datatype-datetime.html + WithoutTimeZone, + /// Postgresql specific `WITH TIME ZONE` formatting, for both TIME and TIMESTAMP. E.g., TIMETZ, [Postgresql] + /// + /// [Postgresql]: https://www.postgresql.org/docs/current/datatype-datetime.html + Tz, + } + #[automatically_derived] + impl ::core::fmt::Debug for TimezoneInfo { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + TimezoneInfo::None => "None", + TimezoneInfo::WithTimeZone => "WithTimeZone", + TimezoneInfo::WithoutTimeZone => "WithoutTimeZone", + TimezoneInfo::Tz => "Tz", + }, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for TimezoneInfo {} + #[automatically_derived] + impl ::core::clone::Clone for TimezoneInfo { + #[inline] + fn clone(&self) -> TimezoneInfo { + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for TimezoneInfo {} + #[automatically_derived] + impl ::core::cmp::PartialEq for TimezoneInfo { + #[inline] + fn eq(&self, other: &TimezoneInfo) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for TimezoneInfo { + #[inline] + fn partial_cmp( + &self, + other: &TimezoneInfo, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for TimezoneInfo { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for TimezoneInfo { + #[inline] + fn cmp(&self, other: &TimezoneInfo) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for TimezoneInfo { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for TimezoneInfo { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + TimezoneInfo::None => f.write_fmt(format_args!("")), + TimezoneInfo::WithTimeZone => { + f.write_fmt(format_args!(" WITH TIME ZONE")) + } + TimezoneInfo::WithoutTimeZone => { + f.write_fmt(format_args!(" WITHOUT TIME ZONE")) + } + TimezoneInfo::Tz => f.write_fmt(format_args!("TZ")), + } + } + } + /// Additional information for `NUMERIC`, `DECIMAL`, and `DEC` data types + /// following the 2016 [standard]. + /// + /// [standard]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#exact-numeric-type + pub enum ExactNumberInfo { + /// No additional information e.g. `DECIMAL` + None, + /// Only precision information e.g. `DECIMAL(10)` + Precision(u64), + /// Precision and scale information e.g. `DECIMAL(10,2)` + PrecisionAndScale(u64, u64), + } + #[automatically_derived] + impl ::core::fmt::Debug for ExactNumberInfo { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + ExactNumberInfo::None => ::core::fmt::Formatter::write_str(f, "None"), + ExactNumberInfo::Precision(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Precision", + &__self_0, + ) + } + ExactNumberInfo::PrecisionAndScale(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "PrecisionAndScale", + __self_0, + &__self_1, + ) + } + } + } + } + #[automatically_derived] + impl ::core::marker::Copy for ExactNumberInfo {} + #[automatically_derived] + impl ::core::clone::Clone for ExactNumberInfo { + #[inline] + fn clone(&self) -> ExactNumberInfo { + let _: ::core::clone::AssertParamIsClone; + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ExactNumberInfo {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ExactNumberInfo { + #[inline] + fn eq(&self, other: &ExactNumberInfo) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + ExactNumberInfo::Precision(__self_0), + ExactNumberInfo::Precision(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ExactNumberInfo::PrecisionAndScale(__self_0, __self_1), + ExactNumberInfo::PrecisionAndScale(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ExactNumberInfo { + #[inline] + fn partial_cmp( + &self, + other: &ExactNumberInfo, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + ExactNumberInfo::Precision(__self_0), + ExactNumberInfo::Precision(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ExactNumberInfo::PrecisionAndScale(__self_0, __self_1), + ExactNumberInfo::PrecisionAndScale(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ExactNumberInfo { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ExactNumberInfo { + #[inline] + fn cmp(&self, other: &ExactNumberInfo) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + ExactNumberInfo::Precision(__self_0), + ExactNumberInfo::Precision(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ExactNumberInfo::PrecisionAndScale(__self_0, __self_1), + ExactNumberInfo::PrecisionAndScale(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ExactNumberInfo { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + ExactNumberInfo::Precision(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ExactNumberInfo::PrecisionAndScale(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + _ => {} + } + } + } + impl fmt::Display for ExactNumberInfo { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + ExactNumberInfo::None => f.write_fmt(format_args!("")), + ExactNumberInfo::Precision(p) => { + f.write_fmt(format_args!("({0})", p)) + } + ExactNumberInfo::PrecisionAndScale(p, s) => { + f.write_fmt(format_args!("({0},{1})", p, s)) + } + } + } + } + /// Information about [character length][1], including length and possibly unit. + /// + /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#character-length + pub enum CharacterLength { + IntegerLength { + /// Default (if VARYING) or maximum (if not VARYING) length + length: u64, + /// Optional unit. If not informed, the ANSI handles it as CHARACTERS implicitly + unit: Option, + }, + /// VARCHAR(MAX) or NVARCHAR(MAX), used in T-SQL (Microsoft SQL Server) + Max, + } + #[automatically_derived] + impl ::core::fmt::Debug for CharacterLength { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + CharacterLength::IntegerLength { + length: __self_0, + unit: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "IntegerLength", + "length", + __self_0, + "unit", + &__self_1, + ) + } + CharacterLength::Max => ::core::fmt::Formatter::write_str(f, "Max"), + } + } + } + #[automatically_derived] + impl ::core::marker::Copy for CharacterLength {} + #[automatically_derived] + impl ::core::clone::Clone for CharacterLength { + #[inline] + fn clone(&self) -> CharacterLength { + let _: ::core::clone::AssertParamIsClone; + let _: ::core::clone::AssertParamIsClone>; + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for CharacterLength {} + #[automatically_derived] + impl ::core::cmp::PartialEq for CharacterLength { + #[inline] + fn eq(&self, other: &CharacterLength) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + CharacterLength::IntegerLength { + length: __self_0, + unit: __self_1, + }, + CharacterLength::IntegerLength { + length: __arg1_0, + unit: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for CharacterLength { + #[inline] + fn partial_cmp( + &self, + other: &CharacterLength, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + CharacterLength::IntegerLength { + length: __self_0, + unit: __self_1, + }, + CharacterLength::IntegerLength { + length: __arg1_0, + unit: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for CharacterLength { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for CharacterLength { + #[inline] + fn cmp(&self, other: &CharacterLength) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + CharacterLength::IntegerLength { + length: __self_0, + unit: __self_1, + }, + CharacterLength::IntegerLength { + length: __arg1_0, + unit: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for CharacterLength { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + CharacterLength::IntegerLength { + length: __self_0, + unit: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + _ => {} + } + } + } + impl fmt::Display for CharacterLength { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + CharacterLength::IntegerLength { length, unit } => { + f.write_fmt(format_args!("{0}", length))?; + if let Some(unit) = unit { + f.write_fmt(format_args!(" {0}", unit))?; + } + } + CharacterLength::Max => { + f.write_fmt(format_args!("MAX"))?; + } + } + Ok(()) + } + } + /// Possible units for characters, initially based on 2016 ANSI [standard][1]. + /// + /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#char-length-units + pub enum CharLengthUnits { + /// CHARACTERS unit + Characters, + /// OCTETS unit + Octets, + } + #[automatically_derived] + impl ::core::fmt::Debug for CharLengthUnits { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + CharLengthUnits::Characters => "Characters", + CharLengthUnits::Octets => "Octets", + }, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for CharLengthUnits {} + #[automatically_derived] + impl ::core::clone::Clone for CharLengthUnits { + #[inline] + fn clone(&self) -> CharLengthUnits { + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for CharLengthUnits {} + #[automatically_derived] + impl ::core::cmp::PartialEq for CharLengthUnits { + #[inline] + fn eq(&self, other: &CharLengthUnits) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for CharLengthUnits { + #[inline] + fn partial_cmp( + &self, + other: &CharLengthUnits, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for CharLengthUnits { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for CharLengthUnits { + #[inline] + fn cmp(&self, other: &CharLengthUnits) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for CharLengthUnits { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for CharLengthUnits { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Self::Characters => f.write_fmt(format_args!("CHARACTERS")), + Self::Octets => f.write_fmt(format_args!("OCTETS")), + } + } + } + /// Represents the data type of the elements in an array (if any) as well as + /// the syntax used to declare the array. + /// + /// For example: Bigquery/Hive use `ARRAY` whereas snowflake uses ARRAY. + pub enum ArrayElemTypeDef { + /// `ARRAY` + None, + /// `ARRAY` + AngleBracket(Box), + /// `INT[]` or `INT[2]` + SquareBracket(Box, Option), + /// `Array(Int64)` + Parenthesis(Box), + } + #[automatically_derived] + impl ::core::fmt::Debug for ArrayElemTypeDef { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + ArrayElemTypeDef::None => { + ::core::fmt::Formatter::write_str(f, "None") + } + ArrayElemTypeDef::AngleBracket(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "AngleBracket", + &__self_0, + ) + } + ArrayElemTypeDef::SquareBracket(__self_0, __self_1) => { + ::core::fmt::Formatter::debug_tuple_field2_finish( + f, + "SquareBracket", + __self_0, + &__self_1, + ) + } + ArrayElemTypeDef::Parenthesis(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Parenthesis", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for ArrayElemTypeDef { + #[inline] + fn clone(&self) -> ArrayElemTypeDef { + match self { + ArrayElemTypeDef::None => ArrayElemTypeDef::None, + ArrayElemTypeDef::AngleBracket(__self_0) => { + ArrayElemTypeDef::AngleBracket( + ::core::clone::Clone::clone(__self_0), + ) + } + ArrayElemTypeDef::SquareBracket(__self_0, __self_1) => { + ArrayElemTypeDef::SquareBracket( + ::core::clone::Clone::clone(__self_0), + ::core::clone::Clone::clone(__self_1), + ) + } + ArrayElemTypeDef::Parenthesis(__self_0) => { + ArrayElemTypeDef::Parenthesis( + ::core::clone::Clone::clone(__self_0), + ) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ArrayElemTypeDef {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ArrayElemTypeDef { + #[inline] + fn eq(&self, other: &ArrayElemTypeDef) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + ArrayElemTypeDef::AngleBracket(__self_0), + ArrayElemTypeDef::AngleBracket(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ArrayElemTypeDef::SquareBracket(__self_0, __self_1), + ArrayElemTypeDef::SquareBracket(__arg1_0, __arg1_1), + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + ArrayElemTypeDef::Parenthesis(__self_0), + ArrayElemTypeDef::Parenthesis(__arg1_0), + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ArrayElemTypeDef { + #[inline] + fn partial_cmp( + &self, + other: &ArrayElemTypeDef, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + ArrayElemTypeDef::AngleBracket(__self_0), + ArrayElemTypeDef::AngleBracket(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ArrayElemTypeDef::SquareBracket(__self_0, __self_1), + ArrayElemTypeDef::SquareBracket(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + ArrayElemTypeDef::Parenthesis(__self_0), + ArrayElemTypeDef::Parenthesis(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ArrayElemTypeDef { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ArrayElemTypeDef { + #[inline] + fn cmp(&self, other: &ArrayElemTypeDef) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + ArrayElemTypeDef::AngleBracket(__self_0), + ArrayElemTypeDef::AngleBracket(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ArrayElemTypeDef::SquareBracket(__self_0, __self_1), + ArrayElemTypeDef::SquareBracket(__arg1_0, __arg1_1), + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + ArrayElemTypeDef::Parenthesis(__self_0), + ArrayElemTypeDef::Parenthesis(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ArrayElemTypeDef { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + ArrayElemTypeDef::AngleBracket(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ArrayElemTypeDef::SquareBracket(__self_0, __self_1) => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + ArrayElemTypeDef::Parenthesis(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + } + mod dcl { + //! AST types specific to GRANT/REVOKE/ROLE variants of [`Statement`](crate::ast::Statement) + //! (commonly referred to as Data Control Language, or DCL) + use core::fmt; + use super::{display_comma_separated, Expr, Ident, Password}; + use crate::ast::{display_separated, ObjectName}; + /// An option in `ROLE` statement. + /// + /// + pub enum RoleOption { + BypassRLS(bool), + ConnectionLimit(Expr), + CreateDB(bool), + CreateRole(bool), + Inherit(bool), + Login(bool), + Password(Password), + Replication(bool), + SuperUser(bool), + ValidUntil(Expr), + } + #[automatically_derived] + impl ::core::fmt::Debug for RoleOption { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + RoleOption::BypassRLS(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "BypassRLS", + &__self_0, + ) + } + RoleOption::ConnectionLimit(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "ConnectionLimit", + &__self_0, + ) + } + RoleOption::CreateDB(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "CreateDB", + &__self_0, + ) + } + RoleOption::CreateRole(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "CreateRole", + &__self_0, + ) + } + RoleOption::Inherit(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Inherit", + &__self_0, + ) + } + RoleOption::Login(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Login", + &__self_0, + ) + } + RoleOption::Password(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Password", + &__self_0, + ) + } + RoleOption::Replication(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Replication", + &__self_0, + ) + } + RoleOption::SuperUser(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "SuperUser", + &__self_0, + ) + } + RoleOption::ValidUntil(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "ValidUntil", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for RoleOption { + #[inline] + fn clone(&self) -> RoleOption { + match self { + RoleOption::BypassRLS(__self_0) => { + RoleOption::BypassRLS(::core::clone::Clone::clone(__self_0)) + } + RoleOption::ConnectionLimit(__self_0) => { + RoleOption::ConnectionLimit( + ::core::clone::Clone::clone(__self_0), + ) + } + RoleOption::CreateDB(__self_0) => { + RoleOption::CreateDB(::core::clone::Clone::clone(__self_0)) + } + RoleOption::CreateRole(__self_0) => { + RoleOption::CreateRole(::core::clone::Clone::clone(__self_0)) + } + RoleOption::Inherit(__self_0) => { + RoleOption::Inherit(::core::clone::Clone::clone(__self_0)) + } + RoleOption::Login(__self_0) => { + RoleOption::Login(::core::clone::Clone::clone(__self_0)) + } + RoleOption::Password(__self_0) => { + RoleOption::Password(::core::clone::Clone::clone(__self_0)) + } + RoleOption::Replication(__self_0) => { + RoleOption::Replication(::core::clone::Clone::clone(__self_0)) + } + RoleOption::SuperUser(__self_0) => { + RoleOption::SuperUser(::core::clone::Clone::clone(__self_0)) + } + RoleOption::ValidUntil(__self_0) => { + RoleOption::ValidUntil(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for RoleOption {} + #[automatically_derived] + impl ::core::cmp::PartialEq for RoleOption { + #[inline] + fn eq(&self, other: &RoleOption) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + RoleOption::BypassRLS(__self_0), + RoleOption::BypassRLS(__arg1_0), + ) => __self_0 == __arg1_0, + ( + RoleOption::ConnectionLimit(__self_0), + RoleOption::ConnectionLimit(__arg1_0), + ) => __self_0 == __arg1_0, + ( + RoleOption::CreateDB(__self_0), + RoleOption::CreateDB(__arg1_0), + ) => __self_0 == __arg1_0, + ( + RoleOption::CreateRole(__self_0), + RoleOption::CreateRole(__arg1_0), + ) => __self_0 == __arg1_0, + ( + RoleOption::Inherit(__self_0), + RoleOption::Inherit(__arg1_0), + ) => __self_0 == __arg1_0, + (RoleOption::Login(__self_0), RoleOption::Login(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + RoleOption::Password(__self_0), + RoleOption::Password(__arg1_0), + ) => __self_0 == __arg1_0, + ( + RoleOption::Replication(__self_0), + RoleOption::Replication(__arg1_0), + ) => __self_0 == __arg1_0, + ( + RoleOption::SuperUser(__self_0), + RoleOption::SuperUser(__arg1_0), + ) => __self_0 == __arg1_0, + ( + RoleOption::ValidUntil(__self_0), + RoleOption::ValidUntil(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for RoleOption { + #[inline] + fn partial_cmp( + &self, + other: &RoleOption, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + RoleOption::BypassRLS(__self_0), + RoleOption::BypassRLS(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + RoleOption::ConnectionLimit(__self_0), + RoleOption::ConnectionLimit(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (RoleOption::CreateDB(__self_0), RoleOption::CreateDB(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + RoleOption::CreateRole(__self_0), + RoleOption::CreateRole(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (RoleOption::Inherit(__self_0), RoleOption::Inherit(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (RoleOption::Login(__self_0), RoleOption::Login(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (RoleOption::Password(__self_0), RoleOption::Password(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + RoleOption::Replication(__self_0), + RoleOption::Replication(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + RoleOption::SuperUser(__self_0), + RoleOption::SuperUser(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + RoleOption::ValidUntil(__self_0), + RoleOption::ValidUntil(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for RoleOption { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for RoleOption { + #[inline] + fn cmp(&self, other: &RoleOption) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + RoleOption::BypassRLS(__self_0), + RoleOption::BypassRLS(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::ConnectionLimit(__self_0), + RoleOption::ConnectionLimit(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::CreateDB(__self_0), + RoleOption::CreateDB(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::CreateRole(__self_0), + RoleOption::CreateRole(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::Inherit(__self_0), + RoleOption::Inherit(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::Login(__self_0), + RoleOption::Login(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::Password(__self_0), + RoleOption::Password(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::Replication(__self_0), + RoleOption::Replication(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::SuperUser(__self_0), + RoleOption::SuperUser(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + RoleOption::ValidUntil(__self_0), + RoleOption::ValidUntil(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for RoleOption { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + RoleOption::BypassRLS(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::ConnectionLimit(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::CreateDB(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::CreateRole(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::Inherit(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::Login(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::Password(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::Replication(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::SuperUser(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + RoleOption::ValidUntil(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for RoleOption { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + RoleOption::BypassRLS(value) => { + f.write_fmt( + format_args!( + "{0}", + if *value { "BYPASSRLS" } else { "NOBYPASSRLS" }, + ), + ) + } + RoleOption::ConnectionLimit(expr) => { + f.write_fmt(format_args!("CONNECTION LIMIT {0}", expr)) + } + RoleOption::CreateDB(value) => { + f.write_fmt( + format_args!( + "{0}", + if *value { "CREATEDB" } else { "NOCREATEDB" }, + ), + ) + } + RoleOption::CreateRole(value) => { + f.write_fmt( + format_args!( + "{0}", + if *value { "CREATEROLE" } else { "NOCREATEROLE" }, + ), + ) + } + RoleOption::Inherit(value) => { + f.write_fmt( + format_args!( + "{0}", + if *value { "INHERIT" } else { "NOINHERIT" }, + ), + ) + } + RoleOption::Login(value) => { + f.write_fmt( + format_args!("{0}", if *value { "LOGIN" } else { "NOLOGIN" }), + ) + } + RoleOption::Password(password) => { + match password { + Password::Password(expr) => { + f.write_fmt(format_args!("PASSWORD {0}", expr)) + } + Password::NullPassword => { + f.write_fmt(format_args!("PASSWORD NULL")) + } + } + } + RoleOption::Replication(value) => { + f.write_fmt( + format_args!( + "{0}", + if *value { "REPLICATION" } else { "NOREPLICATION" }, + ), + ) + } + RoleOption::SuperUser(value) => { + f.write_fmt( + format_args!( + "{0}", + if *value { "SUPERUSER" } else { "NOSUPERUSER" }, + ), + ) + } + RoleOption::ValidUntil(expr) => { + f.write_fmt(format_args!("VALID UNTIL {0}", expr)) + } + } + } + } + /// SET config value option: + /// * SET `configuration_parameter` { TO | = } { `value` | DEFAULT } + /// * SET `configuration_parameter` FROM CURRENT + pub enum SetConfigValue { + Default, + FromCurrent, + Value(Expr), + } + #[automatically_derived] + impl ::core::fmt::Debug for SetConfigValue { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + SetConfigValue::Default => { + ::core::fmt::Formatter::write_str(f, "Default") + } + SetConfigValue::FromCurrent => { + ::core::fmt::Formatter::write_str(f, "FromCurrent") + } + SetConfigValue::Value(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Value", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for SetConfigValue { + #[inline] + fn clone(&self) -> SetConfigValue { + match self { + SetConfigValue::Default => SetConfigValue::Default, + SetConfigValue::FromCurrent => SetConfigValue::FromCurrent, + SetConfigValue::Value(__self_0) => { + SetConfigValue::Value(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for SetConfigValue {} + #[automatically_derived] + impl ::core::cmp::PartialEq for SetConfigValue { + #[inline] + fn eq(&self, other: &SetConfigValue) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + SetConfigValue::Value(__self_0), + SetConfigValue::Value(__arg1_0), + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for SetConfigValue { + #[inline] + fn partial_cmp( + &self, + other: &SetConfigValue, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + SetConfigValue::Value(__self_0), + SetConfigValue::Value(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for SetConfigValue { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for SetConfigValue { + #[inline] + fn cmp(&self, other: &SetConfigValue) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + SetConfigValue::Value(__self_0), + SetConfigValue::Value(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for SetConfigValue { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + SetConfigValue::Value(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + /// RESET config option: + /// * RESET `configuration_parameter` + /// * RESET ALL + pub enum ResetConfig { + ALL, + ConfigName(ObjectName), + } + #[automatically_derived] + impl ::core::fmt::Debug for ResetConfig { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + ResetConfig::ALL => ::core::fmt::Formatter::write_str(f, "ALL"), + ResetConfig::ConfigName(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "ConfigName", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for ResetConfig { + #[inline] + fn clone(&self) -> ResetConfig { + match self { + ResetConfig::ALL => ResetConfig::ALL, + ResetConfig::ConfigName(__self_0) => { + ResetConfig::ConfigName(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ResetConfig {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ResetConfig { + #[inline] + fn eq(&self, other: &ResetConfig) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + ResetConfig::ConfigName(__self_0), + ResetConfig::ConfigName(__arg1_0), + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ResetConfig { + #[inline] + fn partial_cmp( + &self, + other: &ResetConfig, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + ResetConfig::ConfigName(__self_0), + ResetConfig::ConfigName(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ResetConfig { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ResetConfig { + #[inline] + fn cmp(&self, other: &ResetConfig) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + ResetConfig::ConfigName(__self_0), + ResetConfig::ConfigName(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ResetConfig { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + ResetConfig::ConfigName(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + /// An `ALTER ROLE` (`Statement::AlterRole`) operation + pub enum AlterRoleOperation { + /// Generic + RenameRole { role_name: Ident }, + /// MS SQL Server + /// + AddMember { member_name: Ident }, + DropMember { member_name: Ident }, + /// PostgreSQL + /// + WithOptions { options: Vec }, + Set { + config_name: ObjectName, + config_value: SetConfigValue, + in_database: Option, + }, + Reset { config_name: ResetConfig, in_database: Option }, + } + #[automatically_derived] + impl ::core::fmt::Debug for AlterRoleOperation { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + AlterRoleOperation::RenameRole { role_name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "RenameRole", + "role_name", + &__self_0, + ) + } + AlterRoleOperation::AddMember { member_name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "AddMember", + "member_name", + &__self_0, + ) + } + AlterRoleOperation::DropMember { member_name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "DropMember", + "member_name", + &__self_0, + ) + } + AlterRoleOperation::WithOptions { options: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "WithOptions", + "options", + &__self_0, + ) + } + AlterRoleOperation::Set { + config_name: __self_0, + config_value: __self_1, + in_database: __self_2, + } => { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "Set", + "config_name", + __self_0, + "config_value", + __self_1, + "in_database", + &__self_2, + ) + } + AlterRoleOperation::Reset { + config_name: __self_0, + in_database: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "Reset", + "config_name", + __self_0, + "in_database", + &__self_1, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for AlterRoleOperation { + #[inline] + fn clone(&self) -> AlterRoleOperation { + match self { + AlterRoleOperation::RenameRole { role_name: __self_0 } => { + AlterRoleOperation::RenameRole { + role_name: ::core::clone::Clone::clone(__self_0), + } + } + AlterRoleOperation::AddMember { member_name: __self_0 } => { + AlterRoleOperation::AddMember { + member_name: ::core::clone::Clone::clone(__self_0), + } + } + AlterRoleOperation::DropMember { member_name: __self_0 } => { + AlterRoleOperation::DropMember { + member_name: ::core::clone::Clone::clone(__self_0), + } + } + AlterRoleOperation::WithOptions { options: __self_0 } => { + AlterRoleOperation::WithOptions { + options: ::core::clone::Clone::clone(__self_0), + } + } + AlterRoleOperation::Set { + config_name: __self_0, + config_value: __self_1, + in_database: __self_2, + } => { + AlterRoleOperation::Set { + config_name: ::core::clone::Clone::clone(__self_0), + config_value: ::core::clone::Clone::clone(__self_1), + in_database: ::core::clone::Clone::clone(__self_2), + } + } + AlterRoleOperation::Reset { + config_name: __self_0, + in_database: __self_1, + } => { + AlterRoleOperation::Reset { + config_name: ::core::clone::Clone::clone(__self_0), + in_database: ::core::clone::Clone::clone(__self_1), + } + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for AlterRoleOperation {} + #[automatically_derived] + impl ::core::cmp::PartialEq for AlterRoleOperation { + #[inline] + fn eq(&self, other: &AlterRoleOperation) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + AlterRoleOperation::RenameRole { role_name: __self_0 }, + AlterRoleOperation::RenameRole { role_name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterRoleOperation::AddMember { member_name: __self_0 }, + AlterRoleOperation::AddMember { member_name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterRoleOperation::DropMember { member_name: __self_0 }, + AlterRoleOperation::DropMember { member_name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterRoleOperation::WithOptions { options: __self_0 }, + AlterRoleOperation::WithOptions { options: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterRoleOperation::Set { + config_name: __self_0, + config_value: __self_1, + in_database: __self_2, + }, + AlterRoleOperation::Set { + config_name: __arg1_0, + config_value: __arg1_1, + in_database: __arg1_2, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 + } + ( + AlterRoleOperation::Reset { + config_name: __self_0, + in_database: __self_1, + }, + AlterRoleOperation::Reset { + config_name: __arg1_0, + in_database: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for AlterRoleOperation { + #[inline] + fn partial_cmp( + &self, + other: &AlterRoleOperation, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + AlterRoleOperation::RenameRole { role_name: __self_0 }, + AlterRoleOperation::RenameRole { role_name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::AddMember { member_name: __self_0 }, + AlterRoleOperation::AddMember { member_name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::DropMember { member_name: __self_0 }, + AlterRoleOperation::DropMember { member_name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::WithOptions { options: __self_0 }, + AlterRoleOperation::WithOptions { options: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::Set { + config_name: __self_0, + config_value: __self_1, + in_database: __self_2, + }, + AlterRoleOperation::Set { + config_name: __arg1_0, + config_value: __arg1_1, + in_database: __arg1_2, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterRoleOperation::Reset { + config_name: __self_0, + in_database: __self_1, + }, + AlterRoleOperation::Reset { + config_name: __arg1_0, + in_database: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for AlterRoleOperation { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for AlterRoleOperation { + #[inline] + fn cmp(&self, other: &AlterRoleOperation) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + AlterRoleOperation::RenameRole { role_name: __self_0 }, + AlterRoleOperation::RenameRole { role_name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::AddMember { member_name: __self_0 }, + AlterRoleOperation::AddMember { member_name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::DropMember { member_name: __self_0 }, + AlterRoleOperation::DropMember { member_name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::WithOptions { options: __self_0 }, + AlterRoleOperation::WithOptions { options: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterRoleOperation::Set { + config_name: __self_0, + config_value: __self_1, + in_database: __self_2, + }, + AlterRoleOperation::Set { + config_name: __arg1_0, + config_value: __arg1_1, + in_database: __arg1_2, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterRoleOperation::Reset { + config_name: __self_0, + in_database: __self_1, + }, + AlterRoleOperation::Reset { + config_name: __arg1_0, + in_database: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for AlterRoleOperation { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + AlterRoleOperation::RenameRole { role_name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterRoleOperation::AddMember { member_name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterRoleOperation::DropMember { member_name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterRoleOperation::WithOptions { options: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterRoleOperation::Set { + config_name: __self_0, + config_value: __self_1, + in_database: __self_2, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state) + } + AlterRoleOperation::Reset { + config_name: __self_0, + in_database: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + } + } + } + impl fmt::Display for AlterRoleOperation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + AlterRoleOperation::RenameRole { role_name } => { + f.write_fmt(format_args!("RENAME TO {0}", role_name)) + } + AlterRoleOperation::AddMember { member_name } => { + f.write_fmt(format_args!("ADD MEMBER {0}", member_name)) + } + AlterRoleOperation::DropMember { member_name } => { + f.write_fmt(format_args!("DROP MEMBER {0}", member_name)) + } + AlterRoleOperation::WithOptions { options } => { + f.write_fmt( + format_args!("WITH {0}", display_separated(options, " ")), + ) + } + AlterRoleOperation::Set { + config_name, + config_value, + in_database, + } => { + if let Some(database_name) = in_database { + f.write_fmt( + format_args!("IN DATABASE {0} ", database_name), + )?; + } + match config_value { + SetConfigValue::Default => { + f.write_fmt(format_args!("SET {0} TO DEFAULT", config_name)) + } + SetConfigValue::FromCurrent => { + f.write_fmt( + format_args!("SET {0} FROM CURRENT", config_name), + ) + } + SetConfigValue::Value(expr) => { + f.write_fmt( + format_args!("SET {0} TO {1}", config_name, expr), + ) + } + } + } + AlterRoleOperation::Reset { config_name, in_database } => { + if let Some(database_name) = in_database { + f.write_fmt( + format_args!("IN DATABASE {0} ", database_name), + )?; + } + match config_name { + ResetConfig::ALL => f.write_fmt(format_args!("RESET ALL")), + ResetConfig::ConfigName(name) => { + f.write_fmt(format_args!("RESET {0}", name)) + } + } + } + } + } + } + /// A `USE` (`Statement::Use`) operation + pub enum Use { + Catalog(ObjectName), + Schema(ObjectName), + Database(ObjectName), + Warehouse(ObjectName), + Role(ObjectName), + SecondaryRoles(SecondaryRoles), + Object(ObjectName), + Default, + } + #[automatically_derived] + impl ::core::fmt::Debug for Use { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + Use::Catalog(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Catalog", + &__self_0, + ) + } + Use::Schema(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Schema", + &__self_0, + ) + } + Use::Database(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Database", + &__self_0, + ) + } + Use::Warehouse(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Warehouse", + &__self_0, + ) + } + Use::Role(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Role", + &__self_0, + ) + } + Use::SecondaryRoles(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "SecondaryRoles", + &__self_0, + ) + } + Use::Object(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Object", + &__self_0, + ) + } + Use::Default => ::core::fmt::Formatter::write_str(f, "Default"), + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for Use { + #[inline] + fn clone(&self) -> Use { + match self { + Use::Catalog(__self_0) => { + Use::Catalog(::core::clone::Clone::clone(__self_0)) + } + Use::Schema(__self_0) => { + Use::Schema(::core::clone::Clone::clone(__self_0)) + } + Use::Database(__self_0) => { + Use::Database(::core::clone::Clone::clone(__self_0)) + } + Use::Warehouse(__self_0) => { + Use::Warehouse(::core::clone::Clone::clone(__self_0)) + } + Use::Role(__self_0) => { + Use::Role(::core::clone::Clone::clone(__self_0)) + } + Use::SecondaryRoles(__self_0) => { + Use::SecondaryRoles(::core::clone::Clone::clone(__self_0)) + } + Use::Object(__self_0) => { + Use::Object(::core::clone::Clone::clone(__self_0)) + } + Use::Default => Use::Default, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for Use {} + #[automatically_derived] + impl ::core::cmp::PartialEq for Use { + #[inline] + fn eq(&self, other: &Use) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + (Use::Catalog(__self_0), Use::Catalog(__arg1_0)) => { + __self_0 == __arg1_0 + } + (Use::Schema(__self_0), Use::Schema(__arg1_0)) => { + __self_0 == __arg1_0 + } + (Use::Database(__self_0), Use::Database(__arg1_0)) => { + __self_0 == __arg1_0 + } + (Use::Warehouse(__self_0), Use::Warehouse(__arg1_0)) => { + __self_0 == __arg1_0 + } + (Use::Role(__self_0), Use::Role(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + Use::SecondaryRoles(__self_0), + Use::SecondaryRoles(__arg1_0), + ) => __self_0 == __arg1_0, + (Use::Object(__self_0), Use::Object(__arg1_0)) => { + __self_0 == __arg1_0 + } + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for Use { + #[inline] + fn partial_cmp( + &self, + other: &Use, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + (Use::Catalog(__self_0), Use::Catalog(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (Use::Schema(__self_0), Use::Schema(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (Use::Database(__self_0), Use::Database(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (Use::Warehouse(__self_0), Use::Warehouse(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (Use::Role(__self_0), Use::Role(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (Use::SecondaryRoles(__self_0), Use::SecondaryRoles(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (Use::Object(__self_0), Use::Object(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for Use { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for Use { + #[inline] + fn cmp(&self, other: &Use) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + (Use::Catalog(__self_0), Use::Catalog(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (Use::Schema(__self_0), Use::Schema(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (Use::Database(__self_0), Use::Database(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (Use::Warehouse(__self_0), Use::Warehouse(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (Use::Role(__self_0), Use::Role(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + Use::SecondaryRoles(__self_0), + Use::SecondaryRoles(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (Use::Object(__self_0), Use::Object(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for Use { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + Use::Catalog(__self_0) => ::core::hash::Hash::hash(__self_0, state), + Use::Schema(__self_0) => ::core::hash::Hash::hash(__self_0, state), + Use::Database(__self_0) => ::core::hash::Hash::hash(__self_0, state), + Use::Warehouse(__self_0) => ::core::hash::Hash::hash(__self_0, state), + Use::Role(__self_0) => ::core::hash::Hash::hash(__self_0, state), + Use::SecondaryRoles(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + Use::Object(__self_0) => ::core::hash::Hash::hash(__self_0, state), + _ => {} + } + } + } + impl fmt::Display for Use { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str("USE ")?; + match self { + Use::Catalog(name) => f.write_fmt(format_args!("CATALOG {0}", name)), + Use::Schema(name) => f.write_fmt(format_args!("SCHEMA {0}", name)), + Use::Database(name) => { + f.write_fmt(format_args!("DATABASE {0}", name)) + } + Use::Warehouse(name) => { + f.write_fmt(format_args!("WAREHOUSE {0}", name)) + } + Use::Role(name) => f.write_fmt(format_args!("ROLE {0}", name)), + Use::SecondaryRoles(secondary_roles) => { + f.write_fmt(format_args!("SECONDARY ROLES {0}", secondary_roles)) + } + Use::Object(name) => f.write_fmt(format_args!("{0}", name)), + Use::Default => f.write_fmt(format_args!("DEFAULT")), + } + } + } + /// Snowflake `SECONDARY ROLES` USE variant + /// See: + pub enum SecondaryRoles { + All, + None, + List(Vec), + } + #[automatically_derived] + impl ::core::fmt::Debug for SecondaryRoles { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + SecondaryRoles::All => ::core::fmt::Formatter::write_str(f, "All"), + SecondaryRoles::None => ::core::fmt::Formatter::write_str(f, "None"), + SecondaryRoles::List(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "List", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for SecondaryRoles { + #[inline] + fn clone(&self) -> SecondaryRoles { + match self { + SecondaryRoles::All => SecondaryRoles::All, + SecondaryRoles::None => SecondaryRoles::None, + SecondaryRoles::List(__self_0) => { + SecondaryRoles::List(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for SecondaryRoles {} + #[automatically_derived] + impl ::core::cmp::PartialEq for SecondaryRoles { + #[inline] + fn eq(&self, other: &SecondaryRoles) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + SecondaryRoles::List(__self_0), + SecondaryRoles::List(__arg1_0), + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for SecondaryRoles { + #[inline] + fn partial_cmp( + &self, + other: &SecondaryRoles, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + (SecondaryRoles::List(__self_0), SecondaryRoles::List(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for SecondaryRoles { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for SecondaryRoles { + #[inline] + fn cmp(&self, other: &SecondaryRoles) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + SecondaryRoles::List(__self_0), + SecondaryRoles::List(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for SecondaryRoles { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + SecondaryRoles::List(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + impl fmt::Display for SecondaryRoles { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + SecondaryRoles::All => f.write_fmt(format_args!("ALL")), + SecondaryRoles::None => f.write_fmt(format_args!("NONE")), + SecondaryRoles::List(roles) => { + f.write_fmt(format_args!("{0}", display_comma_separated(roles))) + } + } + } + } + } + mod ddl { + //! AST types specific to CREATE/ALTER variants of [`Statement`](crate::ast::Statement) + //! (commonly referred to as Data Definition Language, or DDL) + use core::fmt::{self, Write}; + use crate::ast::value::escape_single_quote_string; + use crate::ast::{ + display_comma_separated, display_separated, CommentDef, CreateFunctionBody, + CreateFunctionUsing, DataType, Expr, FunctionBehavior, FunctionCalledOnNull, + FunctionDeterminismSpecifier, FunctionParallel, Ident, MySQLColumnPosition, + ObjectName, OperateFunctionArg, OrderByExpr, ProjectionSelect, + SequenceOptions, SqlOption, Tag, Value, + }; + use crate::keywords::Keyword; + use crate::tokenizer::Token; + /// An `ALTER TABLE` (`Statement::AlterTable`) operation + pub enum AlterTableOperation { + /// `ADD ` + AddConstraint(TableConstraint), + /// `ADD [COLUMN] [IF NOT EXISTS] ` + AddColumn { + /// `[COLUMN]`. + column_keyword: bool, + /// `[IF NOT EXISTS]` + if_not_exists: bool, + /// . + column_def: ColumnDef, + /// MySQL `ALTER TABLE` only [FIRST | AFTER column_name] + column_position: Option, + }, + /// `ADD PROJECTION [IF NOT EXISTS] name ( SELECT [GROUP BY] [ORDER BY])` + /// + /// Note: this is a ClickHouse-specific operation. + /// Please refer to [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/projection#add-projection) + AddProjection { if_not_exists: bool, name: Ident, select: ProjectionSelect }, + /// `DROP PROJECTION [IF EXISTS] name` + /// + /// Note: this is a ClickHouse-specific operation. + /// Please refer to [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/projection#drop-projection) + DropProjection { if_exists: bool, name: Ident }, + /// `MATERIALIZE PROJECTION [IF EXISTS] name [IN PARTITION partition_name]` + /// + /// Note: this is a ClickHouse-specific operation. + /// Please refer to [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/projection#materialize-projection) + MaterializeProjection { + if_exists: bool, + name: Ident, + partition: Option, + }, + /// `CLEAR PROJECTION [IF EXISTS] name [IN PARTITION partition_name]` + /// + /// Note: this is a ClickHouse-specific operation. + /// Please refer to [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/projection#clear-projection) + ClearProjection { if_exists: bool, name: Ident, partition: Option }, + /// `DISABLE ROW LEVEL SECURITY` + /// + /// Note: this is a PostgreSQL-specific operation. + DisableRowLevelSecurity, + /// `DISABLE RULE rewrite_rule_name` + /// + /// Note: this is a PostgreSQL-specific operation. + DisableRule { name: Ident }, + /// `DISABLE TRIGGER [ trigger_name | ALL | USER ]` + /// + /// Note: this is a PostgreSQL-specific operation. + DisableTrigger { name: Ident }, + /// `DROP CONSTRAINT [ IF EXISTS ] ` + DropConstraint { + if_exists: bool, + name: Ident, + drop_behavior: Option, + }, + /// `DROP [ COLUMN ] [ IF EXISTS ] [ CASCADE ]` + DropColumn { + column_name: Ident, + if_exists: bool, + drop_behavior: Option, + }, + /// `ATTACH PART|PARTITION ` + /// Note: this is a ClickHouse-specific operation, please refer to + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/pakrtition#attach-partitionpart) + AttachPartition { partition: Partition }, + /// `DETACH PART|PARTITION ` + /// Note: this is a ClickHouse-specific operation, please refer to + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#detach-partitionpart) + DetachPartition { partition: Partition }, + /// `FREEZE PARTITION ` + /// Note: this is a ClickHouse-specific operation, please refer to + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#freeze-partition) + FreezePartition { partition: Partition, with_name: Option }, + /// `UNFREEZE PARTITION ` + /// Note: this is a ClickHouse-specific operation, please refer to + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#unfreeze-partition) + UnfreezePartition { partition: Partition, with_name: Option }, + /// `DROP PRIMARY KEY` + /// + /// Note: this is a MySQL-specific operation. + DropPrimaryKey, + /// `ENABLE ALWAYS RULE rewrite_rule_name` + /// + /// Note: this is a PostgreSQL-specific operation. + EnableAlwaysRule { name: Ident }, + /// `ENABLE ALWAYS TRIGGER trigger_name` + /// + /// Note: this is a PostgreSQL-specific operation. + EnableAlwaysTrigger { name: Ident }, + /// `ENABLE REPLICA RULE rewrite_rule_name` + /// + /// Note: this is a PostgreSQL-specific operation. + EnableReplicaRule { name: Ident }, + /// `ENABLE REPLICA TRIGGER trigger_name` + /// + /// Note: this is a PostgreSQL-specific operation. + EnableReplicaTrigger { name: Ident }, + /// `ENABLE ROW LEVEL SECURITY` + /// + /// Note: this is a PostgreSQL-specific operation. + EnableRowLevelSecurity, + /// `ENABLE RULE rewrite_rule_name` + /// + /// Note: this is a PostgreSQL-specific operation. + EnableRule { name: Ident }, + /// `ENABLE TRIGGER [ trigger_name | ALL | USER ]` + /// + /// Note: this is a PostgreSQL-specific operation. + EnableTrigger { name: Ident }, + /// `RENAME TO PARTITION (partition=val)` + RenamePartitions { old_partitions: Vec, new_partitions: Vec }, + /// Add Partitions + AddPartitions { if_not_exists: bool, new_partitions: Vec }, + DropPartitions { partitions: Vec, if_exists: bool }, + /// `RENAME [ COLUMN ] TO ` + RenameColumn { old_column_name: Ident, new_column_name: Ident }, + /// `RENAME TO ` + RenameTable { table_name: ObjectName }, + ChangeColumn { + old_name: Ident, + new_name: Ident, + data_type: DataType, + options: Vec, + /// MySQL `ALTER TABLE` only [FIRST | AFTER column_name] + column_position: Option, + }, + ModifyColumn { + col_name: Ident, + data_type: DataType, + options: Vec, + /// MySQL `ALTER TABLE` only [FIRST | AFTER column_name] + column_position: Option, + }, + /// `RENAME CONSTRAINT TO ` + /// + /// Note: this is a PostgreSQL-specific operation. + RenameConstraint { old_name: Ident, new_name: Ident }, + /// `ALTER [ COLUMN ]` + AlterColumn { column_name: Ident, op: AlterColumnOperation }, + /// 'SWAP WITH ' + /// + /// Note: this is Snowflake specific + SwapWith { table_name: ObjectName }, + /// 'SET TBLPROPERTIES ( { property_key [ = ] property_val } [, ...] )' + SetTblProperties { table_properties: Vec }, + /// `OWNER TO { | CURRENT_ROLE | CURRENT_USER | SESSION_USER }` + /// + /// Note: this is PostgreSQL-specific + OwnerTo { new_owner: Owner }, + /// Snowflake table clustering options + /// + ClusterBy { exprs: Vec }, + DropClusteringKey, + SuspendRecluster, + ResumeRecluster, + } + #[automatically_derived] + impl ::core::fmt::Debug for AlterTableOperation { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + AlterTableOperation::AddConstraint(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "AddConstraint", + &__self_0, + ) + } + AlterTableOperation::AddColumn { + column_keyword: __self_0, + if_not_exists: __self_1, + column_def: __self_2, + column_position: __self_3, + } => { + ::core::fmt::Formatter::debug_struct_field4_finish( + f, + "AddColumn", + "column_keyword", + __self_0, + "if_not_exists", + __self_1, + "column_def", + __self_2, + "column_position", + &__self_3, + ) + } + AlterTableOperation::AddProjection { + if_not_exists: __self_0, + name: __self_1, + select: __self_2, + } => { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "AddProjection", + "if_not_exists", + __self_0, + "name", + __self_1, + "select", + &__self_2, + ) + } + AlterTableOperation::DropProjection { + if_exists: __self_0, + name: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "DropProjection", + "if_exists", + __self_0, + "name", + &__self_1, + ) + } + AlterTableOperation::MaterializeProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + } => { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "MaterializeProjection", + "if_exists", + __self_0, + "name", + __self_1, + "partition", + &__self_2, + ) + } + AlterTableOperation::ClearProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + } => { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "ClearProjection", + "if_exists", + __self_0, + "name", + __self_1, + "partition", + &__self_2, + ) + } + AlterTableOperation::DisableRowLevelSecurity => { + ::core::fmt::Formatter::write_str(f, "DisableRowLevelSecurity") + } + AlterTableOperation::DisableRule { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "DisableRule", + "name", + &__self_0, + ) + } + AlterTableOperation::DisableTrigger { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "DisableTrigger", + "name", + &__self_0, + ) + } + AlterTableOperation::DropConstraint { + if_exists: __self_0, + name: __self_1, + drop_behavior: __self_2, + } => { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "DropConstraint", + "if_exists", + __self_0, + "name", + __self_1, + "drop_behavior", + &__self_2, + ) + } + AlterTableOperation::DropColumn { + column_name: __self_0, + if_exists: __self_1, + drop_behavior: __self_2, + } => { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "DropColumn", + "column_name", + __self_0, + "if_exists", + __self_1, + "drop_behavior", + &__self_2, + ) + } + AlterTableOperation::AttachPartition { partition: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "AttachPartition", + "partition", + &__self_0, + ) + } + AlterTableOperation::DetachPartition { partition: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "DetachPartition", + "partition", + &__self_0, + ) + } + AlterTableOperation::FreezePartition { + partition: __self_0, + with_name: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "FreezePartition", + "partition", + __self_0, + "with_name", + &__self_1, + ) + } + AlterTableOperation::UnfreezePartition { + partition: __self_0, + with_name: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "UnfreezePartition", + "partition", + __self_0, + "with_name", + &__self_1, + ) + } + AlterTableOperation::DropPrimaryKey => { + ::core::fmt::Formatter::write_str(f, "DropPrimaryKey") + } + AlterTableOperation::EnableAlwaysRule { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "EnableAlwaysRule", + "name", + &__self_0, + ) + } + AlterTableOperation::EnableAlwaysTrigger { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "EnableAlwaysTrigger", + "name", + &__self_0, + ) + } + AlterTableOperation::EnableReplicaRule { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "EnableReplicaRule", + "name", + &__self_0, + ) + } + AlterTableOperation::EnableReplicaTrigger { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "EnableReplicaTrigger", + "name", + &__self_0, + ) + } + AlterTableOperation::EnableRowLevelSecurity => { + ::core::fmt::Formatter::write_str(f, "EnableRowLevelSecurity") + } + AlterTableOperation::EnableRule { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "EnableRule", + "name", + &__self_0, + ) + } + AlterTableOperation::EnableTrigger { name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "EnableTrigger", + "name", + &__self_0, + ) + } + AlterTableOperation::RenamePartitions { + old_partitions: __self_0, + new_partitions: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "RenamePartitions", + "old_partitions", + __self_0, + "new_partitions", + &__self_1, + ) + } + AlterTableOperation::AddPartitions { + if_not_exists: __self_0, + new_partitions: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "AddPartitions", + "if_not_exists", + __self_0, + "new_partitions", + &__self_1, + ) + } + AlterTableOperation::DropPartitions { + partitions: __self_0, + if_exists: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "DropPartitions", + "partitions", + __self_0, + "if_exists", + &__self_1, + ) + } + AlterTableOperation::RenameColumn { + old_column_name: __self_0, + new_column_name: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "RenameColumn", + "old_column_name", + __self_0, + "new_column_name", + &__self_1, + ) + } + AlterTableOperation::RenameTable { table_name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "RenameTable", + "table_name", + &__self_0, + ) + } + AlterTableOperation::ChangeColumn { + old_name: __self_0, + new_name: __self_1, + data_type: __self_2, + options: __self_3, + column_position: __self_4, + } => { + ::core::fmt::Formatter::debug_struct_field5_finish( + f, + "ChangeColumn", + "old_name", + __self_0, + "new_name", + __self_1, + "data_type", + __self_2, + "options", + __self_3, + "column_position", + &__self_4, + ) + } + AlterTableOperation::ModifyColumn { + col_name: __self_0, + data_type: __self_1, + options: __self_2, + column_position: __self_3, + } => { + ::core::fmt::Formatter::debug_struct_field4_finish( + f, + "ModifyColumn", + "col_name", + __self_0, + "data_type", + __self_1, + "options", + __self_2, + "column_position", + &__self_3, + ) + } + AlterTableOperation::RenameConstraint { + old_name: __self_0, + new_name: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "RenameConstraint", + "old_name", + __self_0, + "new_name", + &__self_1, + ) + } + AlterTableOperation::AlterColumn { + column_name: __self_0, + op: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "AlterColumn", + "column_name", + __self_0, + "op", + &__self_1, + ) + } + AlterTableOperation::SwapWith { table_name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "SwapWith", + "table_name", + &__self_0, + ) + } + AlterTableOperation::SetTblProperties { + table_properties: __self_0, + } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "SetTblProperties", + "table_properties", + &__self_0, + ) + } + AlterTableOperation::OwnerTo { new_owner: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "OwnerTo", + "new_owner", + &__self_0, + ) + } + AlterTableOperation::ClusterBy { exprs: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "ClusterBy", + "exprs", + &__self_0, + ) + } + AlterTableOperation::DropClusteringKey => { + ::core::fmt::Formatter::write_str(f, "DropClusteringKey") + } + AlterTableOperation::SuspendRecluster => { + ::core::fmt::Formatter::write_str(f, "SuspendRecluster") + } + AlterTableOperation::ResumeRecluster => { + ::core::fmt::Formatter::write_str(f, "ResumeRecluster") + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for AlterTableOperation { + #[inline] + fn clone(&self) -> AlterTableOperation { + match self { + AlterTableOperation::AddConstraint(__self_0) => { + AlterTableOperation::AddConstraint( + ::core::clone::Clone::clone(__self_0), + ) + } + AlterTableOperation::AddColumn { + column_keyword: __self_0, + if_not_exists: __self_1, + column_def: __self_2, + column_position: __self_3, + } => { + AlterTableOperation::AddColumn { + column_keyword: ::core::clone::Clone::clone(__self_0), + if_not_exists: ::core::clone::Clone::clone(__self_1), + column_def: ::core::clone::Clone::clone(__self_2), + column_position: ::core::clone::Clone::clone(__self_3), + } + } + AlterTableOperation::AddProjection { + if_not_exists: __self_0, + name: __self_1, + select: __self_2, + } => { + AlterTableOperation::AddProjection { + if_not_exists: ::core::clone::Clone::clone(__self_0), + name: ::core::clone::Clone::clone(__self_1), + select: ::core::clone::Clone::clone(__self_2), + } + } + AlterTableOperation::DropProjection { + if_exists: __self_0, + name: __self_1, + } => { + AlterTableOperation::DropProjection { + if_exists: ::core::clone::Clone::clone(__self_0), + name: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::MaterializeProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + } => { + AlterTableOperation::MaterializeProjection { + if_exists: ::core::clone::Clone::clone(__self_0), + name: ::core::clone::Clone::clone(__self_1), + partition: ::core::clone::Clone::clone(__self_2), + } + } + AlterTableOperation::ClearProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + } => { + AlterTableOperation::ClearProjection { + if_exists: ::core::clone::Clone::clone(__self_0), + name: ::core::clone::Clone::clone(__self_1), + partition: ::core::clone::Clone::clone(__self_2), + } + } + AlterTableOperation::DisableRowLevelSecurity => { + AlterTableOperation::DisableRowLevelSecurity + } + AlterTableOperation::DisableRule { name: __self_0 } => { + AlterTableOperation::DisableRule { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::DisableTrigger { name: __self_0 } => { + AlterTableOperation::DisableTrigger { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::DropConstraint { + if_exists: __self_0, + name: __self_1, + drop_behavior: __self_2, + } => { + AlterTableOperation::DropConstraint { + if_exists: ::core::clone::Clone::clone(__self_0), + name: ::core::clone::Clone::clone(__self_1), + drop_behavior: ::core::clone::Clone::clone(__self_2), + } + } + AlterTableOperation::DropColumn { + column_name: __self_0, + if_exists: __self_1, + drop_behavior: __self_2, + } => { + AlterTableOperation::DropColumn { + column_name: ::core::clone::Clone::clone(__self_0), + if_exists: ::core::clone::Clone::clone(__self_1), + drop_behavior: ::core::clone::Clone::clone(__self_2), + } + } + AlterTableOperation::AttachPartition { partition: __self_0 } => { + AlterTableOperation::AttachPartition { + partition: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::DetachPartition { partition: __self_0 } => { + AlterTableOperation::DetachPartition { + partition: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::FreezePartition { + partition: __self_0, + with_name: __self_1, + } => { + AlterTableOperation::FreezePartition { + partition: ::core::clone::Clone::clone(__self_0), + with_name: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::UnfreezePartition { + partition: __self_0, + with_name: __self_1, + } => { + AlterTableOperation::UnfreezePartition { + partition: ::core::clone::Clone::clone(__self_0), + with_name: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::DropPrimaryKey => { + AlterTableOperation::DropPrimaryKey + } + AlterTableOperation::EnableAlwaysRule { name: __self_0 } => { + AlterTableOperation::EnableAlwaysRule { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::EnableAlwaysTrigger { name: __self_0 } => { + AlterTableOperation::EnableAlwaysTrigger { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::EnableReplicaRule { name: __self_0 } => { + AlterTableOperation::EnableReplicaRule { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::EnableReplicaTrigger { name: __self_0 } => { + AlterTableOperation::EnableReplicaTrigger { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::EnableRowLevelSecurity => { + AlterTableOperation::EnableRowLevelSecurity + } + AlterTableOperation::EnableRule { name: __self_0 } => { + AlterTableOperation::EnableRule { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::EnableTrigger { name: __self_0 } => { + AlterTableOperation::EnableTrigger { + name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::RenamePartitions { + old_partitions: __self_0, + new_partitions: __self_1, + } => { + AlterTableOperation::RenamePartitions { + old_partitions: ::core::clone::Clone::clone(__self_0), + new_partitions: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::AddPartitions { + if_not_exists: __self_0, + new_partitions: __self_1, + } => { + AlterTableOperation::AddPartitions { + if_not_exists: ::core::clone::Clone::clone(__self_0), + new_partitions: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::DropPartitions { + partitions: __self_0, + if_exists: __self_1, + } => { + AlterTableOperation::DropPartitions { + partitions: ::core::clone::Clone::clone(__self_0), + if_exists: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::RenameColumn { + old_column_name: __self_0, + new_column_name: __self_1, + } => { + AlterTableOperation::RenameColumn { + old_column_name: ::core::clone::Clone::clone(__self_0), + new_column_name: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::RenameTable { table_name: __self_0 } => { + AlterTableOperation::RenameTable { + table_name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::ChangeColumn { + old_name: __self_0, + new_name: __self_1, + data_type: __self_2, + options: __self_3, + column_position: __self_4, + } => { + AlterTableOperation::ChangeColumn { + old_name: ::core::clone::Clone::clone(__self_0), + new_name: ::core::clone::Clone::clone(__self_1), + data_type: ::core::clone::Clone::clone(__self_2), + options: ::core::clone::Clone::clone(__self_3), + column_position: ::core::clone::Clone::clone(__self_4), + } + } + AlterTableOperation::ModifyColumn { + col_name: __self_0, + data_type: __self_1, + options: __self_2, + column_position: __self_3, + } => { + AlterTableOperation::ModifyColumn { + col_name: ::core::clone::Clone::clone(__self_0), + data_type: ::core::clone::Clone::clone(__self_1), + options: ::core::clone::Clone::clone(__self_2), + column_position: ::core::clone::Clone::clone(__self_3), + } + } + AlterTableOperation::RenameConstraint { + old_name: __self_0, + new_name: __self_1, + } => { + AlterTableOperation::RenameConstraint { + old_name: ::core::clone::Clone::clone(__self_0), + new_name: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::AlterColumn { + column_name: __self_0, + op: __self_1, + } => { + AlterTableOperation::AlterColumn { + column_name: ::core::clone::Clone::clone(__self_0), + op: ::core::clone::Clone::clone(__self_1), + } + } + AlterTableOperation::SwapWith { table_name: __self_0 } => { + AlterTableOperation::SwapWith { + table_name: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::SetTblProperties { + table_properties: __self_0, + } => { + AlterTableOperation::SetTblProperties { + table_properties: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::OwnerTo { new_owner: __self_0 } => { + AlterTableOperation::OwnerTo { + new_owner: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::ClusterBy { exprs: __self_0 } => { + AlterTableOperation::ClusterBy { + exprs: ::core::clone::Clone::clone(__self_0), + } + } + AlterTableOperation::DropClusteringKey => { + AlterTableOperation::DropClusteringKey + } + AlterTableOperation::SuspendRecluster => { + AlterTableOperation::SuspendRecluster + } + AlterTableOperation::ResumeRecluster => { + AlterTableOperation::ResumeRecluster + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for AlterTableOperation {} + #[automatically_derived] + impl ::core::cmp::PartialEq for AlterTableOperation { + #[inline] + fn eq(&self, other: &AlterTableOperation) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + AlterTableOperation::AddConstraint(__self_0), + AlterTableOperation::AddConstraint(__arg1_0), + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::AddColumn { + column_keyword: __self_0, + if_not_exists: __self_1, + column_def: __self_2, + column_position: __self_3, + }, + AlterTableOperation::AddColumn { + column_keyword: __arg1_0, + if_not_exists: __arg1_1, + column_def: __arg1_2, + column_position: __arg1_3, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + } + ( + AlterTableOperation::AddProjection { + if_not_exists: __self_0, + name: __self_1, + select: __self_2, + }, + AlterTableOperation::AddProjection { + if_not_exists: __arg1_0, + name: __arg1_1, + select: __arg1_2, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 + } + ( + AlterTableOperation::DropProjection { + if_exists: __self_0, + name: __self_1, + }, + AlterTableOperation::DropProjection { + if_exists: __arg1_0, + name: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::MaterializeProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + }, + AlterTableOperation::MaterializeProjection { + if_exists: __arg1_0, + name: __arg1_1, + partition: __arg1_2, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 + } + ( + AlterTableOperation::ClearProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + }, + AlterTableOperation::ClearProjection { + if_exists: __arg1_0, + name: __arg1_1, + partition: __arg1_2, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 + } + ( + AlterTableOperation::DisableRule { name: __self_0 }, + AlterTableOperation::DisableRule { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::DisableTrigger { name: __self_0 }, + AlterTableOperation::DisableTrigger { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::DropConstraint { + if_exists: __self_0, + name: __self_1, + drop_behavior: __self_2, + }, + AlterTableOperation::DropConstraint { + if_exists: __arg1_0, + name: __arg1_1, + drop_behavior: __arg1_2, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 + } + ( + AlterTableOperation::DropColumn { + column_name: __self_0, + if_exists: __self_1, + drop_behavior: __self_2, + }, + AlterTableOperation::DropColumn { + column_name: __arg1_0, + if_exists: __arg1_1, + drop_behavior: __arg1_2, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 + } + ( + AlterTableOperation::AttachPartition { partition: __self_0 }, + AlterTableOperation::AttachPartition { partition: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::DetachPartition { partition: __self_0 }, + AlterTableOperation::DetachPartition { partition: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::FreezePartition { + partition: __self_0, + with_name: __self_1, + }, + AlterTableOperation::FreezePartition { + partition: __arg1_0, + with_name: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::UnfreezePartition { + partition: __self_0, + with_name: __self_1, + }, + AlterTableOperation::UnfreezePartition { + partition: __arg1_0, + with_name: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::EnableAlwaysRule { name: __self_0 }, + AlterTableOperation::EnableAlwaysRule { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::EnableAlwaysTrigger { name: __self_0 }, + AlterTableOperation::EnableAlwaysTrigger { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::EnableReplicaRule { name: __self_0 }, + AlterTableOperation::EnableReplicaRule { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::EnableReplicaTrigger { name: __self_0 }, + AlterTableOperation::EnableReplicaTrigger { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::EnableRule { name: __self_0 }, + AlterTableOperation::EnableRule { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::EnableTrigger { name: __self_0 }, + AlterTableOperation::EnableTrigger { name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::RenamePartitions { + old_partitions: __self_0, + new_partitions: __self_1, + }, + AlterTableOperation::RenamePartitions { + old_partitions: __arg1_0, + new_partitions: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::AddPartitions { + if_not_exists: __self_0, + new_partitions: __self_1, + }, + AlterTableOperation::AddPartitions { + if_not_exists: __arg1_0, + new_partitions: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::DropPartitions { + partitions: __self_0, + if_exists: __self_1, + }, + AlterTableOperation::DropPartitions { + partitions: __arg1_0, + if_exists: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::RenameColumn { + old_column_name: __self_0, + new_column_name: __self_1, + }, + AlterTableOperation::RenameColumn { + old_column_name: __arg1_0, + new_column_name: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::RenameTable { table_name: __self_0 }, + AlterTableOperation::RenameTable { table_name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::ChangeColumn { + old_name: __self_0, + new_name: __self_1, + data_type: __self_2, + options: __self_3, + column_position: __self_4, + }, + AlterTableOperation::ChangeColumn { + old_name: __arg1_0, + new_name: __arg1_1, + data_type: __arg1_2, + options: __arg1_3, + column_position: __arg1_4, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + && __self_4 == __arg1_4 + } + ( + AlterTableOperation::ModifyColumn { + col_name: __self_0, + data_type: __self_1, + options: __self_2, + column_position: __self_3, + }, + AlterTableOperation::ModifyColumn { + col_name: __arg1_0, + data_type: __arg1_1, + options: __arg1_2, + column_position: __arg1_3, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + } + ( + AlterTableOperation::RenameConstraint { + old_name: __self_0, + new_name: __self_1, + }, + AlterTableOperation::RenameConstraint { + old_name: __arg1_0, + new_name: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::AlterColumn { + column_name: __self_0, + op: __self_1, + }, + AlterTableOperation::AlterColumn { + column_name: __arg1_0, + op: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterTableOperation::SwapWith { table_name: __self_0 }, + AlterTableOperation::SwapWith { table_name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::SetTblProperties { + table_properties: __self_0, + }, + AlterTableOperation::SetTblProperties { + table_properties: __arg1_0, + }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::OwnerTo { new_owner: __self_0 }, + AlterTableOperation::OwnerTo { new_owner: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterTableOperation::ClusterBy { exprs: __self_0 }, + AlterTableOperation::ClusterBy { exprs: __arg1_0 }, + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for AlterTableOperation { + #[inline] + fn partial_cmp( + &self, + other: &AlterTableOperation, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + AlterTableOperation::AddConstraint(__self_0), + AlterTableOperation::AddConstraint(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::AddColumn { + column_keyword: __self_0, + if_not_exists: __self_1, + column_def: __self_2, + column_position: __self_3, + }, + AlterTableOperation::AddColumn { + column_keyword: __arg1_0, + if_not_exists: __arg1_1, + column_def: __arg1_2, + column_position: __arg1_3, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::AddProjection { + if_not_exists: __self_0, + name: __self_1, + select: __self_2, + }, + AlterTableOperation::AddProjection { + if_not_exists: __arg1_0, + name: __arg1_1, + select: __arg1_2, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::DropProjection { + if_exists: __self_0, + name: __self_1, + }, + AlterTableOperation::DropProjection { + if_exists: __arg1_0, + name: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::MaterializeProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + }, + AlterTableOperation::MaterializeProjection { + if_exists: __arg1_0, + name: __arg1_1, + partition: __arg1_2, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::ClearProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + }, + AlterTableOperation::ClearProjection { + if_exists: __arg1_0, + name: __arg1_1, + partition: __arg1_2, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::DisableRule { name: __self_0 }, + AlterTableOperation::DisableRule { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::DisableTrigger { name: __self_0 }, + AlterTableOperation::DisableTrigger { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::DropConstraint { + if_exists: __self_0, + name: __self_1, + drop_behavior: __self_2, + }, + AlterTableOperation::DropConstraint { + if_exists: __arg1_0, + name: __arg1_1, + drop_behavior: __arg1_2, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::DropColumn { + column_name: __self_0, + if_exists: __self_1, + drop_behavior: __self_2, + }, + AlterTableOperation::DropColumn { + column_name: __arg1_0, + if_exists: __arg1_1, + drop_behavior: __arg1_2, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::AttachPartition { partition: __self_0 }, + AlterTableOperation::AttachPartition { partition: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::DetachPartition { partition: __self_0 }, + AlterTableOperation::DetachPartition { partition: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::FreezePartition { + partition: __self_0, + with_name: __self_1, + }, + AlterTableOperation::FreezePartition { + partition: __arg1_0, + with_name: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::UnfreezePartition { + partition: __self_0, + with_name: __self_1, + }, + AlterTableOperation::UnfreezePartition { + partition: __arg1_0, + with_name: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::EnableAlwaysRule { name: __self_0 }, + AlterTableOperation::EnableAlwaysRule { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableAlwaysTrigger { name: __self_0 }, + AlterTableOperation::EnableAlwaysTrigger { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableReplicaRule { name: __self_0 }, + AlterTableOperation::EnableReplicaRule { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableReplicaTrigger { name: __self_0 }, + AlterTableOperation::EnableReplicaTrigger { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableRule { name: __self_0 }, + AlterTableOperation::EnableRule { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableTrigger { name: __self_0 }, + AlterTableOperation::EnableTrigger { name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::RenamePartitions { + old_partitions: __self_0, + new_partitions: __self_1, + }, + AlterTableOperation::RenamePartitions { + old_partitions: __arg1_0, + new_partitions: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::AddPartitions { + if_not_exists: __self_0, + new_partitions: __self_1, + }, + AlterTableOperation::AddPartitions { + if_not_exists: __arg1_0, + new_partitions: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::DropPartitions { + partitions: __self_0, + if_exists: __self_1, + }, + AlterTableOperation::DropPartitions { + partitions: __arg1_0, + if_exists: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::RenameColumn { + old_column_name: __self_0, + new_column_name: __self_1, + }, + AlterTableOperation::RenameColumn { + old_column_name: __arg1_0, + new_column_name: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::RenameTable { table_name: __self_0 }, + AlterTableOperation::RenameTable { table_name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::ChangeColumn { + old_name: __self_0, + new_name: __self_1, + data_type: __self_2, + options: __self_3, + column_position: __self_4, + }, + AlterTableOperation::ChangeColumn { + old_name: __arg1_0, + new_name: __arg1_1, + data_type: __arg1_2, + options: __arg1_3, + column_position: __arg1_4, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_3, + __arg1_3, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::ModifyColumn { + col_name: __self_0, + data_type: __self_1, + options: __self_2, + column_position: __self_3, + }, + AlterTableOperation::ModifyColumn { + col_name: __arg1_0, + data_type: __arg1_1, + options: __arg1_2, + column_position: __arg1_3, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::RenameConstraint { + old_name: __self_0, + new_name: __self_1, + }, + AlterTableOperation::RenameConstraint { + old_name: __arg1_0, + new_name: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::AlterColumn { + column_name: __self_0, + op: __self_1, + }, + AlterTableOperation::AlterColumn { + column_name: __arg1_0, + op: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterTableOperation::SwapWith { table_name: __self_0 }, + AlterTableOperation::SwapWith { table_name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::SetTblProperties { + table_properties: __self_0, + }, + AlterTableOperation::SetTblProperties { + table_properties: __arg1_0, + }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::OwnerTo { new_owner: __self_0 }, + AlterTableOperation::OwnerTo { new_owner: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterTableOperation::ClusterBy { exprs: __self_0 }, + AlterTableOperation::ClusterBy { exprs: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for AlterTableOperation { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for AlterTableOperation { + #[inline] + fn cmp(&self, other: &AlterTableOperation) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + AlterTableOperation::AddConstraint(__self_0), + AlterTableOperation::AddConstraint(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::AddColumn { + column_keyword: __self_0, + if_not_exists: __self_1, + column_def: __self_2, + column_position: __self_3, + }, + AlterTableOperation::AddColumn { + column_keyword: __arg1_0, + if_not_exists: __arg1_1, + column_def: __arg1_2, + column_position: __arg1_3, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::AddProjection { + if_not_exists: __self_0, + name: __self_1, + select: __self_2, + }, + AlterTableOperation::AddProjection { + if_not_exists: __arg1_0, + name: __arg1_1, + select: __arg1_2, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::DropProjection { + if_exists: __self_0, + name: __self_1, + }, + AlterTableOperation::DropProjection { + if_exists: __arg1_0, + name: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::MaterializeProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + }, + AlterTableOperation::MaterializeProjection { + if_exists: __arg1_0, + name: __arg1_1, + partition: __arg1_2, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::ClearProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + }, + AlterTableOperation::ClearProjection { + if_exists: __arg1_0, + name: __arg1_1, + partition: __arg1_2, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::DisableRule { name: __self_0 }, + AlterTableOperation::DisableRule { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::DisableTrigger { name: __self_0 }, + AlterTableOperation::DisableTrigger { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::DropConstraint { + if_exists: __self_0, + name: __self_1, + drop_behavior: __self_2, + }, + AlterTableOperation::DropConstraint { + if_exists: __arg1_0, + name: __arg1_1, + drop_behavior: __arg1_2, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::DropColumn { + column_name: __self_0, + if_exists: __self_1, + drop_behavior: __self_2, + }, + AlterTableOperation::DropColumn { + column_name: __arg1_0, + if_exists: __arg1_1, + drop_behavior: __arg1_2, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::AttachPartition { + partition: __self_0, + }, + AlterTableOperation::AttachPartition { partition: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::DetachPartition { + partition: __self_0, + }, + AlterTableOperation::DetachPartition { partition: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::FreezePartition { + partition: __self_0, + with_name: __self_1, + }, + AlterTableOperation::FreezePartition { + partition: __arg1_0, + with_name: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::UnfreezePartition { + partition: __self_0, + with_name: __self_1, + }, + AlterTableOperation::UnfreezePartition { + partition: __arg1_0, + with_name: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::EnableAlwaysRule { name: __self_0 }, + AlterTableOperation::EnableAlwaysRule { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableAlwaysTrigger { name: __self_0 }, + AlterTableOperation::EnableAlwaysTrigger { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableReplicaRule { name: __self_0 }, + AlterTableOperation::EnableReplicaRule { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableReplicaTrigger { + name: __self_0, + }, + AlterTableOperation::EnableReplicaTrigger { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableRule { name: __self_0 }, + AlterTableOperation::EnableRule { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::EnableTrigger { name: __self_0 }, + AlterTableOperation::EnableTrigger { name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::RenamePartitions { + old_partitions: __self_0, + new_partitions: __self_1, + }, + AlterTableOperation::RenamePartitions { + old_partitions: __arg1_0, + new_partitions: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::AddPartitions { + if_not_exists: __self_0, + new_partitions: __self_1, + }, + AlterTableOperation::AddPartitions { + if_not_exists: __arg1_0, + new_partitions: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::DropPartitions { + partitions: __self_0, + if_exists: __self_1, + }, + AlterTableOperation::DropPartitions { + partitions: __arg1_0, + if_exists: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::RenameColumn { + old_column_name: __self_0, + new_column_name: __self_1, + }, + AlterTableOperation::RenameColumn { + old_column_name: __arg1_0, + new_column_name: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::RenameTable { table_name: __self_0 }, + AlterTableOperation::RenameTable { table_name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::ChangeColumn { + old_name: __self_0, + new_name: __self_1, + data_type: __self_2, + options: __self_3, + column_position: __self_4, + }, + AlterTableOperation::ChangeColumn { + old_name: __arg1_0, + new_name: __arg1_1, + data_type: __arg1_2, + options: __arg1_3, + column_position: __arg1_4, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_4, __arg1_4) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::ModifyColumn { + col_name: __self_0, + data_type: __self_1, + options: __self_2, + column_position: __self_3, + }, + AlterTableOperation::ModifyColumn { + col_name: __arg1_0, + data_type: __arg1_1, + options: __arg1_2, + column_position: __arg1_3, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + AlterTableOperation::RenameConstraint { + old_name: __self_0, + new_name: __self_1, + }, + AlterTableOperation::RenameConstraint { + old_name: __arg1_0, + new_name: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::AlterColumn { + column_name: __self_0, + op: __self_1, + }, + AlterTableOperation::AlterColumn { + column_name: __arg1_0, + op: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterTableOperation::SwapWith { table_name: __self_0 }, + AlterTableOperation::SwapWith { table_name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::SetTblProperties { + table_properties: __self_0, + }, + AlterTableOperation::SetTblProperties { + table_properties: __arg1_0, + }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::OwnerTo { new_owner: __self_0 }, + AlterTableOperation::OwnerTo { new_owner: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterTableOperation::ClusterBy { exprs: __self_0 }, + AlterTableOperation::ClusterBy { exprs: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for AlterTableOperation { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + AlterTableOperation::AddConstraint(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::AddColumn { + column_keyword: __self_0, + if_not_exists: __self_1, + column_def: __self_2, + column_position: __self_3, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state) + } + AlterTableOperation::AddProjection { + if_not_exists: __self_0, + name: __self_1, + select: __self_2, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state) + } + AlterTableOperation::DropProjection { + if_exists: __self_0, + name: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::MaterializeProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state) + } + AlterTableOperation::ClearProjection { + if_exists: __self_0, + name: __self_1, + partition: __self_2, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state) + } + AlterTableOperation::DisableRule { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::DisableTrigger { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::DropConstraint { + if_exists: __self_0, + name: __self_1, + drop_behavior: __self_2, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state) + } + AlterTableOperation::DropColumn { + column_name: __self_0, + if_exists: __self_1, + drop_behavior: __self_2, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state) + } + AlterTableOperation::AttachPartition { partition: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::DetachPartition { partition: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::FreezePartition { + partition: __self_0, + with_name: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::UnfreezePartition { + partition: __self_0, + with_name: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::EnableAlwaysRule { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::EnableAlwaysTrigger { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::EnableReplicaRule { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::EnableReplicaTrigger { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::EnableRule { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::EnableTrigger { name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::RenamePartitions { + old_partitions: __self_0, + new_partitions: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::AddPartitions { + if_not_exists: __self_0, + new_partitions: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::DropPartitions { + partitions: __self_0, + if_exists: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::RenameColumn { + old_column_name: __self_0, + new_column_name: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::RenameTable { table_name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::ChangeColumn { + old_name: __self_0, + new_name: __self_1, + data_type: __self_2, + options: __self_3, + column_position: __self_4, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state); + ::core::hash::Hash::hash(__self_4, state) + } + AlterTableOperation::ModifyColumn { + col_name: __self_0, + data_type: __self_1, + options: __self_2, + column_position: __self_3, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state) + } + AlterTableOperation::RenameConstraint { + old_name: __self_0, + new_name: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::AlterColumn { + column_name: __self_0, + op: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterTableOperation::SwapWith { table_name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::SetTblProperties { + table_properties: __self_0, + } => ::core::hash::Hash::hash(__self_0, state), + AlterTableOperation::OwnerTo { new_owner: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterTableOperation::ClusterBy { exprs: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + /// An `ALTER Policy` (`Statement::AlterPolicy`) operation + /// + /// [PostgreSQL Documentation](https://www.postgresql.org/docs/current/sql-altertable.html) + pub enum AlterPolicyOperation { + Rename { new_name: Ident }, + Apply { + to: Option>, + using: Option, + with_check: Option, + }, + } + #[automatically_derived] + impl ::core::fmt::Debug for AlterPolicyOperation { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + AlterPolicyOperation::Rename { new_name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "Rename", + "new_name", + &__self_0, + ) + } + AlterPolicyOperation::Apply { + to: __self_0, + using: __self_1, + with_check: __self_2, + } => { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "Apply", + "to", + __self_0, + "using", + __self_1, + "with_check", + &__self_2, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for AlterPolicyOperation { + #[inline] + fn clone(&self) -> AlterPolicyOperation { + match self { + AlterPolicyOperation::Rename { new_name: __self_0 } => { + AlterPolicyOperation::Rename { + new_name: ::core::clone::Clone::clone(__self_0), + } + } + AlterPolicyOperation::Apply { + to: __self_0, + using: __self_1, + with_check: __self_2, + } => { + AlterPolicyOperation::Apply { + to: ::core::clone::Clone::clone(__self_0), + using: ::core::clone::Clone::clone(__self_1), + with_check: ::core::clone::Clone::clone(__self_2), + } + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for AlterPolicyOperation {} + #[automatically_derived] + impl ::core::cmp::PartialEq for AlterPolicyOperation { + #[inline] + fn eq(&self, other: &AlterPolicyOperation) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + AlterPolicyOperation::Rename { new_name: __self_0 }, + AlterPolicyOperation::Rename { new_name: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterPolicyOperation::Apply { + to: __self_0, + using: __self_1, + with_check: __self_2, + }, + AlterPolicyOperation::Apply { + to: __arg1_0, + using: __arg1_1, + with_check: __arg1_2, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 + } + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for AlterPolicyOperation { + #[inline] + fn partial_cmp( + &self, + other: &AlterPolicyOperation, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + AlterPolicyOperation::Rename { new_name: __self_0 }, + AlterPolicyOperation::Rename { new_name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterPolicyOperation::Apply { + to: __self_0, + using: __self_1, + with_check: __self_2, + }, + AlterPolicyOperation::Apply { + to: __arg1_0, + using: __arg1_1, + with_check: __arg1_2, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for AlterPolicyOperation { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for AlterPolicyOperation { + #[inline] + fn cmp(&self, other: &AlterPolicyOperation) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + AlterPolicyOperation::Rename { new_name: __self_0 }, + AlterPolicyOperation::Rename { new_name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterPolicyOperation::Apply { + to: __self_0, + using: __self_1, + with_check: __self_2, + }, + AlterPolicyOperation::Apply { + to: __arg1_0, + using: __arg1_1, + with_check: __arg1_2, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_2, __arg1_2) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for AlterPolicyOperation { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + AlterPolicyOperation::Rename { new_name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterPolicyOperation::Apply { + to: __self_0, + using: __self_1, + with_check: __self_2, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state) + } + } + } + } + impl fmt::Display for AlterPolicyOperation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + AlterPolicyOperation::Rename { new_name } => { + f.write_fmt(format_args!(" RENAME TO {0}", new_name)) + } + AlterPolicyOperation::Apply { to, using, with_check } => { + if let Some(to) = to { + f.write_fmt( + format_args!(" TO {0}", display_comma_separated(to)), + )?; + } + if let Some(using) = using { + f.write_fmt(format_args!(" USING ({0})", using))?; + } + if let Some(with_check) = with_check { + f.write_fmt(format_args!(" WITH CHECK ({0})", with_check))?; + } + Ok(()) + } + } + } + } + pub enum Owner { + Ident(Ident), + CurrentRole, + CurrentUser, + SessionUser, + } + #[automatically_derived] + impl ::core::fmt::Debug for Owner { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + Owner::Ident(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Ident", + &__self_0, + ) + } + Owner::CurrentRole => { + ::core::fmt::Formatter::write_str(f, "CurrentRole") + } + Owner::CurrentUser => { + ::core::fmt::Formatter::write_str(f, "CurrentUser") + } + Owner::SessionUser => { + ::core::fmt::Formatter::write_str(f, "SessionUser") + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for Owner { + #[inline] + fn clone(&self) -> Owner { + match self { + Owner::Ident(__self_0) => { + Owner::Ident(::core::clone::Clone::clone(__self_0)) + } + Owner::CurrentRole => Owner::CurrentRole, + Owner::CurrentUser => Owner::CurrentUser, + Owner::SessionUser => Owner::SessionUser, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for Owner {} + #[automatically_derived] + impl ::core::cmp::PartialEq for Owner { + #[inline] + fn eq(&self, other: &Owner) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + (Owner::Ident(__self_0), Owner::Ident(__arg1_0)) => { + __self_0 == __arg1_0 + } + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for Owner { + #[inline] + fn partial_cmp( + &self, + other: &Owner, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + (Owner::Ident(__self_0), Owner::Ident(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for Owner { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for Owner { + #[inline] + fn cmp(&self, other: &Owner) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + (Owner::Ident(__self_0), Owner::Ident(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for Owner { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + Owner::Ident(__self_0) => ::core::hash::Hash::hash(__self_0, state), + _ => {} + } + } + } + impl fmt::Display for Owner { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Owner::Ident(ident) => f.write_fmt(format_args!("{0}", ident)), + Owner::CurrentRole => f.write_fmt(format_args!("CURRENT_ROLE")), + Owner::CurrentUser => f.write_fmt(format_args!("CURRENT_USER")), + Owner::SessionUser => f.write_fmt(format_args!("SESSION_USER")), + } + } + } + pub enum AlterConnectorOwner { + User(Ident), + Role(Ident), + } + #[automatically_derived] + impl ::core::fmt::Debug for AlterConnectorOwner { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + AlterConnectorOwner::User(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "User", + &__self_0, + ) + } + AlterConnectorOwner::Role(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Role", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for AlterConnectorOwner { + #[inline] + fn clone(&self) -> AlterConnectorOwner { + match self { + AlterConnectorOwner::User(__self_0) => { + AlterConnectorOwner::User(::core::clone::Clone::clone(__self_0)) + } + AlterConnectorOwner::Role(__self_0) => { + AlterConnectorOwner::Role(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for AlterConnectorOwner {} + #[automatically_derived] + impl ::core::cmp::PartialEq for AlterConnectorOwner { + #[inline] + fn eq(&self, other: &AlterConnectorOwner) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + AlterConnectorOwner::User(__self_0), + AlterConnectorOwner::User(__arg1_0), + ) => __self_0 == __arg1_0, + ( + AlterConnectorOwner::Role(__self_0), + AlterConnectorOwner::Role(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for AlterConnectorOwner { + #[inline] + fn partial_cmp( + &self, + other: &AlterConnectorOwner, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + AlterConnectorOwner::User(__self_0), + AlterConnectorOwner::User(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterConnectorOwner::Role(__self_0), + AlterConnectorOwner::Role(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for AlterConnectorOwner { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for AlterConnectorOwner { + #[inline] + fn cmp(&self, other: &AlterConnectorOwner) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + AlterConnectorOwner::User(__self_0), + AlterConnectorOwner::User(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterConnectorOwner::Role(__self_0), + AlterConnectorOwner::Role(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for AlterConnectorOwner { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + AlterConnectorOwner::User(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterConnectorOwner::Role(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for AlterConnectorOwner { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + AlterConnectorOwner::User(ident) => { + f.write_fmt(format_args!("USER {0}", ident)) + } + AlterConnectorOwner::Role(ident) => { + f.write_fmt(format_args!("ROLE {0}", ident)) + } + } + } + } + pub enum AlterIndexOperation { + RenameIndex { index_name: ObjectName }, + } + #[automatically_derived] + impl ::core::fmt::Debug for AlterIndexOperation { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + AlterIndexOperation::RenameIndex { index_name: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "RenameIndex", + "index_name", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for AlterIndexOperation { + #[inline] + fn clone(&self) -> AlterIndexOperation { + match self { + AlterIndexOperation::RenameIndex { index_name: __self_0 } => { + AlterIndexOperation::RenameIndex { + index_name: ::core::clone::Clone::clone(__self_0), + } + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for AlterIndexOperation {} + #[automatically_derived] + impl ::core::cmp::PartialEq for AlterIndexOperation { + #[inline] + fn eq(&self, other: &AlterIndexOperation) -> bool { + match (self, other) { + ( + AlterIndexOperation::RenameIndex { index_name: __self_0 }, + AlterIndexOperation::RenameIndex { index_name: __arg1_0 }, + ) => __self_0 == __arg1_0, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for AlterIndexOperation { + #[inline] + fn partial_cmp( + &self, + other: &AlterIndexOperation, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match (self, other) { + ( + AlterIndexOperation::RenameIndex { index_name: __self_0 }, + AlterIndexOperation::RenameIndex { index_name: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for AlterIndexOperation { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for AlterIndexOperation { + #[inline] + fn cmp(&self, other: &AlterIndexOperation) -> ::core::cmp::Ordering { + match (self, other) { + ( + AlterIndexOperation::RenameIndex { index_name: __self_0 }, + AlterIndexOperation::RenameIndex { index_name: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for AlterIndexOperation { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + match self { + AlterIndexOperation::RenameIndex { index_name: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for AlterTableOperation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + AlterTableOperation::AddPartitions { + if_not_exists, + new_partitions, + } => { + f.write_fmt( + format_args!( + "ADD{1} {0}", + display_separated(new_partitions, " "), + if *if_not_exists { " IF NOT EXISTS" } else { "" }, + ), + ) + } + AlterTableOperation::AddConstraint(c) => { + f.write_fmt(format_args!("ADD {0}", c)) + } + AlterTableOperation::AddColumn { + column_keyword, + if_not_exists, + column_def, + column_position, + } => { + f.write_fmt(format_args!("ADD"))?; + if *column_keyword { + f.write_fmt(format_args!(" COLUMN"))?; + } + if *if_not_exists { + f.write_fmt(format_args!(" IF NOT EXISTS"))?; + } + f.write_fmt(format_args!(" {0}", column_def))?; + if let Some(position) = column_position { + f.write_fmt(format_args!(" {0}", position))?; + } + Ok(()) + } + AlterTableOperation::AddProjection { + if_not_exists, + name, + select: query, + } => { + f.write_fmt(format_args!("ADD PROJECTION"))?; + if *if_not_exists { + f.write_fmt(format_args!(" IF NOT EXISTS"))?; + } + f.write_fmt(format_args!(" {0} ({1})", name, query)) + } + AlterTableOperation::DropProjection { if_exists, name } => { + f.write_fmt(format_args!("DROP PROJECTION"))?; + if *if_exists { + f.write_fmt(format_args!(" IF EXISTS"))?; + } + f.write_fmt(format_args!(" {0}", name)) + } + AlterTableOperation::MaterializeProjection { + if_exists, + name, + partition, + } => { + f.write_fmt(format_args!("MATERIALIZE PROJECTION"))?; + if *if_exists { + f.write_fmt(format_args!(" IF EXISTS"))?; + } + f.write_fmt(format_args!(" {0}", name))?; + if let Some(partition) = partition { + f.write_fmt(format_args!(" IN PARTITION {0}", partition))?; + } + Ok(()) + } + AlterTableOperation::ClearProjection { + if_exists, + name, + partition, + } => { + f.write_fmt(format_args!("CLEAR PROJECTION"))?; + if *if_exists { + f.write_fmt(format_args!(" IF EXISTS"))?; + } + f.write_fmt(format_args!(" {0}", name))?; + if let Some(partition) = partition { + f.write_fmt(format_args!(" IN PARTITION {0}", partition))?; + } + Ok(()) + } + AlterTableOperation::AlterColumn { column_name, op } => { + f.write_fmt( + format_args!("ALTER COLUMN {0} {1}", column_name, op), + ) + } + AlterTableOperation::DisableRowLevelSecurity => { + f.write_fmt(format_args!("DISABLE ROW LEVEL SECURITY")) + } + AlterTableOperation::DisableRule { name } => { + f.write_fmt(format_args!("DISABLE RULE {0}", name)) + } + AlterTableOperation::DisableTrigger { name } => { + f.write_fmt(format_args!("DISABLE TRIGGER {0}", name)) + } + AlterTableOperation::DropPartitions { partitions, if_exists } => { + f.write_fmt( + format_args!( + "DROP{1} PARTITION ({0})", + display_comma_separated(partitions), + if *if_exists { " IF EXISTS" } else { "" }, + ), + ) + } + AlterTableOperation::DropConstraint { + if_exists, + name, + drop_behavior, + } => { + f.write_fmt( + format_args!( + "DROP CONSTRAINT {0}{1}{2}", + if *if_exists { "IF EXISTS " } else { "" }, + name, + match drop_behavior { + None => "", + Some(DropBehavior::Restrict) => " RESTRICT", + Some(DropBehavior::Cascade) => " CASCADE", + }, + ), + ) + } + AlterTableOperation::DropPrimaryKey => { + f.write_fmt(format_args!("DROP PRIMARY KEY")) + } + AlterTableOperation::DropColumn { + column_name, + if_exists, + drop_behavior, + } => { + f.write_fmt( + format_args!( + "DROP COLUMN {0}{1}{2}", + if *if_exists { "IF EXISTS " } else { "" }, + column_name, + match drop_behavior { + None => "", + Some(DropBehavior::Restrict) => " RESTRICT", + Some(DropBehavior::Cascade) => " CASCADE", + }, + ), + ) + } + AlterTableOperation::AttachPartition { partition } => { + f.write_fmt(format_args!("ATTACH {0}", partition)) + } + AlterTableOperation::DetachPartition { partition } => { + f.write_fmt(format_args!("DETACH {0}", partition)) + } + AlterTableOperation::EnableAlwaysRule { name } => { + f.write_fmt(format_args!("ENABLE ALWAYS RULE {0}", name)) + } + AlterTableOperation::EnableAlwaysTrigger { name } => { + f.write_fmt(format_args!("ENABLE ALWAYS TRIGGER {0}", name)) + } + AlterTableOperation::EnableReplicaRule { name } => { + f.write_fmt(format_args!("ENABLE REPLICA RULE {0}", name)) + } + AlterTableOperation::EnableReplicaTrigger { name } => { + f.write_fmt(format_args!("ENABLE REPLICA TRIGGER {0}", name)) + } + AlterTableOperation::EnableRowLevelSecurity => { + f.write_fmt(format_args!("ENABLE ROW LEVEL SECURITY")) + } + AlterTableOperation::EnableRule { name } => { + f.write_fmt(format_args!("ENABLE RULE {0}", name)) + } + AlterTableOperation::EnableTrigger { name } => { + f.write_fmt(format_args!("ENABLE TRIGGER {0}", name)) + } + AlterTableOperation::RenamePartitions { + old_partitions, + new_partitions, + } => { + f.write_fmt( + format_args!( + "PARTITION ({0}) RENAME TO PARTITION ({1})", + display_comma_separated(old_partitions), + display_comma_separated(new_partitions), + ), + ) + } + AlterTableOperation::RenameColumn { + old_column_name, + new_column_name, + } => { + f.write_fmt( + format_args!( + "RENAME COLUMN {0} TO {1}", + old_column_name, + new_column_name, + ), + ) + } + AlterTableOperation::RenameTable { table_name } => { + f.write_fmt(format_args!("RENAME TO {0}", table_name)) + } + AlterTableOperation::ChangeColumn { + old_name, + new_name, + data_type, + options, + column_position, + } => { + f.write_fmt( + format_args!( + "CHANGE COLUMN {0} {1} {2}", + old_name, + new_name, + data_type, + ), + )?; + if !options.is_empty() { + f.write_fmt( + format_args!(" {0}", display_separated(options, " ")), + )?; + } + if let Some(position) = column_position { + f.write_fmt(format_args!(" {0}", position))?; + } + Ok(()) + } + AlterTableOperation::ModifyColumn { + col_name, + data_type, + options, + column_position, + } => { + f.write_fmt( + format_args!("MODIFY COLUMN {0} {1}", col_name, data_type), + )?; + if !options.is_empty() { + f.write_fmt( + format_args!(" {0}", display_separated(options, " ")), + )?; + } + if let Some(position) = column_position { + f.write_fmt(format_args!(" {0}", position))?; + } + Ok(()) + } + AlterTableOperation::RenameConstraint { old_name, new_name } => { + f.write_fmt( + format_args!( + "RENAME CONSTRAINT {0} TO {1}", + old_name, + new_name, + ), + ) + } + AlterTableOperation::SwapWith { table_name } => { + f.write_fmt(format_args!("SWAP WITH {0}", table_name)) + } + AlterTableOperation::OwnerTo { new_owner } => { + f.write_fmt(format_args!("OWNER TO {0}", new_owner)) + } + AlterTableOperation::SetTblProperties { table_properties } => { + f.write_fmt( + format_args!( + "SET TBLPROPERTIES({0})", + display_comma_separated(table_properties), + ), + ) + } + AlterTableOperation::FreezePartition { partition, with_name } => { + f.write_fmt(format_args!("FREEZE {0}", partition))?; + if let Some(name) = with_name { + f.write_fmt(format_args!(" WITH NAME {0}", name))?; + } + Ok(()) + } + AlterTableOperation::UnfreezePartition { partition, with_name } => { + f.write_fmt(format_args!("UNFREEZE {0}", partition))?; + if let Some(name) = with_name { + f.write_fmt(format_args!(" WITH NAME {0}", name))?; + } + Ok(()) + } + AlterTableOperation::ClusterBy { exprs } => { + f.write_fmt( + format_args!( + "CLUSTER BY ({0})", + display_comma_separated(exprs), + ), + )?; + Ok(()) + } + AlterTableOperation::DropClusteringKey => { + f.write_fmt(format_args!("DROP CLUSTERING KEY"))?; + Ok(()) + } + AlterTableOperation::SuspendRecluster => { + f.write_fmt(format_args!("SUSPEND RECLUSTER"))?; + Ok(()) + } + AlterTableOperation::ResumeRecluster => { + f.write_fmt(format_args!("RESUME RECLUSTER"))?; + Ok(()) + } + } + } + } + impl fmt::Display for AlterIndexOperation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + AlterIndexOperation::RenameIndex { index_name } => { + f.write_fmt(format_args!("RENAME TO {0}", index_name)) + } + } + } + } + /// An `ALTER COLUMN` (`Statement::AlterTable`) operation + pub enum AlterColumnOperation { + /// `SET NOT NULL` + SetNotNull, + /// `DROP NOT NULL` + DropNotNull, + /// `SET DEFAULT ` + SetDefault { value: Expr }, + /// `DROP DEFAULT` + DropDefault, + /// `[SET DATA] TYPE [USING ]` + SetDataType { + data_type: DataType, + /// PostgreSQL specific + using: Option, + }, + /// `ADD GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( sequence_options ) ]` + /// + /// Note: this is a PostgreSQL-specific operation. + AddGenerated { + generated_as: Option, + sequence_options: Option>, + }, + } + #[automatically_derived] + impl ::core::fmt::Debug for AlterColumnOperation { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + AlterColumnOperation::SetNotNull => { + ::core::fmt::Formatter::write_str(f, "SetNotNull") + } + AlterColumnOperation::DropNotNull => { + ::core::fmt::Formatter::write_str(f, "DropNotNull") + } + AlterColumnOperation::SetDefault { value: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "SetDefault", + "value", + &__self_0, + ) + } + AlterColumnOperation::DropDefault => { + ::core::fmt::Formatter::write_str(f, "DropDefault") + } + AlterColumnOperation::SetDataType { + data_type: __self_0, + using: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "SetDataType", + "data_type", + __self_0, + "using", + &__self_1, + ) + } + AlterColumnOperation::AddGenerated { + generated_as: __self_0, + sequence_options: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "AddGenerated", + "generated_as", + __self_0, + "sequence_options", + &__self_1, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for AlterColumnOperation { + #[inline] + fn clone(&self) -> AlterColumnOperation { + match self { + AlterColumnOperation::SetNotNull => AlterColumnOperation::SetNotNull, + AlterColumnOperation::DropNotNull => { + AlterColumnOperation::DropNotNull + } + AlterColumnOperation::SetDefault { value: __self_0 } => { + AlterColumnOperation::SetDefault { + value: ::core::clone::Clone::clone(__self_0), + } + } + AlterColumnOperation::DropDefault => { + AlterColumnOperation::DropDefault + } + AlterColumnOperation::SetDataType { + data_type: __self_0, + using: __self_1, + } => { + AlterColumnOperation::SetDataType { + data_type: ::core::clone::Clone::clone(__self_0), + using: ::core::clone::Clone::clone(__self_1), + } + } + AlterColumnOperation::AddGenerated { + generated_as: __self_0, + sequence_options: __self_1, + } => { + AlterColumnOperation::AddGenerated { + generated_as: ::core::clone::Clone::clone(__self_0), + sequence_options: ::core::clone::Clone::clone(__self_1), + } + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for AlterColumnOperation {} + #[automatically_derived] + impl ::core::cmp::PartialEq for AlterColumnOperation { + #[inline] + fn eq(&self, other: &AlterColumnOperation) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + AlterColumnOperation::SetDefault { value: __self_0 }, + AlterColumnOperation::SetDefault { value: __arg1_0 }, + ) => __self_0 == __arg1_0, + ( + AlterColumnOperation::SetDataType { + data_type: __self_0, + using: __self_1, + }, + AlterColumnOperation::SetDataType { + data_type: __arg1_0, + using: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + AlterColumnOperation::AddGenerated { + generated_as: __self_0, + sequence_options: __self_1, + }, + AlterColumnOperation::AddGenerated { + generated_as: __arg1_0, + sequence_options: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for AlterColumnOperation { + #[inline] + fn partial_cmp( + &self, + other: &AlterColumnOperation, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + AlterColumnOperation::SetDefault { value: __self_0 }, + AlterColumnOperation::SetDefault { value: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + AlterColumnOperation::SetDataType { + data_type: __self_0, + using: __self_1, + }, + AlterColumnOperation::SetDataType { + data_type: __arg1_0, + using: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + AlterColumnOperation::AddGenerated { + generated_as: __self_0, + sequence_options: __self_1, + }, + AlterColumnOperation::AddGenerated { + generated_as: __arg1_0, + sequence_options: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for AlterColumnOperation { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for AlterColumnOperation { + #[inline] + fn cmp(&self, other: &AlterColumnOperation) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + AlterColumnOperation::SetDefault { value: __self_0 }, + AlterColumnOperation::SetDefault { value: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + AlterColumnOperation::SetDataType { + data_type: __self_0, + using: __self_1, + }, + AlterColumnOperation::SetDataType { + data_type: __arg1_0, + using: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + AlterColumnOperation::AddGenerated { + generated_as: __self_0, + sequence_options: __self_1, + }, + AlterColumnOperation::AddGenerated { + generated_as: __arg1_0, + sequence_options: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for AlterColumnOperation { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + AlterColumnOperation::SetDefault { value: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + AlterColumnOperation::SetDataType { + data_type: __self_0, + using: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + AlterColumnOperation::AddGenerated { + generated_as: __self_0, + sequence_options: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + _ => {} + } + } + } + impl fmt::Display for AlterColumnOperation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + AlterColumnOperation::SetNotNull => { + f.write_fmt(format_args!("SET NOT NULL")) + } + AlterColumnOperation::DropNotNull => { + f.write_fmt(format_args!("DROP NOT NULL")) + } + AlterColumnOperation::SetDefault { value } => { + f.write_fmt(format_args!("SET DEFAULT {0}", value)) + } + AlterColumnOperation::DropDefault {} => { + f.write_fmt(format_args!("DROP DEFAULT")) + } + AlterColumnOperation::SetDataType { data_type, using } => { + if let Some(expr) = using { + f.write_fmt( + format_args!("SET DATA TYPE {0} USING {1}", data_type, expr), + ) + } else { + f.write_fmt(format_args!("SET DATA TYPE {0}", data_type)) + } + } + AlterColumnOperation::AddGenerated { + generated_as, + sequence_options, + } => { + let generated_as = match generated_as { + Some(GeneratedAs::Always) => " ALWAYS", + Some(GeneratedAs::ByDefault) => " BY DEFAULT", + _ => "", + }; + f.write_fmt( + format_args!("ADD GENERATED{0} AS IDENTITY", generated_as), + )?; + if let Some(options) = sequence_options { + f.write_fmt(format_args!(" ("))?; + for sequence_option in options { + f.write_fmt(format_args!("{0}", sequence_option))?; + } + f.write_fmt(format_args!(" )"))?; + } + Ok(()) + } + } + } + } + /// A table-level constraint, specified in a `CREATE TABLE` or an + /// `ALTER TABLE ADD ` statement. + pub enum TableConstraint { + /// MySQL [definition][1] for `UNIQUE` constraints statements:\ + /// * `[CONSTRAINT []] UNIQUE [] [index_type] () ` + /// + /// where: + /// * [index_type][2] is `USING {BTREE | HASH}` + /// * [index_options][3] is `{index_type | COMMENT 'string' | ... %currently unsupported stmts% } ...` + /// * [index_type_display][4] is `[INDEX | KEY]` + /// + /// [1]: https://dev.mysql.com/doc/refman/8.3/en/create-table.html + /// [2]: IndexType + /// [3]: IndexOption + /// [4]: KeyOrIndexDisplay + Unique { + /// Constraint name. + /// + /// Can be not the same as `index_name` + name: Option, + /// Index name + index_name: Option, + /// Whether the type is followed by the keyword `KEY`, `INDEX`, or no keyword at all. + index_type_display: KeyOrIndexDisplay, + /// Optional `USING` of [index type][1] statement before columns. + /// + /// [1]: IndexType + index_type: Option, + /// Identifiers of the columns that are unique. + columns: Vec, + index_options: Vec, + characteristics: Option, + /// Optional Postgres nulls handling: `[ NULLS [ NOT ] DISTINCT ]` + nulls_distinct: NullsDistinctOption, + }, + /// MySQL [definition][1] for `PRIMARY KEY` constraints statements:\ + /// * `[CONSTRAINT []] PRIMARY KEY [index_name] [index_type] () ` + /// + /// Actually the specification have no `[index_name]` but the next query will complete successfully: + /// ```sql + /// CREATE TABLE unspec_table ( + /// xid INT NOT NULL, + /// CONSTRAINT p_name PRIMARY KEY index_name USING BTREE (xid) + /// ); + /// ``` + /// + /// where: + /// * [index_type][2] is `USING {BTREE | HASH}` + /// * [index_options][3] is `{index_type | COMMENT 'string' | ... %currently unsupported stmts% } ...` + /// + /// [1]: https://dev.mysql.com/doc/refman/8.3/en/create-table.html + /// [2]: IndexType + /// [3]: IndexOption + PrimaryKey { + /// Constraint name. + /// + /// Can be not the same as `index_name` + name: Option, + /// Index name + index_name: Option, + /// Optional `USING` of [index type][1] statement before columns. + /// + /// [1]: IndexType + index_type: Option, + /// Identifiers of the columns that form the primary key. + columns: Vec, + index_options: Vec, + characteristics: Option, + }, + /// A referential integrity constraint (`[ CONSTRAINT ] FOREIGN KEY () + /// REFERENCES () + /// { [ON DELETE ] [ON UPDATE ] | + /// [ON UPDATE ] [ON DELETE ] + /// }`). + ForeignKey { + name: Option, + columns: Vec, + foreign_table: ObjectName, + referred_columns: Vec, + on_delete: Option, + on_update: Option, + characteristics: Option, + }, + /// `[ CONSTRAINT ] CHECK ()` + Check { name: Option, expr: Box }, + /// MySQLs [index definition][1] for index creation. Not present on ANSI so, for now, the usage + /// is restricted to MySQL, as no other dialects that support this syntax were found. + /// + /// `{INDEX | KEY} [index_name] [index_type] (key_part,...) [index_option]...` + /// + /// [1]: https://dev.mysql.com/doc/refman/8.0/en/create-table.html + Index { + /// Whether this index starts with KEY (true) or INDEX (false), to maintain the same syntax. + display_as_key: bool, + /// Index name. + name: Option, + /// Optional [index type][1]. + /// + /// [1]: IndexType + index_type: Option, + /// Referred column identifier list. + columns: Vec, + }, + /// MySQLs [fulltext][1] definition. Since the [`SPATIAL`][2] definition is exactly the same, + /// and MySQL displays both the same way, it is part of this definition as well. + /// + /// Supported syntax: + /// + /// ```markdown + /// {FULLTEXT | SPATIAL} [INDEX | KEY] [index_name] (key_part,...) + /// + /// key_part: col_name + /// ``` + /// + /// [1]: https://dev.mysql.com/doc/refman/8.0/en/fulltext-natural-language.html + /// [2]: https://dev.mysql.com/doc/refman/8.0/en/spatial-types.html + FulltextOrSpatial { + /// Whether this is a `FULLTEXT` (true) or `SPATIAL` (false) definition. + fulltext: bool, + /// Whether the type is followed by the keyword `KEY`, `INDEX`, or no keyword at all. + index_type_display: KeyOrIndexDisplay, + /// Optional index name. + opt_index_name: Option, + /// Referred column identifier list. + columns: Vec, + }, + } + #[automatically_derived] + impl ::core::fmt::Debug for TableConstraint { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + TableConstraint::Unique { + name: __self_0, + index_name: __self_1, + index_type_display: __self_2, + index_type: __self_3, + columns: __self_4, + index_options: __self_5, + characteristics: __self_6, + nulls_distinct: __self_7, + } => { + let names: &'static _ = &[ + "name", + "index_name", + "index_type_display", + "index_type", + "columns", + "index_options", + "characteristics", + "nulls_distinct", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + __self_0, + __self_1, + __self_2, + __self_3, + __self_4, + __self_5, + __self_6, + &__self_7, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "Unique", + names, + values, + ) + } + TableConstraint::PrimaryKey { + name: __self_0, + index_name: __self_1, + index_type: __self_2, + columns: __self_3, + index_options: __self_4, + characteristics: __self_5, + } => { + let names: &'static _ = &[ + "name", + "index_name", + "index_type", + "columns", + "index_options", + "characteristics", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + __self_0, + __self_1, + __self_2, + __self_3, + __self_4, + &__self_5, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "PrimaryKey", + names, + values, + ) + } + TableConstraint::ForeignKey { + name: __self_0, + columns: __self_1, + foreign_table: __self_2, + referred_columns: __self_3, + on_delete: __self_4, + on_update: __self_5, + characteristics: __self_6, + } => { + let names: &'static _ = &[ + "name", + "columns", + "foreign_table", + "referred_columns", + "on_delete", + "on_update", + "characteristics", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + __self_0, + __self_1, + __self_2, + __self_3, + __self_4, + __self_5, + &__self_6, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "ForeignKey", + names, + values, + ) + } + TableConstraint::Check { name: __self_0, expr: __self_1 } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "Check", + "name", + __self_0, + "expr", + &__self_1, + ) + } + TableConstraint::Index { + display_as_key: __self_0, + name: __self_1, + index_type: __self_2, + columns: __self_3, + } => { + ::core::fmt::Formatter::debug_struct_field4_finish( + f, + "Index", + "display_as_key", + __self_0, + "name", + __self_1, + "index_type", + __self_2, + "columns", + &__self_3, + ) + } + TableConstraint::FulltextOrSpatial { + fulltext: __self_0, + index_type_display: __self_1, + opt_index_name: __self_2, + columns: __self_3, + } => { + ::core::fmt::Formatter::debug_struct_field4_finish( + f, + "FulltextOrSpatial", + "fulltext", + __self_0, + "index_type_display", + __self_1, + "opt_index_name", + __self_2, + "columns", + &__self_3, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for TableConstraint { + #[inline] + fn clone(&self) -> TableConstraint { + match self { + TableConstraint::Unique { + name: __self_0, + index_name: __self_1, + index_type_display: __self_2, + index_type: __self_3, + columns: __self_4, + index_options: __self_5, + characteristics: __self_6, + nulls_distinct: __self_7, + } => { + TableConstraint::Unique { + name: ::core::clone::Clone::clone(__self_0), + index_name: ::core::clone::Clone::clone(__self_1), + index_type_display: ::core::clone::Clone::clone(__self_2), + index_type: ::core::clone::Clone::clone(__self_3), + columns: ::core::clone::Clone::clone(__self_4), + index_options: ::core::clone::Clone::clone(__self_5), + characteristics: ::core::clone::Clone::clone(__self_6), + nulls_distinct: ::core::clone::Clone::clone(__self_7), + } + } + TableConstraint::PrimaryKey { + name: __self_0, + index_name: __self_1, + index_type: __self_2, + columns: __self_3, + index_options: __self_4, + characteristics: __self_5, + } => { + TableConstraint::PrimaryKey { + name: ::core::clone::Clone::clone(__self_0), + index_name: ::core::clone::Clone::clone(__self_1), + index_type: ::core::clone::Clone::clone(__self_2), + columns: ::core::clone::Clone::clone(__self_3), + index_options: ::core::clone::Clone::clone(__self_4), + characteristics: ::core::clone::Clone::clone(__self_5), + } + } + TableConstraint::ForeignKey { + name: __self_0, + columns: __self_1, + foreign_table: __self_2, + referred_columns: __self_3, + on_delete: __self_4, + on_update: __self_5, + characteristics: __self_6, + } => { + TableConstraint::ForeignKey { + name: ::core::clone::Clone::clone(__self_0), + columns: ::core::clone::Clone::clone(__self_1), + foreign_table: ::core::clone::Clone::clone(__self_2), + referred_columns: ::core::clone::Clone::clone(__self_3), + on_delete: ::core::clone::Clone::clone(__self_4), + on_update: ::core::clone::Clone::clone(__self_5), + characteristics: ::core::clone::Clone::clone(__self_6), + } + } + TableConstraint::Check { name: __self_0, expr: __self_1 } => { + TableConstraint::Check { + name: ::core::clone::Clone::clone(__self_0), + expr: ::core::clone::Clone::clone(__self_1), + } + } + TableConstraint::Index { + display_as_key: __self_0, + name: __self_1, + index_type: __self_2, + columns: __self_3, + } => { + TableConstraint::Index { + display_as_key: ::core::clone::Clone::clone(__self_0), + name: ::core::clone::Clone::clone(__self_1), + index_type: ::core::clone::Clone::clone(__self_2), + columns: ::core::clone::Clone::clone(__self_3), + } + } + TableConstraint::FulltextOrSpatial { + fulltext: __self_0, + index_type_display: __self_1, + opt_index_name: __self_2, + columns: __self_3, + } => { + TableConstraint::FulltextOrSpatial { + fulltext: ::core::clone::Clone::clone(__self_0), + index_type_display: ::core::clone::Clone::clone(__self_1), + opt_index_name: ::core::clone::Clone::clone(__self_2), + columns: ::core::clone::Clone::clone(__self_3), + } + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for TableConstraint {} + #[automatically_derived] + impl ::core::cmp::PartialEq for TableConstraint { + #[inline] + fn eq(&self, other: &TableConstraint) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + TableConstraint::Unique { + name: __self_0, + index_name: __self_1, + index_type_display: __self_2, + index_type: __self_3, + columns: __self_4, + index_options: __self_5, + characteristics: __self_6, + nulls_distinct: __self_7, + }, + TableConstraint::Unique { + name: __arg1_0, + index_name: __arg1_1, + index_type_display: __arg1_2, + index_type: __arg1_3, + columns: __arg1_4, + index_options: __arg1_5, + characteristics: __arg1_6, + nulls_distinct: __arg1_7, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + && __self_4 == __arg1_4 && __self_5 == __arg1_5 + && __self_6 == __arg1_6 && __self_7 == __arg1_7 + } + ( + TableConstraint::PrimaryKey { + name: __self_0, + index_name: __self_1, + index_type: __self_2, + columns: __self_3, + index_options: __self_4, + characteristics: __self_5, + }, + TableConstraint::PrimaryKey { + name: __arg1_0, + index_name: __arg1_1, + index_type: __arg1_2, + columns: __arg1_3, + index_options: __arg1_4, + characteristics: __arg1_5, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + && __self_4 == __arg1_4 && __self_5 == __arg1_5 + } + ( + TableConstraint::ForeignKey { + name: __self_0, + columns: __self_1, + foreign_table: __self_2, + referred_columns: __self_3, + on_delete: __self_4, + on_update: __self_5, + characteristics: __self_6, + }, + TableConstraint::ForeignKey { + name: __arg1_0, + columns: __arg1_1, + foreign_table: __arg1_2, + referred_columns: __arg1_3, + on_delete: __arg1_4, + on_update: __arg1_5, + characteristics: __arg1_6, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + && __self_4 == __arg1_4 && __self_5 == __arg1_5 + && __self_6 == __arg1_6 + } + ( + TableConstraint::Check { name: __self_0, expr: __self_1 }, + TableConstraint::Check { name: __arg1_0, expr: __arg1_1 }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + TableConstraint::Index { + display_as_key: __self_0, + name: __self_1, + index_type: __self_2, + columns: __self_3, + }, + TableConstraint::Index { + display_as_key: __arg1_0, + name: __arg1_1, + index_type: __arg1_2, + columns: __arg1_3, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + } + ( + TableConstraint::FulltextOrSpatial { + fulltext: __self_0, + index_type_display: __self_1, + opt_index_name: __self_2, + columns: __self_3, + }, + TableConstraint::FulltextOrSpatial { + fulltext: __arg1_0, + index_type_display: __arg1_1, + opt_index_name: __arg1_2, + columns: __arg1_3, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + } + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for TableConstraint { + #[inline] + fn partial_cmp( + &self, + other: &TableConstraint, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + TableConstraint::Unique { + name: __self_0, + index_name: __self_1, + index_type_display: __self_2, + index_type: __self_3, + columns: __self_4, + index_options: __self_5, + characteristics: __self_6, + nulls_distinct: __self_7, + }, + TableConstraint::Unique { + name: __arg1_0, + index_name: __arg1_1, + index_type_display: __arg1_2, + index_type: __arg1_3, + columns: __arg1_4, + index_options: __arg1_5, + characteristics: __arg1_6, + nulls_distinct: __arg1_7, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_3, + __arg1_3, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_4, + __arg1_4, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_5, + __arg1_5, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_6, + __arg1_6, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_7, __arg1_7) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::PrimaryKey { + name: __self_0, + index_name: __self_1, + index_type: __self_2, + columns: __self_3, + index_options: __self_4, + characteristics: __self_5, + }, + TableConstraint::PrimaryKey { + name: __arg1_0, + index_name: __arg1_1, + index_type: __arg1_2, + columns: __arg1_3, + index_options: __arg1_4, + characteristics: __arg1_5, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_3, + __arg1_3, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_4, + __arg1_4, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::ForeignKey { + name: __self_0, + columns: __self_1, + foreign_table: __self_2, + referred_columns: __self_3, + on_delete: __self_4, + on_update: __self_5, + characteristics: __self_6, + }, + TableConstraint::ForeignKey { + name: __arg1_0, + columns: __arg1_1, + foreign_table: __arg1_2, + referred_columns: __arg1_3, + on_delete: __arg1_4, + on_update: __arg1_5, + characteristics: __arg1_6, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_3, + __arg1_3, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_4, + __arg1_4, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_5, + __arg1_5, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_6, __arg1_6) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::Check { name: __self_0, expr: __self_1 }, + TableConstraint::Check { name: __arg1_0, expr: __arg1_1 }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + TableConstraint::Index { + display_as_key: __self_0, + name: __self_1, + index_type: __self_2, + columns: __self_3, + }, + TableConstraint::Index { + display_as_key: __arg1_0, + name: __arg1_1, + index_type: __arg1_2, + columns: __arg1_3, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::FulltextOrSpatial { + fulltext: __self_0, + index_type_display: __self_1, + opt_index_name: __self_2, + columns: __self_3, + }, + TableConstraint::FulltextOrSpatial { + fulltext: __arg1_0, + index_type_display: __arg1_1, + opt_index_name: __arg1_2, + columns: __arg1_3, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for TableConstraint { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for TableConstraint { + #[inline] + fn cmp(&self, other: &TableConstraint) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + TableConstraint::Unique { + name: __self_0, + index_name: __self_1, + index_type_display: __self_2, + index_type: __self_3, + columns: __self_4, + index_options: __self_5, + characteristics: __self_6, + nulls_distinct: __self_7, + }, + TableConstraint::Unique { + name: __arg1_0, + index_name: __arg1_1, + index_type_display: __arg1_2, + index_type: __arg1_3, + columns: __arg1_4, + index_options: __arg1_5, + characteristics: __arg1_6, + nulls_distinct: __arg1_7, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_7, __arg1_7) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::PrimaryKey { + name: __self_0, + index_name: __self_1, + index_type: __self_2, + columns: __self_3, + index_options: __self_4, + characteristics: __self_5, + }, + TableConstraint::PrimaryKey { + name: __arg1_0, + index_name: __arg1_1, + index_type: __arg1_2, + columns: __arg1_3, + index_options: __arg1_4, + characteristics: __arg1_5, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_5, __arg1_5) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::ForeignKey { + name: __self_0, + columns: __self_1, + foreign_table: __self_2, + referred_columns: __self_3, + on_delete: __self_4, + on_update: __self_5, + characteristics: __self_6, + }, + TableConstraint::ForeignKey { + name: __arg1_0, + columns: __arg1_1, + foreign_table: __arg1_2, + referred_columns: __arg1_3, + on_delete: __arg1_4, + on_update: __arg1_5, + characteristics: __arg1_6, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_6, __arg1_6) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::Check { name: __self_0, expr: __self_1 }, + TableConstraint::Check { name: __arg1_0, expr: __arg1_1 }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + TableConstraint::Index { + display_as_key: __self_0, + name: __self_1, + index_type: __self_2, + columns: __self_3, + }, + TableConstraint::Index { + display_as_key: __arg1_0, + name: __arg1_1, + index_type: __arg1_2, + columns: __arg1_3, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + TableConstraint::FulltextOrSpatial { + fulltext: __self_0, + index_type_display: __self_1, + opt_index_name: __self_2, + columns: __self_3, + }, + TableConstraint::FulltextOrSpatial { + fulltext: __arg1_0, + index_type_display: __arg1_1, + opt_index_name: __arg1_2, + columns: __arg1_3, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_3, __arg1_3) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for TableConstraint { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + TableConstraint::Unique { + name: __self_0, + index_name: __self_1, + index_type_display: __self_2, + index_type: __self_3, + columns: __self_4, + index_options: __self_5, + characteristics: __self_6, + nulls_distinct: __self_7, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state); + ::core::hash::Hash::hash(__self_4, state); + ::core::hash::Hash::hash(__self_5, state); + ::core::hash::Hash::hash(__self_6, state); + ::core::hash::Hash::hash(__self_7, state) + } + TableConstraint::PrimaryKey { + name: __self_0, + index_name: __self_1, + index_type: __self_2, + columns: __self_3, + index_options: __self_4, + characteristics: __self_5, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state); + ::core::hash::Hash::hash(__self_4, state); + ::core::hash::Hash::hash(__self_5, state) + } + TableConstraint::ForeignKey { + name: __self_0, + columns: __self_1, + foreign_table: __self_2, + referred_columns: __self_3, + on_delete: __self_4, + on_update: __self_5, + characteristics: __self_6, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state); + ::core::hash::Hash::hash(__self_4, state); + ::core::hash::Hash::hash(__self_5, state); + ::core::hash::Hash::hash(__self_6, state) + } + TableConstraint::Check { name: __self_0, expr: __self_1 } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + TableConstraint::Index { + display_as_key: __self_0, + name: __self_1, + index_type: __self_2, + columns: __self_3, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state) + } + TableConstraint::FulltextOrSpatial { + fulltext: __self_0, + index_type_display: __self_1, + opt_index_name: __self_2, + columns: __self_3, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state) + } + } + } + } + impl fmt::Display for TableConstraint { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + TableConstraint::Unique { + name, + index_name, + index_type_display, + index_type, + columns, + index_options, + characteristics, + nulls_distinct, + } => { + f.write_fmt( + format_args!( + "{0}UNIQUE{4}{5:>}{1}{2} ({3})", + display_constraint_name(name), + display_option_spaced(index_name), + display_option(" USING ", "", index_type), + display_comma_separated(columns), + nulls_distinct, + index_type_display, + ), + )?; + if !index_options.is_empty() { + f.write_fmt( + format_args!(" {0}", display_separated(index_options, " ")), + )?; + } + f.write_fmt( + format_args!("{0}", display_option_spaced(characteristics)), + )?; + Ok(()) + } + TableConstraint::PrimaryKey { + name, + index_name, + index_type, + columns, + index_options, + characteristics, + } => { + f.write_fmt( + format_args!( + "{0}PRIMARY KEY{1}{2} ({3})", + display_constraint_name(name), + display_option_spaced(index_name), + display_option(" USING ", "", index_type), + display_comma_separated(columns), + ), + )?; + if !index_options.is_empty() { + f.write_fmt( + format_args!(" {0}", display_separated(index_options, " ")), + )?; + } + f.write_fmt( + format_args!("{0}", display_option_spaced(characteristics)), + )?; + Ok(()) + } + TableConstraint::ForeignKey { + name, + columns, + foreign_table, + referred_columns, + on_delete, + on_update, + characteristics, + } => { + f.write_fmt( + format_args!( + "{0}FOREIGN KEY ({1}) REFERENCES {2}", + display_constraint_name(name), + display_comma_separated(columns), + foreign_table, + ), + )?; + if !referred_columns.is_empty() { + f.write_fmt( + format_args!( + "({0})", + display_comma_separated(referred_columns), + ), + )?; + } + if let Some(action) = on_delete { + f.write_fmt(format_args!(" ON DELETE {0}", action))?; + } + if let Some(action) = on_update { + f.write_fmt(format_args!(" ON UPDATE {0}", action))?; + } + if let Some(characteristics) = characteristics { + f.write_fmt(format_args!(" {0}", characteristics))?; + } + Ok(()) + } + TableConstraint::Check { name, expr } => { + f.write_fmt( + format_args!( + "{0}CHECK ({1})", + display_constraint_name(name), + expr, + ), + ) + } + TableConstraint::Index { + display_as_key, + name, + index_type, + columns, + } => { + f.write_fmt( + format_args!( + "{0}", + if *display_as_key { "KEY" } else { "INDEX" }, + ), + )?; + if let Some(name) = name { + f.write_fmt(format_args!(" {0}", name))?; + } + if let Some(index_type) = index_type { + f.write_fmt(format_args!(" USING {0}", index_type))?; + } + f.write_fmt( + format_args!(" ({0})", display_comma_separated(columns)), + )?; + Ok(()) + } + Self::FulltextOrSpatial { + fulltext, + index_type_display, + opt_index_name, + columns, + } => { + if *fulltext { + f.write_fmt(format_args!("FULLTEXT"))?; + } else { + f.write_fmt(format_args!("SPATIAL"))?; + } + f.write_fmt(format_args!("{0:>}", index_type_display))?; + if let Some(name) = opt_index_name { + f.write_fmt(format_args!(" {0}", name))?; + } + f.write_fmt( + format_args!(" ({0})", display_comma_separated(columns)), + )?; + Ok(()) + } + } + } + } + /// Representation whether a definition can can contains the KEY or INDEX keywords with the same + /// meaning. + /// + /// This enum initially is directed to `FULLTEXT`,`SPATIAL`, and `UNIQUE` indexes on create table + /// statements of `MySQL` [(1)]. + /// + /// [1]: https://dev.mysql.com/doc/refman/8.0/en/create-table.html + pub enum KeyOrIndexDisplay { + /// Nothing to display + None, + /// Display the KEY keyword + Key, + /// Display the INDEX keyword + Index, + } + #[automatically_derived] + impl ::core::fmt::Debug for KeyOrIndexDisplay { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + KeyOrIndexDisplay::None => "None", + KeyOrIndexDisplay::Key => "Key", + KeyOrIndexDisplay::Index => "Index", + }, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for KeyOrIndexDisplay {} + #[automatically_derived] + impl ::core::clone::Clone for KeyOrIndexDisplay { + #[inline] + fn clone(&self) -> KeyOrIndexDisplay { + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for KeyOrIndexDisplay {} + #[automatically_derived] + impl ::core::cmp::PartialEq for KeyOrIndexDisplay { + #[inline] + fn eq(&self, other: &KeyOrIndexDisplay) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for KeyOrIndexDisplay { + #[inline] + fn partial_cmp( + &self, + other: &KeyOrIndexDisplay, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for KeyOrIndexDisplay { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for KeyOrIndexDisplay { + #[inline] + fn cmp(&self, other: &KeyOrIndexDisplay) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for KeyOrIndexDisplay { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl KeyOrIndexDisplay { + pub fn is_none(self) -> bool { + match self { + Self::None => true, + _ => false, + } + } + } + impl fmt::Display for KeyOrIndexDisplay { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let left_space = match f.align() { + Some(fmt::Alignment::Right) => true, + _ => false, + }; + if left_space && !self.is_none() { + f.write_char(' ')? + } + match self { + KeyOrIndexDisplay::None => f.write_fmt(format_args!("")), + KeyOrIndexDisplay::Key => f.write_fmt(format_args!("KEY")), + KeyOrIndexDisplay::Index => f.write_fmt(format_args!("INDEX")), + } + } + } + /// Indexing method used by that index. + /// + /// This structure isn't present on ANSI, but is found at least in [`MySQL` CREATE TABLE][1], + /// [`MySQL` CREATE INDEX][2], and [Postgresql CREATE INDEX][3] statements. + /// + /// [1]: https://dev.mysql.com/doc/refman/8.0/en/create-table.html + /// [2]: https://dev.mysql.com/doc/refman/8.0/en/create-index.html + /// [3]: https://www.postgresql.org/docs/14/sql-createindex.html + pub enum IndexType { + BTree, + Hash, + GIN, + GiST, + SPGiST, + BRIN, + Bloom, + } + #[automatically_derived] + impl ::core::fmt::Debug for IndexType { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + IndexType::BTree => "BTree", + IndexType::Hash => "Hash", + IndexType::GIN => "GIN", + IndexType::GiST => "GiST", + IndexType::SPGiST => "SPGiST", + IndexType::BRIN => "BRIN", + IndexType::Bloom => "Bloom", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for IndexType { + #[inline] + fn clone(&self) -> IndexType { + match self { + IndexType::BTree => IndexType::BTree, + IndexType::Hash => IndexType::Hash, + IndexType::GIN => IndexType::GIN, + IndexType::GiST => IndexType::GiST, + IndexType::SPGiST => IndexType::SPGiST, + IndexType::BRIN => IndexType::BRIN, + IndexType::Bloom => IndexType::Bloom, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IndexType {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IndexType { + #[inline] + fn eq(&self, other: &IndexType) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IndexType { + #[inline] + fn partial_cmp( + &self, + other: &IndexType, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IndexType { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for IndexType { + #[inline] + fn cmp(&self, other: &IndexType) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for IndexType { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for IndexType { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Self::BTree => f.write_fmt(format_args!("BTREE")), + Self::Hash => f.write_fmt(format_args!("HASH")), + Self::GIN => f.write_fmt(format_args!("GIN")), + Self::GiST => f.write_fmt(format_args!("GIST")), + Self::SPGiST => f.write_fmt(format_args!("SPGIST")), + Self::BRIN => f.write_fmt(format_args!("BRIN")), + Self::Bloom => f.write_fmt(format_args!("BLOOM")), + } + } + } + /// MySQLs index option. + /// + /// This structure used here [`MySQL` CREATE TABLE][1], [`MySQL` CREATE INDEX][2]. + /// + /// [1]: https://dev.mysql.com/doc/refman/8.3/en/create-table.html + /// [2]: https://dev.mysql.com/doc/refman/8.3/en/create-index.html + pub enum IndexOption { + Using(IndexType), + Comment(String), + } + #[automatically_derived] + impl ::core::fmt::Debug for IndexOption { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + IndexOption::Using(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Using", + &__self_0, + ) + } + IndexOption::Comment(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Comment", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for IndexOption { + #[inline] + fn clone(&self) -> IndexOption { + match self { + IndexOption::Using(__self_0) => { + IndexOption::Using(::core::clone::Clone::clone(__self_0)) + } + IndexOption::Comment(__self_0) => { + IndexOption::Comment(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IndexOption {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IndexOption { + #[inline] + fn eq(&self, other: &IndexOption) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + (IndexOption::Using(__self_0), IndexOption::Using(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + IndexOption::Comment(__self_0), + IndexOption::Comment(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IndexOption { + #[inline] + fn partial_cmp( + &self, + other: &IndexOption, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + (IndexOption::Using(__self_0), IndexOption::Using(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (IndexOption::Comment(__self_0), IndexOption::Comment(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IndexOption { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for IndexOption { + #[inline] + fn cmp(&self, other: &IndexOption) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + IndexOption::Using(__self_0), + IndexOption::Using(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + IndexOption::Comment(__self_0), + IndexOption::Comment(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for IndexOption { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + IndexOption::Using(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + IndexOption::Comment(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for IndexOption { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Self::Using(index_type) => { + f.write_fmt(format_args!("USING {0}", index_type)) + } + Self::Comment(s) => f.write_fmt(format_args!("COMMENT \'{0}\'", s)), + } + } + } + /// [Postgres] unique index nulls handling option: `[ NULLS [ NOT ] DISTINCT ]` + /// + /// [Postgres]: https://www.postgresql.org/docs/17/sql-altertable.html + pub enum NullsDistinctOption { + /// Not specified + None, + /// NULLS DISTINCT + Distinct, + /// NULLS NOT DISTINCT + NotDistinct, + } + #[automatically_derived] + impl ::core::fmt::Debug for NullsDistinctOption { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + NullsDistinctOption::None => "None", + NullsDistinctOption::Distinct => "Distinct", + NullsDistinctOption::NotDistinct => "NotDistinct", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for NullsDistinctOption { + #[inline] + fn clone(&self) -> NullsDistinctOption { + match self { + NullsDistinctOption::None => NullsDistinctOption::None, + NullsDistinctOption::Distinct => NullsDistinctOption::Distinct, + NullsDistinctOption::NotDistinct => NullsDistinctOption::NotDistinct, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for NullsDistinctOption {} + #[automatically_derived] + impl ::core::cmp::PartialEq for NullsDistinctOption { + #[inline] + fn eq(&self, other: &NullsDistinctOption) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for NullsDistinctOption { + #[inline] + fn partial_cmp( + &self, + other: &NullsDistinctOption, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for NullsDistinctOption { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for NullsDistinctOption { + #[inline] + fn cmp(&self, other: &NullsDistinctOption) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for NullsDistinctOption { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for NullsDistinctOption { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Self::None => Ok(()), + Self::Distinct => f.write_fmt(format_args!(" NULLS DISTINCT")), + Self::NotDistinct => f.write_fmt(format_args!(" NULLS NOT DISTINCT")), + } + } + } + pub struct ProcedureParam { + pub name: Ident, + pub data_type: DataType, + } + #[automatically_derived] + impl ::core::fmt::Debug for ProcedureParam { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "ProcedureParam", + "name", + &self.name, + "data_type", + &&self.data_type, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for ProcedureParam { + #[inline] + fn clone(&self) -> ProcedureParam { + ProcedureParam { + name: ::core::clone::Clone::clone(&self.name), + data_type: ::core::clone::Clone::clone(&self.data_type), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ProcedureParam {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ProcedureParam { + #[inline] + fn eq(&self, other: &ProcedureParam) -> bool { + self.name == other.name && self.data_type == other.data_type + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ProcedureParam { + #[inline] + fn partial_cmp( + &self, + other: &ProcedureParam, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.data_type, + &other.data_type, + ) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ProcedureParam { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ProcedureParam { + #[inline] + fn cmp(&self, other: &ProcedureParam) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.data_type, &other.data_type) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ProcedureParam { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.data_type, state) + } + } + impl fmt::Display for ProcedureParam { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("{0} {1}", self.name, self.data_type)) + } + } + /// SQL column definition + pub struct ColumnDef { + pub name: Ident, + pub data_type: DataType, + pub collation: Option, + pub options: Vec, + } + #[automatically_derived] + impl ::core::fmt::Debug for ColumnDef { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field4_finish( + f, + "ColumnDef", + "name", + &self.name, + "data_type", + &self.data_type, + "collation", + &self.collation, + "options", + &&self.options, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for ColumnDef { + #[inline] + fn clone(&self) -> ColumnDef { + ColumnDef { + name: ::core::clone::Clone::clone(&self.name), + data_type: ::core::clone::Clone::clone(&self.data_type), + collation: ::core::clone::Clone::clone(&self.collation), + options: ::core::clone::Clone::clone(&self.options), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ColumnDef {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ColumnDef { + #[inline] + fn eq(&self, other: &ColumnDef) -> bool { + self.name == other.name && self.data_type == other.data_type + && self.collation == other.collation && self.options == other.options + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ColumnDef { + #[inline] + fn partial_cmp( + &self, + other: &ColumnDef, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.data_type, + &other.data_type, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.collation, + &other.collation, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.options, + &other.options, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ColumnDef { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ColumnDef { + #[inline] + fn cmp(&self, other: &ColumnDef) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.data_type, &other.data_type) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.collation, + &other.collation, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.options, &other.options) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ColumnDef { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.data_type, state); + ::core::hash::Hash::hash(&self.collation, state); + ::core::hash::Hash::hash(&self.options, state) + } + } + impl fmt::Display for ColumnDef { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if self.data_type == DataType::Unspecified { + f.write_fmt(format_args!("{0}", self.name))?; + } else { + f.write_fmt(format_args!("{0} {1}", self.name, self.data_type))?; + } + if let Some(collation) = &self.collation { + f.write_fmt(format_args!(" COLLATE {0}", collation))?; + } + for option in &self.options { + f.write_fmt(format_args!(" {0}", option))?; + } + Ok(()) + } + } + /// Column definition specified in a `CREATE VIEW` statement. + /// + /// Syntax + /// ```markdown + /// [data_type][OPTIONS(option, ...)] + /// + /// option: = + /// ``` + /// + /// Examples: + /// ```sql + /// name + /// age OPTIONS(description = "age column", tag = "prod") + /// amount COMMENT 'The total amount for the order line' + /// created_at DateTime64 + /// ``` + pub struct ViewColumnDef { + pub name: Ident, + pub data_type: Option, + pub options: Option>, + } + #[automatically_derived] + impl ::core::fmt::Debug for ViewColumnDef { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "ViewColumnDef", + "name", + &self.name, + "data_type", + &self.data_type, + "options", + &&self.options, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for ViewColumnDef { + #[inline] + fn clone(&self) -> ViewColumnDef { + ViewColumnDef { + name: ::core::clone::Clone::clone(&self.name), + data_type: ::core::clone::Clone::clone(&self.data_type), + options: ::core::clone::Clone::clone(&self.options), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ViewColumnDef {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ViewColumnDef { + #[inline] + fn eq(&self, other: &ViewColumnDef) -> bool { + self.name == other.name && self.data_type == other.data_type + && self.options == other.options + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ViewColumnDef { + #[inline] + fn partial_cmp( + &self, + other: &ViewColumnDef, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.data_type, + &other.data_type, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.options, + &other.options, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ViewColumnDef { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ViewColumnDef { + #[inline] + fn cmp(&self, other: &ViewColumnDef) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.data_type, &other.data_type) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.options, &other.options) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ViewColumnDef { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.data_type, state); + ::core::hash::Hash::hash(&self.options, state) + } + } + impl fmt::Display for ViewColumnDef { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("{0}", self.name))?; + if let Some(data_type) = self.data_type.as_ref() { + f.write_fmt(format_args!(" {0}", data_type))?; + } + if let Some(options) = self.options.as_ref() { + f.write_fmt( + format_args!(" {0}", display_comma_separated(options.as_slice())), + )?; + } + Ok(()) + } + } + /// An optionally-named `ColumnOption`: `[ CONSTRAINT ] `. + /// + /// Note that implementations are substantially more permissive than the ANSI + /// specification on what order column options can be presented in, and whether + /// they are allowed to be named. The specification distinguishes between + /// constraints (NOT NULL, UNIQUE, PRIMARY KEY, and CHECK), which can be named + /// and can appear in any order, and other options (DEFAULT, GENERATED), which + /// cannot be named and must appear in a fixed order. `PostgreSQL`, however, + /// allows preceding any option with `CONSTRAINT `, even those that are + /// not really constraints, like NULL and DEFAULT. MSSQL is less permissive, + /// allowing DEFAULT, UNIQUE, PRIMARY KEY and CHECK to be named, but not NULL or + /// NOT NULL constraints (the last of which is in violation of the spec). + /// + /// For maximum flexibility, we don't distinguish between constraint and + /// non-constraint options, lumping them all together under the umbrella of + /// "column options," and we allow any column option to be named. + pub struct ColumnOptionDef { + pub name: Option, + pub option: ColumnOption, + } + #[automatically_derived] + impl ::core::fmt::Debug for ColumnOptionDef { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "ColumnOptionDef", + "name", + &self.name, + "option", + &&self.option, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for ColumnOptionDef { + #[inline] + fn clone(&self) -> ColumnOptionDef { + ColumnOptionDef { + name: ::core::clone::Clone::clone(&self.name), + option: ::core::clone::Clone::clone(&self.option), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ColumnOptionDef {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ColumnOptionDef { + #[inline] + fn eq(&self, other: &ColumnOptionDef) -> bool { + self.name == other.name && self.option == other.option + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ColumnOptionDef { + #[inline] + fn partial_cmp( + &self, + other: &ColumnOptionDef, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + ::core::cmp::PartialOrd::partial_cmp(&self.option, &other.option) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ColumnOptionDef { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ColumnOptionDef { + #[inline] + fn cmp(&self, other: &ColumnOptionDef) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.option, &other.option) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ColumnOptionDef { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.option, state) + } + } + impl fmt::Display for ColumnOptionDef { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt( + format_args!( + "{0}{1}", + display_constraint_name(&self.name), + self.option, + ), + ) + } + } + /// Identity is a column option for defining an identity or autoincrement column in a `CREATE TABLE` statement. + /// Syntax + /// ```sql + /// { IDENTITY | AUTOINCREMENT } [ (seed , increment) | START num INCREMENT num ] [ ORDER | NOORDER ] + /// ``` + /// [MS SQL Server]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + pub enum IdentityPropertyKind { + /// An identity property declared via the `AUTOINCREMENT` key word + /// Example: + /// ```sql + /// AUTOINCREMENT(100, 1) NOORDER + /// AUTOINCREMENT START 100 INCREMENT 1 ORDER + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + Autoincrement(IdentityProperty), + /// An identity property declared via the `IDENTITY` key word + /// Example, [MS SQL Server] or [Snowflake]: + /// ```sql + /// IDENTITY(100, 1) + /// ``` + /// [Snowflake] + /// ```sql + /// IDENTITY(100, 1) ORDER + /// IDENTITY START 100 INCREMENT 1 NOORDER + /// ``` + /// [MS SQL Server]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + Identity(IdentityProperty), + } + #[automatically_derived] + impl ::core::fmt::Debug for IdentityPropertyKind { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + IdentityPropertyKind::Autoincrement(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Autoincrement", + &__self_0, + ) + } + IdentityPropertyKind::Identity(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Identity", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for IdentityPropertyKind { + #[inline] + fn clone(&self) -> IdentityPropertyKind { + match self { + IdentityPropertyKind::Autoincrement(__self_0) => { + IdentityPropertyKind::Autoincrement( + ::core::clone::Clone::clone(__self_0), + ) + } + IdentityPropertyKind::Identity(__self_0) => { + IdentityPropertyKind::Identity( + ::core::clone::Clone::clone(__self_0), + ) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IdentityPropertyKind {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IdentityPropertyKind { + #[inline] + fn eq(&self, other: &IdentityPropertyKind) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + IdentityPropertyKind::Autoincrement(__self_0), + IdentityPropertyKind::Autoincrement(__arg1_0), + ) => __self_0 == __arg1_0, + ( + IdentityPropertyKind::Identity(__self_0), + IdentityPropertyKind::Identity(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IdentityPropertyKind { + #[inline] + fn partial_cmp( + &self, + other: &IdentityPropertyKind, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + IdentityPropertyKind::Autoincrement(__self_0), + IdentityPropertyKind::Autoincrement(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + IdentityPropertyKind::Identity(__self_0), + IdentityPropertyKind::Identity(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IdentityPropertyKind { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for IdentityPropertyKind { + #[inline] + fn cmp(&self, other: &IdentityPropertyKind) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + IdentityPropertyKind::Autoincrement(__self_0), + IdentityPropertyKind::Autoincrement(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + IdentityPropertyKind::Identity(__self_0), + IdentityPropertyKind::Identity(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for IdentityPropertyKind { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + IdentityPropertyKind::Autoincrement(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + IdentityPropertyKind::Identity(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for IdentityPropertyKind { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let (command, property) = match self { + IdentityPropertyKind::Identity(property) => ("IDENTITY", property), + IdentityPropertyKind::Autoincrement(property) => { + ("AUTOINCREMENT", property) + } + }; + f.write_fmt(format_args!("{0}", command))?; + if let Some(parameters) = &property.parameters { + f.write_fmt(format_args!("{0}", parameters))?; + } + if let Some(order) = &property.order { + f.write_fmt(format_args!("{0}", order))?; + } + Ok(()) + } + } + pub struct IdentityProperty { + pub parameters: Option, + pub order: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for IdentityProperty { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "IdentityProperty", + "parameters", + &self.parameters, + "order", + &&self.order, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for IdentityProperty { + #[inline] + fn clone(&self) -> IdentityProperty { + IdentityProperty { + parameters: ::core::clone::Clone::clone(&self.parameters), + order: ::core::clone::Clone::clone(&self.order), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IdentityProperty {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IdentityProperty { + #[inline] + fn eq(&self, other: &IdentityProperty) -> bool { + self.parameters == other.parameters && self.order == other.order + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IdentityProperty { + #[inline] + fn partial_cmp( + &self, + other: &IdentityProperty, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.parameters, + &other.parameters, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + ::core::cmp::PartialOrd::partial_cmp(&self.order, &other.order) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IdentityProperty { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for IdentityProperty { + #[inline] + fn cmp(&self, other: &IdentityProperty) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.parameters, &other.parameters) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.order, &other.order) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for IdentityProperty { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.parameters, state); + ::core::hash::Hash::hash(&self.order, state) + } + } + /// A format of parameters of identity column. + /// + /// It is [Snowflake] specific. + /// Syntax + /// ```sql + /// (seed , increment) | START num INCREMENT num + /// ``` + /// [MS SQL Server] uses one way of representing these parameters. + /// Syntax + /// ```sql + /// (seed , increment) + /// ``` + /// [MS SQL Server]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + pub enum IdentityPropertyFormatKind { + /// A parameters of identity column declared like parameters of function call + /// Example: + /// ```sql + /// (100, 1) + /// ``` + /// [MS SQL Server]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + FunctionCall(IdentityParameters), + /// A parameters of identity column declared with keywords `START` and `INCREMENT` + /// Example: + /// ```sql + /// START 100 INCREMENT 1 + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + StartAndIncrement(IdentityParameters), + } + #[automatically_derived] + impl ::core::fmt::Debug for IdentityPropertyFormatKind { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + IdentityPropertyFormatKind::FunctionCall(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "FunctionCall", + &__self_0, + ) + } + IdentityPropertyFormatKind::StartAndIncrement(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "StartAndIncrement", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for IdentityPropertyFormatKind { + #[inline] + fn clone(&self) -> IdentityPropertyFormatKind { + match self { + IdentityPropertyFormatKind::FunctionCall(__self_0) => { + IdentityPropertyFormatKind::FunctionCall( + ::core::clone::Clone::clone(__self_0), + ) + } + IdentityPropertyFormatKind::StartAndIncrement(__self_0) => { + IdentityPropertyFormatKind::StartAndIncrement( + ::core::clone::Clone::clone(__self_0), + ) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IdentityPropertyFormatKind {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IdentityPropertyFormatKind { + #[inline] + fn eq(&self, other: &IdentityPropertyFormatKind) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + IdentityPropertyFormatKind::FunctionCall(__self_0), + IdentityPropertyFormatKind::FunctionCall(__arg1_0), + ) => __self_0 == __arg1_0, + ( + IdentityPropertyFormatKind::StartAndIncrement(__self_0), + IdentityPropertyFormatKind::StartAndIncrement(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IdentityPropertyFormatKind { + #[inline] + fn partial_cmp( + &self, + other: &IdentityPropertyFormatKind, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + IdentityPropertyFormatKind::FunctionCall(__self_0), + IdentityPropertyFormatKind::FunctionCall(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + IdentityPropertyFormatKind::StartAndIncrement(__self_0), + IdentityPropertyFormatKind::StartAndIncrement(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IdentityPropertyFormatKind { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for IdentityPropertyFormatKind { + #[inline] + fn cmp(&self, other: &IdentityPropertyFormatKind) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + IdentityPropertyFormatKind::FunctionCall(__self_0), + IdentityPropertyFormatKind::FunctionCall(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + IdentityPropertyFormatKind::StartAndIncrement(__self_0), + IdentityPropertyFormatKind::StartAndIncrement(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for IdentityPropertyFormatKind { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + IdentityPropertyFormatKind::FunctionCall(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + IdentityPropertyFormatKind::StartAndIncrement(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for IdentityPropertyFormatKind { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + IdentityPropertyFormatKind::FunctionCall(parameters) => { + f.write_fmt( + format_args!( + "({0}, {1})", + parameters.seed, + parameters.increment, + ), + ) + } + IdentityPropertyFormatKind::StartAndIncrement(parameters) => { + f.write_fmt( + format_args!( + " START {0} INCREMENT {1}", + parameters.seed, + parameters.increment, + ), + ) + } + } + } + } + pub struct IdentityParameters { + pub seed: Expr, + pub increment: Expr, + } + #[automatically_derived] + impl ::core::fmt::Debug for IdentityParameters { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "IdentityParameters", + "seed", + &self.seed, + "increment", + &&self.increment, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for IdentityParameters { + #[inline] + fn clone(&self) -> IdentityParameters { + IdentityParameters { + seed: ::core::clone::Clone::clone(&self.seed), + increment: ::core::clone::Clone::clone(&self.increment), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IdentityParameters {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IdentityParameters { + #[inline] + fn eq(&self, other: &IdentityParameters) -> bool { + self.seed == other.seed && self.increment == other.increment + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IdentityParameters { + #[inline] + fn partial_cmp( + &self, + other: &IdentityParameters, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.seed, &other.seed) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.increment, + &other.increment, + ) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IdentityParameters { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for IdentityParameters { + #[inline] + fn cmp(&self, other: &IdentityParameters) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.seed, &other.seed) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.increment, &other.increment) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for IdentityParameters { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.seed, state); + ::core::hash::Hash::hash(&self.increment, state) + } + } + /// The identity column option specifies how values are generated for the auto-incremented column, either in increasing or decreasing order. + /// Syntax + /// ```sql + /// ORDER | NOORDER + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + pub enum IdentityPropertyOrder { + Order, + NoOrder, + } + #[automatically_derived] + impl ::core::fmt::Debug for IdentityPropertyOrder { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + IdentityPropertyOrder::Order => "Order", + IdentityPropertyOrder::NoOrder => "NoOrder", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for IdentityPropertyOrder { + #[inline] + fn clone(&self) -> IdentityPropertyOrder { + match self { + IdentityPropertyOrder::Order => IdentityPropertyOrder::Order, + IdentityPropertyOrder::NoOrder => IdentityPropertyOrder::NoOrder, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IdentityPropertyOrder {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IdentityPropertyOrder { + #[inline] + fn eq(&self, other: &IdentityPropertyOrder) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IdentityPropertyOrder { + #[inline] + fn partial_cmp( + &self, + other: &IdentityPropertyOrder, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IdentityPropertyOrder { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for IdentityPropertyOrder { + #[inline] + fn cmp(&self, other: &IdentityPropertyOrder) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for IdentityPropertyOrder { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for IdentityPropertyOrder { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + IdentityPropertyOrder::Order => f.write_fmt(format_args!(" ORDER")), + IdentityPropertyOrder::NoOrder => { + f.write_fmt(format_args!(" NOORDER")) + } + } + } + } + /// Column policy that identify a security policy of access to a column. + /// Syntax + /// ```sql + /// [ WITH ] MASKING POLICY [ USING ( , , ... ) ] + /// [ WITH ] PROJECTION POLICY + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + pub enum ColumnPolicy { + MaskingPolicy(ColumnPolicyProperty), + ProjectionPolicy(ColumnPolicyProperty), + } + #[automatically_derived] + impl ::core::fmt::Debug for ColumnPolicy { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + ColumnPolicy::MaskingPolicy(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "MaskingPolicy", + &__self_0, + ) + } + ColumnPolicy::ProjectionPolicy(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "ProjectionPolicy", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for ColumnPolicy { + #[inline] + fn clone(&self) -> ColumnPolicy { + match self { + ColumnPolicy::MaskingPolicy(__self_0) => { + ColumnPolicy::MaskingPolicy( + ::core::clone::Clone::clone(__self_0), + ) + } + ColumnPolicy::ProjectionPolicy(__self_0) => { + ColumnPolicy::ProjectionPolicy( + ::core::clone::Clone::clone(__self_0), + ) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ColumnPolicy {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ColumnPolicy { + #[inline] + fn eq(&self, other: &ColumnPolicy) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + ColumnPolicy::MaskingPolicy(__self_0), + ColumnPolicy::MaskingPolicy(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnPolicy::ProjectionPolicy(__self_0), + ColumnPolicy::ProjectionPolicy(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ColumnPolicy { + #[inline] + fn partial_cmp( + &self, + other: &ColumnPolicy, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + ColumnPolicy::MaskingPolicy(__self_0), + ColumnPolicy::MaskingPolicy(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnPolicy::ProjectionPolicy(__self_0), + ColumnPolicy::ProjectionPolicy(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ColumnPolicy { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ColumnPolicy { + #[inline] + fn cmp(&self, other: &ColumnPolicy) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + ColumnPolicy::MaskingPolicy(__self_0), + ColumnPolicy::MaskingPolicy(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnPolicy::ProjectionPolicy(__self_0), + ColumnPolicy::ProjectionPolicy(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ColumnPolicy { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + ColumnPolicy::MaskingPolicy(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnPolicy::ProjectionPolicy(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for ColumnPolicy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let (command, property) = match self { + ColumnPolicy::MaskingPolicy(property) => ("MASKING POLICY", property), + ColumnPolicy::ProjectionPolicy(property) => { + ("PROJECTION POLICY", property) + } + }; + if property.with { + f.write_fmt(format_args!("WITH "))?; + } + f.write_fmt(format_args!("{1} {0}", property.policy_name, command))?; + if let Some(using_columns) = &property.using_columns { + f.write_fmt( + format_args!( + " USING ({0})", + display_comma_separated(using_columns), + ), + )?; + } + Ok(()) + } + } + pub struct ColumnPolicyProperty { + /// This flag indicates that the column policy option is declared using the `WITH` prefix. + /// Example + /// ```sql + /// WITH PROJECTION POLICY sample_policy + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + pub with: bool, + pub policy_name: Ident, + pub using_columns: Option>, + } + #[automatically_derived] + impl ::core::fmt::Debug for ColumnPolicyProperty { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "ColumnPolicyProperty", + "with", + &self.with, + "policy_name", + &self.policy_name, + "using_columns", + &&self.using_columns, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for ColumnPolicyProperty { + #[inline] + fn clone(&self) -> ColumnPolicyProperty { + ColumnPolicyProperty { + with: ::core::clone::Clone::clone(&self.with), + policy_name: ::core::clone::Clone::clone(&self.policy_name), + using_columns: ::core::clone::Clone::clone(&self.using_columns), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ColumnPolicyProperty {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ColumnPolicyProperty { + #[inline] + fn eq(&self, other: &ColumnPolicyProperty) -> bool { + self.with == other.with && self.policy_name == other.policy_name + && self.using_columns == other.using_columns + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ColumnPolicyProperty { + #[inline] + fn partial_cmp( + &self, + other: &ColumnPolicyProperty, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.with, &other.with) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.policy_name, + &other.policy_name, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.using_columns, + &other.using_columns, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ColumnPolicyProperty { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ColumnPolicyProperty { + #[inline] + fn cmp(&self, other: &ColumnPolicyProperty) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.with, &other.with) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.policy_name, + &other.policy_name, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp( + &self.using_columns, + &other.using_columns, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ColumnPolicyProperty { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.with, state); + ::core::hash::Hash::hash(&self.policy_name, state); + ::core::hash::Hash::hash(&self.using_columns, state) + } + } + /// Tags option of column + /// Syntax + /// ```sql + /// [ WITH ] TAG ( = '' [ , = '' , ... ] ) + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + pub struct TagsColumnOption { + /// This flag indicates that the tags option is declared using the `WITH` prefix. + /// Example: + /// ```sql + /// WITH TAG (A = 'Tag A') + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + pub with: bool, + pub tags: Vec, + } + #[automatically_derived] + impl ::core::fmt::Debug for TagsColumnOption { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "TagsColumnOption", + "with", + &self.with, + "tags", + &&self.tags, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for TagsColumnOption { + #[inline] + fn clone(&self) -> TagsColumnOption { + TagsColumnOption { + with: ::core::clone::Clone::clone(&self.with), + tags: ::core::clone::Clone::clone(&self.tags), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for TagsColumnOption {} + #[automatically_derived] + impl ::core::cmp::PartialEq for TagsColumnOption { + #[inline] + fn eq(&self, other: &TagsColumnOption) -> bool { + self.with == other.with && self.tags == other.tags + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for TagsColumnOption { + #[inline] + fn partial_cmp( + &self, + other: &TagsColumnOption, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.with, &other.with) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + ::core::cmp::PartialOrd::partial_cmp(&self.tags, &other.tags) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for TagsColumnOption { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for TagsColumnOption { + #[inline] + fn cmp(&self, other: &TagsColumnOption) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.with, &other.with) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.tags, &other.tags) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for TagsColumnOption { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.with, state); + ::core::hash::Hash::hash(&self.tags, state) + } + } + impl fmt::Display for TagsColumnOption { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if self.with { + f.write_fmt(format_args!("WITH "))?; + } + f.write_fmt( + format_args!("TAG ({0})", display_comma_separated(&self.tags)), + )?; + Ok(()) + } + } + /// `ColumnOption`s are modifiers that follow a column definition in a `CREATE + /// TABLE` statement. + pub enum ColumnOption { + /// `NULL` + Null, + /// `NOT NULL` + NotNull, + /// `DEFAULT ` + Default(Expr), + /// `MATERIALIZE ` + /// Syntax: `b INT MATERIALIZE (a + 1)` + /// + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/create/table#default_values) + Materialized(Expr), + /// `EPHEMERAL []` + /// + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/create/table#default_values) + Ephemeral(Option), + /// `ALIAS ` + /// + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/create/table#default_values) + Alias(Expr), + /// `{ PRIMARY KEY | UNIQUE } []` + Unique { + is_primary: bool, + characteristics: Option, + }, + /// A referential integrity constraint (`[FOREIGN KEY REFERENCES + /// () + /// { [ON DELETE ] [ON UPDATE ] | + /// [ON UPDATE ] [ON DELETE ] + /// } + /// [] + /// `). + ForeignKey { + foreign_table: ObjectName, + referred_columns: Vec, + on_delete: Option, + on_update: Option, + characteristics: Option, + }, + /// `CHECK ()` + Check(Expr), + /// Dialect-specific options, such as: + /// - MySQL's `AUTO_INCREMENT` or SQLite's `AUTOINCREMENT` + /// - ... + DialectSpecific(Vec), + CharacterSet(ObjectName), + Comment(String), + OnUpdate(Expr), + /// `Generated`s are modifiers that follow a column definition in a `CREATE + /// TABLE` statement. + Generated { + generated_as: GeneratedAs, + sequence_options: Option>, + generation_expr: Option, + generation_expr_mode: Option, + /// false if 'GENERATED ALWAYS' is skipped (option starts with AS) + generated_keyword: bool, + }, + /// BigQuery specific: Explicit column options in a view [1] or table [2] + /// Syntax + /// ```sql + /// OPTIONS(description="field desc") + /// ``` + /// [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#view_column_option_list + /// [2]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#column_option_list + Options(Vec), + /// Creates an identity or an autoincrement column in a table. + /// Syntax + /// ```sql + /// { IDENTITY | AUTOINCREMENT } [ (seed , increment) | START num INCREMENT num ] [ ORDER | NOORDER ] + /// ``` + /// [MS SQL Server]: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + Identity(IdentityPropertyKind), + /// SQLite specific: ON CONFLICT option on column definition + /// + OnConflict(Keyword), + /// Snowflake specific: an option of specifying security masking or projection policy to set on a column. + /// Syntax: + /// ```sql + /// [ WITH ] MASKING POLICY [ USING ( , , ... ) ] + /// [ WITH ] PROJECTION POLICY + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + Policy(ColumnPolicy), + /// Snowflake specific: Specifies the tag name and the tag string value. + /// Syntax: + /// ```sql + /// [ WITH ] TAG ( = '' [ , = '' , ... ] ) + /// ``` + /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table + Tags(TagsColumnOption), + } + #[automatically_derived] + impl ::core::fmt::Debug for ColumnOption { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + ColumnOption::Null => ::core::fmt::Formatter::write_str(f, "Null"), + ColumnOption::NotNull => { + ::core::fmt::Formatter::write_str(f, "NotNull") + } + ColumnOption::Default(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Default", + &__self_0, + ) + } + ColumnOption::Materialized(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Materialized", + &__self_0, + ) + } + ColumnOption::Ephemeral(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Ephemeral", + &__self_0, + ) + } + ColumnOption::Alias(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Alias", + &__self_0, + ) + } + ColumnOption::Unique { + is_primary: __self_0, + characteristics: __self_1, + } => { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "Unique", + "is_primary", + __self_0, + "characteristics", + &__self_1, + ) + } + ColumnOption::ForeignKey { + foreign_table: __self_0, + referred_columns: __self_1, + on_delete: __self_2, + on_update: __self_3, + characteristics: __self_4, + } => { + ::core::fmt::Formatter::debug_struct_field5_finish( + f, + "ForeignKey", + "foreign_table", + __self_0, + "referred_columns", + __self_1, + "on_delete", + __self_2, + "on_update", + __self_3, + "characteristics", + &__self_4, + ) + } + ColumnOption::Check(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Check", + &__self_0, + ) + } + ColumnOption::DialectSpecific(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "DialectSpecific", + &__self_0, + ) + } + ColumnOption::CharacterSet(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "CharacterSet", + &__self_0, + ) + } + ColumnOption::Comment(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Comment", + &__self_0, + ) + } + ColumnOption::OnUpdate(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "OnUpdate", + &__self_0, + ) + } + ColumnOption::Generated { + generated_as: __self_0, + sequence_options: __self_1, + generation_expr: __self_2, + generation_expr_mode: __self_3, + generated_keyword: __self_4, + } => { + ::core::fmt::Formatter::debug_struct_field5_finish( + f, + "Generated", + "generated_as", + __self_0, + "sequence_options", + __self_1, + "generation_expr", + __self_2, + "generation_expr_mode", + __self_3, + "generated_keyword", + &__self_4, + ) + } + ColumnOption::Options(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Options", + &__self_0, + ) + } + ColumnOption::Identity(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Identity", + &__self_0, + ) + } + ColumnOption::OnConflict(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "OnConflict", + &__self_0, + ) + } + ColumnOption::Policy(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Policy", + &__self_0, + ) + } + ColumnOption::Tags(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Tags", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for ColumnOption { + #[inline] + fn clone(&self) -> ColumnOption { + match self { + ColumnOption::Null => ColumnOption::Null, + ColumnOption::NotNull => ColumnOption::NotNull, + ColumnOption::Default(__self_0) => { + ColumnOption::Default(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Materialized(__self_0) => { + ColumnOption::Materialized(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Ephemeral(__self_0) => { + ColumnOption::Ephemeral(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Alias(__self_0) => { + ColumnOption::Alias(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Unique { + is_primary: __self_0, + characteristics: __self_1, + } => { + ColumnOption::Unique { + is_primary: ::core::clone::Clone::clone(__self_0), + characteristics: ::core::clone::Clone::clone(__self_1), + } + } + ColumnOption::ForeignKey { + foreign_table: __self_0, + referred_columns: __self_1, + on_delete: __self_2, + on_update: __self_3, + characteristics: __self_4, + } => { + ColumnOption::ForeignKey { + foreign_table: ::core::clone::Clone::clone(__self_0), + referred_columns: ::core::clone::Clone::clone(__self_1), + on_delete: ::core::clone::Clone::clone(__self_2), + on_update: ::core::clone::Clone::clone(__self_3), + characteristics: ::core::clone::Clone::clone(__self_4), + } + } + ColumnOption::Check(__self_0) => { + ColumnOption::Check(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::DialectSpecific(__self_0) => { + ColumnOption::DialectSpecific( + ::core::clone::Clone::clone(__self_0), + ) + } + ColumnOption::CharacterSet(__self_0) => { + ColumnOption::CharacterSet(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Comment(__self_0) => { + ColumnOption::Comment(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::OnUpdate(__self_0) => { + ColumnOption::OnUpdate(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Generated { + generated_as: __self_0, + sequence_options: __self_1, + generation_expr: __self_2, + generation_expr_mode: __self_3, + generated_keyword: __self_4, + } => { + ColumnOption::Generated { + generated_as: ::core::clone::Clone::clone(__self_0), + sequence_options: ::core::clone::Clone::clone(__self_1), + generation_expr: ::core::clone::Clone::clone(__self_2), + generation_expr_mode: ::core::clone::Clone::clone(__self_3), + generated_keyword: ::core::clone::Clone::clone(__self_4), + } + } + ColumnOption::Options(__self_0) => { + ColumnOption::Options(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Identity(__self_0) => { + ColumnOption::Identity(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::OnConflict(__self_0) => { + ColumnOption::OnConflict(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Policy(__self_0) => { + ColumnOption::Policy(::core::clone::Clone::clone(__self_0)) + } + ColumnOption::Tags(__self_0) => { + ColumnOption::Tags(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ColumnOption {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ColumnOption { + #[inline] + fn eq(&self, other: &ColumnOption) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + ColumnOption::Default(__self_0), + ColumnOption::Default(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Materialized(__self_0), + ColumnOption::Materialized(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Ephemeral(__self_0), + ColumnOption::Ephemeral(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Alias(__self_0), + ColumnOption::Alias(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Unique { + is_primary: __self_0, + characteristics: __self_1, + }, + ColumnOption::Unique { + is_primary: __arg1_0, + characteristics: __arg1_1, + }, + ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, + ( + ColumnOption::ForeignKey { + foreign_table: __self_0, + referred_columns: __self_1, + on_delete: __self_2, + on_update: __self_3, + characteristics: __self_4, + }, + ColumnOption::ForeignKey { + foreign_table: __arg1_0, + referred_columns: __arg1_1, + on_delete: __arg1_2, + on_update: __arg1_3, + characteristics: __arg1_4, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + && __self_4 == __arg1_4 + } + ( + ColumnOption::Check(__self_0), + ColumnOption::Check(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::DialectSpecific(__self_0), + ColumnOption::DialectSpecific(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::CharacterSet(__self_0), + ColumnOption::CharacterSet(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Comment(__self_0), + ColumnOption::Comment(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::OnUpdate(__self_0), + ColumnOption::OnUpdate(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Generated { + generated_as: __self_0, + sequence_options: __self_1, + generation_expr: __self_2, + generation_expr_mode: __self_3, + generated_keyword: __self_4, + }, + ColumnOption::Generated { + generated_as: __arg1_0, + sequence_options: __arg1_1, + generation_expr: __arg1_2, + generation_expr_mode: __arg1_3, + generated_keyword: __arg1_4, + }, + ) => { + __self_0 == __arg1_0 && __self_1 == __arg1_1 + && __self_2 == __arg1_2 && __self_3 == __arg1_3 + && __self_4 == __arg1_4 + } + ( + ColumnOption::Options(__self_0), + ColumnOption::Options(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Identity(__self_0), + ColumnOption::Identity(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::OnConflict(__self_0), + ColumnOption::OnConflict(__arg1_0), + ) => __self_0 == __arg1_0, + ( + ColumnOption::Policy(__self_0), + ColumnOption::Policy(__arg1_0), + ) => __self_0 == __arg1_0, + (ColumnOption::Tags(__self_0), ColumnOption::Tags(__arg1_0)) => { + __self_0 == __arg1_0 + } + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ColumnOption { + #[inline] + fn partial_cmp( + &self, + other: &ColumnOption, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + ColumnOption::Default(__self_0), + ColumnOption::Default(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::Materialized(__self_0), + ColumnOption::Materialized(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::Ephemeral(__self_0), + ColumnOption::Ephemeral(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (ColumnOption::Alias(__self_0), ColumnOption::Alias(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + ColumnOption::Unique { + is_primary: __self_0, + characteristics: __self_1, + }, + ColumnOption::Unique { + is_primary: __arg1_0, + characteristics: __arg1_1, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), + cmp => cmp, + } + } + ( + ColumnOption::ForeignKey { + foreign_table: __self_0, + referred_columns: __self_1, + on_delete: __self_2, + on_update: __self_3, + characteristics: __self_4, + }, + ColumnOption::ForeignKey { + foreign_table: __arg1_0, + referred_columns: __arg1_1, + on_delete: __arg1_2, + on_update: __arg1_3, + characteristics: __arg1_4, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_3, + __arg1_3, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + (ColumnOption::Check(__self_0), ColumnOption::Check(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + ColumnOption::DialectSpecific(__self_0), + ColumnOption::DialectSpecific(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::CharacterSet(__self_0), + ColumnOption::CharacterSet(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::Comment(__self_0), + ColumnOption::Comment(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::OnUpdate(__self_0), + ColumnOption::OnUpdate(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::Generated { + generated_as: __self_0, + sequence_options: __self_1, + generation_expr: __self_2, + generation_expr_mode: __self_3, + generated_keyword: __self_4, + }, + ColumnOption::Generated { + generated_as: __arg1_0, + sequence_options: __arg1_1, + generation_expr: __arg1_2, + generation_expr_mode: __arg1_3, + generated_keyword: __arg1_4, + }, + ) => { + match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_1, + __arg1_1, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_2, + __arg1_2, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + __self_3, + __arg1_3, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + ColumnOption::Options(__self_0), + ColumnOption::Options(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::Identity(__self_0), + ColumnOption::Identity(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + ColumnOption::OnConflict(__self_0), + ColumnOption::OnConflict(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (ColumnOption::Policy(__self_0), ColumnOption::Policy(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (ColumnOption::Tags(__self_0), ColumnOption::Tags(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ColumnOption { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ColumnOption { + #[inline] + fn cmp(&self, other: &ColumnOption) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + ColumnOption::Default(__self_0), + ColumnOption::Default(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Materialized(__self_0), + ColumnOption::Materialized(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Ephemeral(__self_0), + ColumnOption::Ephemeral(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Alias(__self_0), + ColumnOption::Alias(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Unique { + is_primary: __self_0, + characteristics: __self_1, + }, + ColumnOption::Unique { + is_primary: __arg1_0, + characteristics: __arg1_1, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_1, __arg1_1) + } + cmp => cmp, + } + } + ( + ColumnOption::ForeignKey { + foreign_table: __self_0, + referred_columns: __self_1, + on_delete: __self_2, + on_update: __self_3, + characteristics: __self_4, + }, + ColumnOption::ForeignKey { + foreign_table: __arg1_0, + referred_columns: __arg1_1, + on_delete: __arg1_2, + on_update: __arg1_3, + characteristics: __arg1_4, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_4, __arg1_4) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + ColumnOption::Check(__self_0), + ColumnOption::Check(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::DialectSpecific(__self_0), + ColumnOption::DialectSpecific(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::CharacterSet(__self_0), + ColumnOption::CharacterSet(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Comment(__self_0), + ColumnOption::Comment(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::OnUpdate(__self_0), + ColumnOption::OnUpdate(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Generated { + generated_as: __self_0, + sequence_options: __self_1, + generation_expr: __self_2, + generation_expr_mode: __self_3, + generated_keyword: __self_4, + }, + ColumnOption::Generated { + generated_as: __arg1_0, + sequence_options: __arg1_1, + generation_expr: __arg1_2, + generation_expr_mode: __arg1_3, + generated_keyword: __arg1_4, + }, + ) => { + match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(__self_4, __arg1_4) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + ( + ColumnOption::Options(__self_0), + ColumnOption::Options(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Identity(__self_0), + ColumnOption::Identity(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::OnConflict(__self_0), + ColumnOption::OnConflict(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Policy(__self_0), + ColumnOption::Policy(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + ColumnOption::Tags(__self_0), + ColumnOption::Tags(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ColumnOption { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + ColumnOption::Default(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Materialized(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Ephemeral(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Alias(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Unique { + is_primary: __self_0, + characteristics: __self_1, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state) + } + ColumnOption::ForeignKey { + foreign_table: __self_0, + referred_columns: __self_1, + on_delete: __self_2, + on_update: __self_3, + characteristics: __self_4, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state); + ::core::hash::Hash::hash(__self_4, state) + } + ColumnOption::Check(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::DialectSpecific(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::CharacterSet(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Comment(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::OnUpdate(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Generated { + generated_as: __self_0, + sequence_options: __self_1, + generation_expr: __self_2, + generation_expr_mode: __self_3, + generated_keyword: __self_4, + } => { + ::core::hash::Hash::hash(__self_0, state); + ::core::hash::Hash::hash(__self_1, state); + ::core::hash::Hash::hash(__self_2, state); + ::core::hash::Hash::hash(__self_3, state); + ::core::hash::Hash::hash(__self_4, state) + } + ColumnOption::Options(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Identity(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::OnConflict(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Policy(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + ColumnOption::Tags(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + impl fmt::Display for ColumnOption { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + use ColumnOption::*; + match self { + Null => f.write_fmt(format_args!("NULL")), + NotNull => f.write_fmt(format_args!("NOT NULL")), + Default(expr) => f.write_fmt(format_args!("DEFAULT {0}", expr)), + Materialized(expr) => { + f.write_fmt(format_args!("MATERIALIZED {0}", expr)) + } + Ephemeral(expr) => { + if let Some(e) = expr { + f.write_fmt(format_args!("EPHEMERAL {0}", e)) + } else { + f.write_fmt(format_args!("EPHEMERAL")) + } + } + Alias(expr) => f.write_fmt(format_args!("ALIAS {0}", expr)), + Unique { is_primary, characteristics } => { + f.write_fmt( + format_args!( + "{0}", + if *is_primary { "PRIMARY KEY" } else { "UNIQUE" }, + ), + )?; + if let Some(characteristics) = characteristics { + f.write_fmt(format_args!(" {0}", characteristics))?; + } + Ok(()) + } + ForeignKey { + foreign_table, + referred_columns, + on_delete, + on_update, + characteristics, + } => { + f.write_fmt(format_args!("REFERENCES {0}", foreign_table))?; + if !referred_columns.is_empty() { + f.write_fmt( + format_args!( + " ({0})", + display_comma_separated(referred_columns), + ), + )?; + } + if let Some(action) = on_delete { + f.write_fmt(format_args!(" ON DELETE {0}", action))?; + } + if let Some(action) = on_update { + f.write_fmt(format_args!(" ON UPDATE {0}", action))?; + } + if let Some(characteristics) = characteristics { + f.write_fmt(format_args!(" {0}", characteristics))?; + } + Ok(()) + } + Check(expr) => f.write_fmt(format_args!("CHECK ({0})", expr)), + DialectSpecific(val) => { + f.write_fmt(format_args!("{0}", display_separated(val, " "))) + } + CharacterSet(n) => f.write_fmt(format_args!("CHARACTER SET {0}", n)), + Comment(v) => { + f.write_fmt( + format_args!( + "COMMENT \'{0}\'", + escape_single_quote_string(v), + ), + ) + } + OnUpdate(expr) => f.write_fmt(format_args!("ON UPDATE {0}", expr)), + Generated { + generated_as, + sequence_options, + generation_expr, + generation_expr_mode, + generated_keyword, + } => { + if let Some(expr) = generation_expr { + let modifier = match generation_expr_mode { + None => "", + Some(GeneratedExpressionMode::Virtual) => " VIRTUAL", + Some(GeneratedExpressionMode::Stored) => " STORED", + }; + if *generated_keyword { + f.write_fmt( + format_args!("GENERATED ALWAYS AS ({0}){1}", expr, modifier), + )?; + } else { + f.write_fmt(format_args!("AS ({0}){1}", expr, modifier))?; + } + Ok(()) + } else { + let when = match generated_as { + GeneratedAs::Always => "ALWAYS", + GeneratedAs::ByDefault => "BY DEFAULT", + GeneratedAs::ExpStored => { + ::core::panicking::panic( + "internal error: entered unreachable code", + ) + } + }; + f.write_fmt( + format_args!("GENERATED {0} AS IDENTITY", when), + )?; + if sequence_options.is_some() { + let so = sequence_options.as_ref().unwrap(); + if !so.is_empty() { + f.write_fmt(format_args!(" ("))?; + } + for sequence_option in so { + f.write_fmt(format_args!("{0}", sequence_option))?; + } + if !so.is_empty() { + f.write_fmt(format_args!(" )"))?; + } + } + Ok(()) + } + } + Options(options) => { + f.write_fmt( + format_args!( + "OPTIONS({0})", + display_comma_separated(options), + ), + ) + } + Identity(parameters) => f.write_fmt(format_args!("{0}", parameters)), + OnConflict(keyword) => { + f.write_fmt(format_args!("ON CONFLICT {0:?}", keyword))?; + Ok(()) + } + Policy(parameters) => f.write_fmt(format_args!("{0}", parameters)), + Tags(tags) => f.write_fmt(format_args!("{0}", tags)), + } + } + } + /// `GeneratedAs`s are modifiers that follow a column option in a `generated`. + /// 'ExpStored' is used for a column generated from an expression and stored. + pub enum GeneratedAs { + Always, + ByDefault, + ExpStored, + } + #[automatically_derived] + impl ::core::fmt::Debug for GeneratedAs { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + GeneratedAs::Always => "Always", + GeneratedAs::ByDefault => "ByDefault", + GeneratedAs::ExpStored => "ExpStored", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for GeneratedAs { + #[inline] + fn clone(&self) -> GeneratedAs { + match self { + GeneratedAs::Always => GeneratedAs::Always, + GeneratedAs::ByDefault => GeneratedAs::ByDefault, + GeneratedAs::ExpStored => GeneratedAs::ExpStored, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for GeneratedAs {} + #[automatically_derived] + impl ::core::cmp::PartialEq for GeneratedAs { + #[inline] + fn eq(&self, other: &GeneratedAs) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for GeneratedAs { + #[inline] + fn partial_cmp( + &self, + other: &GeneratedAs, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for GeneratedAs { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for GeneratedAs { + #[inline] + fn cmp(&self, other: &GeneratedAs) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for GeneratedAs { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + /// `GeneratedExpressionMode`s are modifiers that follow an expression in a `generated`. + /// No modifier is typically the same as Virtual. + pub enum GeneratedExpressionMode { + Virtual, + Stored, + } + #[automatically_derived] + impl ::core::fmt::Debug for GeneratedExpressionMode { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + GeneratedExpressionMode::Virtual => "Virtual", + GeneratedExpressionMode::Stored => "Stored", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for GeneratedExpressionMode { + #[inline] + fn clone(&self) -> GeneratedExpressionMode { + match self { + GeneratedExpressionMode::Virtual => GeneratedExpressionMode::Virtual, + GeneratedExpressionMode::Stored => GeneratedExpressionMode::Stored, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for GeneratedExpressionMode {} + #[automatically_derived] + impl ::core::cmp::PartialEq for GeneratedExpressionMode { + #[inline] + fn eq(&self, other: &GeneratedExpressionMode) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for GeneratedExpressionMode { + #[inline] + fn partial_cmp( + &self, + other: &GeneratedExpressionMode, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for GeneratedExpressionMode { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for GeneratedExpressionMode { + #[inline] + fn cmp(&self, other: &GeneratedExpressionMode) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for GeneratedExpressionMode { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + #[must_use] + fn display_constraint_name(name: &'_ Option) -> impl fmt::Display + '_ { + struct ConstraintName<'a>(&'a Option); + impl fmt::Display for ConstraintName<'_> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if let Some(name) = self.0 { + f.write_fmt(format_args!("CONSTRAINT {0} ", name))?; + } + Ok(()) + } + } + ConstraintName(name) + } + /// If `option` is + /// * `Some(inner)` => create display struct for `"{prefix}{inner}{postfix}"` + /// * `_` => do nothing + #[must_use] + fn display_option<'a, T: fmt::Display>( + prefix: &'a str, + postfix: &'a str, + option: &'a Option, + ) -> impl fmt::Display + 'a { + struct OptionDisplay<'a, T>(&'a str, &'a str, &'a Option); + impl fmt::Display for OptionDisplay<'_, T> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if let Some(inner) = self.2 { + let (prefix, postfix) = (self.0, self.1); + f.write_fmt(format_args!("{0}{1}{2}", prefix, inner, postfix))?; + } + Ok(()) + } + } + OptionDisplay(prefix, postfix, option) + } + /// If `option` is + /// * `Some(inner)` => create display struct for `" {inner}"` + /// * `_` => do nothing + #[must_use] + fn display_option_spaced( + option: &Option, + ) -> impl fmt::Display + '_ { + display_option(" ", "", option) + } + /// ` = [ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ] [ ENFORCED | NOT ENFORCED ]` + /// + /// Used in UNIQUE and foreign key constraints. The individual settings may occur in any order. + pub struct ConstraintCharacteristics { + /// `[ DEFERRABLE | NOT DEFERRABLE ]` + pub deferrable: Option, + /// `[ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]` + pub initially: Option, + /// `[ ENFORCED | NOT ENFORCED ]` + pub enforced: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for ConstraintCharacteristics { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "ConstraintCharacteristics", + "deferrable", + &self.deferrable, + "initially", + &self.initially, + "enforced", + &&self.enforced, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for ConstraintCharacteristics {} + #[automatically_derived] + impl ::core::clone::Clone for ConstraintCharacteristics { + #[inline] + fn clone(&self) -> ConstraintCharacteristics { + let _: ::core::clone::AssertParamIsClone>; + let _: ::core::clone::AssertParamIsClone>; + let _: ::core::clone::AssertParamIsClone>; + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ConstraintCharacteristics {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ConstraintCharacteristics { + #[inline] + fn eq(&self, other: &ConstraintCharacteristics) -> bool { + self.deferrable == other.deferrable && self.initially == other.initially + && self.enforced == other.enforced + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ConstraintCharacteristics { + #[inline] + fn partial_cmp( + &self, + other: &ConstraintCharacteristics, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.deferrable, + &other.deferrable, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.initially, + &other.initially, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.enforced, + &other.enforced, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::default::Default for ConstraintCharacteristics { + #[inline] + fn default() -> ConstraintCharacteristics { + ConstraintCharacteristics { + deferrable: ::core::default::Default::default(), + initially: ::core::default::Default::default(), + enforced: ::core::default::Default::default(), + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ConstraintCharacteristics { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ConstraintCharacteristics { + #[inline] + fn cmp(&self, other: &ConstraintCharacteristics) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.deferrable, &other.deferrable) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.initially, &other.initially) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.enforced, &other.enforced) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ConstraintCharacteristics { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.deferrable, state); + ::core::hash::Hash::hash(&self.initially, state); + ::core::hash::Hash::hash(&self.enforced, state) + } + } + pub enum DeferrableInitial { + /// `INITIALLY IMMEDIATE` + Immediate, + /// `INITIALLY DEFERRED` + Deferred, + } + #[automatically_derived] + impl ::core::fmt::Debug for DeferrableInitial { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + DeferrableInitial::Immediate => "Immediate", + DeferrableInitial::Deferred => "Deferred", + }, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for DeferrableInitial {} + #[automatically_derived] + impl ::core::clone::Clone for DeferrableInitial { + #[inline] + fn clone(&self) -> DeferrableInitial { + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for DeferrableInitial {} + #[automatically_derived] + impl ::core::cmp::PartialEq for DeferrableInitial { + #[inline] + fn eq(&self, other: &DeferrableInitial) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for DeferrableInitial { + #[inline] + fn partial_cmp( + &self, + other: &DeferrableInitial, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for DeferrableInitial { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for DeferrableInitial { + #[inline] + fn cmp(&self, other: &DeferrableInitial) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for DeferrableInitial { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl ConstraintCharacteristics { + fn deferrable_text(&self) -> Option<&'static str> { + self.deferrable + .map(|deferrable| { + if deferrable { "DEFERRABLE" } else { "NOT DEFERRABLE" } + }) + } + fn initially_immediate_text(&self) -> Option<&'static str> { + self.initially + .map(|initially_immediate| match initially_immediate { + DeferrableInitial::Immediate => "INITIALLY IMMEDIATE", + DeferrableInitial::Deferred => "INITIALLY DEFERRED", + }) + } + fn enforced_text(&self) -> Option<&'static str> { + self.enforced + .map(|enforced| { + if enforced { "ENFORCED" } else { "NOT ENFORCED" } + }) + } + } + impl fmt::Display for ConstraintCharacteristics { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let deferrable = self.deferrable_text(); + let initially_immediate = self.initially_immediate_text(); + let enforced = self.enforced_text(); + match (deferrable, initially_immediate, enforced) { + (None, None, None) => Ok(()), + (None, None, Some(enforced)) => { + f.write_fmt(format_args!("{0}", enforced)) + } + (None, Some(initial), None) => { + f.write_fmt(format_args!("{0}", initial)) + } + (None, Some(initial), Some(enforced)) => { + f.write_fmt(format_args!("{0} {1}", initial, enforced)) + } + (Some(deferrable), None, None) => { + f.write_fmt(format_args!("{0}", deferrable)) + } + (Some(deferrable), None, Some(enforced)) => { + f.write_fmt(format_args!("{0} {1}", deferrable, enforced)) + } + (Some(deferrable), Some(initial), None) => { + f.write_fmt(format_args!("{0} {1}", deferrable, initial)) + } + (Some(deferrable), Some(initial), Some(enforced)) => { + f.write_fmt( + format_args!("{0} {1} {2}", deferrable, initial, enforced), + ) + } + } + } + } + /// ` = + /// { RESTRICT | CASCADE | SET NULL | NO ACTION | SET DEFAULT }` + /// + /// Used in foreign key constraints in `ON UPDATE` and `ON DELETE` options. + pub enum ReferentialAction { + Restrict, + Cascade, + SetNull, + NoAction, + SetDefault, + } + #[automatically_derived] + impl ::core::fmt::Debug for ReferentialAction { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + ReferentialAction::Restrict => "Restrict", + ReferentialAction::Cascade => "Cascade", + ReferentialAction::SetNull => "SetNull", + ReferentialAction::NoAction => "NoAction", + ReferentialAction::SetDefault => "SetDefault", + }, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for ReferentialAction {} + #[automatically_derived] + impl ::core::clone::Clone for ReferentialAction { + #[inline] + fn clone(&self) -> ReferentialAction { + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ReferentialAction {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ReferentialAction { + #[inline] + fn eq(&self, other: &ReferentialAction) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ReferentialAction { + #[inline] + fn partial_cmp( + &self, + other: &ReferentialAction, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ReferentialAction { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for ReferentialAction { + #[inline] + fn cmp(&self, other: &ReferentialAction) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for ReferentialAction { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for ReferentialAction { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str( + match self { + ReferentialAction::Restrict => "RESTRICT", + ReferentialAction::Cascade => "CASCADE", + ReferentialAction::SetNull => "SET NULL", + ReferentialAction::NoAction => "NO ACTION", + ReferentialAction::SetDefault => "SET DEFAULT", + }, + ) + } + } + /// ` ::= CASCADE | RESTRICT`. + /// + /// Used in `DROP` statements. + pub enum DropBehavior { + Restrict, + Cascade, + } + #[automatically_derived] + impl ::core::fmt::Debug for DropBehavior { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + DropBehavior::Restrict => "Restrict", + DropBehavior::Cascade => "Cascade", + }, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for DropBehavior {} + #[automatically_derived] + impl ::core::clone::Clone for DropBehavior { + #[inline] + fn clone(&self) -> DropBehavior { + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for DropBehavior {} + #[automatically_derived] + impl ::core::cmp::PartialEq for DropBehavior { + #[inline] + fn eq(&self, other: &DropBehavior) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for DropBehavior { + #[inline] + fn partial_cmp( + &self, + other: &DropBehavior, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for DropBehavior { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for DropBehavior { + #[inline] + fn cmp(&self, other: &DropBehavior) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for DropBehavior { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for DropBehavior { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str( + match self { + DropBehavior::Restrict => "RESTRICT", + DropBehavior::Cascade => "CASCADE", + }, + ) + } + } + /// SQL user defined type definition + pub enum UserDefinedTypeRepresentation { + Composite { attributes: Vec }, + /// Note: this is PostgreSQL-specific. See + Enum { labels: Vec }, + } + #[automatically_derived] + impl ::core::fmt::Debug for UserDefinedTypeRepresentation { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + UserDefinedTypeRepresentation::Composite { attributes: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "Composite", + "attributes", + &__self_0, + ) + } + UserDefinedTypeRepresentation::Enum { labels: __self_0 } => { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "Enum", + "labels", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for UserDefinedTypeRepresentation { + #[inline] + fn clone(&self) -> UserDefinedTypeRepresentation { + match self { + UserDefinedTypeRepresentation::Composite { attributes: __self_0 } => { + UserDefinedTypeRepresentation::Composite { + attributes: ::core::clone::Clone::clone(__self_0), + } + } + UserDefinedTypeRepresentation::Enum { labels: __self_0 } => { + UserDefinedTypeRepresentation::Enum { + labels: ::core::clone::Clone::clone(__self_0), + } + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for UserDefinedTypeRepresentation {} + #[automatically_derived] + impl ::core::cmp::PartialEq for UserDefinedTypeRepresentation { + #[inline] + fn eq(&self, other: &UserDefinedTypeRepresentation) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + UserDefinedTypeRepresentation::Composite { + attributes: __self_0, + }, + UserDefinedTypeRepresentation::Composite { + attributes: __arg1_0, + }, + ) => __self_0 == __arg1_0, + ( + UserDefinedTypeRepresentation::Enum { labels: __self_0 }, + UserDefinedTypeRepresentation::Enum { labels: __arg1_0 }, + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for UserDefinedTypeRepresentation { + #[inline] + fn partial_cmp( + &self, + other: &UserDefinedTypeRepresentation, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + UserDefinedTypeRepresentation::Composite { + attributes: __self_0, + }, + UserDefinedTypeRepresentation::Composite { attributes: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + UserDefinedTypeRepresentation::Enum { labels: __self_0 }, + UserDefinedTypeRepresentation::Enum { labels: __arg1_0 }, + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for UserDefinedTypeRepresentation { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq< + Vec, + >; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for UserDefinedTypeRepresentation { + #[inline] + fn cmp( + &self, + other: &UserDefinedTypeRepresentation, + ) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + UserDefinedTypeRepresentation::Composite { + attributes: __self_0, + }, + UserDefinedTypeRepresentation::Composite { + attributes: __arg1_0, + }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + UserDefinedTypeRepresentation::Enum { labels: __self_0 }, + UserDefinedTypeRepresentation::Enum { labels: __arg1_0 }, + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for UserDefinedTypeRepresentation { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + UserDefinedTypeRepresentation::Composite { attributes: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + UserDefinedTypeRepresentation::Enum { labels: __self_0 } => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl fmt::Display for UserDefinedTypeRepresentation { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + UserDefinedTypeRepresentation::Composite { attributes } => { + f.write_fmt( + format_args!("({0})", display_comma_separated(attributes)), + ) + } + UserDefinedTypeRepresentation::Enum { labels } => { + f.write_fmt( + format_args!("ENUM ({0})", display_comma_separated(labels)), + ) + } + } + } + } + /// SQL user defined type attribute definition + pub struct UserDefinedTypeCompositeAttributeDef { + pub name: Ident, + pub data_type: DataType, + pub collation: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for UserDefinedTypeCompositeAttributeDef { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "UserDefinedTypeCompositeAttributeDef", + "name", + &self.name, + "data_type", + &self.data_type, + "collation", + &&self.collation, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for UserDefinedTypeCompositeAttributeDef { + #[inline] + fn clone(&self) -> UserDefinedTypeCompositeAttributeDef { + UserDefinedTypeCompositeAttributeDef { + name: ::core::clone::Clone::clone(&self.name), + data_type: ::core::clone::Clone::clone(&self.data_type), + collation: ::core::clone::Clone::clone(&self.collation), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq + for UserDefinedTypeCompositeAttributeDef {} + #[automatically_derived] + impl ::core::cmp::PartialEq for UserDefinedTypeCompositeAttributeDef { + #[inline] + fn eq(&self, other: &UserDefinedTypeCompositeAttributeDef) -> bool { + self.name == other.name && self.data_type == other.data_type + && self.collation == other.collation + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for UserDefinedTypeCompositeAttributeDef { + #[inline] + fn partial_cmp( + &self, + other: &UserDefinedTypeCompositeAttributeDef, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.data_type, + &other.data_type, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.collation, + &other.collation, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for UserDefinedTypeCompositeAttributeDef { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for UserDefinedTypeCompositeAttributeDef { + #[inline] + fn cmp( + &self, + other: &UserDefinedTypeCompositeAttributeDef, + ) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.data_type, &other.data_type) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.collation, &other.collation) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for UserDefinedTypeCompositeAttributeDef { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.data_type, state); + ::core::hash::Hash::hash(&self.collation, state) + } + } + impl fmt::Display for UserDefinedTypeCompositeAttributeDef { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("{0} {1}", self.name, self.data_type))?; + if let Some(collation) = &self.collation { + f.write_fmt(format_args!(" COLLATE {0}", collation))?; + } + Ok(()) + } + } + /// PARTITION statement used in ALTER TABLE et al. such as in Hive and ClickHouse SQL. + /// For example, ClickHouse's OPTIMIZE TABLE supports syntax like PARTITION ID 'partition_id' and PARTITION expr. + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/optimize) + pub enum Partition { + Identifier(Ident), + Expr(Expr), + /// ClickHouse supports PART expr which represents physical partition in disk. + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/partition#attach-partitionpart) + Part(Expr), + Partitions(Vec), + } + #[automatically_derived] + impl ::core::fmt::Debug for Partition { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + Partition::Identifier(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Identifier", + &__self_0, + ) + } + Partition::Expr(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Expr", + &__self_0, + ) + } + Partition::Part(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Part", + &__self_0, + ) + } + Partition::Partitions(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Partitions", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for Partition { + #[inline] + fn clone(&self) -> Partition { + match self { + Partition::Identifier(__self_0) => { + Partition::Identifier(::core::clone::Clone::clone(__self_0)) + } + Partition::Expr(__self_0) => { + Partition::Expr(::core::clone::Clone::clone(__self_0)) + } + Partition::Part(__self_0) => { + Partition::Part(::core::clone::Clone::clone(__self_0)) + } + Partition::Partitions(__self_0) => { + Partition::Partitions(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for Partition {} + #[automatically_derived] + impl ::core::cmp::PartialEq for Partition { + #[inline] + fn eq(&self, other: &Partition) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + Partition::Identifier(__self_0), + Partition::Identifier(__arg1_0), + ) => __self_0 == __arg1_0, + (Partition::Expr(__self_0), Partition::Expr(__arg1_0)) => { + __self_0 == __arg1_0 + } + (Partition::Part(__self_0), Partition::Part(__arg1_0)) => { + __self_0 == __arg1_0 + } + ( + Partition::Partitions(__self_0), + Partition::Partitions(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for Partition { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::hash::Hash for Partition { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + Partition::Identifier(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + Partition::Expr(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + Partition::Part(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + Partition::Partitions(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for Partition { + #[inline] + fn partial_cmp( + &self, + other: &Partition, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + Partition::Identifier(__self_0), + Partition::Identifier(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + (Partition::Expr(__self_0), Partition::Expr(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + (Partition::Part(__self_0), Partition::Part(__arg1_0)) => { + ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) + } + ( + Partition::Partitions(__self_0), + Partition::Partitions(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Ord for Partition { + #[inline] + fn cmp(&self, other: &Partition) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + Partition::Identifier(__self_0), + Partition::Identifier(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + (Partition::Expr(__self_0), Partition::Expr(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + (Partition::Part(__self_0), Partition::Part(__arg1_0)) => { + ::core::cmp::Ord::cmp(__self_0, __arg1_0) + } + ( + Partition::Partitions(__self_0), + Partition::Partitions(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + impl fmt::Display for Partition { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Partition::Identifier(id) => { + f.write_fmt(format_args!("PARTITION ID {0}", id)) + } + Partition::Expr(expr) => { + f.write_fmt(format_args!("PARTITION {0}", expr)) + } + Partition::Part(expr) => f.write_fmt(format_args!("PART {0}", expr)), + Partition::Partitions(partitions) => { + f.write_fmt( + format_args!( + "PARTITION ({0})", + display_comma_separated(partitions), + ), + ) + } + } + } + } + /// DEDUPLICATE statement used in OPTIMIZE TABLE et al. such as in ClickHouse SQL + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/optimize) + pub enum Deduplicate { + All, + ByExpression(Expr), + } + #[automatically_derived] + impl ::core::fmt::Debug for Deduplicate { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + Deduplicate::All => ::core::fmt::Formatter::write_str(f, "All"), + Deduplicate::ByExpression(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "ByExpression", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for Deduplicate { + #[inline] + fn clone(&self) -> Deduplicate { + match self { + Deduplicate::All => Deduplicate::All, + Deduplicate::ByExpression(__self_0) => { + Deduplicate::ByExpression(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for Deduplicate {} + #[automatically_derived] + impl ::core::cmp::PartialEq for Deduplicate { + #[inline] + fn eq(&self, other: &Deduplicate) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + Deduplicate::ByExpression(__self_0), + Deduplicate::ByExpression(__arg1_0), + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for Deduplicate { + #[inline] + fn partial_cmp( + &self, + other: &Deduplicate, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + Deduplicate::ByExpression(__self_0), + Deduplicate::ByExpression(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for Deduplicate { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for Deduplicate { + #[inline] + fn cmp(&self, other: &Deduplicate) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + Deduplicate::ByExpression(__self_0), + Deduplicate::ByExpression(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for Deduplicate { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + Deduplicate::ByExpression(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + impl fmt::Display for Deduplicate { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + Deduplicate::All => f.write_fmt(format_args!("DEDUPLICATE")), + Deduplicate::ByExpression(expr) => { + f.write_fmt(format_args!("DEDUPLICATE BY {0}", expr)) + } + } + } + } + /// Hive supports `CLUSTERED BY` statement in `CREATE TABLE`. + /// Syntax: `CLUSTERED BY (col_name, ...) [SORTED BY (col_name [ASC|DESC], ...)] INTO num_buckets BUCKETS` + /// + /// [Hive](https://cwiki.apache.org/confluence/display/Hive/LanguageManual+DDL#LanguageManualDDL-CreateTable) + pub struct ClusteredBy { + pub columns: Vec, + pub sorted_by: Option>, + pub num_buckets: Value, + } + #[automatically_derived] + impl ::core::fmt::Debug for ClusteredBy { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "ClusteredBy", + "columns", + &self.columns, + "sorted_by", + &self.sorted_by, + "num_buckets", + &&self.num_buckets, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for ClusteredBy { + #[inline] + fn clone(&self) -> ClusteredBy { + ClusteredBy { + columns: ::core::clone::Clone::clone(&self.columns), + sorted_by: ::core::clone::Clone::clone(&self.sorted_by), + num_buckets: ::core::clone::Clone::clone(&self.num_buckets), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ClusteredBy {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ClusteredBy { + #[inline] + fn eq(&self, other: &ClusteredBy) -> bool { + self.columns == other.columns && self.sorted_by == other.sorted_by + && self.num_buckets == other.num_buckets + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ClusteredBy { + #[inline] + fn partial_cmp( + &self, + other: &ClusteredBy, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.columns, + &other.columns, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.sorted_by, + &other.sorted_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.num_buckets, + &other.num_buckets, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ClusteredBy { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ClusteredBy { + #[inline] + fn cmp(&self, other: &ClusteredBy) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.columns, &other.columns) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.sorted_by, &other.sorted_by) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.num_buckets, &other.num_buckets) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ClusteredBy { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.columns, state); + ::core::hash::Hash::hash(&self.sorted_by, state); + ::core::hash::Hash::hash(&self.num_buckets, state) + } + } + impl fmt::Display for ClusteredBy { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt( + format_args!( + "CLUSTERED BY ({0})", + display_comma_separated(&self.columns), + ), + )?; + if let Some(ref sorted_by) = self.sorted_by { + f.write_fmt( + format_args!( + " SORTED BY ({0})", + display_comma_separated(sorted_by), + ), + )?; + } + f.write_fmt(format_args!(" INTO {0} BUCKETS", self.num_buckets)) + } + } + pub struct CreateFunction { + pub or_replace: bool, + pub temporary: bool, + pub if_not_exists: bool, + pub name: ObjectName, + pub args: Option>, + pub return_type: Option, + /// The expression that defines the function. + /// + /// Examples: + /// ```sql + /// AS ((SELECT 1)) + /// AS "console.log();" + /// ``` + pub function_body: Option, + /// Behavior attribute for the function + /// + /// IMMUTABLE | STABLE | VOLATILE + /// + /// [Postgres](https://www.postgresql.org/docs/current/sql-createfunction.html) + pub behavior: Option, + /// CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT + /// + /// [Postgres](https://www.postgresql.org/docs/current/sql-createfunction.html) + pub called_on_null: Option, + /// PARALLEL { UNSAFE | RESTRICTED | SAFE } + /// + /// [Postgres](https://www.postgresql.org/docs/current/sql-createfunction.html) + pub parallel: Option, + /// USING ... (Hive only) + pub using: Option, + /// Language used in a UDF definition. + /// + /// Example: + /// ```sql + /// CREATE FUNCTION foo() LANGUAGE js AS "console.log();" + /// ``` + /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_a_javascript_udf) + pub language: Option, + /// Determinism keyword used for non-sql UDF definitions. + /// + /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#syntax_11) + pub determinism_specifier: Option, + /// List of options for creating the function. + /// + /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#syntax_11) + pub options: Option>, + /// Connection resource for a remote function. + /// + /// Example: + /// ```sql + /// CREATE FUNCTION foo() + /// RETURNS FLOAT64 + /// REMOTE WITH CONNECTION us.myconnection + /// ``` + /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_a_remote_function) + pub remote_connection: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for CreateFunction { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "or_replace", + "temporary", + "if_not_exists", + "name", + "args", + "return_type", + "function_body", + "behavior", + "called_on_null", + "parallel", + "using", + "language", + "determinism_specifier", + "options", + "remote_connection", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.or_replace, + &self.temporary, + &self.if_not_exists, + &self.name, + &self.args, + &self.return_type, + &self.function_body, + &self.behavior, + &self.called_on_null, + &self.parallel, + &self.using, + &self.language, + &self.determinism_specifier, + &self.options, + &&self.remote_connection, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "CreateFunction", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for CreateFunction { + #[inline] + fn clone(&self) -> CreateFunction { + CreateFunction { + or_replace: ::core::clone::Clone::clone(&self.or_replace), + temporary: ::core::clone::Clone::clone(&self.temporary), + if_not_exists: ::core::clone::Clone::clone(&self.if_not_exists), + name: ::core::clone::Clone::clone(&self.name), + args: ::core::clone::Clone::clone(&self.args), + return_type: ::core::clone::Clone::clone(&self.return_type), + function_body: ::core::clone::Clone::clone(&self.function_body), + behavior: ::core::clone::Clone::clone(&self.behavior), + called_on_null: ::core::clone::Clone::clone(&self.called_on_null), + parallel: ::core::clone::Clone::clone(&self.parallel), + using: ::core::clone::Clone::clone(&self.using), + language: ::core::clone::Clone::clone(&self.language), + determinism_specifier: ::core::clone::Clone::clone( + &self.determinism_specifier, + ), + options: ::core::clone::Clone::clone(&self.options), + remote_connection: ::core::clone::Clone::clone( + &self.remote_connection, + ), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for CreateFunction {} + #[automatically_derived] + impl ::core::cmp::PartialEq for CreateFunction { + #[inline] + fn eq(&self, other: &CreateFunction) -> bool { + self.or_replace == other.or_replace && self.temporary == other.temporary + && self.if_not_exists == other.if_not_exists + && self.name == other.name && self.args == other.args + && self.return_type == other.return_type + && self.function_body == other.function_body + && self.behavior == other.behavior + && self.called_on_null == other.called_on_null + && self.parallel == other.parallel && self.using == other.using + && self.language == other.language + && self.determinism_specifier == other.determinism_specifier + && self.options == other.options + && self.remote_connection == other.remote_connection + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for CreateFunction { + #[inline] + fn partial_cmp( + &self, + other: &CreateFunction, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.or_replace, + &other.or_replace, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.temporary, + &other.temporary, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.name, + &other.name, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.args, + &other.args, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.return_type, + &other.return_type, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.function_body, + &other.function_body, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.behavior, + &other.behavior, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.called_on_null, + &other.called_on_null, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.parallel, + &other.parallel, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.using, + &other.using, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.language, + &other.language, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.determinism_specifier, + &other.determinism_specifier, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.options, + &other.options, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.remote_connection, + &other.remote_connection, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for CreateFunction { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq< + Option, + >; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for CreateFunction { + #[inline] + fn cmp(&self, other: &CreateFunction) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.or_replace, &other.or_replace) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.temporary, &other.temporary) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.args, &other.args) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.return_type, + &other.return_type, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.function_body, + &other.function_body, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.behavior, + &other.behavior, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.called_on_null, + &other.called_on_null, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.parallel, + &other.parallel, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.using, &other.using) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.language, + &other.language, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.determinism_specifier, + &other.determinism_specifier, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.options, &other.options) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp( + &self.remote_connection, + &other.remote_connection, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for CreateFunction { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.or_replace, state); + ::core::hash::Hash::hash(&self.temporary, state); + ::core::hash::Hash::hash(&self.if_not_exists, state); + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.args, state); + ::core::hash::Hash::hash(&self.return_type, state); + ::core::hash::Hash::hash(&self.function_body, state); + ::core::hash::Hash::hash(&self.behavior, state); + ::core::hash::Hash::hash(&self.called_on_null, state); + ::core::hash::Hash::hash(&self.parallel, state); + ::core::hash::Hash::hash(&self.using, state); + ::core::hash::Hash::hash(&self.language, state); + ::core::hash::Hash::hash(&self.determinism_specifier, state); + ::core::hash::Hash::hash(&self.options, state); + ::core::hash::Hash::hash(&self.remote_connection, state) + } + } + impl fmt::Display for CreateFunction { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt( + format_args!( + "CREATE {2}{1}FUNCTION {3}{0}", + self.name, + if self.temporary { "TEMPORARY " } else { "" }, + if self.or_replace { "OR REPLACE " } else { "" }, + if self.if_not_exists { "IF NOT EXISTS " } else { "" }, + ), + )?; + if let Some(args) = &self.args { + f.write_fmt(format_args!("({0})", display_comma_separated(args)))?; + } + if let Some(return_type) = &self.return_type { + f.write_fmt(format_args!(" RETURNS {0}", return_type))?; + } + if let Some(determinism_specifier) = &self.determinism_specifier { + f.write_fmt(format_args!(" {0}", determinism_specifier))?; + } + if let Some(language) = &self.language { + f.write_fmt(format_args!(" LANGUAGE {0}", language))?; + } + if let Some(behavior) = &self.behavior { + f.write_fmt(format_args!(" {0}", behavior))?; + } + if let Some(called_on_null) = &self.called_on_null { + f.write_fmt(format_args!(" {0}", called_on_null))?; + } + if let Some(parallel) = &self.parallel { + f.write_fmt(format_args!(" {0}", parallel))?; + } + if let Some(remote_connection) = &self.remote_connection { + f.write_fmt( + format_args!(" REMOTE WITH CONNECTION {0}", remote_connection), + )?; + } + if let Some(CreateFunctionBody::AsBeforeOptions(function_body)) = &self + .function_body + { + f.write_fmt(format_args!(" AS {0}", function_body))?; + } + if let Some(CreateFunctionBody::Return(function_body)) = &self + .function_body + { + f.write_fmt(format_args!(" RETURN {0}", function_body))?; + } + if let Some(using) = &self.using { + f.write_fmt(format_args!(" {0}", using))?; + } + if let Some(options) = &self.options { + f.write_fmt( + format_args!( + " OPTIONS({0})", + display_comma_separated(options.as_slice()), + ), + )?; + } + if let Some(CreateFunctionBody::AsAfterOptions(function_body)) = &self + .function_body + { + f.write_fmt(format_args!(" AS {0}", function_body))?; + } + Ok(()) + } + } + /// ```sql + /// CREATE CONNECTOR [IF NOT EXISTS] connector_name + /// [TYPE datasource_type] + /// [URL datasource_url] + /// [COMMENT connector_comment] + /// [WITH DCPROPERTIES(property_name=property_value, ...)] + /// ``` + /// + /// [Hive](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=27362034#LanguageManualDDL-CreateDataConnectorCreateConnector) + pub struct CreateConnector { + pub name: Ident, + pub if_not_exists: bool, + pub connector_type: Option, + pub url: Option, + pub comment: Option, + pub with_dcproperties: Option>, + } + #[automatically_derived] + impl ::core::fmt::Debug for CreateConnector { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "name", + "if_not_exists", + "connector_type", + "url", + "comment", + "with_dcproperties", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.name, + &self.if_not_exists, + &self.connector_type, + &self.url, + &self.comment, + &&self.with_dcproperties, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "CreateConnector", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for CreateConnector { + #[inline] + fn clone(&self) -> CreateConnector { + CreateConnector { + name: ::core::clone::Clone::clone(&self.name), + if_not_exists: ::core::clone::Clone::clone(&self.if_not_exists), + connector_type: ::core::clone::Clone::clone(&self.connector_type), + url: ::core::clone::Clone::clone(&self.url), + comment: ::core::clone::Clone::clone(&self.comment), + with_dcproperties: ::core::clone::Clone::clone( + &self.with_dcproperties, + ), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for CreateConnector {} + #[automatically_derived] + impl ::core::cmp::PartialEq for CreateConnector { + #[inline] + fn eq(&self, other: &CreateConnector) -> bool { + self.name == other.name && self.if_not_exists == other.if_not_exists + && self.connector_type == other.connector_type + && self.url == other.url && self.comment == other.comment + && self.with_dcproperties == other.with_dcproperties + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for CreateConnector { + #[inline] + fn partial_cmp( + &self, + other: &CreateConnector, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.connector_type, + &other.connector_type, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.url, + &other.url, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.comment, + &other.comment, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.with_dcproperties, + &other.with_dcproperties, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for CreateConnector { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for CreateConnector { + #[inline] + fn cmp(&self, other: &CreateConnector) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.connector_type, + &other.connector_type, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.url, &other.url) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.comment, &other.comment) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp( + &self.with_dcproperties, + &other.with_dcproperties, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for CreateConnector { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.if_not_exists, state); + ::core::hash::Hash::hash(&self.connector_type, state); + ::core::hash::Hash::hash(&self.url, state); + ::core::hash::Hash::hash(&self.comment, state); + ::core::hash::Hash::hash(&self.with_dcproperties, state) + } + } + impl fmt::Display for CreateConnector { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt( + format_args!( + "CREATE CONNECTOR {0}{1}", + if self.if_not_exists { "IF NOT EXISTS " } else { "" }, + self.name, + ), + )?; + if let Some(connector_type) = &self.connector_type { + f.write_fmt(format_args!(" TYPE \'{0}\'", connector_type))?; + } + if let Some(url) = &self.url { + f.write_fmt(format_args!(" URL \'{0}\'", url))?; + } + if let Some(comment) = &self.comment { + f.write_fmt(format_args!(" COMMENT = \'{0}\'", comment))?; + } + if let Some(with_dcproperties) = &self.with_dcproperties { + f.write_fmt( + format_args!( + " WITH DCPROPERTIES({0})", + display_comma_separated(with_dcproperties), + ), + )?; + } + Ok(()) + } + } + } + mod dml { + use core::fmt::{self, Display}; + pub use super::ddl::{ColumnDef, TableConstraint}; + use super::{ + display_comma_separated, display_separated, + operator_classes::IndexOperatorClass, query::InputFormatClause, Assignment, + ClusteredBy, CommentDef, Expr, FileFormat, FromTable, HiveDistributionStyle, + HiveFormat, HiveIOFormat, HiveRowFormat, Ident, IndexType, InsertAliases, + MysqlInsertPriority, ObjectName, OnCommit, OnInsert, OneOrManyWithParens, + OrderByExpr, Query, RowAccessPolicy, SelectItem, Setting, SqlOption, + SqliteOnConflict, StorageSerializationPolicy, TableEngine, TableObject, + TableWithJoins, Tag, WrappedCollection, + }; + /// Index column type. + pub struct IndexColumn { + pub column: OrderByExpr, + pub operator_class: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for IndexColumn { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "IndexColumn", + "column", + &self.column, + "operator_class", + &&self.operator_class, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for IndexColumn { + #[inline] + fn clone(&self) -> IndexColumn { + IndexColumn { + column: ::core::clone::Clone::clone(&self.column), + operator_class: ::core::clone::Clone::clone(&self.operator_class), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IndexColumn {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IndexColumn { + #[inline] + fn eq(&self, other: &IndexColumn) -> bool { + self.column == other.column + && self.operator_class == other.operator_class + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IndexColumn { + #[inline] + fn partial_cmp( + &self, + other: &IndexColumn, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.column, &other.column) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.operator_class, + &other.operator_class, + ) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IndexColumn { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for IndexColumn { + #[inline] + fn cmp(&self, other: &IndexColumn) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.column, &other.column) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp( + &self.operator_class, + &other.operator_class, + ) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for IndexColumn { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.column, state); + ::core::hash::Hash::hash(&self.operator_class, state) + } + } + impl From for IndexColumn { + fn from(column: OrderByExpr) -> Self { + Self { + column, + operator_class: None, + } + } + } + impl Display for IndexColumn { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("{0}", self.column))?; + if let Some(operator_class) = &self.operator_class { + f.write_fmt(format_args!(" {0}", operator_class))?; + } + Ok(()) + } + } + /// CREATE INDEX statement. + pub struct CreateIndex { + /// index name + pub name: Option, + pub table_name: ObjectName, + pub using: Option, + pub columns: Vec, + pub unique: bool, + pub concurrently: bool, + pub if_not_exists: bool, + pub include: Vec, + pub nulls_distinct: Option, + /// WITH clause: + pub with: Vec, + pub predicate: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for CreateIndex { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "name", + "table_name", + "using", + "columns", + "unique", + "concurrently", + "if_not_exists", + "include", + "nulls_distinct", + "with", + "predicate", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.name, + &self.table_name, + &self.using, + &self.columns, + &self.unique, + &self.concurrently, + &self.if_not_exists, + &self.include, + &self.nulls_distinct, + &self.with, + &&self.predicate, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "CreateIndex", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for CreateIndex { + #[inline] + fn clone(&self) -> CreateIndex { + CreateIndex { + name: ::core::clone::Clone::clone(&self.name), + table_name: ::core::clone::Clone::clone(&self.table_name), + using: ::core::clone::Clone::clone(&self.using), + columns: ::core::clone::Clone::clone(&self.columns), + unique: ::core::clone::Clone::clone(&self.unique), + concurrently: ::core::clone::Clone::clone(&self.concurrently), + if_not_exists: ::core::clone::Clone::clone(&self.if_not_exists), + include: ::core::clone::Clone::clone(&self.include), + nulls_distinct: ::core::clone::Clone::clone(&self.nulls_distinct), + with: ::core::clone::Clone::clone(&self.with), + predicate: ::core::clone::Clone::clone(&self.predicate), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for CreateIndex {} + #[automatically_derived] + impl ::core::cmp::PartialEq for CreateIndex { + #[inline] + fn eq(&self, other: &CreateIndex) -> bool { + self.name == other.name && self.table_name == other.table_name + && self.using == other.using && self.columns == other.columns + && self.unique == other.unique + && self.concurrently == other.concurrently + && self.if_not_exists == other.if_not_exists + && self.include == other.include + && self.nulls_distinct == other.nulls_distinct + && self.with == other.with && self.predicate == other.predicate + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for CreateIndex { + #[inline] + fn partial_cmp( + &self, + other: &CreateIndex, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.table_name, + &other.table_name, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.using, + &other.using, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.columns, + &other.columns, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.unique, + &other.unique, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.concurrently, + &other.concurrently, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.include, + &other.include, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.nulls_distinct, + &other.nulls_distinct, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.with, + &other.with, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.predicate, + &other.predicate, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for CreateIndex { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for CreateIndex { + #[inline] + fn cmp(&self, other: &CreateIndex) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.table_name, + &other.table_name, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.using, &other.using) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.columns, &other.columns) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.unique, &other.unique) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.concurrently, + &other.concurrently, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.include, &other.include) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.nulls_distinct, + &other.nulls_distinct, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.with, &other.with) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.predicate, &other.predicate) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for CreateIndex { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.table_name, state); + ::core::hash::Hash::hash(&self.using, state); + ::core::hash::Hash::hash(&self.columns, state); + ::core::hash::Hash::hash(&self.unique, state); + ::core::hash::Hash::hash(&self.concurrently, state); + ::core::hash::Hash::hash(&self.if_not_exists, state); + ::core::hash::Hash::hash(&self.include, state); + ::core::hash::Hash::hash(&self.nulls_distinct, state); + ::core::hash::Hash::hash(&self.with, state); + ::core::hash::Hash::hash(&self.predicate, state) + } + } + impl Display for CreateIndex { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt( + format_args!( + "CREATE {0}INDEX {1}{2}", + if self.unique { "UNIQUE " } else { "" }, + if self.concurrently { "CONCURRENTLY " } else { "" }, + if self.if_not_exists { "IF NOT EXISTS " } else { "" }, + ), + )?; + if let Some(value) = &self.name { + f.write_fmt(format_args!("{0} ", value))?; + } + f.write_fmt(format_args!("ON {0}", self.table_name))?; + if let Some(value) = &self.using { + f.write_fmt(format_args!(" USING {0} ", value))?; + } + f.write_fmt( + format_args!("({0})", display_separated(&self.columns, ",")), + )?; + if !self.include.is_empty() { + f.write_fmt( + format_args!( + " INCLUDE ({0})", + display_separated(&self.include, ","), + ), + )?; + } + if let Some(value) = self.nulls_distinct { + if value { + f.write_fmt(format_args!(" NULLS DISTINCT"))?; + } else { + f.write_fmt(format_args!(" NULLS NOT DISTINCT"))?; + } + } + if !self.with.is_empty() { + f.write_fmt( + format_args!(" WITH ({0})", display_comma_separated(&self.with)), + )?; + } + if let Some(predicate) = &self.predicate { + f.write_fmt(format_args!(" WHERE {0}", predicate))?; + } + Ok(()) + } + } + /// CREATE TABLE statement. + pub struct CreateTable { + pub or_replace: bool, + pub temporary: bool, + pub external: bool, + pub global: Option, + pub if_not_exists: bool, + pub transient: bool, + pub volatile: bool, + pub iceberg: bool, + /// Table name + pub name: ObjectName, + /// Optional schema + pub columns: Vec, + pub constraints: Vec, + pub hive_distribution: HiveDistributionStyle, + pub hive_formats: Option, + pub table_properties: Vec, + pub with_options: Vec, + pub file_format: Option, + pub location: Option, + pub query: Option>, + pub without_rowid: bool, + pub like: Option, + pub clone: Option, + pub engine: Option, + pub comment: Option, + pub auto_increment_offset: Option, + pub default_charset: Option, + pub collation: Option, + pub on_commit: Option, + /// ClickHouse "ON CLUSTER" clause: + /// + pub on_cluster: Option, + /// ClickHouse "PRIMARY KEY " clause. + /// + pub primary_key: Option>, + /// ClickHouse "ORDER BY " clause. Note that omitted ORDER BY is different + /// than empty (represented as ()), the latter meaning "no sorting". + /// + pub order_by: Option>, + /// BigQuery: A partition expression for the table. + /// + pub partition_by: Option>, + /// BigQuery: Table clustering column list. + /// + pub cluster_by: Option>>, + /// Hive: Table clustering column list. + /// + pub clustered_by: Option, + /// BigQuery: Table options list. + /// + pub options: Option>, + /// SQLite "STRICT" clause. + /// if the "STRICT" table-option keyword is added to the end, after the closing ")", + /// then strict typing rules apply to that table. + pub strict: bool, + /// Snowflake "COPY GRANTS" clause + /// + pub copy_grants: bool, + /// Snowflake "ENABLE_SCHEMA_EVOLUTION" clause + /// + pub enable_schema_evolution: Option, + /// Snowflake "CHANGE_TRACKING" clause + /// + pub change_tracking: Option, + /// Snowflake "DATA_RETENTION_TIME_IN_DAYS" clause + /// + pub data_retention_time_in_days: Option, + /// Snowflake "MAX_DATA_EXTENSION_TIME_IN_DAYS" clause + /// + pub max_data_extension_time_in_days: Option, + /// Snowflake "DEFAULT_DDL_COLLATION" clause + /// + pub default_ddl_collation: Option, + /// Snowflake "WITH AGGREGATION POLICY" clause + /// + pub with_aggregation_policy: Option, + /// Snowflake "WITH ROW ACCESS POLICY" clause + /// + pub with_row_access_policy: Option, + /// Snowflake "WITH TAG" clause + /// + pub with_tags: Option>, + /// Snowflake "EXTERNAL_VOLUME" clause for Iceberg tables + /// + pub external_volume: Option, + /// Snowflake "BASE_LOCATION" clause for Iceberg tables + /// + pub base_location: Option, + /// Snowflake "CATALOG" clause for Iceberg tables + /// + pub catalog: Option, + /// Snowflake "CATALOG_SYNC" clause for Iceberg tables + /// + pub catalog_sync: Option, + /// Snowflake "STORAGE_SERIALIZATION_POLICY" clause for Iceberg tables + /// + pub storage_serialization_policy: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for CreateTable { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "or_replace", + "temporary", + "external", + "global", + "if_not_exists", + "transient", + "volatile", + "iceberg", + "name", + "columns", + "constraints", + "hive_distribution", + "hive_formats", + "table_properties", + "with_options", + "file_format", + "location", + "query", + "without_rowid", + "like", + "clone", + "engine", + "comment", + "auto_increment_offset", + "default_charset", + "collation", + "on_commit", + "on_cluster", + "primary_key", + "order_by", + "partition_by", + "cluster_by", + "clustered_by", + "options", + "strict", + "copy_grants", + "enable_schema_evolution", + "change_tracking", + "data_retention_time_in_days", + "max_data_extension_time_in_days", + "default_ddl_collation", + "with_aggregation_policy", + "with_row_access_policy", + "with_tags", + "external_volume", + "base_location", + "catalog", + "catalog_sync", + "storage_serialization_policy", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.or_replace, + &self.temporary, + &self.external, + &self.global, + &self.if_not_exists, + &self.transient, + &self.volatile, + &self.iceberg, + &self.name, + &self.columns, + &self.constraints, + &self.hive_distribution, + &self.hive_formats, + &self.table_properties, + &self.with_options, + &self.file_format, + &self.location, + &self.query, + &self.without_rowid, + &self.like, + &self.clone, + &self.engine, + &self.comment, + &self.auto_increment_offset, + &self.default_charset, + &self.collation, + &self.on_commit, + &self.on_cluster, + &self.primary_key, + &self.order_by, + &self.partition_by, + &self.cluster_by, + &self.clustered_by, + &self.options, + &self.strict, + &self.copy_grants, + &self.enable_schema_evolution, + &self.change_tracking, + &self.data_retention_time_in_days, + &self.max_data_extension_time_in_days, + &self.default_ddl_collation, + &self.with_aggregation_policy, + &self.with_row_access_policy, + &self.with_tags, + &self.external_volume, + &self.base_location, + &self.catalog, + &self.catalog_sync, + &&self.storage_serialization_policy, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "CreateTable", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for CreateTable { + #[inline] + fn clone(&self) -> CreateTable { + CreateTable { + or_replace: ::core::clone::Clone::clone(&self.or_replace), + temporary: ::core::clone::Clone::clone(&self.temporary), + external: ::core::clone::Clone::clone(&self.external), + global: ::core::clone::Clone::clone(&self.global), + if_not_exists: ::core::clone::Clone::clone(&self.if_not_exists), + transient: ::core::clone::Clone::clone(&self.transient), + volatile: ::core::clone::Clone::clone(&self.volatile), + iceberg: ::core::clone::Clone::clone(&self.iceberg), + name: ::core::clone::Clone::clone(&self.name), + columns: ::core::clone::Clone::clone(&self.columns), + constraints: ::core::clone::Clone::clone(&self.constraints), + hive_distribution: ::core::clone::Clone::clone( + &self.hive_distribution, + ), + hive_formats: ::core::clone::Clone::clone(&self.hive_formats), + table_properties: ::core::clone::Clone::clone( + &self.table_properties, + ), + with_options: ::core::clone::Clone::clone(&self.with_options), + file_format: ::core::clone::Clone::clone(&self.file_format), + location: ::core::clone::Clone::clone(&self.location), + query: ::core::clone::Clone::clone(&self.query), + without_rowid: ::core::clone::Clone::clone(&self.without_rowid), + like: ::core::clone::Clone::clone(&self.like), + clone: ::core::clone::Clone::clone(&self.clone), + engine: ::core::clone::Clone::clone(&self.engine), + comment: ::core::clone::Clone::clone(&self.comment), + auto_increment_offset: ::core::clone::Clone::clone( + &self.auto_increment_offset, + ), + default_charset: ::core::clone::Clone::clone(&self.default_charset), + collation: ::core::clone::Clone::clone(&self.collation), + on_commit: ::core::clone::Clone::clone(&self.on_commit), + on_cluster: ::core::clone::Clone::clone(&self.on_cluster), + primary_key: ::core::clone::Clone::clone(&self.primary_key), + order_by: ::core::clone::Clone::clone(&self.order_by), + partition_by: ::core::clone::Clone::clone(&self.partition_by), + cluster_by: ::core::clone::Clone::clone(&self.cluster_by), + clustered_by: ::core::clone::Clone::clone(&self.clustered_by), + options: ::core::clone::Clone::clone(&self.options), + strict: ::core::clone::Clone::clone(&self.strict), + copy_grants: ::core::clone::Clone::clone(&self.copy_grants), + enable_schema_evolution: ::core::clone::Clone::clone( + &self.enable_schema_evolution, + ), + change_tracking: ::core::clone::Clone::clone(&self.change_tracking), + data_retention_time_in_days: ::core::clone::Clone::clone( + &self.data_retention_time_in_days, + ), + max_data_extension_time_in_days: ::core::clone::Clone::clone( + &self.max_data_extension_time_in_days, + ), + default_ddl_collation: ::core::clone::Clone::clone( + &self.default_ddl_collation, + ), + with_aggregation_policy: ::core::clone::Clone::clone( + &self.with_aggregation_policy, + ), + with_row_access_policy: ::core::clone::Clone::clone( + &self.with_row_access_policy, + ), + with_tags: ::core::clone::Clone::clone(&self.with_tags), + external_volume: ::core::clone::Clone::clone(&self.external_volume), + base_location: ::core::clone::Clone::clone(&self.base_location), + catalog: ::core::clone::Clone::clone(&self.catalog), + catalog_sync: ::core::clone::Clone::clone(&self.catalog_sync), + storage_serialization_policy: ::core::clone::Clone::clone( + &self.storage_serialization_policy, + ), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for CreateTable {} + #[automatically_derived] + impl ::core::cmp::PartialEq for CreateTable { + #[inline] + fn eq(&self, other: &CreateTable) -> bool { + self.or_replace == other.or_replace && self.temporary == other.temporary + && self.external == other.external && self.global == other.global + && self.if_not_exists == other.if_not_exists + && self.transient == other.transient + && self.volatile == other.volatile && self.iceberg == other.iceberg + && self.name == other.name && self.columns == other.columns + && self.constraints == other.constraints + && self.hive_distribution == other.hive_distribution + && self.hive_formats == other.hive_formats + && self.table_properties == other.table_properties + && self.with_options == other.with_options + && self.file_format == other.file_format + && self.location == other.location && self.query == other.query + && self.without_rowid == other.without_rowid + && self.like == other.like && self.clone == other.clone + && self.engine == other.engine && self.comment == other.comment + && self.auto_increment_offset == other.auto_increment_offset + && self.default_charset == other.default_charset + && self.collation == other.collation + && self.on_commit == other.on_commit + && self.on_cluster == other.on_cluster + && self.primary_key == other.primary_key + && self.order_by == other.order_by + && self.partition_by == other.partition_by + && self.cluster_by == other.cluster_by + && self.clustered_by == other.clustered_by + && self.options == other.options && self.strict == other.strict + && self.copy_grants == other.copy_grants + && self.enable_schema_evolution == other.enable_schema_evolution + && self.change_tracking == other.change_tracking + && self.data_retention_time_in_days + == other.data_retention_time_in_days + && self.max_data_extension_time_in_days + == other.max_data_extension_time_in_days + && self.default_ddl_collation == other.default_ddl_collation + && self.with_aggregation_policy == other.with_aggregation_policy + && self.with_row_access_policy == other.with_row_access_policy + && self.with_tags == other.with_tags + && self.external_volume == other.external_volume + && self.base_location == other.base_location + && self.catalog == other.catalog + && self.catalog_sync == other.catalog_sync + && self.storage_serialization_policy + == other.storage_serialization_policy + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for CreateTable { + #[inline] + fn partial_cmp( + &self, + other: &CreateTable, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.or_replace, + &other.or_replace, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.temporary, + &other.temporary, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.external, + &other.external, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.global, + &other.global, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.transient, + &other.transient, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.volatile, + &other.volatile, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.iceberg, + &other.iceberg, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.name, + &other.name, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.columns, + &other.columns, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.constraints, + &other.constraints, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.hive_distribution, + &other.hive_distribution, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.hive_formats, + &other.hive_formats, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.table_properties, + &other.table_properties, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.with_options, + &other.with_options, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.file_format, + &other.file_format, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.location, + &other.location, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.query, + &other.query, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.without_rowid, + &other.without_rowid, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.like, + &other.like, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.clone, + &other.clone, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.engine, + &other.engine, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.comment, + &other.comment, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.auto_increment_offset, + &other.auto_increment_offset, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.default_charset, + &other.default_charset, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.collation, + &other.collation, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.on_commit, + &other.on_commit, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.on_cluster, + &other.on_cluster, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.primary_key, + &other.primary_key, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.order_by, + &other.order_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.partition_by, + &other.partition_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.cluster_by, + &other.cluster_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.clustered_by, + &other.clustered_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.options, + &other.options, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.strict, + &other.strict, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.copy_grants, + &other.copy_grants, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.enable_schema_evolution, + &other.enable_schema_evolution, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.change_tracking, + &other.change_tracking, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.data_retention_time_in_days, + &other.data_retention_time_in_days, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.max_data_extension_time_in_days, + &other.max_data_extension_time_in_days, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.default_ddl_collation, + &other.default_ddl_collation, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.with_aggregation_policy, + &other.with_aggregation_policy, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.with_row_access_policy, + &other.with_row_access_policy, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.with_tags, + &other.with_tags, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.external_volume, + &other.external_volume, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.base_location, + &other.base_location, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.catalog, + &other.catalog, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.catalog_sync, + &other.catalog_sync, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.storage_serialization_policy, + &other.storage_serialization_policy, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for CreateTable { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq< + Option>>, + >; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for CreateTable { + #[inline] + fn cmp(&self, other: &CreateTable) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.or_replace, &other.or_replace) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.temporary, &other.temporary) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.external, + &other.external, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.global, &other.global) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.if_not_exists, + &other.if_not_exists, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.transient, + &other.transient, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.volatile, + &other.volatile, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.iceberg, &other.iceberg) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.name, &other.name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.columns, &other.columns) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.constraints, + &other.constraints, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.hive_distribution, + &other.hive_distribution, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.hive_formats, + &other.hive_formats, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.table_properties, + &other.table_properties, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.with_options, + &other.with_options, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.file_format, + &other.file_format, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.location, + &other.location, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.query, &other.query) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.without_rowid, + &other.without_rowid, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.like, &other.like) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.clone, &other.clone) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.engine, &other.engine) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.comment, &other.comment) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.auto_increment_offset, + &other.auto_increment_offset, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.default_charset, + &other.default_charset, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.collation, + &other.collation, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.on_commit, + &other.on_commit, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.on_cluster, + &other.on_cluster, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.primary_key, + &other.primary_key, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.order_by, + &other.order_by, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.partition_by, + &other.partition_by, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.cluster_by, + &other.cluster_by, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.clustered_by, + &other.clustered_by, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.options, &other.options) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.strict, &other.strict) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.copy_grants, + &other.copy_grants, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.enable_schema_evolution, + &other.enable_schema_evolution, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.change_tracking, + &other.change_tracking, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.data_retention_time_in_days, + &other.data_retention_time_in_days, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.max_data_extension_time_in_days, + &other.max_data_extension_time_in_days, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.default_ddl_collation, + &other.default_ddl_collation, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.with_aggregation_policy, + &other.with_aggregation_policy, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.with_row_access_policy, + &other.with_row_access_policy, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.with_tags, + &other.with_tags, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.external_volume, + &other.external_volume, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.base_location, + &other.base_location, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.catalog, &other.catalog) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.catalog_sync, + &other.catalog_sync, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp( + &self.storage_serialization_policy, + &other.storage_serialization_policy, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for CreateTable { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.or_replace, state); + ::core::hash::Hash::hash(&self.temporary, state); + ::core::hash::Hash::hash(&self.external, state); + ::core::hash::Hash::hash(&self.global, state); + ::core::hash::Hash::hash(&self.if_not_exists, state); + ::core::hash::Hash::hash(&self.transient, state); + ::core::hash::Hash::hash(&self.volatile, state); + ::core::hash::Hash::hash(&self.iceberg, state); + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.columns, state); + ::core::hash::Hash::hash(&self.constraints, state); + ::core::hash::Hash::hash(&self.hive_distribution, state); + ::core::hash::Hash::hash(&self.hive_formats, state); + ::core::hash::Hash::hash(&self.table_properties, state); + ::core::hash::Hash::hash(&self.with_options, state); + ::core::hash::Hash::hash(&self.file_format, state); + ::core::hash::Hash::hash(&self.location, state); + ::core::hash::Hash::hash(&self.query, state); + ::core::hash::Hash::hash(&self.without_rowid, state); + ::core::hash::Hash::hash(&self.like, state); + ::core::hash::Hash::hash(&self.clone, state); + ::core::hash::Hash::hash(&self.engine, state); + ::core::hash::Hash::hash(&self.comment, state); + ::core::hash::Hash::hash(&self.auto_increment_offset, state); + ::core::hash::Hash::hash(&self.default_charset, state); + ::core::hash::Hash::hash(&self.collation, state); + ::core::hash::Hash::hash(&self.on_commit, state); + ::core::hash::Hash::hash(&self.on_cluster, state); + ::core::hash::Hash::hash(&self.primary_key, state); + ::core::hash::Hash::hash(&self.order_by, state); + ::core::hash::Hash::hash(&self.partition_by, state); + ::core::hash::Hash::hash(&self.cluster_by, state); + ::core::hash::Hash::hash(&self.clustered_by, state); + ::core::hash::Hash::hash(&self.options, state); + ::core::hash::Hash::hash(&self.strict, state); + ::core::hash::Hash::hash(&self.copy_grants, state); + ::core::hash::Hash::hash(&self.enable_schema_evolution, state); + ::core::hash::Hash::hash(&self.change_tracking, state); + ::core::hash::Hash::hash(&self.data_retention_time_in_days, state); + ::core::hash::Hash::hash(&self.max_data_extension_time_in_days, state); + ::core::hash::Hash::hash(&self.default_ddl_collation, state); + ::core::hash::Hash::hash(&self.with_aggregation_policy, state); + ::core::hash::Hash::hash(&self.with_row_access_policy, state); + ::core::hash::Hash::hash(&self.with_tags, state); + ::core::hash::Hash::hash(&self.external_volume, state); + ::core::hash::Hash::hash(&self.base_location, state); + ::core::hash::Hash::hash(&self.catalog, state); + ::core::hash::Hash::hash(&self.catalog_sync, state); + ::core::hash::Hash::hash(&self.storage_serialization_policy, state) + } + } + impl Display for CreateTable { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt( + format_args!( + "CREATE {0}{1}{2}{4}{5}{6}{7}TABLE {3}{8}", + if self.or_replace { "OR REPLACE " } else { "" }, + if self.external { "EXTERNAL " } else { "" }, + self + .global + .map(|global| { if global { "GLOBAL " } else { "LOCAL " } }) + .unwrap_or(""), + if self.if_not_exists { "IF NOT EXISTS " } else { "" }, + if self.temporary { "TEMPORARY " } else { "" }, + if self.transient { "TRANSIENT " } else { "" }, + if self.volatile { "VOLATILE " } else { "" }, + if self.iceberg { "ICEBERG " } else { "" }, + self.name, + ), + )?; + if let Some(on_cluster) = &self.on_cluster { + f.write_fmt(format_args!(" ON CLUSTER {0}", on_cluster))?; + } + if !self.columns.is_empty() || !self.constraints.is_empty() { + f.write_fmt( + format_args!(" ({0}", display_comma_separated(&self.columns)), + )?; + if !self.columns.is_empty() && !self.constraints.is_empty() { + f.write_fmt(format_args!(", "))?; + } + f.write_fmt( + format_args!("{0})", display_comma_separated(&self.constraints)), + )?; + } else if self.query.is_none() && self.like.is_none() + && self.clone.is_none() + { + f.write_fmt(format_args!(" ()"))?; + } + if let Some(CommentDef::AfterColumnDefsWithoutEq(comment)) = &self + .comment + { + f.write_fmt(format_args!(" COMMENT \'{0}\'", comment))?; + } + if self.without_rowid { + f.write_fmt(format_args!(" WITHOUT ROWID"))?; + } + if let Some(l) = &self.like { + f.write_fmt(format_args!(" LIKE {0}", l))?; + } + if let Some(c) = &self.clone { + f.write_fmt(format_args!(" CLONE {0}", c))?; + } + match &self.hive_distribution { + HiveDistributionStyle::PARTITIONED { columns } => { + f.write_fmt( + format_args!( + " PARTITIONED BY ({0})", + display_comma_separated(columns), + ), + )?; + } + HiveDistributionStyle::SKEWED { + columns, + on, + stored_as_directories, + } => { + f.write_fmt( + format_args!( + " SKEWED BY ({0})) ON ({1})", + display_comma_separated(columns), + display_comma_separated(on), + ), + )?; + if *stored_as_directories { + f.write_fmt(format_args!(" STORED AS DIRECTORIES"))?; + } + } + _ => {} + } + if let Some(clustered_by) = &self.clustered_by { + f.write_fmt(format_args!(" {0}", clustered_by))?; + } + if let Some( + HiveFormat { row_format, serde_properties, storage, location }, + ) = &self.hive_formats + { + match row_format { + Some(HiveRowFormat::SERDE { class }) => { + f.write_fmt( + format_args!(" ROW FORMAT SERDE \'{0}\'", class), + )? + } + Some(HiveRowFormat::DELIMITED { delimiters }) => { + f.write_fmt(format_args!(" ROW FORMAT DELIMITED"))?; + if !delimiters.is_empty() { + f.write_fmt( + format_args!(" {0}", display_separated(delimiters, " ")), + )?; + } + } + None => {} + } + match storage { + Some(HiveIOFormat::IOF { input_format, output_format }) => { + f.write_fmt( + format_args!( + " STORED AS INPUTFORMAT {0} OUTPUTFORMAT {1}", + input_format, + output_format, + ), + )? + } + Some(HiveIOFormat::FileFormat { format }) if !self.external => { + f.write_fmt(format_args!(" STORED AS {0}", format))? + } + _ => {} + } + if let Some(serde_properties) = serde_properties.as_ref() { + f.write_fmt( + format_args!( + " WITH SERDEPROPERTIES ({0})", + display_comma_separated(serde_properties), + ), + )?; + } + if !self.external { + if let Some(loc) = location { + f.write_fmt(format_args!(" LOCATION \'{0}\'", loc))?; + } + } + } + if self.external { + if let Some(file_format) = self.file_format { + f.write_fmt(format_args!(" STORED AS {0}", file_format))?; + } + f.write_fmt( + format_args!( + " LOCATION \'{0}\'", + self.location.as_ref().unwrap(), + ), + )?; + } + if !self.table_properties.is_empty() { + f.write_fmt( + format_args!( + " TBLPROPERTIES ({0})", + display_comma_separated(&self.table_properties), + ), + )?; + } + if !self.with_options.is_empty() { + f.write_fmt( + format_args!( + " WITH ({0})", + display_comma_separated(&self.with_options), + ), + )?; + } + if let Some(engine) = &self.engine { + f.write_fmt(format_args!(" ENGINE={0}", engine))?; + } + if let Some(comment_def) = &self.comment { + match comment_def { + CommentDef::WithEq(comment) => { + f.write_fmt(format_args!(" COMMENT = \'{0}\'", comment))?; + } + CommentDef::WithoutEq(comment) => { + f.write_fmt(format_args!(" COMMENT \'{0}\'", comment))?; + } + CommentDef::AfterColumnDefsWithoutEq(_) => {} + } + } + if let Some(auto_increment_offset) = self.auto_increment_offset { + f.write_fmt( + format_args!(" AUTO_INCREMENT {0}", auto_increment_offset), + )?; + } + if let Some(primary_key) = &self.primary_key { + f.write_fmt(format_args!(" PRIMARY KEY {0}", primary_key))?; + } + if let Some(order_by) = &self.order_by { + f.write_fmt(format_args!(" ORDER BY {0}", order_by))?; + } + if let Some(partition_by) = self.partition_by.as_ref() { + f.write_fmt(format_args!(" PARTITION BY {0}", partition_by))?; + } + if let Some(cluster_by) = self.cluster_by.as_ref() { + f.write_fmt(format_args!(" CLUSTER BY {0}", cluster_by))?; + } + if let Some(options) = self.options.as_ref() { + f.write_fmt( + format_args!( + " OPTIONS({0})", + display_comma_separated(options.as_slice()), + ), + )?; + } + if let Some(external_volume) = self.external_volume.as_ref() { + f.write_fmt( + format_args!(" EXTERNAL_VOLUME = \'{0}\'", external_volume), + )?; + } + if let Some(catalog) = self.catalog.as_ref() { + f.write_fmt(format_args!(" CATALOG = \'{0}\'", catalog))?; + } + if self.iceberg { + if let Some(base_location) = self.base_location.as_ref() { + f.write_fmt( + format_args!(" BASE_LOCATION = \'{0}\'", base_location), + )?; + } + } + if let Some(catalog_sync) = self.catalog_sync.as_ref() { + f.write_fmt(format_args!(" CATALOG_SYNC = \'{0}\'", catalog_sync))?; + } + if let Some(storage_serialization_policy) = self + .storage_serialization_policy + .as_ref() + { + f.write_fmt( + format_args!( + " STORAGE_SERIALIZATION_POLICY = {0}", + storage_serialization_policy, + ), + )?; + } + if self.copy_grants { + f.write_fmt(format_args!(" COPY GRANTS"))?; + } + if let Some(is_enabled) = self.enable_schema_evolution { + f.write_fmt( + format_args!( + " ENABLE_SCHEMA_EVOLUTION={0}", + if is_enabled { "TRUE" } else { "FALSE" }, + ), + )?; + } + if let Some(is_enabled) = self.change_tracking { + f.write_fmt( + format_args!( + " CHANGE_TRACKING={0}", + if is_enabled { "TRUE" } else { "FALSE" }, + ), + )?; + } + if let Some(data_retention_time_in_days) = self + .data_retention_time_in_days + { + f.write_fmt( + format_args!( + " DATA_RETENTION_TIME_IN_DAYS={0}", + data_retention_time_in_days, + ), + )?; + } + if let Some(max_data_extension_time_in_days) = self + .max_data_extension_time_in_days + { + f.write_fmt( + format_args!( + " MAX_DATA_EXTENSION_TIME_IN_DAYS={0}", + max_data_extension_time_in_days, + ), + )?; + } + if let Some(default_ddl_collation) = &self.default_ddl_collation { + f.write_fmt( + format_args!( + " DEFAULT_DDL_COLLATION=\'{0}\'", + default_ddl_collation, + ), + )?; + } + if let Some(with_aggregation_policy) = &self.with_aggregation_policy { + f.write_fmt( + format_args!( + " WITH AGGREGATION POLICY {0}", + with_aggregation_policy, + ), + )?; + } + if let Some(row_access_policy) = &self.with_row_access_policy { + f.write_fmt(format_args!(" {0}", row_access_policy))?; + } + if let Some(tag) = &self.with_tags { + f.write_fmt( + format_args!( + " WITH TAG ({0})", + display_comma_separated(tag.as_slice()), + ), + )?; + } + if let Some(default_charset) = &self.default_charset { + f.write_fmt(format_args!(" DEFAULT CHARSET={0}", default_charset))?; + } + if let Some(collation) = &self.collation { + f.write_fmt(format_args!(" COLLATE={0}", collation))?; + } + if self.on_commit.is_some() { + let on_commit = match self.on_commit { + Some(OnCommit::DeleteRows) => "ON COMMIT DELETE ROWS", + Some(OnCommit::PreserveRows) => "ON COMMIT PRESERVE ROWS", + Some(OnCommit::Drop) => "ON COMMIT DROP", + None => "", + }; + f.write_fmt(format_args!(" {0}", on_commit))?; + } + if self.strict { + f.write_fmt(format_args!(" STRICT"))?; + } + if let Some(query) = &self.query { + f.write_fmt(format_args!(" AS {0}", query))?; + } + Ok(()) + } + } + /// INSERT statement. + pub struct Insert { + /// Only for Sqlite + pub or: Option, + /// Only for mysql + pub ignore: bool, + /// INTO - optional keyword + pub into: bool, + /// TABLE + pub table: TableObject, + /// table_name as foo (for PostgreSQL) + pub table_alias: Option, + /// COLUMNS + pub columns: Vec, + /// Overwrite (Hive) + pub overwrite: bool, + /// A SQL query that specifies what to insert + pub source: Option>, + /// MySQL `INSERT INTO ... SET` + /// See: + pub assignments: Vec, + /// partitioned insert (Hive) + pub partitioned: Option>, + /// Columns defined after PARTITION + pub after_columns: Vec, + /// whether the insert has the table keyword (Hive) + pub has_table_keyword: bool, + pub on: Option, + /// RETURNING + pub returning: Option>, + /// Only for mysql + pub replace_into: bool, + /// Only for mysql + pub priority: Option, + /// Only for mysql + pub insert_alias: Option, + /// Settings used for ClickHouse. + /// + /// ClickHouse syntax: `INSERT INTO tbl SETTINGS format_template_resultset = '/some/path/resultset.format'` + /// + /// [ClickHouse `INSERT INTO`](https://clickhouse.com/docs/en/sql-reference/statements/insert-into) + pub settings: Option>, + /// Format for `INSERT` statement when not using standard SQL format. Can be e.g. `CSV`, + /// `JSON`, `JSONAsString`, `LineAsString` and more. + /// + /// ClickHouse syntax: `INSERT INTO tbl FORMAT JSONEachRow {"foo": 1, "bar": 2}, {"foo": 3}` + /// + /// [ClickHouse formats JSON insert](https://clickhouse.com/docs/en/interfaces/formats#json-inserting-data) + pub format_clause: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for Insert { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "or", + "ignore", + "into", + "table", + "table_alias", + "columns", + "overwrite", + "source", + "assignments", + "partitioned", + "after_columns", + "has_table_keyword", + "on", + "returning", + "replace_into", + "priority", + "insert_alias", + "settings", + "format_clause", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.or, + &self.ignore, + &self.into, + &self.table, + &self.table_alias, + &self.columns, + &self.overwrite, + &self.source, + &self.assignments, + &self.partitioned, + &self.after_columns, + &self.has_table_keyword, + &self.on, + &self.returning, + &self.replace_into, + &self.priority, + &self.insert_alias, + &self.settings, + &&self.format_clause, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "Insert", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for Insert { + #[inline] + fn clone(&self) -> Insert { + Insert { + or: ::core::clone::Clone::clone(&self.or), + ignore: ::core::clone::Clone::clone(&self.ignore), + into: ::core::clone::Clone::clone(&self.into), + table: ::core::clone::Clone::clone(&self.table), + table_alias: ::core::clone::Clone::clone(&self.table_alias), + columns: ::core::clone::Clone::clone(&self.columns), + overwrite: ::core::clone::Clone::clone(&self.overwrite), + source: ::core::clone::Clone::clone(&self.source), + assignments: ::core::clone::Clone::clone(&self.assignments), + partitioned: ::core::clone::Clone::clone(&self.partitioned), + after_columns: ::core::clone::Clone::clone(&self.after_columns), + has_table_keyword: ::core::clone::Clone::clone( + &self.has_table_keyword, + ), + on: ::core::clone::Clone::clone(&self.on), + returning: ::core::clone::Clone::clone(&self.returning), + replace_into: ::core::clone::Clone::clone(&self.replace_into), + priority: ::core::clone::Clone::clone(&self.priority), + insert_alias: ::core::clone::Clone::clone(&self.insert_alias), + settings: ::core::clone::Clone::clone(&self.settings), + format_clause: ::core::clone::Clone::clone(&self.format_clause), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for Insert {} + #[automatically_derived] + impl ::core::cmp::PartialEq for Insert { + #[inline] + fn eq(&self, other: &Insert) -> bool { + self.or == other.or && self.ignore == other.ignore + && self.into == other.into && self.table == other.table + && self.table_alias == other.table_alias + && self.columns == other.columns && self.overwrite == other.overwrite + && self.source == other.source + && self.assignments == other.assignments + && self.partitioned == other.partitioned + && self.after_columns == other.after_columns + && self.has_table_keyword == other.has_table_keyword + && self.on == other.on && self.returning == other.returning + && self.replace_into == other.replace_into + && self.priority == other.priority + && self.insert_alias == other.insert_alias + && self.settings == other.settings + && self.format_clause == other.format_clause + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for Insert { + #[inline] + fn partial_cmp( + &self, + other: &Insert, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.or, &other.or) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.ignore, + &other.ignore, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.into, + &other.into, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.table, + &other.table, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.table_alias, + &other.table_alias, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.columns, + &other.columns, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.overwrite, + &other.overwrite, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.source, + &other.source, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.assignments, + &other.assignments, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.partitioned, + &other.partitioned, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.after_columns, + &other.after_columns, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.has_table_keyword, + &other.has_table_keyword, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.on, + &other.on, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.returning, + &other.returning, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.replace_into, + &other.replace_into, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.priority, + &other.priority, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.insert_alias, + &other.insert_alias, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.settings, + &other.settings, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.format_clause, + &other.format_clause, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for Insert { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for Insert { + #[inline] + fn cmp(&self, other: &Insert) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.or, &other.or) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.ignore, &other.ignore) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.into, &other.into) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.table, &other.table) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.table_alias, + &other.table_alias, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.columns, &other.columns) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.overwrite, + &other.overwrite, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.source, &other.source) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.assignments, + &other.assignments, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.partitioned, + &other.partitioned, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.after_columns, + &other.after_columns, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.has_table_keyword, + &other.has_table_keyword, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.on, &other.on) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.returning, + &other.returning, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.replace_into, + &other.replace_into, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.priority, + &other.priority, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.insert_alias, + &other.insert_alias, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.settings, + &other.settings, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp( + &self.format_clause, + &other.format_clause, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for Insert { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.or, state); + ::core::hash::Hash::hash(&self.ignore, state); + ::core::hash::Hash::hash(&self.into, state); + ::core::hash::Hash::hash(&self.table, state); + ::core::hash::Hash::hash(&self.table_alias, state); + ::core::hash::Hash::hash(&self.columns, state); + ::core::hash::Hash::hash(&self.overwrite, state); + ::core::hash::Hash::hash(&self.source, state); + ::core::hash::Hash::hash(&self.assignments, state); + ::core::hash::Hash::hash(&self.partitioned, state); + ::core::hash::Hash::hash(&self.after_columns, state); + ::core::hash::Hash::hash(&self.has_table_keyword, state); + ::core::hash::Hash::hash(&self.on, state); + ::core::hash::Hash::hash(&self.returning, state); + ::core::hash::Hash::hash(&self.replace_into, state); + ::core::hash::Hash::hash(&self.priority, state); + ::core::hash::Hash::hash(&self.insert_alias, state); + ::core::hash::Hash::hash(&self.settings, state); + ::core::hash::Hash::hash(&self.format_clause, state) + } + } + impl Display for Insert { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + let table_name = if let Some(alias) = &self.table_alias { + ::alloc::__export::must_use({ + let res = ::alloc::fmt::format( + format_args!("{0} AS {1}", self.table, alias), + ); + res + }) + } else { + self.table.to_string() + }; + if let Some(on_conflict) = self.or { + f.write_fmt( + format_args!("INSERT {0} INTO {1} ", on_conflict, table_name), + )?; + } else { + f.write_fmt( + format_args!( + "{0}", + if self.replace_into { "REPLACE" } else { "INSERT" }, + ), + )?; + if let Some(priority) = self.priority { + f.write_fmt(format_args!(" {0}", priority))?; + } + f.write_fmt( + format_args!( + "{1}{2}{3}{4} {0} ", + table_name, + if self.ignore { " IGNORE" } else { "" }, + if self.overwrite { " OVERWRITE" } else { "" }, + if self.into { " INTO" } else { "" }, + if self.has_table_keyword { " TABLE" } else { "" }, + ), + )?; + } + if !self.columns.is_empty() { + f.write_fmt( + format_args!("({0}) ", display_comma_separated(&self.columns)), + )?; + } + if let Some(ref parts) = self.partitioned { + if !parts.is_empty() { + f.write_fmt( + format_args!( + "PARTITION ({0}) ", + display_comma_separated(parts), + ), + )?; + } + } + if !self.after_columns.is_empty() { + f.write_fmt( + format_args!( + "({0}) ", + display_comma_separated(&self.after_columns), + ), + )?; + } + if let Some(settings) = &self.settings { + f.write_fmt( + format_args!("SETTINGS {0} ", display_comma_separated(settings)), + )?; + } + if let Some(source) = &self.source { + f.write_fmt(format_args!("{0}", source))?; + } else if !self.assignments.is_empty() { + f.write_fmt(format_args!("SET "))?; + f.write_fmt( + format_args!("{0}", display_comma_separated(&self.assignments)), + )?; + } else if let Some(format_clause) = &self.format_clause { + f.write_fmt(format_args!("{0}", format_clause))?; + } else if self.columns.is_empty() { + f.write_fmt(format_args!("DEFAULT VALUES"))?; + } + if let Some(insert_alias) = &self.insert_alias { + f.write_fmt(format_args!(" AS {0}", insert_alias.row_alias))?; + if let Some(col_aliases) = &insert_alias.col_aliases { + if !col_aliases.is_empty() { + f.write_fmt( + format_args!(" ({0})", display_comma_separated(col_aliases)), + )?; + } + } + } + if let Some(on) = &self.on { + f.write_fmt(format_args!("{0}", on))?; + } + if let Some(returning) = &self.returning { + f.write_fmt( + format_args!( + " RETURNING {0}", + display_comma_separated(returning), + ), + )?; + } + Ok(()) + } + } + /// DELETE statement. + pub struct Delete { + /// Multi tables delete are supported in mysql + pub tables: Vec, + /// FROM + pub from: FromTable, + /// USING (Snowflake, Postgres, MySQL) + pub using: Option>, + /// WHERE + pub selection: Option, + /// RETURNING + pub returning: Option>, + /// ORDER BY (MySQL) + pub order_by: Vec, + /// LIMIT (MySQL) + pub limit: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for Delete { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "tables", + "from", + "using", + "selection", + "returning", + "order_by", + "limit", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.tables, + &self.from, + &self.using, + &self.selection, + &self.returning, + &self.order_by, + &&self.limit, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "Delete", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for Delete { + #[inline] + fn clone(&self) -> Delete { + Delete { + tables: ::core::clone::Clone::clone(&self.tables), + from: ::core::clone::Clone::clone(&self.from), + using: ::core::clone::Clone::clone(&self.using), + selection: ::core::clone::Clone::clone(&self.selection), + returning: ::core::clone::Clone::clone(&self.returning), + order_by: ::core::clone::Clone::clone(&self.order_by), + limit: ::core::clone::Clone::clone(&self.limit), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for Delete {} + #[automatically_derived] + impl ::core::cmp::PartialEq for Delete { + #[inline] + fn eq(&self, other: &Delete) -> bool { + self.tables == other.tables && self.from == other.from + && self.using == other.using && self.selection == other.selection + && self.returning == other.returning + && self.order_by == other.order_by && self.limit == other.limit + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for Delete { + #[inline] + fn partial_cmp( + &self, + other: &Delete, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.tables, &other.tables) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.from, + &other.from, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.using, + &other.using, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.selection, + &other.selection, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.returning, + &other.returning, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.order_by, + &other.order_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.limit, + &other.limit, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for Delete { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for Delete { + #[inline] + fn cmp(&self, other: &Delete) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.tables, &other.tables) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.from, &other.from) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.using, &other.using) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.selection, + &other.selection, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.returning, + &other.returning, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.order_by, + &other.order_by, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.limit, &other.limit) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for Delete { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.tables, state); + ::core::hash::Hash::hash(&self.from, state); + ::core::hash::Hash::hash(&self.using, state); + ::core::hash::Hash::hash(&self.selection, state); + ::core::hash::Hash::hash(&self.returning, state); + ::core::hash::Hash::hash(&self.order_by, state); + ::core::hash::Hash::hash(&self.limit, state) + } + } + impl Display for Delete { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.write_fmt(format_args!("DELETE "))?; + if !self.tables.is_empty() { + f.write_fmt( + format_args!("{0} ", display_comma_separated(&self.tables)), + )?; + } + match &self.from { + FromTable::WithFromKeyword(from) => { + f.write_fmt( + format_args!("FROM {0}", display_comma_separated(from)), + )?; + } + FromTable::WithoutKeyword(from) => { + f.write_fmt(format_args!("{0}", display_comma_separated(from)))?; + } + } + if let Some(using) = &self.using { + f.write_fmt( + format_args!(" USING {0}", display_comma_separated(using)), + )?; + } + if let Some(selection) = &self.selection { + f.write_fmt(format_args!(" WHERE {0}", selection))?; + } + if let Some(returning) = &self.returning { + f.write_fmt( + format_args!( + " RETURNING {0}", + display_comma_separated(returning), + ), + )?; + } + if !self.order_by.is_empty() { + f.write_fmt( + format_args!( + " ORDER BY {0}", + display_comma_separated(&self.order_by), + ), + )?; + } + if let Some(limit) = &self.limit { + f.write_fmt(format_args!(" LIMIT {0}", limit))?; + } + Ok(()) + } + } + } + pub mod helpers { + pub mod attached_token { + use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; + use core::fmt::{self, Debug, Formatter}; + use core::hash::{Hash, Hasher}; + use crate::tokenizer::TokenWithSpan; + /// A wrapper over [`TokenWithSpan`]s that ignores the token and source + /// location in comparisons and hashing. + /// + /// This type is used when the token and location is not relevant for semantics, + /// but is still needed for accurate source location tracking, for example, in + /// the nodes in the [ast](crate::ast) module. + /// + /// Note: **All** `AttachedTokens` are equal. + /// + /// # Examples + /// + /// Same token, different location are equal + /// ``` + /// # use sqlparser::ast::helpers::attached_token::AttachedToken; + /// # use sqlparser::tokenizer::{Location, Span, Token, TokenWithLocation}; + /// // commas @ line 1, column 10 + /// let tok1 = TokenWithLocation::new( + /// Token::Comma, + /// Span::new(Location::new(1, 10), Location::new(1, 11)), + /// ); + /// // commas @ line 2, column 20 + /// let tok2 = TokenWithLocation::new( + /// Token::Comma, + /// Span::new(Location::new(2, 20), Location::new(2, 21)), + /// ); + /// + /// assert_ne!(tok1, tok2); // token with locations are *not* equal + /// assert_eq!(AttachedToken(tok1), AttachedToken(tok2)); // attached tokens are + /// ``` + /// + /// Different token, different location are equal 🤯 + /// + /// ``` + /// # use sqlparser::ast::helpers::attached_token::AttachedToken; + /// # use sqlparser::tokenizer::{Location, Span, Token, TokenWithLocation}; + /// // commas @ line 1, column 10 + /// let tok1 = TokenWithLocation::new( + /// Token::Comma, + /// Span::new(Location::new(1, 10), Location::new(1, 11)), + /// ); + /// // period @ line 2, column 20 + /// let tok2 = TokenWithLocation::new( + /// Token::Period, + /// Span::new(Location::new(2, 10), Location::new(2, 21)), + /// ); + /// + /// assert_ne!(tok1, tok2); // token with locations are *not* equal + /// assert_eq!(AttachedToken(tok1), AttachedToken(tok2)); // attached tokens are + /// ``` + /// // period @ line 2, column 20 + pub struct AttachedToken(pub TokenWithSpan); + #[automatically_derived] + impl ::core::clone::Clone for AttachedToken { + #[inline] + fn clone(&self) -> AttachedToken { + AttachedToken(::core::clone::Clone::clone(&self.0)) + } + } + impl AttachedToken { + /// Return a new Empty AttachedToken + pub fn empty() -> Self { + AttachedToken(TokenWithSpan::new_eof()) + } + } + impl Debug for AttachedToken { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + self.0.fmt(f) + } + } + impl PartialEq for AttachedToken { + fn eq(&self, _: &Self) -> bool { + true + } + } + impl Eq for AttachedToken {} + impl PartialOrd for AttachedToken { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } + } + impl Ord for AttachedToken { + fn cmp(&self, _: &Self) -> Ordering { + Ordering::Equal + } + } + impl Hash for AttachedToken { + fn hash(&self, _state: &mut H) {} + } + impl From for AttachedToken { + fn from(value: TokenWithSpan) -> Self { + AttachedToken(value) + } + } + impl From for TokenWithSpan { + fn from(value: AttachedToken) -> Self { + value.0 + } + } + } + pub mod stmt_create_table { + use super::super::dml::CreateTable; + use crate::ast::{ + ClusteredBy, ColumnDef, CommentDef, Expr, FileFormat, + HiveDistributionStyle, HiveFormat, Ident, ObjectName, OnCommit, + OneOrManyWithParens, Query, RowAccessPolicy, SqlOption, Statement, + StorageSerializationPolicy, TableConstraint, TableEngine, Tag, + WrappedCollection, + }; + use crate::parser::ParserError; + /// Builder for create table statement variant ([1]). + /// + /// This structure helps building and accessing a create table with more ease, without needing to: + /// - Match the enum itself a lot of times; or + /// - Moving a lot of variables around the code. + /// + /// # Example + /// ```rust + /// use sqlparser::ast::helpers::stmt_create_table::CreateTableBuilder; + /// use sqlparser::ast::{ColumnDef, DataType, Ident, ObjectName}; + /// let builder = CreateTableBuilder::new(ObjectName::from(vec![Ident::new("table_name")])) + /// .if_not_exists(true) + /// .columns(vec![ColumnDef { + /// name: Ident::new("c1"), + /// data_type: DataType::Int(None), + /// collation: None, + /// options: vec![], + /// }]); + /// // You can access internal elements with ease + /// assert!(builder.if_not_exists); + /// // Convert to a statement + /// assert_eq!( + /// builder.build().to_string(), + /// "CREATE TABLE IF NOT EXISTS table_name (c1 INT)" + /// ) + /// ``` + /// + /// [1]: crate::ast::Statement::CreateTable + pub struct CreateTableBuilder { + pub or_replace: bool, + pub temporary: bool, + pub external: bool, + pub global: Option, + pub if_not_exists: bool, + pub transient: bool, + pub volatile: bool, + pub iceberg: bool, + pub name: ObjectName, + pub columns: Vec, + pub constraints: Vec, + pub hive_distribution: HiveDistributionStyle, + pub hive_formats: Option, + pub table_properties: Vec, + pub with_options: Vec, + pub file_format: Option, + pub location: Option, + pub query: Option>, + pub without_rowid: bool, + pub like: Option, + pub clone: Option, + pub engine: Option, + pub comment: Option, + pub auto_increment_offset: Option, + pub default_charset: Option, + pub collation: Option, + pub on_commit: Option, + pub on_cluster: Option, + pub primary_key: Option>, + pub order_by: Option>, + pub partition_by: Option>, + pub cluster_by: Option>>, + pub clustered_by: Option, + pub options: Option>, + pub strict: bool, + pub copy_grants: bool, + pub enable_schema_evolution: Option, + pub change_tracking: Option, + pub data_retention_time_in_days: Option, + pub max_data_extension_time_in_days: Option, + pub default_ddl_collation: Option, + pub with_aggregation_policy: Option, + pub with_row_access_policy: Option, + pub with_tags: Option>, + pub base_location: Option, + pub external_volume: Option, + pub catalog: Option, + pub catalog_sync: Option, + pub storage_serialization_policy: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for CreateTableBuilder { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "or_replace", + "temporary", + "external", + "global", + "if_not_exists", + "transient", + "volatile", + "iceberg", + "name", + "columns", + "constraints", + "hive_distribution", + "hive_formats", + "table_properties", + "with_options", + "file_format", + "location", + "query", + "without_rowid", + "like", + "clone", + "engine", + "comment", + "auto_increment_offset", + "default_charset", + "collation", + "on_commit", + "on_cluster", + "primary_key", + "order_by", + "partition_by", + "cluster_by", + "clustered_by", + "options", + "strict", + "copy_grants", + "enable_schema_evolution", + "change_tracking", + "data_retention_time_in_days", + "max_data_extension_time_in_days", + "default_ddl_collation", + "with_aggregation_policy", + "with_row_access_policy", + "with_tags", + "base_location", + "external_volume", + "catalog", + "catalog_sync", + "storage_serialization_policy", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.or_replace, + &self.temporary, + &self.external, + &self.global, + &self.if_not_exists, + &self.transient, + &self.volatile, + &self.iceberg, + &self.name, + &self.columns, + &self.constraints, + &self.hive_distribution, + &self.hive_formats, + &self.table_properties, + &self.with_options, + &self.file_format, + &self.location, + &self.query, + &self.without_rowid, + &self.like, + &self.clone, + &self.engine, + &self.comment, + &self.auto_increment_offset, + &self.default_charset, + &self.collation, + &self.on_commit, + &self.on_cluster, + &self.primary_key, + &self.order_by, + &self.partition_by, + &self.cluster_by, + &self.clustered_by, + &self.options, + &self.strict, + &self.copy_grants, + &self.enable_schema_evolution, + &self.change_tracking, + &self.data_retention_time_in_days, + &self.max_data_extension_time_in_days, + &self.default_ddl_collation, + &self.with_aggregation_policy, + &self.with_row_access_policy, + &self.with_tags, + &self.base_location, + &self.external_volume, + &self.catalog, + &self.catalog_sync, + &&self.storage_serialization_policy, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "CreateTableBuilder", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for CreateTableBuilder { + #[inline] + fn clone(&self) -> CreateTableBuilder { + CreateTableBuilder { + or_replace: ::core::clone::Clone::clone(&self.or_replace), + temporary: ::core::clone::Clone::clone(&self.temporary), + external: ::core::clone::Clone::clone(&self.external), + global: ::core::clone::Clone::clone(&self.global), + if_not_exists: ::core::clone::Clone::clone(&self.if_not_exists), + transient: ::core::clone::Clone::clone(&self.transient), + volatile: ::core::clone::Clone::clone(&self.volatile), + iceberg: ::core::clone::Clone::clone(&self.iceberg), + name: ::core::clone::Clone::clone(&self.name), + columns: ::core::clone::Clone::clone(&self.columns), + constraints: ::core::clone::Clone::clone(&self.constraints), + hive_distribution: ::core::clone::Clone::clone( + &self.hive_distribution, + ), + hive_formats: ::core::clone::Clone::clone(&self.hive_formats), + table_properties: ::core::clone::Clone::clone( + &self.table_properties, + ), + with_options: ::core::clone::Clone::clone(&self.with_options), + file_format: ::core::clone::Clone::clone(&self.file_format), + location: ::core::clone::Clone::clone(&self.location), + query: ::core::clone::Clone::clone(&self.query), + without_rowid: ::core::clone::Clone::clone(&self.without_rowid), + like: ::core::clone::Clone::clone(&self.like), + clone: ::core::clone::Clone::clone(&self.clone), + engine: ::core::clone::Clone::clone(&self.engine), + comment: ::core::clone::Clone::clone(&self.comment), + auto_increment_offset: ::core::clone::Clone::clone( + &self.auto_increment_offset, + ), + default_charset: ::core::clone::Clone::clone( + &self.default_charset, + ), + collation: ::core::clone::Clone::clone(&self.collation), + on_commit: ::core::clone::Clone::clone(&self.on_commit), + on_cluster: ::core::clone::Clone::clone(&self.on_cluster), + primary_key: ::core::clone::Clone::clone(&self.primary_key), + order_by: ::core::clone::Clone::clone(&self.order_by), + partition_by: ::core::clone::Clone::clone(&self.partition_by), + cluster_by: ::core::clone::Clone::clone(&self.cluster_by), + clustered_by: ::core::clone::Clone::clone(&self.clustered_by), + options: ::core::clone::Clone::clone(&self.options), + strict: ::core::clone::Clone::clone(&self.strict), + copy_grants: ::core::clone::Clone::clone(&self.copy_grants), + enable_schema_evolution: ::core::clone::Clone::clone( + &self.enable_schema_evolution, + ), + change_tracking: ::core::clone::Clone::clone( + &self.change_tracking, + ), + data_retention_time_in_days: ::core::clone::Clone::clone( + &self.data_retention_time_in_days, + ), + max_data_extension_time_in_days: ::core::clone::Clone::clone( + &self.max_data_extension_time_in_days, + ), + default_ddl_collation: ::core::clone::Clone::clone( + &self.default_ddl_collation, + ), + with_aggregation_policy: ::core::clone::Clone::clone( + &self.with_aggregation_policy, + ), + with_row_access_policy: ::core::clone::Clone::clone( + &self.with_row_access_policy, + ), + with_tags: ::core::clone::Clone::clone(&self.with_tags), + base_location: ::core::clone::Clone::clone(&self.base_location), + external_volume: ::core::clone::Clone::clone( + &self.external_volume, + ), + catalog: ::core::clone::Clone::clone(&self.catalog), + catalog_sync: ::core::clone::Clone::clone(&self.catalog_sync), + storage_serialization_policy: ::core::clone::Clone::clone( + &self.storage_serialization_policy, + ), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for CreateTableBuilder {} + #[automatically_derived] + impl ::core::cmp::PartialEq for CreateTableBuilder { + #[inline] + fn eq(&self, other: &CreateTableBuilder) -> bool { + self.or_replace == other.or_replace + && self.temporary == other.temporary + && self.external == other.external && self.global == other.global + && self.if_not_exists == other.if_not_exists + && self.transient == other.transient + && self.volatile == other.volatile + && self.iceberg == other.iceberg && self.name == other.name + && self.columns == other.columns + && self.constraints == other.constraints + && self.hive_distribution == other.hive_distribution + && self.hive_formats == other.hive_formats + && self.table_properties == other.table_properties + && self.with_options == other.with_options + && self.file_format == other.file_format + && self.location == other.location && self.query == other.query + && self.without_rowid == other.without_rowid + && self.like == other.like && self.clone == other.clone + && self.engine == other.engine && self.comment == other.comment + && self.auto_increment_offset == other.auto_increment_offset + && self.default_charset == other.default_charset + && self.collation == other.collation + && self.on_commit == other.on_commit + && self.on_cluster == other.on_cluster + && self.primary_key == other.primary_key + && self.order_by == other.order_by + && self.partition_by == other.partition_by + && self.cluster_by == other.cluster_by + && self.clustered_by == other.clustered_by + && self.options == other.options && self.strict == other.strict + && self.copy_grants == other.copy_grants + && self.enable_schema_evolution == other.enable_schema_evolution + && self.change_tracking == other.change_tracking + && self.data_retention_time_in_days + == other.data_retention_time_in_days + && self.max_data_extension_time_in_days + == other.max_data_extension_time_in_days + && self.default_ddl_collation == other.default_ddl_collation + && self.with_aggregation_policy == other.with_aggregation_policy + && self.with_row_access_policy == other.with_row_access_policy + && self.with_tags == other.with_tags + && self.base_location == other.base_location + && self.external_volume == other.external_volume + && self.catalog == other.catalog + && self.catalog_sync == other.catalog_sync + && self.storage_serialization_policy + == other.storage_serialization_policy + } + } + #[automatically_derived] + impl ::core::cmp::Eq for CreateTableBuilder { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq< + Option>, + >; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq< + Option>>, + >; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq< + Option, + >; + } + } + #[automatically_derived] + impl ::core::hash::Hash for CreateTableBuilder { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.or_replace, state); + ::core::hash::Hash::hash(&self.temporary, state); + ::core::hash::Hash::hash(&self.external, state); + ::core::hash::Hash::hash(&self.global, state); + ::core::hash::Hash::hash(&self.if_not_exists, state); + ::core::hash::Hash::hash(&self.transient, state); + ::core::hash::Hash::hash(&self.volatile, state); + ::core::hash::Hash::hash(&self.iceberg, state); + ::core::hash::Hash::hash(&self.name, state); + ::core::hash::Hash::hash(&self.columns, state); + ::core::hash::Hash::hash(&self.constraints, state); + ::core::hash::Hash::hash(&self.hive_distribution, state); + ::core::hash::Hash::hash(&self.hive_formats, state); + ::core::hash::Hash::hash(&self.table_properties, state); + ::core::hash::Hash::hash(&self.with_options, state); + ::core::hash::Hash::hash(&self.file_format, state); + ::core::hash::Hash::hash(&self.location, state); + ::core::hash::Hash::hash(&self.query, state); + ::core::hash::Hash::hash(&self.without_rowid, state); + ::core::hash::Hash::hash(&self.like, state); + ::core::hash::Hash::hash(&self.clone, state); + ::core::hash::Hash::hash(&self.engine, state); + ::core::hash::Hash::hash(&self.comment, state); + ::core::hash::Hash::hash(&self.auto_increment_offset, state); + ::core::hash::Hash::hash(&self.default_charset, state); + ::core::hash::Hash::hash(&self.collation, state); + ::core::hash::Hash::hash(&self.on_commit, state); + ::core::hash::Hash::hash(&self.on_cluster, state); + ::core::hash::Hash::hash(&self.primary_key, state); + ::core::hash::Hash::hash(&self.order_by, state); + ::core::hash::Hash::hash(&self.partition_by, state); + ::core::hash::Hash::hash(&self.cluster_by, state); + ::core::hash::Hash::hash(&self.clustered_by, state); + ::core::hash::Hash::hash(&self.options, state); + ::core::hash::Hash::hash(&self.strict, state); + ::core::hash::Hash::hash(&self.copy_grants, state); + ::core::hash::Hash::hash(&self.enable_schema_evolution, state); + ::core::hash::Hash::hash(&self.change_tracking, state); + ::core::hash::Hash::hash(&self.data_retention_time_in_days, state); + ::core::hash::Hash::hash( + &self.max_data_extension_time_in_days, + state, + ); + ::core::hash::Hash::hash(&self.default_ddl_collation, state); + ::core::hash::Hash::hash(&self.with_aggregation_policy, state); + ::core::hash::Hash::hash(&self.with_row_access_policy, state); + ::core::hash::Hash::hash(&self.with_tags, state); + ::core::hash::Hash::hash(&self.base_location, state); + ::core::hash::Hash::hash(&self.external_volume, state); + ::core::hash::Hash::hash(&self.catalog, state); + ::core::hash::Hash::hash(&self.catalog_sync, state); + ::core::hash::Hash::hash(&self.storage_serialization_policy, state) + } + } + impl CreateTableBuilder { + pub fn new(name: ObjectName) -> Self { + Self { + or_replace: false, + temporary: false, + external: false, + global: None, + if_not_exists: false, + transient: false, + volatile: false, + iceberg: false, + name, + columns: ::alloc::vec::Vec::new(), + constraints: ::alloc::vec::Vec::new(), + hive_distribution: HiveDistributionStyle::NONE, + hive_formats: None, + table_properties: ::alloc::vec::Vec::new(), + with_options: ::alloc::vec::Vec::new(), + file_format: None, + location: None, + query: None, + without_rowid: false, + like: None, + clone: None, + engine: None, + comment: None, + auto_increment_offset: None, + default_charset: None, + collation: None, + on_commit: None, + on_cluster: None, + primary_key: None, + order_by: None, + partition_by: None, + cluster_by: None, + clustered_by: None, + options: None, + strict: false, + copy_grants: false, + enable_schema_evolution: None, + change_tracking: None, + data_retention_time_in_days: None, + max_data_extension_time_in_days: None, + default_ddl_collation: None, + with_aggregation_policy: None, + with_row_access_policy: None, + with_tags: None, + base_location: None, + external_volume: None, + catalog: None, + catalog_sync: None, + storage_serialization_policy: None, + } + } + pub fn or_replace(mut self, or_replace: bool) -> Self { + self.or_replace = or_replace; + self + } + pub fn temporary(mut self, temporary: bool) -> Self { + self.temporary = temporary; + self + } + pub fn external(mut self, external: bool) -> Self { + self.external = external; + self + } + pub fn global(mut self, global: Option) -> Self { + self.global = global; + self + } + pub fn if_not_exists(mut self, if_not_exists: bool) -> Self { + self.if_not_exists = if_not_exists; + self + } + pub fn transient(mut self, transient: bool) -> Self { + self.transient = transient; + self + } + pub fn volatile(mut self, volatile: bool) -> Self { + self.volatile = volatile; + self + } + pub fn iceberg(mut self, iceberg: bool) -> Self { + self.iceberg = iceberg; + self + } + pub fn columns(mut self, columns: Vec) -> Self { + self.columns = columns; + self + } + pub fn constraints(mut self, constraints: Vec) -> Self { + self.constraints = constraints; + self + } + pub fn hive_distribution( + mut self, + hive_distribution: HiveDistributionStyle, + ) -> Self { + self.hive_distribution = hive_distribution; + self + } + pub fn hive_formats(mut self, hive_formats: Option) -> Self { + self.hive_formats = hive_formats; + self + } + pub fn table_properties( + mut self, + table_properties: Vec, + ) -> Self { + self.table_properties = table_properties; + self + } + pub fn with_options(mut self, with_options: Vec) -> Self { + self.with_options = with_options; + self + } + pub fn file_format(mut self, file_format: Option) -> Self { + self.file_format = file_format; + self + } + pub fn location(mut self, location: Option) -> Self { + self.location = location; + self + } + pub fn query(mut self, query: Option>) -> Self { + self.query = query; + self + } + pub fn without_rowid(mut self, without_rowid: bool) -> Self { + self.without_rowid = without_rowid; + self + } + pub fn like(mut self, like: Option) -> Self { + self.like = like; + self + } + pub fn clone_clause(mut self, clone: Option) -> Self { + self.clone = clone; + self + } + pub fn engine(mut self, engine: Option) -> Self { + self.engine = engine; + self + } + pub fn comment(mut self, comment: Option) -> Self { + self.comment = comment; + self + } + pub fn auto_increment_offset(mut self, offset: Option) -> Self { + self.auto_increment_offset = offset; + self + } + pub fn default_charset( + mut self, + default_charset: Option, + ) -> Self { + self.default_charset = default_charset; + self + } + pub fn collation(mut self, collation: Option) -> Self { + self.collation = collation; + self + } + pub fn on_commit(mut self, on_commit: Option) -> Self { + self.on_commit = on_commit; + self + } + pub fn on_cluster(mut self, on_cluster: Option) -> Self { + self.on_cluster = on_cluster; + self + } + pub fn primary_key(mut self, primary_key: Option>) -> Self { + self.primary_key = primary_key; + self + } + pub fn order_by( + mut self, + order_by: Option>, + ) -> Self { + self.order_by = order_by; + self + } + pub fn partition_by(mut self, partition_by: Option>) -> Self { + self.partition_by = partition_by; + self + } + pub fn cluster_by( + mut self, + cluster_by: Option>>, + ) -> Self { + self.cluster_by = cluster_by; + self + } + pub fn clustered_by( + mut self, + clustered_by: Option, + ) -> Self { + self.clustered_by = clustered_by; + self + } + pub fn options(mut self, options: Option>) -> Self { + self.options = options; + self + } + pub fn strict(mut self, strict: bool) -> Self { + self.strict = strict; + self + } + pub fn copy_grants(mut self, copy_grants: bool) -> Self { + self.copy_grants = copy_grants; + self + } + pub fn enable_schema_evolution( + mut self, + enable_schema_evolution: Option, + ) -> Self { + self.enable_schema_evolution = enable_schema_evolution; + self + } + pub fn change_tracking(mut self, change_tracking: Option) -> Self { + self.change_tracking = change_tracking; + self + } + pub fn data_retention_time_in_days( + mut self, + data_retention_time_in_days: Option, + ) -> Self { + self.data_retention_time_in_days = data_retention_time_in_days; + self + } + pub fn max_data_extension_time_in_days( + mut self, + max_data_extension_time_in_days: Option, + ) -> Self { + self.max_data_extension_time_in_days = max_data_extension_time_in_days; + self + } + pub fn default_ddl_collation( + mut self, + default_ddl_collation: Option, + ) -> Self { + self.default_ddl_collation = default_ddl_collation; + self + } + pub fn with_aggregation_policy( + mut self, + with_aggregation_policy: Option, + ) -> Self { + self.with_aggregation_policy = with_aggregation_policy; + self + } + pub fn with_row_access_policy( + mut self, + with_row_access_policy: Option, + ) -> Self { + self.with_row_access_policy = with_row_access_policy; + self + } + pub fn with_tags(mut self, with_tags: Option>) -> Self { + self.with_tags = with_tags; + self + } + pub fn base_location(mut self, base_location: Option) -> Self { + self.base_location = base_location; + self + } + pub fn external_volume( + mut self, + external_volume: Option, + ) -> Self { + self.external_volume = external_volume; + self + } + pub fn catalog(mut self, catalog: Option) -> Self { + self.catalog = catalog; + self + } + pub fn catalog_sync(mut self, catalog_sync: Option) -> Self { + self.catalog_sync = catalog_sync; + self + } + pub fn storage_serialization_policy( + mut self, + storage_serialization_policy: Option, + ) -> Self { + self.storage_serialization_policy = storage_serialization_policy; + self + } + pub fn build(self) -> Statement { + Statement::CreateTable(CreateTable { + or_replace: self.or_replace, + temporary: self.temporary, + external: self.external, + global: self.global, + if_not_exists: self.if_not_exists, + transient: self.transient, + volatile: self.volatile, + iceberg: self.iceberg, + name: self.name, + columns: self.columns, + constraints: self.constraints, + hive_distribution: self.hive_distribution, + hive_formats: self.hive_formats, + table_properties: self.table_properties, + with_options: self.with_options, + file_format: self.file_format, + location: self.location, + query: self.query, + without_rowid: self.without_rowid, + like: self.like, + clone: self.clone, + engine: self.engine, + comment: self.comment, + auto_increment_offset: self.auto_increment_offset, + default_charset: self.default_charset, + collation: self.collation, + on_commit: self.on_commit, + on_cluster: self.on_cluster, + primary_key: self.primary_key, + order_by: self.order_by, + partition_by: self.partition_by, + cluster_by: self.cluster_by, + clustered_by: self.clustered_by, + options: self.options, + strict: self.strict, + copy_grants: self.copy_grants, + enable_schema_evolution: self.enable_schema_evolution, + change_tracking: self.change_tracking, + data_retention_time_in_days: self.data_retention_time_in_days, + max_data_extension_time_in_days: self + .max_data_extension_time_in_days, + default_ddl_collation: self.default_ddl_collation, + with_aggregation_policy: self.with_aggregation_policy, + with_row_access_policy: self.with_row_access_policy, + with_tags: self.with_tags, + base_location: self.base_location, + external_volume: self.external_volume, + catalog: self.catalog, + catalog_sync: self.catalog_sync, + storage_serialization_policy: self.storage_serialization_policy, + }) + } + } + impl TryFrom for CreateTableBuilder { + type Error = ParserError; + fn try_from(stmt: Statement) -> Result { + match stmt { + Statement::CreateTable( + CreateTable { + or_replace, + temporary, + external, + global, + if_not_exists, + transient, + volatile, + iceberg, + name, + columns, + constraints, + hive_distribution, + hive_formats, + table_properties, + with_options, + file_format, + location, + query, + without_rowid, + like, + clone, + engine, + comment, + auto_increment_offset, + default_charset, + collation, + on_commit, + on_cluster, + primary_key, + order_by, + partition_by, + cluster_by, + clustered_by, + options, + strict, + copy_grants, + enable_schema_evolution, + change_tracking, + data_retention_time_in_days, + max_data_extension_time_in_days, + default_ddl_collation, + with_aggregation_policy, + with_row_access_policy, + with_tags, + base_location, + external_volume, + catalog, + catalog_sync, + storage_serialization_policy, + }, + ) => { + Ok(Self { + or_replace, + temporary, + external, + global, + if_not_exists, + transient, + name, + columns, + constraints, + hive_distribution, + hive_formats, + table_properties, + with_options, + file_format, + location, + query, + without_rowid, + like, + clone, + engine, + comment, + auto_increment_offset, + default_charset, + collation, + on_commit, + on_cluster, + primary_key, + order_by, + partition_by, + cluster_by, + clustered_by, + options, + strict, + iceberg, + copy_grants, + enable_schema_evolution, + change_tracking, + data_retention_time_in_days, + max_data_extension_time_in_days, + default_ddl_collation, + with_aggregation_policy, + with_row_access_policy, + with_tags, + volatile, + base_location, + external_volume, + catalog, + catalog_sync, + storage_serialization_policy, + }) + } + _ => { + Err( + ParserError::ParserError( + ::alloc::__export::must_use({ + let res = ::alloc::fmt::format( + format_args!( + "Expected create table statement, but received: {0}", + stmt, + ), + ); + res + }), + ), + ) + } + } + } + } + /// Helper return type when parsing configuration for a `CREATE TABLE` statement. + pub(crate) struct CreateTableConfiguration { + pub partition_by: Option>, + pub cluster_by: Option>>, + pub options: Option>, + } + #[automatically_derived] + impl ::core::default::Default for CreateTableConfiguration { + #[inline] + fn default() -> CreateTableConfiguration { + CreateTableConfiguration { + partition_by: ::core::default::Default::default(), + cluster_by: ::core::default::Default::default(), + options: ::core::default::Default::default(), + } + } + } + } + pub mod stmt_data_loading { + //! AST types specific to loading and unloading syntax, like one available in Snowflake which + //! contains: STAGE ddl operations, PUT upload or COPY INTO + //! See [this page](https://docs.snowflake.com/en/sql-reference/commands-data-loading) for more details. + use core::fmt; + use core::fmt::Formatter; + use crate::ast::{Ident, ObjectName}; + pub struct StageParamsObject { + pub url: Option, + pub encryption: DataLoadingOptions, + pub endpoint: Option, + pub storage_integration: Option, + pub credentials: DataLoadingOptions, + } + #[automatically_derived] + impl ::core::fmt::Debug for StageParamsObject { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field5_finish( + f, + "StageParamsObject", + "url", + &self.url, + "encryption", + &self.encryption, + "endpoint", + &self.endpoint, + "storage_integration", + &self.storage_integration, + "credentials", + &&self.credentials, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for StageParamsObject { + #[inline] + fn clone(&self) -> StageParamsObject { + StageParamsObject { + url: ::core::clone::Clone::clone(&self.url), + encryption: ::core::clone::Clone::clone(&self.encryption), + endpoint: ::core::clone::Clone::clone(&self.endpoint), + storage_integration: ::core::clone::Clone::clone( + &self.storage_integration, + ), + credentials: ::core::clone::Clone::clone(&self.credentials), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for StageParamsObject {} + #[automatically_derived] + impl ::core::cmp::PartialEq for StageParamsObject { + #[inline] + fn eq(&self, other: &StageParamsObject) -> bool { + self.url == other.url && self.encryption == other.encryption + && self.endpoint == other.endpoint + && self.storage_integration == other.storage_integration + && self.credentials == other.credentials + } + } + #[automatically_derived] + impl ::core::cmp::Eq for StageParamsObject { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for StageParamsObject { + #[inline] + fn partial_cmp( + &self, + other: &StageParamsObject, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.url, &other.url) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.encryption, + &other.encryption, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.endpoint, + &other.endpoint, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.storage_integration, + &other.storage_integration, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.credentials, + &other.credentials, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Ord for StageParamsObject { + #[inline] + fn cmp(&self, other: &StageParamsObject) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.url, &other.url) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.encryption, + &other.encryption, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.endpoint, + &other.endpoint, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.storage_integration, + &other.storage_integration, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.credentials, &other.credentials) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for StageParamsObject { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.url, state); + ::core::hash::Hash::hash(&self.encryption, state); + ::core::hash::Hash::hash(&self.endpoint, state); + ::core::hash::Hash::hash(&self.storage_integration, state); + ::core::hash::Hash::hash(&self.credentials, state) + } + } + pub struct DataLoadingOptions { + pub options: Vec, + } + #[automatically_derived] + impl ::core::fmt::Debug for DataLoadingOptions { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field1_finish( + f, + "DataLoadingOptions", + "options", + &&self.options, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for DataLoadingOptions { + #[inline] + fn clone(&self) -> DataLoadingOptions { + DataLoadingOptions { + options: ::core::clone::Clone::clone(&self.options), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for DataLoadingOptions {} + #[automatically_derived] + impl ::core::cmp::PartialEq for DataLoadingOptions { + #[inline] + fn eq(&self, other: &DataLoadingOptions) -> bool { + self.options == other.options + } + } + #[automatically_derived] + impl ::core::cmp::Eq for DataLoadingOptions { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for DataLoadingOptions { + #[inline] + fn partial_cmp( + &self, + other: &DataLoadingOptions, + ) -> ::core::option::Option<::core::cmp::Ordering> { + ::core::cmp::PartialOrd::partial_cmp(&self.options, &other.options) + } + } + #[automatically_derived] + impl ::core::cmp::Ord for DataLoadingOptions { + #[inline] + fn cmp(&self, other: &DataLoadingOptions) -> ::core::cmp::Ordering { + ::core::cmp::Ord::cmp(&self.options, &other.options) + } + } + #[automatically_derived] + impl ::core::hash::Hash for DataLoadingOptions { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.options, state) + } + } + pub enum DataLoadingOptionType { + STRING, + BOOLEAN, + ENUM, + } + #[automatically_derived] + impl ::core::fmt::Debug for DataLoadingOptionType { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + DataLoadingOptionType::STRING => "STRING", + DataLoadingOptionType::BOOLEAN => "BOOLEAN", + DataLoadingOptionType::ENUM => "ENUM", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for DataLoadingOptionType { + #[inline] + fn clone(&self) -> DataLoadingOptionType { + match self { + DataLoadingOptionType::STRING => DataLoadingOptionType::STRING, + DataLoadingOptionType::BOOLEAN => DataLoadingOptionType::BOOLEAN, + DataLoadingOptionType::ENUM => DataLoadingOptionType::ENUM, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for DataLoadingOptionType {} + #[automatically_derived] + impl ::core::cmp::PartialEq for DataLoadingOptionType { + #[inline] + fn eq(&self, other: &DataLoadingOptionType) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::Eq for DataLoadingOptionType { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for DataLoadingOptionType { + #[inline] + fn partial_cmp( + &self, + other: &DataLoadingOptionType, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Ord for DataLoadingOptionType { + #[inline] + fn cmp(&self, other: &DataLoadingOptionType) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for DataLoadingOptionType { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + pub struct DataLoadingOption { + pub option_name: String, + pub option_type: DataLoadingOptionType, + pub value: String, + } + #[automatically_derived] + impl ::core::fmt::Debug for DataLoadingOption { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "DataLoadingOption", + "option_name", + &self.option_name, + "option_type", + &self.option_type, + "value", + &&self.value, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for DataLoadingOption { + #[inline] + fn clone(&self) -> DataLoadingOption { + DataLoadingOption { + option_name: ::core::clone::Clone::clone(&self.option_name), + option_type: ::core::clone::Clone::clone(&self.option_type), + value: ::core::clone::Clone::clone(&self.value), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for DataLoadingOption {} + #[automatically_derived] + impl ::core::cmp::PartialEq for DataLoadingOption { + #[inline] + fn eq(&self, other: &DataLoadingOption) -> bool { + self.option_name == other.option_name + && self.option_type == other.option_type + && self.value == other.value + } + } + #[automatically_derived] + impl ::core::cmp::Eq for DataLoadingOption { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for DataLoadingOption { + #[inline] + fn partial_cmp( + &self, + other: &DataLoadingOption, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.option_name, + &other.option_name, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.option_type, + &other.option_type, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.value, + &other.value, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Ord for DataLoadingOption { + #[inline] + fn cmp(&self, other: &DataLoadingOption) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.option_name, &other.option_name) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.option_type, + &other.option_type, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.value, &other.value) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for DataLoadingOption { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.option_name, state); + ::core::hash::Hash::hash(&self.option_type, state); + ::core::hash::Hash::hash(&self.value, state) + } + } + pub struct StageLoadSelectItem { + pub alias: Option, + pub file_col_num: i32, + pub element: Option, + pub item_as: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for StageLoadSelectItem { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field4_finish( + f, + "StageLoadSelectItem", + "alias", + &self.alias, + "file_col_num", + &self.file_col_num, + "element", + &self.element, + "item_as", + &&self.item_as, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for StageLoadSelectItem { + #[inline] + fn clone(&self) -> StageLoadSelectItem { + StageLoadSelectItem { + alias: ::core::clone::Clone::clone(&self.alias), + file_col_num: ::core::clone::Clone::clone(&self.file_col_num), + element: ::core::clone::Clone::clone(&self.element), + item_as: ::core::clone::Clone::clone(&self.item_as), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for StageLoadSelectItem {} + #[automatically_derived] + impl ::core::cmp::PartialEq for StageLoadSelectItem { + #[inline] + fn eq(&self, other: &StageLoadSelectItem) -> bool { + self.alias == other.alias && self.file_col_num == other.file_col_num + && self.element == other.element && self.item_as == other.item_as + } + } + #[automatically_derived] + impl ::core::cmp::Eq for StageLoadSelectItem { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for StageLoadSelectItem { + #[inline] + fn partial_cmp( + &self, + other: &StageLoadSelectItem, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.alias, + &other.alias, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.file_col_num, + &other.file_col_num, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.element, + &other.element, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.item_as, + &other.item_as, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Ord for StageLoadSelectItem { + #[inline] + fn cmp(&self, other: &StageLoadSelectItem) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.alias, &other.alias) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.file_col_num, + &other.file_col_num, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.element, &other.element) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.item_as, &other.item_as) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for StageLoadSelectItem { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.alias, state); + ::core::hash::Hash::hash(&self.file_col_num, state); + ::core::hash::Hash::hash(&self.element, state); + ::core::hash::Hash::hash(&self.item_as, state) + } + } + impl fmt::Display for StageParamsObject { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let url = &self.url.as_ref(); + let storage_integration = &self.storage_integration.as_ref(); + let endpoint = &self.endpoint.as_ref(); + if url.is_some() { + f.write_fmt(format_args!(" URL=\'{0}\'", url.unwrap()))?; + } + if storage_integration.is_some() { + f.write_fmt( + format_args!( + " STORAGE_INTEGRATION={0}", + storage_integration.unwrap(), + ), + )?; + } + if endpoint.is_some() { + f.write_fmt( + format_args!(" ENDPOINT=\'{0}\'", endpoint.unwrap()), + )?; + } + if !self.credentials.options.is_empty() { + f.write_fmt( + format_args!(" CREDENTIALS=({0})", self.credentials), + )?; + } + if !self.encryption.options.is_empty() { + f.write_fmt(format_args!(" ENCRYPTION=({0})", self.encryption))?; + } + Ok(()) + } + } + impl fmt::Display for DataLoadingOptions { + fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result { + if !self.options.is_empty() { + let mut first = false; + for option in &self.options { + if !first { + first = true; + } else { + f.write_str(" ")?; + } + f.write_fmt(format_args!("{0}", option))?; + } + } + Ok(()) + } + } + impl fmt::Display for DataLoadingOption { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self.option_type { + DataLoadingOptionType::STRING => { + f.write_fmt( + format_args!("{0}=\'{1}\'", self.option_name, self.value), + )?; + } + DataLoadingOptionType::ENUM => { + f.write_fmt( + format_args!("{0}={1}", self.option_name, self.value), + )?; + } + DataLoadingOptionType::BOOLEAN => { + f.write_fmt( + format_args!("{0}={1}", self.option_name, self.value), + )?; + } + } + Ok(()) + } + } + impl fmt::Display for StageLoadSelectItem { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if self.alias.is_some() { + f.write_fmt(format_args!("{0}.", self.alias.as_ref().unwrap()))?; + } + f.write_fmt(format_args!("${0}", self.file_col_num))?; + if self.element.is_some() { + f.write_fmt( + format_args!(":{0}", self.element.as_ref().unwrap()), + )?; + } + if self.item_as.is_some() { + f.write_fmt( + format_args!(" AS {0}", self.item_as.as_ref().unwrap()), + )?; + } + Ok(()) + } + } + pub struct FileStagingCommand { + pub stage: ObjectName, + pub pattern: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for FileStagingCommand { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field2_finish( + f, + "FileStagingCommand", + "stage", + &self.stage, + "pattern", + &&self.pattern, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for FileStagingCommand { + #[inline] + fn clone(&self) -> FileStagingCommand { + FileStagingCommand { + stage: ::core::clone::Clone::clone(&self.stage), + pattern: ::core::clone::Clone::clone(&self.pattern), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for FileStagingCommand {} + #[automatically_derived] + impl ::core::cmp::PartialEq for FileStagingCommand { + #[inline] + fn eq(&self, other: &FileStagingCommand) -> bool { + self.stage == other.stage && self.pattern == other.pattern + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for FileStagingCommand { + #[inline] + fn partial_cmp( + &self, + other: &FileStagingCommand, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.stage, + &other.stage, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.pattern, + &other.pattern, + ) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for FileStagingCommand { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for FileStagingCommand { + #[inline] + fn cmp(&self, other: &FileStagingCommand) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.stage, &other.stage) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.pattern, &other.pattern) + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for FileStagingCommand { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.stage, state); + ::core::hash::Hash::hash(&self.pattern, state) + } + } + impl fmt::Display for FileStagingCommand { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt(format_args!("{0}", self.stage))?; + if let Some(pattern) = self.pattern.as_ref() { + f.write_fmt(format_args!(" PATTERN=\'{0}\'", pattern))?; + } + Ok(()) + } + } + } + } + mod operator { + use core::fmt; + use super::display_separated; + /// Unary operators + pub enum UnaryOperator { + /// Plus, e.g. `+9` + Plus, + /// Minus, e.g. `-9` + Minus, + /// Not, e.g. `NOT(true)` + Not, + /// Bitwise Not, e.g. `~9` (PostgreSQL-specific) + PGBitwiseNot, + /// Square root, e.g. `|/9` (PostgreSQL-specific) + PGSquareRoot, + /// Cube root, e.g. `||/27` (PostgreSQL-specific) + PGCubeRoot, + /// Factorial, e.g. `9!` (PostgreSQL-specific) + PGPostfixFactorial, + /// Factorial, e.g. `!!9` (PostgreSQL-specific) + PGPrefixFactorial, + /// Absolute value, e.g. `@ -9` (PostgreSQL-specific) + PGAbs, + /// Unary logical not operator: e.g. `! false` (Hive-specific) + BangNot, + } + #[automatically_derived] + impl ::core::fmt::Debug for UnaryOperator { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + UnaryOperator::Plus => "Plus", + UnaryOperator::Minus => "Minus", + UnaryOperator::Not => "Not", + UnaryOperator::PGBitwiseNot => "PGBitwiseNot", + UnaryOperator::PGSquareRoot => "PGSquareRoot", + UnaryOperator::PGCubeRoot => "PGCubeRoot", + UnaryOperator::PGPostfixFactorial => "PGPostfixFactorial", + UnaryOperator::PGPrefixFactorial => "PGPrefixFactorial", + UnaryOperator::PGAbs => "PGAbs", + UnaryOperator::BangNot => "BangNot", + }, + ) + } + } + #[automatically_derived] + impl ::core::marker::Copy for UnaryOperator {} + #[automatically_derived] + impl ::core::clone::Clone for UnaryOperator { + #[inline] + fn clone(&self) -> UnaryOperator { + *self + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for UnaryOperator {} + #[automatically_derived] + impl ::core::cmp::PartialEq for UnaryOperator { + #[inline] + fn eq(&self, other: &UnaryOperator) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for UnaryOperator { + #[inline] + fn partial_cmp( + &self, + other: &UnaryOperator, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for UnaryOperator { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for UnaryOperator { + #[inline] + fn cmp(&self, other: &UnaryOperator) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for UnaryOperator { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl fmt::Display for UnaryOperator { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_str( + match self { + UnaryOperator::Plus => "+", + UnaryOperator::Minus => "-", + UnaryOperator::Not => "NOT", + UnaryOperator::PGBitwiseNot => "~", + UnaryOperator::PGSquareRoot => "|/", + UnaryOperator::PGCubeRoot => "||/", + UnaryOperator::PGPostfixFactorial => "!", + UnaryOperator::PGPrefixFactorial => "!!", + UnaryOperator::PGAbs => "@", + UnaryOperator::BangNot => "!", + }, + ) + } + } + /// Binary operators + pub enum BinaryOperator { + /// Plus, e.g. `a + b` + Plus, + /// Minus, e.g. `a - b` + Minus, + /// Multiply, e.g. `a * b` + Multiply, + /// Divide, e.g. `a / b` + Divide, + /// Modulo, e.g. `a % b` + Modulo, + /// String/Array Concat operator, e.g. `a || b` + StringConcat, + /// Greater than, e.g. `a > b` + Gt, + /// Less than, e.g. `a < b` + Lt, + /// Greater equal, e.g. `a >= b` + GtEq, + /// Less equal, e.g. `a <= b` + LtEq, + /// Spaceship, e.g. `a <=> b` + Spaceship, + /// Equal, e.g. `a = b` + Eq, + /// Not equal, e.g. `a <> b` + NotEq, + /// And, e.g. `a AND b` + And, + /// Or, e.g. `a OR b` + Or, + /// XOR, e.g. `a XOR b` + Xor, + /// Bitwise or, e.g. `a | b` + BitwiseOr, + /// Bitwise and, e.g. `a & b` + BitwiseAnd, + /// Bitwise XOR, e.g. `a ^ b` + BitwiseXor, + /// Integer division operator `//` in DuckDB + DuckIntegerDivide, + /// MySQL [`DIV`](https://dev.mysql.com/doc/refman/8.0/en/arithmetic-functions.html) integer division + MyIntegerDivide, + /// Support for custom operators (such as Postgres custom operators) + Custom(String), + /// Bitwise XOR, e.g. `a # b` (PostgreSQL-specific) + PGBitwiseXor, + /// Bitwise shift left, e.g. `a << b` (PostgreSQL-specific) + PGBitwiseShiftLeft, + /// Bitwise shift right, e.g. `a >> b` (PostgreSQL-specific) + PGBitwiseShiftRight, + /// Exponent, e.g. `a ^ b` (PostgreSQL-specific) + PGExp, + /// Overlap operator, e.g. `a && b` (PostgreSQL-specific) + PGOverlap, + /// String matches regular expression (case sensitively), e.g. `a ~ b` (PostgreSQL-specific) + PGRegexMatch, + /// String matches regular expression (case insensitively), e.g. `a ~* b` (PostgreSQL-specific) + PGRegexIMatch, + /// String does not match regular expression (case sensitively), e.g. `a !~ b` (PostgreSQL-specific) + PGRegexNotMatch, + /// String does not match regular expression (case insensitively), e.g. `a !~* b` (PostgreSQL-specific) + PGRegexNotIMatch, + /// String matches pattern (case sensitively), e.g. `a ~~ b` (PostgreSQL-specific) + PGLikeMatch, + /// String matches pattern (case insensitively), e.g. `a ~~* b` (PostgreSQL-specific) + PGILikeMatch, + /// String does not match pattern (case sensitively), e.g. `a !~~ b` (PostgreSQL-specific) + PGNotLikeMatch, + /// String does not match pattern (case insensitively), e.g. `a !~~* b` (PostgreSQL-specific) + PGNotILikeMatch, + /// String "starts with", eg: `a ^@ b` (PostgreSQL-specific) + PGStartsWith, + /// The `->` operator. + /// + /// On PostgreSQL, this operator extracts a JSON object field or array + /// element, for example `'{"a":"b"}'::json -> 'a'` or `[1, 2, 3]'::json + /// -> 2`. + /// + /// See . + Arrow, + /// The `->>` operator. + /// + /// On PostgreSQL, this operator extracts a JSON object field or JSON + /// array element and converts it to text, for example `'{"a":"b"}'::json + /// ->> 'a'` or `[1, 2, 3]'::json ->> 2`. + /// + /// See . + LongArrow, + /// The `#>` operator. + /// + /// On PostgreSQL, this operator extracts a JSON sub-object at the specified + /// path, for example: + /// + /// ```notrust + ///'{"a": {"b": ["foo","bar"]}}'::json #> '{a,b,1}' + /// ``` + /// + /// See . + HashArrow, + /// The `#>>` operator. + /// + /// A PostgreSQL-specific operator that extracts JSON sub-object at the + /// specified path, for example + /// + /// ```notrust + ///'{"a": {"b": ["foo","bar"]}}'::json #>> '{a,b,1}' + /// ``` + /// + /// See . + HashLongArrow, + /// The `@@` operator. + /// + /// On PostgreSQL, this is used for JSON and text searches. + /// + /// See . + /// See . + AtAt, + /// The `@>` operator. + /// + /// On PostgreSQL, this is used for JSON and text searches. + /// + /// See . + /// See . + AtArrow, + /// The `<@` operator. + /// + /// On PostgreSQL, this is used for JSON and text searches. + /// + /// See . + /// See . + ArrowAt, + /// The `#-` operator. + /// + /// On PostgreSQL, this operator is used to delete a field or array element + /// at a specified path. + /// + /// See . + HashMinus, + /// The `@?` operator. + /// + /// On PostgreSQL, this operator is used to check the given JSON path + /// returns an item for the JSON value. + /// + /// See . + AtQuestion, + /// The `?` operator. + /// + /// On PostgreSQL, this operator is used to check whether a string exists as a top-level key + /// within the JSON value + /// + /// See . + Question, + /// The `?&` operator. + /// + /// On PostgreSQL, this operator is used to check whether all of the the indicated array + /// members exist as top-level keys. + /// + /// See . + QuestionAnd, + /// The `?|` operator. + /// + /// On PostgreSQL, this operator is used to check whether any of the the indicated array + /// members exist as top-level keys. + /// + /// See . + QuestionPipe, + /// PostgreSQL-specific custom operator. + /// + /// See [CREATE OPERATOR](https://www.postgresql.org/docs/current/sql-createoperator.html) + /// for more information. + PGCustomBinaryOperator(Vec), + /// The `OVERLAPS` operator + /// + /// Specifies a test for an overlap between two datetime periods: + /// + Overlaps, + } + #[automatically_derived] + impl ::core::fmt::Debug for BinaryOperator { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + BinaryOperator::Plus => ::core::fmt::Formatter::write_str(f, "Plus"), + BinaryOperator::Minus => { + ::core::fmt::Formatter::write_str(f, "Minus") + } + BinaryOperator::Multiply => { + ::core::fmt::Formatter::write_str(f, "Multiply") + } + BinaryOperator::Divide => { + ::core::fmt::Formatter::write_str(f, "Divide") + } + BinaryOperator::Modulo => { + ::core::fmt::Formatter::write_str(f, "Modulo") + } + BinaryOperator::StringConcat => { + ::core::fmt::Formatter::write_str(f, "StringConcat") + } + BinaryOperator::Gt => ::core::fmt::Formatter::write_str(f, "Gt"), + BinaryOperator::Lt => ::core::fmt::Formatter::write_str(f, "Lt"), + BinaryOperator::GtEq => ::core::fmt::Formatter::write_str(f, "GtEq"), + BinaryOperator::LtEq => ::core::fmt::Formatter::write_str(f, "LtEq"), + BinaryOperator::Spaceship => { + ::core::fmt::Formatter::write_str(f, "Spaceship") + } + BinaryOperator::Eq => ::core::fmt::Formatter::write_str(f, "Eq"), + BinaryOperator::NotEq => { + ::core::fmt::Formatter::write_str(f, "NotEq") + } + BinaryOperator::And => ::core::fmt::Formatter::write_str(f, "And"), + BinaryOperator::Or => ::core::fmt::Formatter::write_str(f, "Or"), + BinaryOperator::Xor => ::core::fmt::Formatter::write_str(f, "Xor"), + BinaryOperator::BitwiseOr => { + ::core::fmt::Formatter::write_str(f, "BitwiseOr") + } + BinaryOperator::BitwiseAnd => { + ::core::fmt::Formatter::write_str(f, "BitwiseAnd") + } + BinaryOperator::BitwiseXor => { + ::core::fmt::Formatter::write_str(f, "BitwiseXor") + } + BinaryOperator::DuckIntegerDivide => { + ::core::fmt::Formatter::write_str(f, "DuckIntegerDivide") + } + BinaryOperator::MyIntegerDivide => { + ::core::fmt::Formatter::write_str(f, "MyIntegerDivide") + } + BinaryOperator::Custom(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Custom", + &__self_0, + ) + } + BinaryOperator::PGBitwiseXor => { + ::core::fmt::Formatter::write_str(f, "PGBitwiseXor") + } + BinaryOperator::PGBitwiseShiftLeft => { + ::core::fmt::Formatter::write_str(f, "PGBitwiseShiftLeft") + } + BinaryOperator::PGBitwiseShiftRight => { + ::core::fmt::Formatter::write_str(f, "PGBitwiseShiftRight") + } + BinaryOperator::PGExp => { + ::core::fmt::Formatter::write_str(f, "PGExp") + } + BinaryOperator::PGOverlap => { + ::core::fmt::Formatter::write_str(f, "PGOverlap") + } + BinaryOperator::PGRegexMatch => { + ::core::fmt::Formatter::write_str(f, "PGRegexMatch") + } + BinaryOperator::PGRegexIMatch => { + ::core::fmt::Formatter::write_str(f, "PGRegexIMatch") + } + BinaryOperator::PGRegexNotMatch => { + ::core::fmt::Formatter::write_str(f, "PGRegexNotMatch") + } + BinaryOperator::PGRegexNotIMatch => { + ::core::fmt::Formatter::write_str(f, "PGRegexNotIMatch") + } + BinaryOperator::PGLikeMatch => { + ::core::fmt::Formatter::write_str(f, "PGLikeMatch") + } + BinaryOperator::PGILikeMatch => { + ::core::fmt::Formatter::write_str(f, "PGILikeMatch") + } + BinaryOperator::PGNotLikeMatch => { + ::core::fmt::Formatter::write_str(f, "PGNotLikeMatch") + } + BinaryOperator::PGNotILikeMatch => { + ::core::fmt::Formatter::write_str(f, "PGNotILikeMatch") + } + BinaryOperator::PGStartsWith => { + ::core::fmt::Formatter::write_str(f, "PGStartsWith") + } + BinaryOperator::Arrow => { + ::core::fmt::Formatter::write_str(f, "Arrow") + } + BinaryOperator::LongArrow => { + ::core::fmt::Formatter::write_str(f, "LongArrow") + } + BinaryOperator::HashArrow => { + ::core::fmt::Formatter::write_str(f, "HashArrow") + } + BinaryOperator::HashLongArrow => { + ::core::fmt::Formatter::write_str(f, "HashLongArrow") + } + BinaryOperator::AtAt => ::core::fmt::Formatter::write_str(f, "AtAt"), + BinaryOperator::AtArrow => { + ::core::fmt::Formatter::write_str(f, "AtArrow") + } + BinaryOperator::ArrowAt => { + ::core::fmt::Formatter::write_str(f, "ArrowAt") + } + BinaryOperator::HashMinus => { + ::core::fmt::Formatter::write_str(f, "HashMinus") + } + BinaryOperator::AtQuestion => { + ::core::fmt::Formatter::write_str(f, "AtQuestion") + } + BinaryOperator::Question => { + ::core::fmt::Formatter::write_str(f, "Question") + } + BinaryOperator::QuestionAnd => { + ::core::fmt::Formatter::write_str(f, "QuestionAnd") + } + BinaryOperator::QuestionPipe => { + ::core::fmt::Formatter::write_str(f, "QuestionPipe") + } + BinaryOperator::PGCustomBinaryOperator(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "PGCustomBinaryOperator", + &__self_0, + ) + } + BinaryOperator::Overlaps => { + ::core::fmt::Formatter::write_str(f, "Overlaps") + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for BinaryOperator { + #[inline] + fn clone(&self) -> BinaryOperator { + match self { + BinaryOperator::Plus => BinaryOperator::Plus, + BinaryOperator::Minus => BinaryOperator::Minus, + BinaryOperator::Multiply => BinaryOperator::Multiply, + BinaryOperator::Divide => BinaryOperator::Divide, + BinaryOperator::Modulo => BinaryOperator::Modulo, + BinaryOperator::StringConcat => BinaryOperator::StringConcat, + BinaryOperator::Gt => BinaryOperator::Gt, + BinaryOperator::Lt => BinaryOperator::Lt, + BinaryOperator::GtEq => BinaryOperator::GtEq, + BinaryOperator::LtEq => BinaryOperator::LtEq, + BinaryOperator::Spaceship => BinaryOperator::Spaceship, + BinaryOperator::Eq => BinaryOperator::Eq, + BinaryOperator::NotEq => BinaryOperator::NotEq, + BinaryOperator::And => BinaryOperator::And, + BinaryOperator::Or => BinaryOperator::Or, + BinaryOperator::Xor => BinaryOperator::Xor, + BinaryOperator::BitwiseOr => BinaryOperator::BitwiseOr, + BinaryOperator::BitwiseAnd => BinaryOperator::BitwiseAnd, + BinaryOperator::BitwiseXor => BinaryOperator::BitwiseXor, + BinaryOperator::DuckIntegerDivide => { + BinaryOperator::DuckIntegerDivide + } + BinaryOperator::MyIntegerDivide => BinaryOperator::MyIntegerDivide, + BinaryOperator::Custom(__self_0) => { + BinaryOperator::Custom(::core::clone::Clone::clone(__self_0)) + } + BinaryOperator::PGBitwiseXor => BinaryOperator::PGBitwiseXor, + BinaryOperator::PGBitwiseShiftLeft => { + BinaryOperator::PGBitwiseShiftLeft + } + BinaryOperator::PGBitwiseShiftRight => { + BinaryOperator::PGBitwiseShiftRight + } + BinaryOperator::PGExp => BinaryOperator::PGExp, + BinaryOperator::PGOverlap => BinaryOperator::PGOverlap, + BinaryOperator::PGRegexMatch => BinaryOperator::PGRegexMatch, + BinaryOperator::PGRegexIMatch => BinaryOperator::PGRegexIMatch, + BinaryOperator::PGRegexNotMatch => BinaryOperator::PGRegexNotMatch, + BinaryOperator::PGRegexNotIMatch => BinaryOperator::PGRegexNotIMatch, + BinaryOperator::PGLikeMatch => BinaryOperator::PGLikeMatch, + BinaryOperator::PGILikeMatch => BinaryOperator::PGILikeMatch, + BinaryOperator::PGNotLikeMatch => BinaryOperator::PGNotLikeMatch, + BinaryOperator::PGNotILikeMatch => BinaryOperator::PGNotILikeMatch, + BinaryOperator::PGStartsWith => BinaryOperator::PGStartsWith, + BinaryOperator::Arrow => BinaryOperator::Arrow, + BinaryOperator::LongArrow => BinaryOperator::LongArrow, + BinaryOperator::HashArrow => BinaryOperator::HashArrow, + BinaryOperator::HashLongArrow => BinaryOperator::HashLongArrow, + BinaryOperator::AtAt => BinaryOperator::AtAt, + BinaryOperator::AtArrow => BinaryOperator::AtArrow, + BinaryOperator::ArrowAt => BinaryOperator::ArrowAt, + BinaryOperator::HashMinus => BinaryOperator::HashMinus, + BinaryOperator::AtQuestion => BinaryOperator::AtQuestion, + BinaryOperator::Question => BinaryOperator::Question, + BinaryOperator::QuestionAnd => BinaryOperator::QuestionAnd, + BinaryOperator::QuestionPipe => BinaryOperator::QuestionPipe, + BinaryOperator::PGCustomBinaryOperator(__self_0) => { + BinaryOperator::PGCustomBinaryOperator( + ::core::clone::Clone::clone(__self_0), + ) + } + BinaryOperator::Overlaps => BinaryOperator::Overlaps, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for BinaryOperator {} + #[automatically_derived] + impl ::core::cmp::PartialEq for BinaryOperator { + #[inline] + fn eq(&self, other: &BinaryOperator) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + BinaryOperator::Custom(__self_0), + BinaryOperator::Custom(__arg1_0), + ) => __self_0 == __arg1_0, + ( + BinaryOperator::PGCustomBinaryOperator(__self_0), + BinaryOperator::PGCustomBinaryOperator(__arg1_0), + ) => __self_0 == __arg1_0, + _ => true, + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for BinaryOperator { + #[inline] + fn partial_cmp( + &self, + other: &BinaryOperator, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + BinaryOperator::Custom(__self_0), + BinaryOperator::Custom(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + BinaryOperator::PGCustomBinaryOperator(__self_0), + BinaryOperator::PGCustomBinaryOperator(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for BinaryOperator { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for BinaryOperator { + #[inline] + fn cmp(&self, other: &BinaryOperator) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + BinaryOperator::Custom(__self_0), + BinaryOperator::Custom(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + BinaryOperator::PGCustomBinaryOperator(__self_0), + BinaryOperator::PGCustomBinaryOperator(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => ::core::cmp::Ordering::Equal, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for BinaryOperator { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + BinaryOperator::Custom(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + BinaryOperator::PGCustomBinaryOperator(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + _ => {} + } + } + } + impl fmt::Display for BinaryOperator { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + BinaryOperator::Plus => f.write_str("+"), + BinaryOperator::Minus => f.write_str("-"), + BinaryOperator::Multiply => f.write_str("*"), + BinaryOperator::Divide => f.write_str("/"), + BinaryOperator::Modulo => f.write_str("%"), + BinaryOperator::StringConcat => f.write_str("||"), + BinaryOperator::Gt => f.write_str(">"), + BinaryOperator::Lt => f.write_str("<"), + BinaryOperator::GtEq => f.write_str(">="), + BinaryOperator::LtEq => f.write_str("<="), + BinaryOperator::Spaceship => f.write_str("<=>"), + BinaryOperator::Eq => f.write_str("="), + BinaryOperator::NotEq => f.write_str("<>"), + BinaryOperator::And => f.write_str("AND"), + BinaryOperator::Or => f.write_str("OR"), + BinaryOperator::Xor => f.write_str("XOR"), + BinaryOperator::BitwiseOr => f.write_str("|"), + BinaryOperator::BitwiseAnd => f.write_str("&"), + BinaryOperator::BitwiseXor => f.write_str("^"), + BinaryOperator::DuckIntegerDivide => f.write_str("//"), + BinaryOperator::MyIntegerDivide => f.write_str("DIV"), + BinaryOperator::Custom(s) => f.write_str(s), + BinaryOperator::PGBitwiseXor => f.write_str("#"), + BinaryOperator::PGBitwiseShiftLeft => f.write_str("<<"), + BinaryOperator::PGBitwiseShiftRight => f.write_str(">>"), + BinaryOperator::PGExp => f.write_str("^"), + BinaryOperator::PGOverlap => f.write_str("&&"), + BinaryOperator::PGRegexMatch => f.write_str("~"), + BinaryOperator::PGRegexIMatch => f.write_str("~*"), + BinaryOperator::PGRegexNotMatch => f.write_str("!~"), + BinaryOperator::PGRegexNotIMatch => f.write_str("!~*"), + BinaryOperator::PGLikeMatch => f.write_str("~~"), + BinaryOperator::PGILikeMatch => f.write_str("~~*"), + BinaryOperator::PGNotLikeMatch => f.write_str("!~~"), + BinaryOperator::PGNotILikeMatch => f.write_str("!~~*"), + BinaryOperator::PGStartsWith => f.write_str("^@"), + BinaryOperator::Arrow => f.write_str("->"), + BinaryOperator::LongArrow => f.write_str("->>"), + BinaryOperator::HashArrow => f.write_str("#>"), + BinaryOperator::HashLongArrow => f.write_str("#>>"), + BinaryOperator::AtAt => f.write_str("@@"), + BinaryOperator::AtArrow => f.write_str("@>"), + BinaryOperator::ArrowAt => f.write_str("<@"), + BinaryOperator::HashMinus => f.write_str("#-"), + BinaryOperator::AtQuestion => f.write_str("@?"), + BinaryOperator::Question => f.write_str("?"), + BinaryOperator::QuestionAnd => f.write_str("?&"), + BinaryOperator::QuestionPipe => f.write_str("?|"), + BinaryOperator::PGCustomBinaryOperator(idents) => { + f.write_fmt( + format_args!("OPERATOR({0})", display_separated(idents, ".")), + ) + } + BinaryOperator::Overlaps => f.write_str("OVERLAPS"), + } + } + } + } + mod operator_classes { + use core::fmt::{self, Display}; + use crate::keywords::Keyword; + /// Trait characterizing the operator classes + pub trait OperatorClass: From + Into { + /// List of keywords associated to the operator class + const KEYWORDS: &'static [Keyword]; + } + /// Bloom-index specific operator classes + pub enum BloomOperatorClass { + Int4, + Text, + } + #[automatically_derived] + impl ::core::fmt::Debug for BloomOperatorClass { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + BloomOperatorClass::Int4 => "Int4", + BloomOperatorClass::Text => "Text", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for BloomOperatorClass { + #[inline] + fn clone(&self) -> BloomOperatorClass { + match self { + BloomOperatorClass::Int4 => BloomOperatorClass::Int4, + BloomOperatorClass::Text => BloomOperatorClass::Text, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for BloomOperatorClass {} + #[automatically_derived] + impl ::core::cmp::PartialEq for BloomOperatorClass { + #[inline] + fn eq(&self, other: &BloomOperatorClass) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for BloomOperatorClass { + #[inline] + fn partial_cmp( + &self, + other: &BloomOperatorClass, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for BloomOperatorClass { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for BloomOperatorClass { + #[inline] + fn cmp(&self, other: &BloomOperatorClass) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for BloomOperatorClass { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl OperatorClass for BloomOperatorClass { + const KEYWORDS: &'static [Keyword] = &[Keyword::INT4_OPS, Keyword::TEXT_OPS]; + } + impl From for BloomOperatorClass { + fn from(keyword: Keyword) -> Self { + match keyword { + Keyword::INT4_OPS => BloomOperatorClass::Int4, + Keyword::TEXT_OPS => BloomOperatorClass::Text, + _ => { + ::core::panicking::panic( + "internal error: entered unreachable code", + ) + } + } + } + } + impl Display for BloomOperatorClass { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + BloomOperatorClass::Int4 => f.write_fmt(format_args!("int4_ops")), + BloomOperatorClass::Text => f.write_fmt(format_args!("text_ops")), + } + } + } + /// BTree GIN-based index operator class + pub enum GINOperatorClass { + Int2, + Int4, + Int8, + Float4, + Float8, + Money, + OID, + Timestamp, + TimestampTZ, + Time, + TimeTZ, + Date, + Interval, + MACAddr, + MACAddr8, + INET, + CIDR, + Text, + VARCHAR, + CHAR, + Bytea, + Bit, + Varbit, + Numeric, + Enum, + UUID, + Name, + Bool, + BPChar, + /// Support for similarity of text using trigram matching: [`pg_tgrm`](https://www.postgresql.org/docs/current/pgtrgm.html) + TRGM, + /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) + HStore, + } + #[automatically_derived] + impl ::core::fmt::Debug for GINOperatorClass { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + GINOperatorClass::Int2 => "Int2", + GINOperatorClass::Int4 => "Int4", + GINOperatorClass::Int8 => "Int8", + GINOperatorClass::Float4 => "Float4", + GINOperatorClass::Float8 => "Float8", + GINOperatorClass::Money => "Money", + GINOperatorClass::OID => "OID", + GINOperatorClass::Timestamp => "Timestamp", + GINOperatorClass::TimestampTZ => "TimestampTZ", + GINOperatorClass::Time => "Time", + GINOperatorClass::TimeTZ => "TimeTZ", + GINOperatorClass::Date => "Date", + GINOperatorClass::Interval => "Interval", + GINOperatorClass::MACAddr => "MACAddr", + GINOperatorClass::MACAddr8 => "MACAddr8", + GINOperatorClass::INET => "INET", + GINOperatorClass::CIDR => "CIDR", + GINOperatorClass::Text => "Text", + GINOperatorClass::VARCHAR => "VARCHAR", + GINOperatorClass::CHAR => "CHAR", + GINOperatorClass::Bytea => "Bytea", + GINOperatorClass::Bit => "Bit", + GINOperatorClass::Varbit => "Varbit", + GINOperatorClass::Numeric => "Numeric", + GINOperatorClass::Enum => "Enum", + GINOperatorClass::UUID => "UUID", + GINOperatorClass::Name => "Name", + GINOperatorClass::Bool => "Bool", + GINOperatorClass::BPChar => "BPChar", + GINOperatorClass::TRGM => "TRGM", + GINOperatorClass::HStore => "HStore", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for GINOperatorClass { + #[inline] + fn clone(&self) -> GINOperatorClass { + match self { + GINOperatorClass::Int2 => GINOperatorClass::Int2, + GINOperatorClass::Int4 => GINOperatorClass::Int4, + GINOperatorClass::Int8 => GINOperatorClass::Int8, + GINOperatorClass::Float4 => GINOperatorClass::Float4, + GINOperatorClass::Float8 => GINOperatorClass::Float8, + GINOperatorClass::Money => GINOperatorClass::Money, + GINOperatorClass::OID => GINOperatorClass::OID, + GINOperatorClass::Timestamp => GINOperatorClass::Timestamp, + GINOperatorClass::TimestampTZ => GINOperatorClass::TimestampTZ, + GINOperatorClass::Time => GINOperatorClass::Time, + GINOperatorClass::TimeTZ => GINOperatorClass::TimeTZ, + GINOperatorClass::Date => GINOperatorClass::Date, + GINOperatorClass::Interval => GINOperatorClass::Interval, + GINOperatorClass::MACAddr => GINOperatorClass::MACAddr, + GINOperatorClass::MACAddr8 => GINOperatorClass::MACAddr8, + GINOperatorClass::INET => GINOperatorClass::INET, + GINOperatorClass::CIDR => GINOperatorClass::CIDR, + GINOperatorClass::Text => GINOperatorClass::Text, + GINOperatorClass::VARCHAR => GINOperatorClass::VARCHAR, + GINOperatorClass::CHAR => GINOperatorClass::CHAR, + GINOperatorClass::Bytea => GINOperatorClass::Bytea, + GINOperatorClass::Bit => GINOperatorClass::Bit, + GINOperatorClass::Varbit => GINOperatorClass::Varbit, + GINOperatorClass::Numeric => GINOperatorClass::Numeric, + GINOperatorClass::Enum => GINOperatorClass::Enum, + GINOperatorClass::UUID => GINOperatorClass::UUID, + GINOperatorClass::Name => GINOperatorClass::Name, + GINOperatorClass::Bool => GINOperatorClass::Bool, + GINOperatorClass::BPChar => GINOperatorClass::BPChar, + GINOperatorClass::TRGM => GINOperatorClass::TRGM, + GINOperatorClass::HStore => GINOperatorClass::HStore, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for GINOperatorClass {} + #[automatically_derived] + impl ::core::cmp::PartialEq for GINOperatorClass { + #[inline] + fn eq(&self, other: &GINOperatorClass) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for GINOperatorClass { + #[inline] + fn partial_cmp( + &self, + other: &GINOperatorClass, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for GINOperatorClass { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for GINOperatorClass { + #[inline] + fn cmp(&self, other: &GINOperatorClass) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for GINOperatorClass { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl OperatorClass for GINOperatorClass { + const KEYWORDS: &'static [Keyword] = &[ + Keyword::INT2_OPS, + Keyword::INT4_OPS, + Keyword::INT8_OPS, + Keyword::FLOAT4_OPS, + Keyword::FLOAT8_OPS, + Keyword::MONEY_OPS, + Keyword::OID_OPS, + Keyword::TIMESTAMP_OPS, + Keyword::TIMESTAMPTZ_OPS, + Keyword::TIME_OPS, + Keyword::TIMETZ_OPS, + Keyword::DATE_OPS, + Keyword::INTERVAL_OPS, + Keyword::MACADDR_OPS, + Keyword::MACADDR8_OPS, + Keyword::INET_OPS, + Keyword::CIDR_OPS, + Keyword::TEXT_OPS, + Keyword::VARCHAR_OPS, + Keyword::CHAR_OPS, + Keyword::BYTEA_OPS, + Keyword::BIT_OPS, + Keyword::VARBIT_OPS, + Keyword::NUMERIC_OPS, + Keyword::ENUM_OPS, + Keyword::UUID_OPS, + Keyword::NAME_OPS, + Keyword::BOOL_OPS, + Keyword::BPCHAR_OPS, + Keyword::GIN_TRGM_OPS, + Keyword::GIN_HSTORE_OPS, + ]; + } + impl From for GINOperatorClass { + fn from(keyword: Keyword) -> Self { + match keyword { + Keyword::INT2_OPS => GINOperatorClass::Int2, + Keyword::INT4_OPS => GINOperatorClass::Int4, + Keyword::INT8_OPS => GINOperatorClass::Int8, + Keyword::FLOAT4_OPS => GINOperatorClass::Float4, + Keyword::FLOAT8_OPS => GINOperatorClass::Float8, + Keyword::MONEY_OPS => GINOperatorClass::Money, + Keyword::OID_OPS => GINOperatorClass::OID, + Keyword::TIMESTAMP_OPS => GINOperatorClass::Timestamp, + Keyword::TIMESTAMPTZ_OPS => GINOperatorClass::TimestampTZ, + Keyword::TIME_OPS => GINOperatorClass::Time, + Keyword::TIMETZ_OPS => GINOperatorClass::TimeTZ, + Keyword::DATE_OPS => GINOperatorClass::Date, + Keyword::INTERVAL_OPS => GINOperatorClass::Interval, + Keyword::MACADDR_OPS => GINOperatorClass::MACAddr, + Keyword::MACADDR8_OPS => GINOperatorClass::MACAddr8, + Keyword::INET_OPS => GINOperatorClass::INET, + Keyword::CIDR_OPS => GINOperatorClass::CIDR, + Keyword::TEXT_OPS => GINOperatorClass::Text, + Keyword::VARCHAR_OPS => GINOperatorClass::VARCHAR, + Keyword::CHAR_OPS => GINOperatorClass::CHAR, + Keyword::BYTEA_OPS => GINOperatorClass::Bytea, + Keyword::BIT_OPS => GINOperatorClass::Bit, + Keyword::VARBIT_OPS => GINOperatorClass::Varbit, + Keyword::NUMERIC_OPS => GINOperatorClass::Numeric, + Keyword::ENUM_OPS => GINOperatorClass::Enum, + Keyword::UUID_OPS => GINOperatorClass::UUID, + Keyword::NAME_OPS => GINOperatorClass::Name, + Keyword::BOOL_OPS => GINOperatorClass::Bool, + Keyword::BPCHAR_OPS => GINOperatorClass::BPChar, + Keyword::GIN_TRGM_OPS => GINOperatorClass::TRGM, + Keyword::GIN_HSTORE_OPS => GINOperatorClass::HStore, + _ => { + ::core::panicking::panic( + "internal error: entered unreachable code", + ) + } + } + } + } + impl Display for GINOperatorClass { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + GINOperatorClass::Int2 => f.write_fmt(format_args!("int2_ops")), + GINOperatorClass::Int4 => f.write_fmt(format_args!("int4_ops")), + GINOperatorClass::Int8 => f.write_fmt(format_args!("int8_ops")), + GINOperatorClass::Float4 => f.write_fmt(format_args!("float4_ops")), + GINOperatorClass::Float8 => f.write_fmt(format_args!("float8_ops")), + GINOperatorClass::Money => f.write_fmt(format_args!("money_ops")), + GINOperatorClass::OID => f.write_fmt(format_args!("oid_ops")), + GINOperatorClass::Timestamp => { + f.write_fmt(format_args!("timestamp_ops")) + } + GINOperatorClass::TimestampTZ => { + f.write_fmt(format_args!("timestamptz_ops")) + } + GINOperatorClass::Time => f.write_fmt(format_args!("time_ops")), + GINOperatorClass::TimeTZ => f.write_fmt(format_args!("timetz_ops")), + GINOperatorClass::Date => f.write_fmt(format_args!("date_ops")), + GINOperatorClass::Interval => { + f.write_fmt(format_args!("interval_ops")) + } + GINOperatorClass::MACAddr => f.write_fmt(format_args!("macaddr_ops")), + GINOperatorClass::MACAddr8 => { + f.write_fmt(format_args!("macaddr8_ops")) + } + GINOperatorClass::INET => f.write_fmt(format_args!("inet_ops")), + GINOperatorClass::CIDR => f.write_fmt(format_args!("cidr_ops")), + GINOperatorClass::Text => f.write_fmt(format_args!("text_ops")), + GINOperatorClass::VARCHAR => f.write_fmt(format_args!("varchar_ops")), + GINOperatorClass::CHAR => f.write_fmt(format_args!("char_ops")), + GINOperatorClass::Bytea => f.write_fmt(format_args!("bytea_ops")), + GINOperatorClass::Bit => f.write_fmt(format_args!("bit_ops")), + GINOperatorClass::Varbit => f.write_fmt(format_args!("varbit_ops")), + GINOperatorClass::Numeric => f.write_fmt(format_args!("numeric_ops")), + GINOperatorClass::Enum => f.write_fmt(format_args!("enum_ops")), + GINOperatorClass::UUID => f.write_fmt(format_args!("uuid_ops")), + GINOperatorClass::Name => f.write_fmt(format_args!("name_ops")), + GINOperatorClass::Bool => f.write_fmt(format_args!("bool_ops")), + GINOperatorClass::BPChar => f.write_fmt(format_args!("bpchar_ops")), + GINOperatorClass::TRGM => f.write_fmt(format_args!("gin_trgm_ops")), + GINOperatorClass::HStore => { + f.write_fmt(format_args!("gin_hstore_ops")) + } + } + } + } + /// BTree GIST-based index operator class + pub enum GiSTOperatorClass { + OID, + UUID, + Int2, + Int4, + Int8, + Float4, + Float8, + Timestamp, + TimestampTZ, + Time, + TimeTZ, + Date, + Interval, + Cash, + MACAddr, + MACAddr8, + Text, + BPChar, + Bytea, + Numeric, + Bit, + VBit, + INet, + CIDR, + Enum, + Bool, + /// Type for representing line segments, or floating point intervals: [`seg`](https://www.postgresql.org/docs/current/seg.html) + SEG, + /// Support for similarity of text using trigram matching: [`pg_tgrm`](https://www.postgresql.org/docs/current/pgtrgm.html) + TRGM, + /// Type for representing labels of data stored in a hierarchical tree-like structure: [`ltree`](https://www.postgresql.org/docs/current/ltree.html) + LTREE, + /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) + HStore, + /// Type cube for representing multidimensional cubes: [`cube`](https://www.postgresql.org/docs/current/cube.html) + Cube, + } + #[automatically_derived] + impl ::core::fmt::Debug for GiSTOperatorClass { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + GiSTOperatorClass::OID => "OID", + GiSTOperatorClass::UUID => "UUID", + GiSTOperatorClass::Int2 => "Int2", + GiSTOperatorClass::Int4 => "Int4", + GiSTOperatorClass::Int8 => "Int8", + GiSTOperatorClass::Float4 => "Float4", + GiSTOperatorClass::Float8 => "Float8", + GiSTOperatorClass::Timestamp => "Timestamp", + GiSTOperatorClass::TimestampTZ => "TimestampTZ", + GiSTOperatorClass::Time => "Time", + GiSTOperatorClass::TimeTZ => "TimeTZ", + GiSTOperatorClass::Date => "Date", + GiSTOperatorClass::Interval => "Interval", + GiSTOperatorClass::Cash => "Cash", + GiSTOperatorClass::MACAddr => "MACAddr", + GiSTOperatorClass::MACAddr8 => "MACAddr8", + GiSTOperatorClass::Text => "Text", + GiSTOperatorClass::BPChar => "BPChar", + GiSTOperatorClass::Bytea => "Bytea", + GiSTOperatorClass::Numeric => "Numeric", + GiSTOperatorClass::Bit => "Bit", + GiSTOperatorClass::VBit => "VBit", + GiSTOperatorClass::INet => "INet", + GiSTOperatorClass::CIDR => "CIDR", + GiSTOperatorClass::Enum => "Enum", + GiSTOperatorClass::Bool => "Bool", + GiSTOperatorClass::SEG => "SEG", + GiSTOperatorClass::TRGM => "TRGM", + GiSTOperatorClass::LTREE => "LTREE", + GiSTOperatorClass::HStore => "HStore", + GiSTOperatorClass::Cube => "Cube", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for GiSTOperatorClass { + #[inline] + fn clone(&self) -> GiSTOperatorClass { + match self { + GiSTOperatorClass::OID => GiSTOperatorClass::OID, + GiSTOperatorClass::UUID => GiSTOperatorClass::UUID, + GiSTOperatorClass::Int2 => GiSTOperatorClass::Int2, + GiSTOperatorClass::Int4 => GiSTOperatorClass::Int4, + GiSTOperatorClass::Int8 => GiSTOperatorClass::Int8, + GiSTOperatorClass::Float4 => GiSTOperatorClass::Float4, + GiSTOperatorClass::Float8 => GiSTOperatorClass::Float8, + GiSTOperatorClass::Timestamp => GiSTOperatorClass::Timestamp, + GiSTOperatorClass::TimestampTZ => GiSTOperatorClass::TimestampTZ, + GiSTOperatorClass::Time => GiSTOperatorClass::Time, + GiSTOperatorClass::TimeTZ => GiSTOperatorClass::TimeTZ, + GiSTOperatorClass::Date => GiSTOperatorClass::Date, + GiSTOperatorClass::Interval => GiSTOperatorClass::Interval, + GiSTOperatorClass::Cash => GiSTOperatorClass::Cash, + GiSTOperatorClass::MACAddr => GiSTOperatorClass::MACAddr, + GiSTOperatorClass::MACAddr8 => GiSTOperatorClass::MACAddr8, + GiSTOperatorClass::Text => GiSTOperatorClass::Text, + GiSTOperatorClass::BPChar => GiSTOperatorClass::BPChar, + GiSTOperatorClass::Bytea => GiSTOperatorClass::Bytea, + GiSTOperatorClass::Numeric => GiSTOperatorClass::Numeric, + GiSTOperatorClass::Bit => GiSTOperatorClass::Bit, + GiSTOperatorClass::VBit => GiSTOperatorClass::VBit, + GiSTOperatorClass::INet => GiSTOperatorClass::INet, + GiSTOperatorClass::CIDR => GiSTOperatorClass::CIDR, + GiSTOperatorClass::Enum => GiSTOperatorClass::Enum, + GiSTOperatorClass::Bool => GiSTOperatorClass::Bool, + GiSTOperatorClass::SEG => GiSTOperatorClass::SEG, + GiSTOperatorClass::TRGM => GiSTOperatorClass::TRGM, + GiSTOperatorClass::LTREE => GiSTOperatorClass::LTREE, + GiSTOperatorClass::HStore => GiSTOperatorClass::HStore, + GiSTOperatorClass::Cube => GiSTOperatorClass::Cube, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for GiSTOperatorClass {} + #[automatically_derived] + impl ::core::cmp::PartialEq for GiSTOperatorClass { + #[inline] + fn eq(&self, other: &GiSTOperatorClass) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for GiSTOperatorClass { + #[inline] + fn partial_cmp( + &self, + other: &GiSTOperatorClass, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for GiSTOperatorClass { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for GiSTOperatorClass { + #[inline] + fn cmp(&self, other: &GiSTOperatorClass) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for GiSTOperatorClass { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl OperatorClass for GiSTOperatorClass { + const KEYWORDS: &'static [Keyword] = &[ + Keyword::GIST_OID_OPS, + Keyword::GIST_UUID_OPS, + Keyword::GIST_INT2_OPS, + Keyword::GIST_INT4_OPS, + Keyword::GIST_INT8_OPS, + Keyword::GIST_FLOAT4_OPS, + Keyword::GIST_FLOAT8_OPS, + Keyword::GIST_TIMESTAMP_OPS, + Keyword::GIST_TIMESTAMPTZ_OPS, + Keyword::GIST_TIME_OPS, + Keyword::GIST_TIMETZ_OPS, + Keyword::GIST_DATE_OPS, + Keyword::GIST_INTERVAL_OPS, + Keyword::GIST_CASH_OPS, + Keyword::GIST_MACADDR_OPS, + Keyword::GIST_MACADDR8_OPS, + Keyword::GIST_TEXT_OPS, + Keyword::GIST_BPCHAR_OPS, + Keyword::GIST_BYTEA_OPS, + Keyword::GIST_NUMERIC_OPS, + Keyword::GIST_BIT_OPS, + Keyword::GIST_VBIT_OPS, + Keyword::GIST_INET_OPS, + Keyword::GIST_CIDR_OPS, + Keyword::GIST_ENUM_OPS, + Keyword::GIST_BOOL_OPS, + Keyword::GIST_SEG_OPS, + Keyword::GIST_TRGM_OPS, + Keyword::GIST_LTREE_OPS, + Keyword::GIST_HSTORE_OPS, + Keyword::GIST_CUBE_OPS, + ]; + } + impl From for GiSTOperatorClass { + fn from(keyword: Keyword) -> Self { + match keyword { + Keyword::GIST_OID_OPS => GiSTOperatorClass::OID, + Keyword::GIST_UUID_OPS => GiSTOperatorClass::UUID, + Keyword::GIST_INT2_OPS => GiSTOperatorClass::Int2, + Keyword::GIST_INT4_OPS => GiSTOperatorClass::Int4, + Keyword::GIST_INT8_OPS => GiSTOperatorClass::Int8, + Keyword::GIST_FLOAT4_OPS => GiSTOperatorClass::Float4, + Keyword::GIST_FLOAT8_OPS => GiSTOperatorClass::Float8, + Keyword::GIST_TIMESTAMP_OPS => GiSTOperatorClass::Timestamp, + Keyword::GIST_TIMESTAMPTZ_OPS => GiSTOperatorClass::TimestampTZ, + Keyword::GIST_TIME_OPS => GiSTOperatorClass::Time, + Keyword::GIST_TIMETZ_OPS => GiSTOperatorClass::TimeTZ, + Keyword::GIST_DATE_OPS => GiSTOperatorClass::Date, + Keyword::GIST_INTERVAL_OPS => GiSTOperatorClass::Interval, + Keyword::GIST_CASH_OPS => GiSTOperatorClass::Cash, + Keyword::GIST_MACADDR_OPS => GiSTOperatorClass::MACAddr, + Keyword::GIST_MACADDR8_OPS => GiSTOperatorClass::MACAddr8, + Keyword::GIST_TEXT_OPS => GiSTOperatorClass::Text, + Keyword::GIST_BPCHAR_OPS => GiSTOperatorClass::BPChar, + Keyword::GIST_BYTEA_OPS => GiSTOperatorClass::Bytea, + Keyword::GIST_NUMERIC_OPS => GiSTOperatorClass::Numeric, + Keyword::GIST_BIT_OPS => GiSTOperatorClass::Bit, + Keyword::GIST_VBIT_OPS => GiSTOperatorClass::VBit, + Keyword::GIST_INET_OPS => GiSTOperatorClass::INet, + Keyword::GIST_CIDR_OPS => GiSTOperatorClass::CIDR, + Keyword::GIST_ENUM_OPS => GiSTOperatorClass::Enum, + Keyword::GIST_BOOL_OPS => GiSTOperatorClass::Bool, + Keyword::GIST_SEG_OPS => GiSTOperatorClass::SEG, + Keyword::GIST_TRGM_OPS => GiSTOperatorClass::TRGM, + Keyword::GIST_LTREE_OPS => GiSTOperatorClass::LTREE, + Keyword::GIST_HSTORE_OPS => GiSTOperatorClass::HStore, + Keyword::GIST_CUBE_OPS => GiSTOperatorClass::Cube, + _ => { + ::core::panicking::panic( + "internal error: entered unreachable code", + ) + } + } + } + } + impl Display for GiSTOperatorClass { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + GiSTOperatorClass::OID => f.write_fmt(format_args!("gist_oid_ops")), + GiSTOperatorClass::UUID => f.write_fmt(format_args!("gist_uuid_ops")), + GiSTOperatorClass::Int2 => f.write_fmt(format_args!("gist_int2_ops")), + GiSTOperatorClass::Int4 => f.write_fmt(format_args!("gist_int4_ops")), + GiSTOperatorClass::Int8 => f.write_fmt(format_args!("gist_int8_ops")), + GiSTOperatorClass::Float4 => { + f.write_fmt(format_args!("gist_float4_ops")) + } + GiSTOperatorClass::Float8 => { + f.write_fmt(format_args!("gist_float8_ops")) + } + GiSTOperatorClass::Timestamp => { + f.write_fmt(format_args!("gist_timestamp_ops")) + } + GiSTOperatorClass::TimestampTZ => { + f.write_fmt(format_args!("gist_timestamptz_ops")) + } + GiSTOperatorClass::Time => f.write_fmt(format_args!("gist_time_ops")), + GiSTOperatorClass::TimeTZ => { + f.write_fmt(format_args!("gist_timetz_ops")) + } + GiSTOperatorClass::Date => f.write_fmt(format_args!("gist_date_ops")), + GiSTOperatorClass::Interval => { + f.write_fmt(format_args!("gist_interval_ops")) + } + GiSTOperatorClass::Cash => f.write_fmt(format_args!("gist_cash_ops")), + GiSTOperatorClass::MACAddr => { + f.write_fmt(format_args!("gist_macaddr_ops")) + } + GiSTOperatorClass::MACAddr8 => { + f.write_fmt(format_args!("gist_macaddr8_ops")) + } + GiSTOperatorClass::Text => f.write_fmt(format_args!("gist_text_ops")), + GiSTOperatorClass::BPChar => { + f.write_fmt(format_args!("gist_bpchar_ops")) + } + GiSTOperatorClass::Bytea => { + f.write_fmt(format_args!("gist_bytea_ops")) + } + GiSTOperatorClass::Numeric => { + f.write_fmt(format_args!("gist_numeric_ops")) + } + GiSTOperatorClass::Bit => f.write_fmt(format_args!("gist_bit_ops")), + GiSTOperatorClass::VBit => f.write_fmt(format_args!("GIST_VBIT_OPS")), + GiSTOperatorClass::INet => f.write_fmt(format_args!("gist_inet_ops")), + GiSTOperatorClass::CIDR => f.write_fmt(format_args!("gist_cidr_ops")), + GiSTOperatorClass::Enum => f.write_fmt(format_args!("gist_enum_ops")), + GiSTOperatorClass::Bool => f.write_fmt(format_args!("gist_bool_ops")), + GiSTOperatorClass::SEG => f.write_fmt(format_args!("gist_seg_ops")), + GiSTOperatorClass::TRGM => f.write_fmt(format_args!("gist_trgm_ops")), + GiSTOperatorClass::LTREE => { + f.write_fmt(format_args!("gist_ltree_ops")) + } + GiSTOperatorClass::HStore => { + f.write_fmt(format_args!("gist_hstore_ops")) + } + GiSTOperatorClass::Cube => f.write_fmt(format_args!("gist_cube_ops")), + } + } + } + /// BTree-index specific operator classes + pub enum BTreeOperatorClass { + /// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html) + EAN13, + ISBN, + ISBN13, + ISMN, + ISMN13, + ISSN, + ISSN13, + UPC, + /// Type for representing line segments, or floating point intervals: [`seg`](https://www.postgresql.org/docs/current/seg.html) + SEG, + /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) + HStore, + /// Type cube for representing multidimensional cubes: [`cube`](https://www.postgresql.org/docs/current/cube.html) + Cube, + /// Case-insensitive character string type: [`citext`](https://www.postgresql.org/docs/current/citext.html) + Citext, + } + #[automatically_derived] + impl ::core::fmt::Debug for BTreeOperatorClass { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + BTreeOperatorClass::EAN13 => "EAN13", + BTreeOperatorClass::ISBN => "ISBN", + BTreeOperatorClass::ISBN13 => "ISBN13", + BTreeOperatorClass::ISMN => "ISMN", + BTreeOperatorClass::ISMN13 => "ISMN13", + BTreeOperatorClass::ISSN => "ISSN", + BTreeOperatorClass::ISSN13 => "ISSN13", + BTreeOperatorClass::UPC => "UPC", + BTreeOperatorClass::SEG => "SEG", + BTreeOperatorClass::HStore => "HStore", + BTreeOperatorClass::Cube => "Cube", + BTreeOperatorClass::Citext => "Citext", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for BTreeOperatorClass { + #[inline] + fn clone(&self) -> BTreeOperatorClass { + match self { + BTreeOperatorClass::EAN13 => BTreeOperatorClass::EAN13, + BTreeOperatorClass::ISBN => BTreeOperatorClass::ISBN, + BTreeOperatorClass::ISBN13 => BTreeOperatorClass::ISBN13, + BTreeOperatorClass::ISMN => BTreeOperatorClass::ISMN, + BTreeOperatorClass::ISMN13 => BTreeOperatorClass::ISMN13, + BTreeOperatorClass::ISSN => BTreeOperatorClass::ISSN, + BTreeOperatorClass::ISSN13 => BTreeOperatorClass::ISSN13, + BTreeOperatorClass::UPC => BTreeOperatorClass::UPC, + BTreeOperatorClass::SEG => BTreeOperatorClass::SEG, + BTreeOperatorClass::HStore => BTreeOperatorClass::HStore, + BTreeOperatorClass::Cube => BTreeOperatorClass::Cube, + BTreeOperatorClass::Citext => BTreeOperatorClass::Citext, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for BTreeOperatorClass {} + #[automatically_derived] + impl ::core::cmp::PartialEq for BTreeOperatorClass { + #[inline] + fn eq(&self, other: &BTreeOperatorClass) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for BTreeOperatorClass { + #[inline] + fn partial_cmp( + &self, + other: &BTreeOperatorClass, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for BTreeOperatorClass { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for BTreeOperatorClass { + #[inline] + fn cmp(&self, other: &BTreeOperatorClass) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for BTreeOperatorClass { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl OperatorClass for BTreeOperatorClass { + const KEYWORDS: &'static [Keyword] = &[ + Keyword::EAN13_OPS, + Keyword::ISBN_OPS, + Keyword::ISBN13_OPS, + Keyword::ISMN_OPS, + Keyword::ISMN13_OPS, + Keyword::ISSN_OPS, + Keyword::ISSN13_OPS, + Keyword::UPC_OPS, + Keyword::SEG_OPS, + Keyword::BTREE_HSTORE_OPS, + Keyword::BTREE_CUBE_OPS, + Keyword::CITEXT_OPS, + ]; + } + impl From for BTreeOperatorClass { + fn from(keyword: Keyword) -> Self { + match keyword { + Keyword::EAN13_OPS => BTreeOperatorClass::EAN13, + Keyword::ISBN_OPS => BTreeOperatorClass::ISBN, + Keyword::ISBN13_OPS => BTreeOperatorClass::ISBN13, + Keyword::ISMN_OPS => BTreeOperatorClass::ISMN, + Keyword::ISMN13_OPS => BTreeOperatorClass::ISMN13, + Keyword::ISSN_OPS => BTreeOperatorClass::ISSN, + Keyword::ISSN13_OPS => BTreeOperatorClass::ISSN13, + Keyword::UPC_OPS => BTreeOperatorClass::UPC, + Keyword::SEG_OPS => BTreeOperatorClass::SEG, + Keyword::BTREE_HSTORE_OPS => BTreeOperatorClass::HStore, + Keyword::BTREE_CUBE_OPS => BTreeOperatorClass::Cube, + Keyword::CITEXT_OPS => BTreeOperatorClass::Citext, + _ => { + ::core::panicking::panic( + "internal error: entered unreachable code", + ) + } + } + } + } + impl Display for BTreeOperatorClass { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + BTreeOperatorClass::EAN13 => f.write_fmt(format_args!("ean13_ops")), + BTreeOperatorClass::ISBN => f.write_fmt(format_args!("isbn_ops")), + BTreeOperatorClass::ISBN13 => f.write_fmt(format_args!("isbn13_ops")), + BTreeOperatorClass::ISMN => f.write_fmt(format_args!("ismn_ops")), + BTreeOperatorClass::ISMN13 => f.write_fmt(format_args!("ismn13_ops")), + BTreeOperatorClass::ISSN => f.write_fmt(format_args!("issn_ops")), + BTreeOperatorClass::ISSN13 => f.write_fmt(format_args!("issn13_ops")), + BTreeOperatorClass::UPC => f.write_fmt(format_args!("upc_ops")), + BTreeOperatorClass::SEG => f.write_fmt(format_args!("seg_ops")), + BTreeOperatorClass::HStore => { + f.write_fmt(format_args!("btree_hstore_ops")) + } + BTreeOperatorClass::Cube => { + f.write_fmt(format_args!("btree_cube_ops")) + } + BTreeOperatorClass::Citext => f.write_fmt(format_args!("citext_ops")), + } + } + } + /// Hash-index specific operator classes + pub enum HashOperatorClass { + /// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html) + EAN13, + ISBN, + ISBN13, + ISMN, + ISMN13, + ISSN, + ISSN13, + UPC, + /// Type for representing labels of data stored in a hierarchical tree-like structure: [`ltree`](https://www.postgresql.org/docs/current/ltree.html) + LTREE, + /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) + HStore, + /// Case-insensitive character string type: [`citext`](https://www.postgresql.org/docs/current/citext.html) + Citext, + } + #[automatically_derived] + impl ::core::fmt::Debug for HashOperatorClass { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str( + f, + match self { + HashOperatorClass::EAN13 => "EAN13", + HashOperatorClass::ISBN => "ISBN", + HashOperatorClass::ISBN13 => "ISBN13", + HashOperatorClass::ISMN => "ISMN", + HashOperatorClass::ISMN13 => "ISMN13", + HashOperatorClass::ISSN => "ISSN", + HashOperatorClass::ISSN13 => "ISSN13", + HashOperatorClass::UPC => "UPC", + HashOperatorClass::LTREE => "LTREE", + HashOperatorClass::HStore => "HStore", + HashOperatorClass::Citext => "Citext", + }, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for HashOperatorClass { + #[inline] + fn clone(&self) -> HashOperatorClass { + match self { + HashOperatorClass::EAN13 => HashOperatorClass::EAN13, + HashOperatorClass::ISBN => HashOperatorClass::ISBN, + HashOperatorClass::ISBN13 => HashOperatorClass::ISBN13, + HashOperatorClass::ISMN => HashOperatorClass::ISMN, + HashOperatorClass::ISMN13 => HashOperatorClass::ISMN13, + HashOperatorClass::ISSN => HashOperatorClass::ISSN, + HashOperatorClass::ISSN13 => HashOperatorClass::ISSN13, + HashOperatorClass::UPC => HashOperatorClass::UPC, + HashOperatorClass::LTREE => HashOperatorClass::LTREE, + HashOperatorClass::HStore => HashOperatorClass::HStore, + HashOperatorClass::Citext => HashOperatorClass::Citext, + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for HashOperatorClass {} + #[automatically_derived] + impl ::core::cmp::PartialEq for HashOperatorClass { + #[inline] + fn eq(&self, other: &HashOperatorClass) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for HashOperatorClass { + #[inline] + fn partial_cmp( + &self, + other: &HashOperatorClass, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::cmp::Eq for HashOperatorClass { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () {} + } + #[automatically_derived] + impl ::core::cmp::Ord for HashOperatorClass { + #[inline] + fn cmp(&self, other: &HashOperatorClass) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) + } + } + #[automatically_derived] + impl ::core::hash::Hash for HashOperatorClass { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state) + } + } + impl OperatorClass for HashOperatorClass { + const KEYWORDS: &'static [Keyword] = &[ + Keyword::EAN13_OPS, + Keyword::ISBN_OPS, + Keyword::ISBN13_OPS, + Keyword::ISMN_OPS, + Keyword::ISMN13_OPS, + Keyword::ISSN_OPS, + Keyword::ISSN13_OPS, + Keyword::UPC_OPS, + Keyword::HASH_LTREE_OPS, + Keyword::HASH_HSTORE_OPS, + Keyword::CITEXT_OPS, + ]; + } + impl From for HashOperatorClass { + fn from(keyword: Keyword) -> Self { + match keyword { + Keyword::EAN13_OPS => HashOperatorClass::EAN13, + Keyword::ISBN_OPS => HashOperatorClass::ISBN, + Keyword::ISBN13_OPS => HashOperatorClass::ISBN13, + Keyword::ISMN_OPS => HashOperatorClass::ISMN, + Keyword::ISMN13_OPS => HashOperatorClass::ISMN13, + Keyword::ISSN_OPS => HashOperatorClass::ISSN, + Keyword::ISSN13_OPS => HashOperatorClass::ISSN13, + Keyword::UPC_OPS => HashOperatorClass::UPC, + Keyword::HASH_LTREE_OPS => HashOperatorClass::LTREE, + Keyword::HASH_HSTORE_OPS => HashOperatorClass::HStore, + Keyword::CITEXT_OPS => HashOperatorClass::Citext, + _ => { + ::core::panicking::panic( + "internal error: entered unreachable code", + ) + } + } + } + } + impl Display for HashOperatorClass { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + HashOperatorClass::EAN13 => f.write_fmt(format_args!("ean13_ops")), + HashOperatorClass::ISBN => f.write_fmt(format_args!("isbn_ops")), + HashOperatorClass::ISBN13 => f.write_fmt(format_args!("isbn13_ops")), + HashOperatorClass::ISMN => f.write_fmt(format_args!("ismn_ops")), + HashOperatorClass::ISMN13 => f.write_fmt(format_args!("ismn13_ops")), + HashOperatorClass::ISSN => f.write_fmt(format_args!("issn_ops")), + HashOperatorClass::ISSN13 => f.write_fmt(format_args!("issn13_ops")), + HashOperatorClass::UPC => f.write_fmt(format_args!("upc_ops")), + HashOperatorClass::LTREE => { + f.write_fmt(format_args!("hash_ltree_ops")) + } + HashOperatorClass::HStore => { + f.write_fmt(format_args!("hash_hstore_ops")) + } + HashOperatorClass::Citext => f.write_fmt(format_args!("citext_ops")), + } + } + } + /// Index Operator Classes + pub enum IndexOperatorClass { + GIN(GINOperatorClass), + GIST(GiSTOperatorClass), + Bloom(BloomOperatorClass), + Hash(HashOperatorClass), + BTree(BTreeOperatorClass), + } + #[automatically_derived] + impl ::core::fmt::Debug for IndexOperatorClass { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + match self { + IndexOperatorClass::GIN(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "GIN", + &__self_0, + ) + } + IndexOperatorClass::GIST(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "GIST", + &__self_0, + ) + } + IndexOperatorClass::Bloom(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Bloom", + &__self_0, + ) + } + IndexOperatorClass::Hash(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "Hash", + &__self_0, + ) + } + IndexOperatorClass::BTree(__self_0) => { + ::core::fmt::Formatter::debug_tuple_field1_finish( + f, + "BTree", + &__self_0, + ) + } + } + } + } + #[automatically_derived] + impl ::core::clone::Clone for IndexOperatorClass { + #[inline] + fn clone(&self) -> IndexOperatorClass { + match self { + IndexOperatorClass::GIN(__self_0) => { + IndexOperatorClass::GIN(::core::clone::Clone::clone(__self_0)) + } + IndexOperatorClass::GIST(__self_0) => { + IndexOperatorClass::GIST(::core::clone::Clone::clone(__self_0)) + } + IndexOperatorClass::Bloom(__self_0) => { + IndexOperatorClass::Bloom(::core::clone::Clone::clone(__self_0)) + } + IndexOperatorClass::Hash(__self_0) => { + IndexOperatorClass::Hash(::core::clone::Clone::clone(__self_0)) + } + IndexOperatorClass::BTree(__self_0) => { + IndexOperatorClass::BTree(::core::clone::Clone::clone(__self_0)) + } + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for IndexOperatorClass {} + #[automatically_derived] + impl ::core::cmp::PartialEq for IndexOperatorClass { + #[inline] + fn eq(&self, other: &IndexOperatorClass) -> bool { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + __self_discr == __arg1_discr + && match (self, other) { + ( + IndexOperatorClass::GIN(__self_0), + IndexOperatorClass::GIN(__arg1_0), + ) => __self_0 == __arg1_0, + ( + IndexOperatorClass::GIST(__self_0), + IndexOperatorClass::GIST(__arg1_0), + ) => __self_0 == __arg1_0, + ( + IndexOperatorClass::Bloom(__self_0), + IndexOperatorClass::Bloom(__arg1_0), + ) => __self_0 == __arg1_0, + ( + IndexOperatorClass::Hash(__self_0), + IndexOperatorClass::Hash(__arg1_0), + ) => __self_0 == __arg1_0, + ( + IndexOperatorClass::BTree(__self_0), + IndexOperatorClass::BTree(__arg1_0), + ) => __self_0 == __arg1_0, + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for IndexOperatorClass { + #[inline] + fn partial_cmp( + &self, + other: &IndexOperatorClass, + ) -> ::core::option::Option<::core::cmp::Ordering> { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match (self, other) { + ( + IndexOperatorClass::GIN(__self_0), + IndexOperatorClass::GIN(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::GIST(__self_0), + IndexOperatorClass::GIST(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::Bloom(__self_0), + IndexOperatorClass::Bloom(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::Hash(__self_0), + IndexOperatorClass::Hash(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::BTree(__self_0), + IndexOperatorClass::BTree(__arg1_0), + ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), + _ => { + ::core::cmp::PartialOrd::partial_cmp( + &__self_discr, + &__arg1_discr, + ) + } + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for IndexOperatorClass { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + let _: ::core::cmp::AssertParamIsEq; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for IndexOperatorClass { + #[inline] + fn cmp(&self, other: &IndexOperatorClass) -> ::core::cmp::Ordering { + let __self_discr = ::core::intrinsics::discriminant_value(self); + let __arg1_discr = ::core::intrinsics::discriminant_value(other); + match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { + ::core::cmp::Ordering::Equal => { + match (self, other) { + ( + IndexOperatorClass::GIN(__self_0), + IndexOperatorClass::GIN(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::GIST(__self_0), + IndexOperatorClass::GIST(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::Bloom(__self_0), + IndexOperatorClass::Bloom(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::Hash(__self_0), + IndexOperatorClass::Hash(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + ( + IndexOperatorClass::BTree(__self_0), + IndexOperatorClass::BTree(__arg1_0), + ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), + _ => unsafe { ::core::intrinsics::unreachable() } + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for IndexOperatorClass { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + let __self_discr = ::core::intrinsics::discriminant_value(self); + ::core::hash::Hash::hash(&__self_discr, state); + match self { + IndexOperatorClass::GIN(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + IndexOperatorClass::GIST(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + IndexOperatorClass::Bloom(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + IndexOperatorClass::Hash(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + IndexOperatorClass::BTree(__self_0) => { + ::core::hash::Hash::hash(__self_0, state) + } + } + } + } + impl Display for IndexOperatorClass { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + IndexOperatorClass::GIN(op) => f.write_fmt(format_args!("{0}", op)), + IndexOperatorClass::GIST(op) => f.write_fmt(format_args!("{0}", op)), + IndexOperatorClass::Bloom(op) => f.write_fmt(format_args!("{0}", op)), + IndexOperatorClass::Hash(op) => f.write_fmt(format_args!("{0}", op)), + IndexOperatorClass::BTree(op) => f.write_fmt(format_args!("{0}", op)), + } + } + } + impl From for IndexOperatorClass { + fn from(op: GINOperatorClass) -> Self { + IndexOperatorClass::GIN(op) + } + } + impl From for IndexOperatorClass { + fn from(op: GiSTOperatorClass) -> Self { + IndexOperatorClass::GIST(op) + } + } + impl From for IndexOperatorClass { + fn from(op: BloomOperatorClass) -> Self { + IndexOperatorClass::Bloom(op) + } + } + impl From for IndexOperatorClass { + fn from(op: HashOperatorClass) -> Self { + IndexOperatorClass::Hash(op) + } + } + impl From for IndexOperatorClass { + fn from(op: BTreeOperatorClass) -> Self { + IndexOperatorClass::BTree(op) + } + } + } + mod query { + use helpers::attached_token::AttachedToken; + use crate::{ast::*, tokenizer::{Token, TokenWithSpan}}; + /// The most complete variant of a `SELECT` query expression, optionally + /// including `WITH`, `UNION` / other set operations, and `ORDER BY`. + pub struct Query { + /// WITH (common table expressions, or CTEs) + pub with: Option, + /// SELECT or UNION / EXCEPT / INTERSECT + pub body: Box, + /// ORDER BY + pub order_by: Option, + /// `LIMIT { | ALL }` + pub limit: Option, + /// `LIMIT { } BY { ,,... } }` + pub limit_by: Vec, + /// `OFFSET [ { ROW | ROWS } ]` + pub offset: Option, + /// `FETCH { FIRST | NEXT } [ PERCENT ] { ROW | ROWS } | { ONLY | WITH TIES }` + pub fetch: Option, + /// `FOR { UPDATE | SHARE } [ OF table_name ] [ SKIP LOCKED | NOWAIT ]` + pub locks: Vec, + /// `FOR XML { RAW | AUTO | EXPLICIT | PATH } [ , ELEMENTS ]` + /// `FOR JSON { AUTO | PATH } [ , INCLUDE_NULL_VALUES ]` + /// (MSSQL-specific) + pub for_clause: Option, + /// ClickHouse syntax: `SELECT * FROM t SETTINGS key1 = value1, key2 = value2` + /// + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/select#settings-in-select-query) + pub settings: Option>, + /// `SELECT * FROM t FORMAT JSONCompact` + /// + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/select/format) + /// (ClickHouse-specific) + pub format_clause: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for Query { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + let names: &'static _ = &[ + "with", + "body", + "order_by", + "limit", + "limit_by", + "offset", + "fetch", + "locks", + "for_clause", + "settings", + "format_clause", + ]; + let values: &[&dyn ::core::fmt::Debug] = &[ + &self.with, + &self.body, + &self.order_by, + &self.limit, + &self.limit_by, + &self.offset, + &self.fetch, + &self.locks, + &self.for_clause, + &self.settings, + &&self.format_clause, + ]; + ::core::fmt::Formatter::debug_struct_fields_finish( + f, + "Query", + names, + values, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for Query { + #[inline] + fn clone(&self) -> Query { + Query { + with: ::core::clone::Clone::clone(&self.with), + body: ::core::clone::Clone::clone(&self.body), + order_by: ::core::clone::Clone::clone(&self.order_by), + limit: ::core::clone::Clone::clone(&self.limit), + limit_by: ::core::clone::Clone::clone(&self.limit_by), + offset: ::core::clone::Clone::clone(&self.offset), + fetch: ::core::clone::Clone::clone(&self.fetch), + locks: ::core::clone::Clone::clone(&self.locks), + for_clause: ::core::clone::Clone::clone(&self.for_clause), + settings: ::core::clone::Clone::clone(&self.settings), + format_clause: ::core::clone::Clone::clone(&self.format_clause), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for Query {} + #[automatically_derived] + impl ::core::cmp::PartialEq for Query { + #[inline] + fn eq(&self, other: &Query) -> bool { + self.with == other.with && self.body == other.body + && self.order_by == other.order_by && self.limit == other.limit + && self.limit_by == other.limit_by && self.offset == other.offset + && self.fetch == other.fetch && self.locks == other.locks + && self.for_clause == other.for_clause + && self.settings == other.settings + && self.format_clause == other.format_clause + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for Query { + #[inline] + fn partial_cmp( + &self, + other: &Query, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp(&self.with, &other.with) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.body, + &other.body, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.order_by, + &other.order_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.limit, + &other.limit, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.limit_by, + &other.limit_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.offset, + &other.offset, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.fetch, + &other.fetch, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.locks, + &other.locks, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.for_clause, + &other.for_clause, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.settings, + &other.settings, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.format_clause, + &other.format_clause, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for Query { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for Query { + #[inline] + fn cmp(&self, other: &Query) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.with, &other.with) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.body, &other.body) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.order_by, + &other.order_by, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.limit, &other.limit) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.limit_by, + &other.limit_by, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.offset, &other.offset) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.fetch, &other.fetch) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.locks, &other.locks) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.for_clause, + &other.for_clause, + ) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp( + &self.settings, + &other.settings, + ) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp( + &self.format_clause, + &other.format_clause, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for Query { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.with, state); + ::core::hash::Hash::hash(&self.body, state); + ::core::hash::Hash::hash(&self.order_by, state); + ::core::hash::Hash::hash(&self.limit, state); + ::core::hash::Hash::hash(&self.limit_by, state); + ::core::hash::Hash::hash(&self.offset, state); + ::core::hash::Hash::hash(&self.fetch, state); + ::core::hash::Hash::hash(&self.locks, state); + ::core::hash::Hash::hash(&self.for_clause, state); + ::core::hash::Hash::hash(&self.settings, state); + ::core::hash::Hash::hash(&self.format_clause, state) + } + } + impl fmt::Display for Query { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + if let Some(ref with) = self.with { + f.write_fmt(format_args!("{0} ", with))?; + } + f.write_fmt(format_args!("{0}", self.body))?; + if let Some(ref order_by) = self.order_by { + f.write_fmt(format_args!(" {0}", order_by))?; + } + if let Some(ref limit) = self.limit { + f.write_fmt(format_args!(" LIMIT {0}", limit))?; + } + if let Some(ref offset) = self.offset { + f.write_fmt(format_args!(" {0}", offset))?; + } + if !self.limit_by.is_empty() { + f.write_fmt( + format_args!(" BY {0}", display_separated(&self.limit_by, ", ")), + )?; + } + if let Some(ref settings) = self.settings { + f.write_fmt( + format_args!(" SETTINGS {0}", display_comma_separated(settings)), + )?; + } + if let Some(ref fetch) = self.fetch { + f.write_fmt(format_args!(" {0}", fetch))?; + } + if !self.locks.is_empty() { + f.write_fmt( + format_args!(" {0}", display_separated(&self.locks, " ")), + )?; + } + if let Some(ref for_clause) = self.for_clause { + f.write_fmt(format_args!(" {0}", for_clause))?; + } + if let Some(ref format) = self.format_clause { + f.write_fmt(format_args!(" {0}", format))?; + } + Ok(()) + } + } + /// Query syntax for ClickHouse ADD PROJECTION statement. + /// Its syntax is similar to SELECT statement, but it is used to add a new projection to a table. + /// Syntax is `SELECT [GROUP BY] [ORDER BY]` + /// + /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/projection#add-projection) + pub struct ProjectionSelect { + pub projection: Vec, + pub order_by: Option, + pub group_by: Option, + } + #[automatically_derived] + impl ::core::fmt::Debug for ProjectionSelect { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::debug_struct_field3_finish( + f, + "ProjectionSelect", + "projection", + &self.projection, + "order_by", + &self.order_by, + "group_by", + &&self.group_by, + ) + } + } + #[automatically_derived] + impl ::core::clone::Clone for ProjectionSelect { + #[inline] + fn clone(&self) -> ProjectionSelect { + ProjectionSelect { + projection: ::core::clone::Clone::clone(&self.projection), + order_by: ::core::clone::Clone::clone(&self.order_by), + group_by: ::core::clone::Clone::clone(&self.group_by), + } + } + } + #[automatically_derived] + impl ::core::marker::StructuralPartialEq for ProjectionSelect {} + #[automatically_derived] + impl ::core::cmp::PartialEq for ProjectionSelect { + #[inline] + fn eq(&self, other: &ProjectionSelect) -> bool { + self.projection == other.projection && self.order_by == other.order_by + && self.group_by == other.group_by + } + } + #[automatically_derived] + impl ::core::cmp::PartialOrd for ProjectionSelect { + #[inline] + fn partial_cmp( + &self, + other: &ProjectionSelect, + ) -> ::core::option::Option<::core::cmp::Ordering> { + match ::core::cmp::PartialOrd::partial_cmp( + &self.projection, + &other.projection, + ) { + ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { + match ::core::cmp::PartialOrd::partial_cmp( + &self.order_by, + &other.order_by, + ) { + ::core::option::Option::Some( + ::core::cmp::Ordering::Equal, + ) => { + ::core::cmp::PartialOrd::partial_cmp( + &self.group_by, + &other.group_by, + ) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::cmp::Eq for ProjectionSelect { + #[inline] + #[doc(hidden)] + #[coverage(off)] + fn assert_receiver_is_total_eq(&self) -> () { + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + let _: ::core::cmp::AssertParamIsEq>; + } + } + #[automatically_derived] + impl ::core::cmp::Ord for ProjectionSelect { + #[inline] + fn cmp(&self, other: &ProjectionSelect) -> ::core::cmp::Ordering { + match ::core::cmp::Ord::cmp(&self.projection, &other.projection) { + ::core::cmp::Ordering::Equal => { + match ::core::cmp::Ord::cmp(&self.order_by, &other.order_by) { + ::core::cmp::Ordering::Equal => { + ::core::cmp::Ord::cmp(&self.group_by, &other.group_by) + } + cmp => cmp, + } + } + cmp => cmp, + } + } + } + #[automatically_derived] + impl ::core::hash::Hash for ProjectionSelect { + #[inline] + fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { + ::core::hash::Hash::hash(&self.projection, state); + ::core::hash::Hash::hash(&self.order_by, state); + ::core::hash::Hash::hash(&self.group_by, state) + } + } + impl fmt::Display for ProjectionSelect { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + f.write_fmt( + format_args!("SELECT {0}", display_comma_separated(&self.projection)), + )?; + if let Some(ref group_by) = self.group_by { + f.write_fmt(format_args!(" {0}", group_by))?; + } + if let Some(ref order_by) = self.order_by { + f.write_fmt(format_args!(" {0}", order_by))?; + } + Ok(()) + } + } + /// A node in a tree, representing a "query body" expression, roughly: + /// `SELECT ... [ {UNION|EXCEPT|INTERSECT} SELECT ...]` + #[allow(clippy::large_enum_variant)] + pub enum SetExpr { + /// Restricted SELECT .. FROM .. HAVING (no ORDER BY or set operations) + Select(Box), - /// Parenthesized SELECT subquery, which may include more set operations - /// in its body and an optional ORDER BY / LIMIT. - Query(Box), - /// UNION/EXCEPT/INTERSECT of two queries - SetOperation { - op: SetOperator, - set_quantifier: SetQuantifier, - left: Box, - right: Box, - }, - Values(Values), - Insert(Statement), - Update(Statement), - Table(Box), - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::fmt::Debug for SetExpr { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - SetExpr::Select(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Select", - &__self_0, - ) - } - SetExpr::Query(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Query", - &__self_0, - ) - } - SetExpr::SetOperation { - op: __self_0, - set_quantifier: __self_1, - left: __self_2, - right: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "SetOperation", - "op", - __self_0, - "set_quantifier", - __self_1, - "left", - __self_2, - "right", - &__self_3, - ) - } - SetExpr::Values(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Values", - &__self_0, - ) - } - SetExpr::Insert(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Insert", - &__self_0, - ) - } - SetExpr::Update(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Update", - &__self_0, - ) - } - SetExpr::Table(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Table", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::clone::Clone for SetExpr { - #[inline] - fn clone(&self) -> SetExpr { - match self { - SetExpr::Select(__self_0) => { - SetExpr::Select(::core::clone::Clone::clone(__self_0)) - } - SetExpr::Query(__self_0) => { - SetExpr::Query(::core::clone::Clone::clone(__self_0)) - } - SetExpr::SetOperation { - op: __self_0, - set_quantifier: __self_1, - left: __self_2, - right: __self_3, - } => { - SetExpr::SetOperation { - op: ::core::clone::Clone::clone(__self_0), - set_quantifier: ::core::clone::Clone::clone(__self_1), - left: ::core::clone::Clone::clone(__self_2), - right: ::core::clone::Clone::clone(__self_3), - } - } - SetExpr::Values(__self_0) => { - SetExpr::Values(::core::clone::Clone::clone(__self_0)) - } - SetExpr::Insert(__self_0) => { - SetExpr::Insert(::core::clone::Clone::clone(__self_0)) - } - SetExpr::Update(__self_0) => { - SetExpr::Update(::core::clone::Clone::clone(__self_0)) - } - SetExpr::Table(__self_0) => { - SetExpr::Table(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::marker::StructuralPartialEq for SetExpr {} - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialEq for SetExpr { - #[inline] - fn eq(&self, other: &SetExpr) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (SetExpr::Select(__self_0), SetExpr::Select(__arg1_0)) => { - __self_0 == __arg1_0 - } - (SetExpr::Query(__self_0), SetExpr::Query(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - SetExpr::SetOperation { - op: __self_0, - set_quantifier: __self_1, - left: __self_2, - right: __self_3, - }, - SetExpr::SetOperation { - op: __arg1_0, - set_quantifier: __arg1_1, - left: __arg1_2, - right: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - (SetExpr::Values(__self_0), SetExpr::Values(__arg1_0)) => { - __self_0 == __arg1_0 - } - (SetExpr::Insert(__self_0), SetExpr::Insert(__arg1_0)) => { - __self_0 == __arg1_0 - } - (SetExpr::Update(__self_0), SetExpr::Update(__arg1_0)) => { - __self_0 == __arg1_0 - } - (SetExpr::Table(__self_0), SetExpr::Table(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialOrd for SetExpr { - #[inline] - fn partial_cmp( - &self, - other: &SetExpr, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (SetExpr::Select(__self_0), SetExpr::Select(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (SetExpr::Query(__self_0), SetExpr::Query(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - SetExpr::SetOperation { - op: __self_0, - set_quantifier: __self_1, - left: __self_2, - right: __self_3, - }, - SetExpr::SetOperation { - op: __arg1_0, - set_quantifier: __arg1_1, - left: __arg1_2, - right: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (SetExpr::Values(__self_0), SetExpr::Values(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (SetExpr::Insert(__self_0), SetExpr::Insert(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (SetExpr::Update(__self_0), SetExpr::Update(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (SetExpr::Table(__self_0), SetExpr::Table(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => { - ::core::cmp::PartialOrd::partial_cmp( - &__self_discr, - &__arg1_discr, - ) - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Eq for SetExpr { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Ord for SetExpr { - #[inline] - fn cmp(&self, other: &SetExpr) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (SetExpr::Select(__self_0), SetExpr::Select(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (SetExpr::Query(__self_0), SetExpr::Query(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - SetExpr::SetOperation { - op: __self_0, - set_quantifier: __self_1, - left: __self_2, - right: __self_3, - }, - SetExpr::SetOperation { - op: __arg1_0, - set_quantifier: __arg1_1, - left: __arg1_2, - right: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (SetExpr::Values(__self_0), SetExpr::Values(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (SetExpr::Insert(__self_0), SetExpr::Insert(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (SetExpr::Update(__self_0), SetExpr::Update(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (SetExpr::Table(__self_0), SetExpr::Table(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::hash::Hash for SetExpr { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - SetExpr::Select(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SetExpr::Query(__self_0) => ::core::hash::Hash::hash(__self_0, state), - SetExpr::SetOperation { - op: __self_0, - set_quantifier: __self_1, - left: __self_2, - right: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - SetExpr::Values(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SetExpr::Insert(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SetExpr::Update(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SetExpr::Table(__self_0) => ::core::hash::Hash::hash(__self_0, state), - } - } - } - impl SetExpr { - /// If this `SetExpr` is a `SELECT`, returns the [`Select`]. - pub fn as_select(&self) -> Option<&Select> { - if let Self::Select(select) = self { Some(&**select) } else { None } - } - } - impl fmt::Display for SetExpr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SetExpr::Select(s) => f.write_fmt(format_args!("{0}", s)), - SetExpr::Query(q) => f.write_fmt(format_args!("({0})", q)), - SetExpr::Values(v) => f.write_fmt(format_args!("{0}", v)), - SetExpr::Insert(v) => f.write_fmt(format_args!("{0}", v)), - SetExpr::Update(v) => f.write_fmt(format_args!("{0}", v)), - SetExpr::Table(t) => f.write_fmt(format_args!("{0}", t)), - SetExpr::SetOperation { left, right, op, set_quantifier } => { - f.write_fmt(format_args!("{0} {1}", left, op))?; - match set_quantifier { - SetQuantifier::All - | SetQuantifier::Distinct - | SetQuantifier::ByName - | SetQuantifier::AllByName - | SetQuantifier::DistinctByName => { - f.write_fmt(format_args!(" {0}", set_quantifier))? - } - SetQuantifier::None => { - f.write_fmt(format_args!("{0}", set_quantifier))? - } - } - f.write_fmt(format_args!(" {0}", right))?; - Ok(()) - } - } - } - } - pub enum SetOperator { - Union, - Except, - Intersect, - Minus, - } - #[automatically_derived] - impl ::core::fmt::Debug for SetOperator { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - SetOperator::Union => "Union", - SetOperator::Except => "Except", - SetOperator::Intersect => "Intersect", - SetOperator::Minus => "Minus", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for SetOperator {} - #[automatically_derived] - impl ::core::clone::Clone for SetOperator { - #[inline] - fn clone(&self) -> SetOperator { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SetOperator {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SetOperator { - #[inline] - fn eq(&self, other: &SetOperator) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SetOperator { - #[inline] - fn partial_cmp( - &self, - other: &SetOperator, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SetOperator { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for SetOperator { - #[inline] - fn cmp(&self, other: &SetOperator) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for SetOperator { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for SetOperator { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - SetOperator::Union => "UNION", - SetOperator::Except => "EXCEPT", - SetOperator::Intersect => "INTERSECT", - SetOperator::Minus => "MINUS", - }, - ) - } - } - /// A quantifier for [SetOperator]. - pub enum SetQuantifier { - All, - Distinct, - ByName, - AllByName, - DistinctByName, - None, - } - #[automatically_derived] - impl ::core::fmt::Debug for SetQuantifier { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - SetQuantifier::All => "All", - SetQuantifier::Distinct => "Distinct", - SetQuantifier::ByName => "ByName", - SetQuantifier::AllByName => "AllByName", - SetQuantifier::DistinctByName => "DistinctByName", - SetQuantifier::None => "None", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for SetQuantifier {} - #[automatically_derived] - impl ::core::clone::Clone for SetQuantifier { - #[inline] - fn clone(&self) -> SetQuantifier { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SetQuantifier {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SetQuantifier { - #[inline] - fn eq(&self, other: &SetQuantifier) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SetQuantifier { - #[inline] - fn partial_cmp( - &self, - other: &SetQuantifier, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SetQuantifier { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for SetQuantifier { - #[inline] - fn cmp(&self, other: &SetQuantifier) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for SetQuantifier { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for SetQuantifier { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SetQuantifier::All => f.write_fmt(format_args!("ALL")), - SetQuantifier::Distinct => f.write_fmt(format_args!("DISTINCT")), - SetQuantifier::ByName => f.write_fmt(format_args!("BY NAME")), - SetQuantifier::AllByName => f.write_fmt(format_args!("ALL BY NAME")), - SetQuantifier::DistinctByName => { - f.write_fmt(format_args!("DISTINCT BY NAME")) - } - SetQuantifier::None => f.write_fmt(format_args!("")), - } - } - } - /// A [`TABLE` command]( https://www.postgresql.org/docs/current/sql-select.html#SQL-TABLE) - pub struct Table { - pub table_name: Option, - pub schema_name: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for Table { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Table", - "table_name", - &self.table_name, - "schema_name", - &&self.schema_name, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Table { - #[inline] - fn clone(&self) -> Table { - Table { - table_name: ::core::clone::Clone::clone(&self.table_name), - schema_name: ::core::clone::Clone::clone(&self.schema_name), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Table {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Table { - #[inline] - fn eq(&self, other: &Table) -> bool { - self.table_name == other.table_name - && self.schema_name == other.schema_name - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Table { - #[inline] - fn partial_cmp( - &self, - other: &Table, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.table_name, - &other.table_name, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.schema_name, - &other.schema_name, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Table { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Table { - #[inline] - fn cmp(&self, other: &Table) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.table_name, &other.table_name) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.schema_name, &other.schema_name) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Table { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.table_name, state); - ::core::hash::Hash::hash(&self.schema_name, state) - } - } - impl fmt::Display for Table { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(ref schema_name) = self.schema_name { - f.write_fmt( - format_args!( - "TABLE {0}.{1}", - schema_name, - self.table_name.as_ref().unwrap(), - ), - )?; - } else { - f.write_fmt( - format_args!("TABLE {0}", self.table_name.as_ref().unwrap()), - )?; - } - Ok(()) - } - } - /// A restricted variant of `SELECT` (without CTEs/`ORDER BY`), which may - /// appear either as the only body item of a `Query`, or as an operand - /// to a set operation like `UNION`. - pub struct Select { - /// Token for the `SELECT` keyword - pub select_token: AttachedToken, - /// `SELECT [DISTINCT] ...` - pub distinct: Option, - /// MSSQL syntax: `TOP () [ PERCENT ] [ WITH TIES ]` - pub top: Option, - /// Whether the top was located before `ALL`/`DISTINCT` - pub top_before_distinct: bool, - /// projection expressions - pub projection: Vec, - /// INTO - pub into: Option, - /// FROM - pub from: Vec, - /// LATERAL VIEWs - pub lateral_views: Vec, - /// ClickHouse syntax: `PREWHERE a = 1 WHERE b = 2`, - /// and it can be used together with WHERE selection. - /// - /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/select/prewhere) - pub prewhere: Option, - /// WHERE - pub selection: Option, - /// GROUP BY - pub group_by: GroupByExpr, - /// CLUSTER BY (Hive) - pub cluster_by: Vec, - /// DISTRIBUTE BY (Hive) - pub distribute_by: Vec, - /// SORT BY (Hive) - pub sort_by: Vec, - /// HAVING - pub having: Option, - /// WINDOW AS - pub named_window: Vec, - /// QUALIFY (Snowflake) - pub qualify: Option, - /// The positioning of QUALIFY and WINDOW clauses differ between dialects. - /// e.g. BigQuery requires that WINDOW comes after QUALIFY, while DUCKDB accepts - /// WINDOW before QUALIFY. - /// We accept either positioning and flag the accepted variant. - pub window_before_qualify: bool, - /// BigQuery syntax: `SELECT AS VALUE | SELECT AS STRUCT` - pub value_table_mode: Option, - /// STARTING WITH .. CONNECT BY - pub connect_by: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for Select { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - let names: &'static _ = &[ - "select_token", - "distinct", - "top", - "top_before_distinct", - "projection", - "into", - "from", - "lateral_views", - "prewhere", - "selection", - "group_by", - "cluster_by", - "distribute_by", - "sort_by", - "having", - "named_window", - "qualify", - "window_before_qualify", - "value_table_mode", - "connect_by", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - &self.select_token, - &self.distinct, - &self.top, - &self.top_before_distinct, - &self.projection, - &self.into, - &self.from, - &self.lateral_views, - &self.prewhere, - &self.selection, - &self.group_by, - &self.cluster_by, - &self.distribute_by, - &self.sort_by, - &self.having, - &self.named_window, - &self.qualify, - &self.window_before_qualify, - &self.value_table_mode, - &&self.connect_by, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Select", - names, - values, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Select { - #[inline] - fn clone(&self) -> Select { - Select { - select_token: ::core::clone::Clone::clone(&self.select_token), - distinct: ::core::clone::Clone::clone(&self.distinct), - top: ::core::clone::Clone::clone(&self.top), - top_before_distinct: ::core::clone::Clone::clone( - &self.top_before_distinct, - ), - projection: ::core::clone::Clone::clone(&self.projection), - into: ::core::clone::Clone::clone(&self.into), - from: ::core::clone::Clone::clone(&self.from), - lateral_views: ::core::clone::Clone::clone(&self.lateral_views), - prewhere: ::core::clone::Clone::clone(&self.prewhere), - selection: ::core::clone::Clone::clone(&self.selection), - group_by: ::core::clone::Clone::clone(&self.group_by), - cluster_by: ::core::clone::Clone::clone(&self.cluster_by), - distribute_by: ::core::clone::Clone::clone(&self.distribute_by), - sort_by: ::core::clone::Clone::clone(&self.sort_by), - having: ::core::clone::Clone::clone(&self.having), - named_window: ::core::clone::Clone::clone(&self.named_window), - qualify: ::core::clone::Clone::clone(&self.qualify), - window_before_qualify: ::core::clone::Clone::clone( - &self.window_before_qualify, - ), - value_table_mode: ::core::clone::Clone::clone( - &self.value_table_mode, - ), - connect_by: ::core::clone::Clone::clone(&self.connect_by), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Select {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Select { - #[inline] - fn eq(&self, other: &Select) -> bool { - self.select_token == other.select_token - && self.distinct == other.distinct && self.top == other.top - && self.top_before_distinct == other.top_before_distinct - && self.projection == other.projection && self.into == other.into - && self.from == other.from - && self.lateral_views == other.lateral_views - && self.prewhere == other.prewhere - && self.selection == other.selection - && self.group_by == other.group_by - && self.cluster_by == other.cluster_by - && self.distribute_by == other.distribute_by - && self.sort_by == other.sort_by && self.having == other.having - && self.named_window == other.named_window - && self.qualify == other.qualify - && self.window_before_qualify == other.window_before_qualify - && self.value_table_mode == other.value_table_mode - && self.connect_by == other.connect_by - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Select { - #[inline] - fn partial_cmp( - &self, - other: &Select, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.select_token, - &other.select_token, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.distinct, - &other.distinct, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.top, - &other.top, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.top_before_distinct, - &other.top_before_distinct, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.projection, - &other.projection, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.into, - &other.into, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.from, - &other.from, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.lateral_views, - &other.lateral_views, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.prewhere, - &other.prewhere, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.selection, - &other.selection, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.group_by, - &other.group_by, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.cluster_by, - &other.cluster_by, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.distribute_by, - &other.distribute_by, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.sort_by, - &other.sort_by, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.having, - &other.having, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.named_window, - &other.named_window, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.qualify, - &other.qualify, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.window_before_qualify, - &other.window_before_qualify, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.value_table_mode, - &other.value_table_mode, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.connect_by, - &other.connect_by, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Select { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Select { - #[inline] - fn cmp(&self, other: &Select) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.select_token, &other.select_token) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.distinct, &other.distinct) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.top, &other.top) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.top_before_distinct, - &other.top_before_distinct, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.projection, - &other.projection, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.into, &other.into) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.from, &other.from) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.lateral_views, - &other.lateral_views, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.prewhere, - &other.prewhere, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.selection, - &other.selection, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.group_by, - &other.group_by, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.cluster_by, - &other.cluster_by, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.distribute_by, - &other.distribute_by, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.sort_by, &other.sort_by) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.having, &other.having) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.named_window, - &other.named_window, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.qualify, &other.qualify) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.window_before_qualify, - &other.window_before_qualify, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.value_table_mode, - &other.value_table_mode, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.connect_by, &other.connect_by) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Select { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.select_token, state); - ::core::hash::Hash::hash(&self.distinct, state); - ::core::hash::Hash::hash(&self.top, state); - ::core::hash::Hash::hash(&self.top_before_distinct, state); - ::core::hash::Hash::hash(&self.projection, state); - ::core::hash::Hash::hash(&self.into, state); - ::core::hash::Hash::hash(&self.from, state); - ::core::hash::Hash::hash(&self.lateral_views, state); - ::core::hash::Hash::hash(&self.prewhere, state); - ::core::hash::Hash::hash(&self.selection, state); - ::core::hash::Hash::hash(&self.group_by, state); - ::core::hash::Hash::hash(&self.cluster_by, state); - ::core::hash::Hash::hash(&self.distribute_by, state); - ::core::hash::Hash::hash(&self.sort_by, state); - ::core::hash::Hash::hash(&self.having, state); - ::core::hash::Hash::hash(&self.named_window, state); - ::core::hash::Hash::hash(&self.qualify, state); - ::core::hash::Hash::hash(&self.window_before_qualify, state); - ::core::hash::Hash::hash(&self.value_table_mode, state); - ::core::hash::Hash::hash(&self.connect_by, state) - } - } - impl fmt::Display for Select { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("SELECT"))?; - if let Some(value_table_mode) = self.value_table_mode { - f.write_fmt(format_args!(" {0}", value_table_mode))?; - } - if let Some(ref top) = self.top { - if self.top_before_distinct { - f.write_fmt(format_args!(" {0}", top))?; - } - } - if let Some(ref distinct) = self.distinct { - f.write_fmt(format_args!(" {0}", distinct))?; - } - if let Some(ref top) = self.top { - if !self.top_before_distinct { - f.write_fmt(format_args!(" {0}", top))?; - } - } - if !self.projection.is_empty() { - f.write_fmt( - format_args!(" {0}", display_comma_separated(&self.projection)), - )?; - } - if let Some(ref into) = self.into { - f.write_fmt(format_args!(" {0}", into))?; - } - if !self.from.is_empty() { - f.write_fmt( - format_args!(" FROM {0}", display_comma_separated(&self.from)), - )?; - } - if !self.lateral_views.is_empty() { - for lv in &self.lateral_views { - f.write_fmt(format_args!("{0}", lv))?; - } - } - if let Some(ref prewhere) = self.prewhere { - f.write_fmt(format_args!(" PREWHERE {0}", prewhere))?; - } - if let Some(ref selection) = self.selection { - f.write_fmt(format_args!(" WHERE {0}", selection))?; - } - match &self.group_by { - GroupByExpr::All(_) => { - f.write_fmt(format_args!(" {0}", self.group_by))? - } - GroupByExpr::Expressions(exprs, _) => { - if !exprs.is_empty() { - f.write_fmt(format_args!(" {0}", self.group_by))? - } - } - } - if !self.cluster_by.is_empty() { - f.write_fmt( - format_args!( - " CLUSTER BY {0}", - display_comma_separated(&self.cluster_by), - ), - )?; - } - if !self.distribute_by.is_empty() { - f.write_fmt( - format_args!( - " DISTRIBUTE BY {0}", - display_comma_separated(&self.distribute_by), - ), - )?; - } - if !self.sort_by.is_empty() { - f.write_fmt( - format_args!( - " SORT BY {0}", - display_comma_separated(&self.sort_by), - ), - )?; - } - if let Some(ref having) = self.having { - f.write_fmt(format_args!(" HAVING {0}", having))?; - } - if self.window_before_qualify { - if !self.named_window.is_empty() { - f.write_fmt( - format_args!( - " WINDOW {0}", - display_comma_separated(&self.named_window), - ), - )?; - } - if let Some(ref qualify) = self.qualify { - f.write_fmt(format_args!(" QUALIFY {0}", qualify))?; - } - } else { - if let Some(ref qualify) = self.qualify { - f.write_fmt(format_args!(" QUALIFY {0}", qualify))?; - } - if !self.named_window.is_empty() { - f.write_fmt( - format_args!( - " WINDOW {0}", - display_comma_separated(&self.named_window), - ), - )?; - } - } - if let Some(ref connect_by) = self.connect_by { - f.write_fmt(format_args!(" {0}", connect_by))?; - } - Ok(()) - } - } - /// A hive LATERAL VIEW with potential column aliases - pub struct LateralView { - /// LATERAL VIEW - pub lateral_view: Expr, - /// LATERAL VIEW table name - pub lateral_view_name: ObjectName, - /// LATERAL VIEW optional column aliases - pub lateral_col_alias: Vec, - /// LATERAL VIEW OUTER - pub outer: bool, - } - #[automatically_derived] - impl ::core::fmt::Debug for LateralView { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "LateralView", - "lateral_view", - &self.lateral_view, - "lateral_view_name", - &self.lateral_view_name, - "lateral_col_alias", - &self.lateral_col_alias, - "outer", - &&self.outer, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for LateralView { - #[inline] - fn clone(&self) -> LateralView { - LateralView { - lateral_view: ::core::clone::Clone::clone(&self.lateral_view), - lateral_view_name: ::core::clone::Clone::clone( - &self.lateral_view_name, - ), - lateral_col_alias: ::core::clone::Clone::clone( - &self.lateral_col_alias, - ), - outer: ::core::clone::Clone::clone(&self.outer), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for LateralView {} - #[automatically_derived] - impl ::core::cmp::PartialEq for LateralView { - #[inline] - fn eq(&self, other: &LateralView) -> bool { - self.lateral_view == other.lateral_view - && self.lateral_view_name == other.lateral_view_name - && self.lateral_col_alias == other.lateral_col_alias - && self.outer == other.outer - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for LateralView { - #[inline] - fn partial_cmp( - &self, - other: &LateralView, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.lateral_view, - &other.lateral_view, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.lateral_view_name, - &other.lateral_view_name, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.lateral_col_alias, - &other.lateral_col_alias, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.outer, - &other.outer, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for LateralView { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for LateralView { - #[inline] - fn cmp(&self, other: &LateralView) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.lateral_view, &other.lateral_view) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.lateral_view_name, - &other.lateral_view_name, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.lateral_col_alias, - &other.lateral_col_alias, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.outer, &other.outer) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for LateralView { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.lateral_view, state); - ::core::hash::Hash::hash(&self.lateral_view_name, state); - ::core::hash::Hash::hash(&self.lateral_col_alias, state); - ::core::hash::Hash::hash(&self.outer, state) - } - } - impl fmt::Display for LateralView { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - " LATERAL VIEW{2} {0} {1}", - self.lateral_view, - self.lateral_view_name, - if self.outer { " OUTER" } else { "" }, - ), - )?; - if !self.lateral_col_alias.is_empty() { - f.write_fmt( - format_args!( - " AS {0}", - display_comma_separated(&self.lateral_col_alias), - ), - )?; - } - Ok(()) - } - } - /// An expression used in a named window declaration. - /// - /// ```sql - /// WINDOW mywindow AS [named_window_expr] - /// ``` - pub enum NamedWindowExpr { - /// A direct reference to another named window definition. - /// [BigQuery] - /// - /// Example: - /// ```sql - /// WINDOW mywindow AS prev_window - /// ``` - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls#ref_named_window - NamedWindow(Ident), - /// A window expression. - /// - /// Example: - /// ```sql - /// WINDOW mywindow AS (ORDER BY 1) - /// ``` - WindowSpec(WindowSpec), - } - #[automatically_derived] - impl ::core::fmt::Debug for NamedWindowExpr { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - NamedWindowExpr::NamedWindow(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "NamedWindow", - &__self_0, - ) - } - NamedWindowExpr::WindowSpec(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "WindowSpec", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for NamedWindowExpr { - #[inline] - fn clone(&self) -> NamedWindowExpr { - match self { - NamedWindowExpr::NamedWindow(__self_0) => { - NamedWindowExpr::NamedWindow( - ::core::clone::Clone::clone(__self_0), - ) - } - NamedWindowExpr::WindowSpec(__self_0) => { - NamedWindowExpr::WindowSpec( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for NamedWindowExpr {} - #[automatically_derived] - impl ::core::cmp::PartialEq for NamedWindowExpr { - #[inline] - fn eq(&self, other: &NamedWindowExpr) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - NamedWindowExpr::NamedWindow(__self_0), - NamedWindowExpr::NamedWindow(__arg1_0), - ) => __self_0 == __arg1_0, - ( - NamedWindowExpr::WindowSpec(__self_0), - NamedWindowExpr::WindowSpec(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for NamedWindowExpr { - #[inline] - fn partial_cmp( - &self, - other: &NamedWindowExpr, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - NamedWindowExpr::NamedWindow(__self_0), - NamedWindowExpr::NamedWindow(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - NamedWindowExpr::WindowSpec(__self_0), - NamedWindowExpr::WindowSpec(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => { - ::core::cmp::PartialOrd::partial_cmp( - &__self_discr, - &__arg1_discr, - ) - } - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for NamedWindowExpr { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for NamedWindowExpr { - #[inline] - fn cmp(&self, other: &NamedWindowExpr) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - NamedWindowExpr::NamedWindow(__self_0), - NamedWindowExpr::NamedWindow(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - NamedWindowExpr::WindowSpec(__self_0), - NamedWindowExpr::WindowSpec(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for NamedWindowExpr { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - NamedWindowExpr::NamedWindow(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - NamedWindowExpr::WindowSpec(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for NamedWindowExpr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - NamedWindowExpr::NamedWindow(named_window) => { - f.write_fmt(format_args!("{0}", named_window))?; - } - NamedWindowExpr::WindowSpec(window_spec) => { - f.write_fmt(format_args!("({0})", window_spec))?; - } - }; - Ok(()) - } - } - pub struct NamedWindowDefinition(pub Ident, pub NamedWindowExpr); - #[automatically_derived] - impl ::core::fmt::Debug for NamedWindowDefinition { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "NamedWindowDefinition", - &self.0, - &&self.1, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for NamedWindowDefinition { - #[inline] - fn clone(&self) -> NamedWindowDefinition { - NamedWindowDefinition( - ::core::clone::Clone::clone(&self.0), - ::core::clone::Clone::clone(&self.1), - ) - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for NamedWindowDefinition {} - #[automatically_derived] - impl ::core::cmp::PartialEq for NamedWindowDefinition { - #[inline] - fn eq(&self, other: &NamedWindowDefinition) -> bool { - self.0 == other.0 && self.1 == other.1 - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for NamedWindowDefinition { - #[inline] - fn partial_cmp( - &self, - other: &NamedWindowDefinition, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.1, &other.1) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for NamedWindowDefinition { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for NamedWindowDefinition { - #[inline] - fn cmp(&self, other: &NamedWindowDefinition) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.0, &other.0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.1, &other.1) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for NamedWindowDefinition { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.0, state); - ::core::hash::Hash::hash(&self.1, state) - } - } - impl fmt::Display for NamedWindowDefinition { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0} AS {1}", self.0, self.1)) - } - } - pub struct With { - /// Token for the "WITH" keyword - pub with_token: AttachedToken, - pub recursive: bool, - pub cte_tables: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for With { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "With", - "with_token", - &self.with_token, - "recursive", - &self.recursive, - "cte_tables", - &&self.cte_tables, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for With { - #[inline] - fn clone(&self) -> With { - With { - with_token: ::core::clone::Clone::clone(&self.with_token), - recursive: ::core::clone::Clone::clone(&self.recursive), - cte_tables: ::core::clone::Clone::clone(&self.cte_tables), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for With {} - #[automatically_derived] - impl ::core::cmp::PartialEq for With { - #[inline] - fn eq(&self, other: &With) -> bool { - self.with_token == other.with_token && self.recursive == other.recursive - && self.cte_tables == other.cte_tables - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for With { - #[inline] - fn partial_cmp( - &self, - other: &With, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.with_token, - &other.with_token, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.recursive, - &other.recursive, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.cte_tables, - &other.cte_tables, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for With { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for With { - #[inline] - fn cmp(&self, other: &With) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.with_token, &other.with_token) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.recursive, &other.recursive) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.cte_tables, &other.cte_tables) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for With { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.with_token, state); - ::core::hash::Hash::hash(&self.recursive, state); - ::core::hash::Hash::hash(&self.cte_tables, state) - } - } - impl fmt::Display for With { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - "WITH {0}{1}", - if self.recursive { "RECURSIVE " } else { "" }, - display_comma_separated(&self.cte_tables), - ), - ) - } - } - pub enum CteAsMaterialized { - /// The `WITH` statement specifies `AS MATERIALIZED` behavior - Materialized, - /// The `WITH` statement specifies `AS NOT MATERIALIZED` behavior - NotMaterialized, - } - #[automatically_derived] - impl ::core::fmt::Debug for CteAsMaterialized { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - CteAsMaterialized::Materialized => "Materialized", - CteAsMaterialized::NotMaterialized => "NotMaterialized", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for CteAsMaterialized { - #[inline] - fn clone(&self) -> CteAsMaterialized { - match self { - CteAsMaterialized::Materialized => CteAsMaterialized::Materialized, - CteAsMaterialized::NotMaterialized => { - CteAsMaterialized::NotMaterialized - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CteAsMaterialized {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CteAsMaterialized { - #[inline] - fn eq(&self, other: &CteAsMaterialized) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CteAsMaterialized { - #[inline] - fn partial_cmp( - &self, - other: &CteAsMaterialized, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CteAsMaterialized { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for CteAsMaterialized { - #[inline] - fn cmp(&self, other: &CteAsMaterialized) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for CteAsMaterialized { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for CteAsMaterialized { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match *self { - CteAsMaterialized::Materialized => { - f.write_fmt(format_args!("MATERIALIZED"))?; - } - CteAsMaterialized::NotMaterialized => { - f.write_fmt(format_args!("NOT MATERIALIZED"))?; - } - }; - Ok(()) - } - } - /// A single CTE (used after `WITH`): ` [(col1, col2, ...)] AS ( )` - /// The names in the column list before `AS`, when specified, replace the names - /// of the columns returned by the query. The parser does not validate that the - /// number of columns in the query matches the number of columns in the query. - pub struct Cte { - pub alias: TableAlias, - pub query: Box, - pub from: Option, - pub materialized: Option, - /// Token for the closing parenthesis - pub closing_paren_token: AttachedToken, - } - #[automatically_derived] - impl ::core::fmt::Debug for Cte { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "Cte", - "alias", - &self.alias, - "query", - &self.query, - "from", - &self.from, - "materialized", - &self.materialized, - "closing_paren_token", - &&self.closing_paren_token, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Cte { - #[inline] - fn clone(&self) -> Cte { - Cte { - alias: ::core::clone::Clone::clone(&self.alias), - query: ::core::clone::Clone::clone(&self.query), - from: ::core::clone::Clone::clone(&self.from), - materialized: ::core::clone::Clone::clone(&self.materialized), - closing_paren_token: ::core::clone::Clone::clone( - &self.closing_paren_token, - ), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Cte {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Cte { - #[inline] - fn eq(&self, other: &Cte) -> bool { - self.alias == other.alias && self.query == other.query - && self.from == other.from && self.materialized == other.materialized - && self.closing_paren_token == other.closing_paren_token - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Cte { - #[inline] - fn partial_cmp( - &self, - other: &Cte, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.alias, &other.alias) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.query, - &other.query, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.from, - &other.from, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.materialized, - &other.materialized, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.closing_paren_token, - &other.closing_paren_token, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Cte { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Cte { - #[inline] - fn cmp(&self, other: &Cte) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.alias, &other.alias) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.query, &other.query) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.from, &other.from) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.materialized, - &other.materialized, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp( - &self.closing_paren_token, - &other.closing_paren_token, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Cte { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.alias, state); - ::core::hash::Hash::hash(&self.query, state); - ::core::hash::Hash::hash(&self.from, state); - ::core::hash::Hash::hash(&self.materialized, state); - ::core::hash::Hash::hash(&self.closing_paren_token, state) - } - } - impl fmt::Display for Cte { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self.materialized.as_ref() { - None => { - f.write_fmt( - format_args!("{0} AS ({1})", self.alias, self.query), - )? - } - Some(materialized) => { - f.write_fmt( - format_args!( - "{0} AS {2} ({1})", - self.alias, - self.query, - materialized, - ), - )? - } - }; - if let Some(ref fr) = self.from { - f.write_fmt(format_args!(" FROM {0}", fr))?; - } - Ok(()) - } - } - /// Represents an expression behind a wildcard expansion in a projection. - /// `SELECT T.* FROM T; - pub enum SelectItemQualifiedWildcardKind { - /// Expression is an object name. - /// e.g. `alias.*` or even `schema.table.*` - ObjectName(ObjectName), - /// Select star on an arbitrary expression. - /// e.g. `STRUCT('foo').*` - Expr(Expr), - } - #[automatically_derived] - impl ::core::fmt::Debug for SelectItemQualifiedWildcardKind { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - SelectItemQualifiedWildcardKind::ObjectName(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ObjectName", - &__self_0, - ) - } - SelectItemQualifiedWildcardKind::Expr(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Expr", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for SelectItemQualifiedWildcardKind { - #[inline] - fn clone(&self) -> SelectItemQualifiedWildcardKind { - match self { - SelectItemQualifiedWildcardKind::ObjectName(__self_0) => { - SelectItemQualifiedWildcardKind::ObjectName( - ::core::clone::Clone::clone(__self_0), - ) - } - SelectItemQualifiedWildcardKind::Expr(__self_0) => { - SelectItemQualifiedWildcardKind::Expr( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SelectItemQualifiedWildcardKind {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SelectItemQualifiedWildcardKind { - #[inline] - fn eq(&self, other: &SelectItemQualifiedWildcardKind) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - SelectItemQualifiedWildcardKind::ObjectName(__self_0), - SelectItemQualifiedWildcardKind::ObjectName(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SelectItemQualifiedWildcardKind::Expr(__self_0), - SelectItemQualifiedWildcardKind::Expr(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SelectItemQualifiedWildcardKind { - #[inline] - fn partial_cmp( - &self, - other: &SelectItemQualifiedWildcardKind, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - SelectItemQualifiedWildcardKind::ObjectName(__self_0), - SelectItemQualifiedWildcardKind::ObjectName(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SelectItemQualifiedWildcardKind::Expr(__self_0), - SelectItemQualifiedWildcardKind::Expr(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => { - ::core::cmp::PartialOrd::partial_cmp( - &__self_discr, - &__arg1_discr, - ) - } - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SelectItemQualifiedWildcardKind { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SelectItemQualifiedWildcardKind { - #[inline] - fn cmp( - &self, - other: &SelectItemQualifiedWildcardKind, - ) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - SelectItemQualifiedWildcardKind::ObjectName(__self_0), - SelectItemQualifiedWildcardKind::ObjectName(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SelectItemQualifiedWildcardKind::Expr(__self_0), - SelectItemQualifiedWildcardKind::Expr(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SelectItemQualifiedWildcardKind { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - SelectItemQualifiedWildcardKind::ObjectName(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SelectItemQualifiedWildcardKind::Expr(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - /// One item of the comma-separated list following `SELECT` - pub enum SelectItem { - /// Any expression, not followed by `[ AS ] alias` - UnnamedExpr(Expr), - /// An expression, followed by `[ AS ] alias` - ExprWithAlias { expr: Expr, alias: Ident }, - /// An expression, followed by a wildcard expansion. - /// e.g. `alias.*`, `STRUCT('foo').*` - QualifiedWildcard( - SelectItemQualifiedWildcardKind, - WildcardAdditionalOptions, - ), - /// An unqualified `*` - Wildcard(WildcardAdditionalOptions), - } - #[automatically_derived] - impl ::core::fmt::Debug for SelectItem { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - SelectItem::UnnamedExpr(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "UnnamedExpr", - &__self_0, - ) - } - SelectItem::ExprWithAlias { expr: __self_0, alias: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "ExprWithAlias", - "expr", - __self_0, - "alias", - &__self_1, - ) - } - SelectItem::QualifiedWildcard(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "QualifiedWildcard", - __self_0, - &__self_1, - ) - } - SelectItem::Wildcard(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Wildcard", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for SelectItem { - #[inline] - fn clone(&self) -> SelectItem { - match self { - SelectItem::UnnamedExpr(__self_0) => { - SelectItem::UnnamedExpr(::core::clone::Clone::clone(__self_0)) - } - SelectItem::ExprWithAlias { expr: __self_0, alias: __self_1 } => { - SelectItem::ExprWithAlias { - expr: ::core::clone::Clone::clone(__self_0), - alias: ::core::clone::Clone::clone(__self_1), - } - } - SelectItem::QualifiedWildcard(__self_0, __self_1) => { - SelectItem::QualifiedWildcard( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - SelectItem::Wildcard(__self_0) => { - SelectItem::Wildcard(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SelectItem {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SelectItem { - #[inline] - fn eq(&self, other: &SelectItem) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - SelectItem::UnnamedExpr(__self_0), - SelectItem::UnnamedExpr(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SelectItem::ExprWithAlias { - expr: __self_0, - alias: __self_1, - }, - SelectItem::ExprWithAlias { expr: __arg1_0, alias: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - SelectItem::QualifiedWildcard(__self_0, __self_1), - SelectItem::QualifiedWildcard(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - SelectItem::Wildcard(__self_0), - SelectItem::Wildcard(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SelectItem { - #[inline] - fn partial_cmp( - &self, - other: &SelectItem, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - SelectItem::UnnamedExpr(__self_0), - SelectItem::UnnamedExpr(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SelectItem::ExprWithAlias { expr: __self_0, alias: __self_1 }, - SelectItem::ExprWithAlias { expr: __arg1_0, alias: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), - cmp => cmp, - } - } - ( - SelectItem::QualifiedWildcard(__self_0, __self_1), - SelectItem::QualifiedWildcard(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1), - cmp => cmp, - } - } - (SelectItem::Wildcard(__self_0), SelectItem::Wildcard(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => { - ::core::cmp::PartialOrd::partial_cmp( - &__self_discr, - &__arg1_discr, - ) - } - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SelectItem { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SelectItem { - #[inline] - fn cmp(&self, other: &SelectItem) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - SelectItem::UnnamedExpr(__self_0), - SelectItem::UnnamedExpr(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SelectItem::ExprWithAlias { - expr: __self_0, - alias: __self_1, - }, - SelectItem::ExprWithAlias { - expr: __arg1_0, - alias: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - SelectItem::QualifiedWildcard(__self_0, __self_1), - SelectItem::QualifiedWildcard(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - SelectItem::Wildcard(__self_0), - SelectItem::Wildcard(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SelectItem { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - SelectItem::UnnamedExpr(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SelectItem::ExprWithAlias { expr: __self_0, alias: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - SelectItem::QualifiedWildcard(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - SelectItem::Wildcard(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for SelectItemQualifiedWildcardKind { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match &self { - SelectItemQualifiedWildcardKind::ObjectName(object_name) => { - f.write_fmt(format_args!("{0}.*", object_name)) - } - SelectItemQualifiedWildcardKind::Expr(expr) => { - f.write_fmt(format_args!("{0}.*", expr)) - } - } - } - } - /// Single aliased identifier - /// - /// # Syntax - /// ```plaintext - /// AS - /// ``` - pub struct IdentWithAlias { - pub ident: Ident, - pub alias: Ident, - } - #[automatically_derived] - impl ::core::fmt::Debug for IdentWithAlias { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "IdentWithAlias", - "ident", - &self.ident, - "alias", - &&self.alias, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for IdentWithAlias { - #[inline] - fn clone(&self) -> IdentWithAlias { - IdentWithAlias { - ident: ::core::clone::Clone::clone(&self.ident), - alias: ::core::clone::Clone::clone(&self.alias), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for IdentWithAlias {} - #[automatically_derived] - impl ::core::cmp::PartialEq for IdentWithAlias { - #[inline] - fn eq(&self, other: &IdentWithAlias) -> bool { - self.ident == other.ident && self.alias == other.alias - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for IdentWithAlias { - #[inline] - fn partial_cmp( - &self, - other: &IdentWithAlias, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.ident, &other.ident) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.alias, &other.alias) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for IdentWithAlias { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for IdentWithAlias { - #[inline] - fn cmp(&self, other: &IdentWithAlias) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.ident, &other.ident) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.alias, &other.alias) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for IdentWithAlias { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.ident, state); - ::core::hash::Hash::hash(&self.alias, state) - } - } - impl fmt::Display for IdentWithAlias { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0} AS {1}", self.ident, self.alias)) - } - } - /// Additional options for wildcards, e.g. Snowflake `EXCLUDE`/`RENAME` and Bigquery `EXCEPT`. - pub struct WildcardAdditionalOptions { - /// The wildcard token `*` - pub wildcard_token: AttachedToken, - /// `[ILIKE...]`. - /// Snowflake syntax: - pub opt_ilike: Option, - /// `[EXCLUDE...]`. - pub opt_exclude: Option, - /// `[EXCEPT...]`. - /// Clickhouse syntax: - pub opt_except: Option, - /// `[REPLACE]` - /// BigQuery syntax: - /// Clickhouse syntax: - /// Snowflake syntax: - pub opt_replace: Option, - /// `[RENAME ...]`. - pub opt_rename: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for WildcardAdditionalOptions { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - let names: &'static _ = &[ - "wildcard_token", - "opt_ilike", - "opt_exclude", - "opt_except", - "opt_replace", - "opt_rename", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - &self.wildcard_token, - &self.opt_ilike, - &self.opt_exclude, - &self.opt_except, - &self.opt_replace, - &&self.opt_rename, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "WildcardAdditionalOptions", - names, - values, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for WildcardAdditionalOptions { - #[inline] - fn clone(&self) -> WildcardAdditionalOptions { - WildcardAdditionalOptions { - wildcard_token: ::core::clone::Clone::clone(&self.wildcard_token), - opt_ilike: ::core::clone::Clone::clone(&self.opt_ilike), - opt_exclude: ::core::clone::Clone::clone(&self.opt_exclude), - opt_except: ::core::clone::Clone::clone(&self.opt_except), - opt_replace: ::core::clone::Clone::clone(&self.opt_replace), - opt_rename: ::core::clone::Clone::clone(&self.opt_rename), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for WildcardAdditionalOptions {} - #[automatically_derived] - impl ::core::cmp::PartialEq for WildcardAdditionalOptions { - #[inline] - fn eq(&self, other: &WildcardAdditionalOptions) -> bool { - self.wildcard_token == other.wildcard_token - && self.opt_ilike == other.opt_ilike - && self.opt_exclude == other.opt_exclude - && self.opt_except == other.opt_except - && self.opt_replace == other.opt_replace - && self.opt_rename == other.opt_rename - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for WildcardAdditionalOptions { - #[inline] - fn partial_cmp( - &self, - other: &WildcardAdditionalOptions, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.wildcard_token, - &other.wildcard_token, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.opt_ilike, - &other.opt_ilike, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.opt_exclude, - &other.opt_exclude, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.opt_except, - &other.opt_except, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.opt_replace, - &other.opt_replace, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.opt_rename, - &other.opt_rename, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for WildcardAdditionalOptions { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for WildcardAdditionalOptions { - #[inline] - fn cmp(&self, other: &WildcardAdditionalOptions) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp( - &self.wildcard_token, - &other.wildcard_token, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.opt_ilike, &other.opt_ilike) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.opt_exclude, - &other.opt_exclude, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.opt_except, - &other.opt_except, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.opt_replace, - &other.opt_replace, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.opt_rename, &other.opt_rename) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for WildcardAdditionalOptions { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.wildcard_token, state); - ::core::hash::Hash::hash(&self.opt_ilike, state); - ::core::hash::Hash::hash(&self.opt_exclude, state); - ::core::hash::Hash::hash(&self.opt_except, state); - ::core::hash::Hash::hash(&self.opt_replace, state); - ::core::hash::Hash::hash(&self.opt_rename, state) - } - } - impl Default for WildcardAdditionalOptions { - fn default() -> Self { - Self { - wildcard_token: TokenWithSpan::wrap(Token::Mul).into(), - opt_ilike: None, - opt_exclude: None, - opt_except: None, - opt_replace: None, - opt_rename: None, - } - } - } - impl fmt::Display for WildcardAdditionalOptions { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(ilike) = &self.opt_ilike { - f.write_fmt(format_args!(" {0}", ilike))?; - } - if let Some(exclude) = &self.opt_exclude { - f.write_fmt(format_args!(" {0}", exclude))?; - } - if let Some(except) = &self.opt_except { - f.write_fmt(format_args!(" {0}", except))?; - } - if let Some(replace) = &self.opt_replace { - f.write_fmt(format_args!(" {0}", replace))?; - } - if let Some(rename) = &self.opt_rename { - f.write_fmt(format_args!(" {0}", rename))?; - } - Ok(()) - } - } - /// Snowflake `ILIKE` information. - /// - /// # Syntax - /// ```plaintext - /// ILIKE - /// ``` - pub struct IlikeSelectItem { - pub pattern: String, - } - #[automatically_derived] - impl ::core::fmt::Debug for IlikeSelectItem { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "IlikeSelectItem", - "pattern", - &&self.pattern, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for IlikeSelectItem { - #[inline] - fn clone(&self) -> IlikeSelectItem { - IlikeSelectItem { - pattern: ::core::clone::Clone::clone(&self.pattern), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for IlikeSelectItem {} - #[automatically_derived] - impl ::core::cmp::PartialEq for IlikeSelectItem { - #[inline] - fn eq(&self, other: &IlikeSelectItem) -> bool { - self.pattern == other.pattern - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for IlikeSelectItem { - #[inline] - fn partial_cmp( - &self, - other: &IlikeSelectItem, - ) -> ::core::option::Option<::core::cmp::Ordering> { - ::core::cmp::PartialOrd::partial_cmp(&self.pattern, &other.pattern) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for IlikeSelectItem { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for IlikeSelectItem { - #[inline] - fn cmp(&self, other: &IlikeSelectItem) -> ::core::cmp::Ordering { - ::core::cmp::Ord::cmp(&self.pattern, &other.pattern) - } - } - #[automatically_derived] - impl ::core::hash::Hash for IlikeSelectItem { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.pattern, state) - } - } - impl fmt::Display for IlikeSelectItem { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - "ILIKE \'{0}\'", - value::escape_single_quote_string(&self.pattern), - ), - )?; - Ok(()) - } - } - /// Snowflake `EXCLUDE` information. - /// - /// # Syntax - /// ```plaintext - /// - /// | (, , ...) - /// ``` - pub enum ExcludeSelectItem { - /// Single column name without parenthesis. - /// - /// # Syntax - /// ```plaintext - /// - /// ``` - Single(Ident), - /// Multiple column names inside parenthesis. - /// # Syntax - /// ```plaintext - /// (, , ...) - /// ``` - Multiple(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for ExcludeSelectItem { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - ExcludeSelectItem::Single(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Single", - &__self_0, - ) - } - ExcludeSelectItem::Multiple(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Multiple", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for ExcludeSelectItem { - #[inline] - fn clone(&self) -> ExcludeSelectItem { - match self { - ExcludeSelectItem::Single(__self_0) => { - ExcludeSelectItem::Single(::core::clone::Clone::clone(__self_0)) - } - ExcludeSelectItem::Multiple(__self_0) => { - ExcludeSelectItem::Multiple( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ExcludeSelectItem {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ExcludeSelectItem { - #[inline] - fn eq(&self, other: &ExcludeSelectItem) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - ExcludeSelectItem::Single(__self_0), - ExcludeSelectItem::Single(__arg1_0), - ) => __self_0 == __arg1_0, - ( - ExcludeSelectItem::Multiple(__self_0), - ExcludeSelectItem::Multiple(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ExcludeSelectItem { - #[inline] - fn partial_cmp( - &self, - other: &ExcludeSelectItem, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - ExcludeSelectItem::Single(__self_0), - ExcludeSelectItem::Single(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - ExcludeSelectItem::Multiple(__self_0), - ExcludeSelectItem::Multiple(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => { - ::core::cmp::PartialOrd::partial_cmp( - &__self_discr, - &__arg1_discr, - ) - } - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ExcludeSelectItem { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ExcludeSelectItem { - #[inline] - fn cmp(&self, other: &ExcludeSelectItem) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - ExcludeSelectItem::Single(__self_0), - ExcludeSelectItem::Single(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - ExcludeSelectItem::Multiple(__self_0), - ExcludeSelectItem::Multiple(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ExcludeSelectItem { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - ExcludeSelectItem::Single(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - ExcludeSelectItem::Multiple(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for ExcludeSelectItem { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("EXCLUDE"))?; - match self { - Self::Single(column) => { - f.write_fmt(format_args!(" {0}", column))?; - } - Self::Multiple(columns) => { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(columns)), - )?; - } - } - Ok(()) - } - } - /// Snowflake `RENAME` information. - /// - /// # Syntax - /// ```plaintext - /// AS - /// | ( AS , AS , ...) - /// ``` - pub enum RenameSelectItem { - /// Single column name with alias without parenthesis. - /// - /// # Syntax - /// ```plaintext - /// AS - /// ``` - Single(IdentWithAlias), - /// Multiple column names with aliases inside parenthesis. - /// # Syntax - /// ```plaintext - /// ( AS , AS , ...) - /// ``` - Multiple(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for RenameSelectItem { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - RenameSelectItem::Single(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Single", - &__self_0, - ) - } - RenameSelectItem::Multiple(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Multiple", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for RenameSelectItem { - #[inline] - fn clone(&self) -> RenameSelectItem { - match self { - RenameSelectItem::Single(__self_0) => { - RenameSelectItem::Single(::core::clone::Clone::clone(__self_0)) - } - RenameSelectItem::Multiple(__self_0) => { - RenameSelectItem::Multiple(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for RenameSelectItem {} - #[automatically_derived] - impl ::core::cmp::PartialEq for RenameSelectItem { - #[inline] - fn eq(&self, other: &RenameSelectItem) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - RenameSelectItem::Single(__self_0), - RenameSelectItem::Single(__arg1_0), - ) => __self_0 == __arg1_0, - ( - RenameSelectItem::Multiple(__self_0), - RenameSelectItem::Multiple(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for RenameSelectItem { - #[inline] - fn partial_cmp( - &self, - other: &RenameSelectItem, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - RenameSelectItem::Single(__self_0), - RenameSelectItem::Single(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - RenameSelectItem::Multiple(__self_0), - RenameSelectItem::Multiple(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => { - ::core::cmp::PartialOrd::partial_cmp( - &__self_discr, - &__arg1_discr, - ) - } - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for RenameSelectItem { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for RenameSelectItem { - #[inline] - fn cmp(&self, other: &RenameSelectItem) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - RenameSelectItem::Single(__self_0), - RenameSelectItem::Single(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - RenameSelectItem::Multiple(__self_0), - RenameSelectItem::Multiple(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for RenameSelectItem { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - RenameSelectItem::Single(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - RenameSelectItem::Multiple(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for RenameSelectItem { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("RENAME"))?; - match self { - Self::Single(column) => { - f.write_fmt(format_args!(" {0}", column))?; - } - Self::Multiple(columns) => { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(columns)), - )?; - } - } - Ok(()) - } - } - /// Bigquery `EXCEPT` information, with at least one column. - /// - /// # Syntax - /// ```plaintext - /// EXCEPT ( [, ...]) - /// ``` - pub struct ExceptSelectItem { - /// First guaranteed column. - pub first_element: Ident, - /// Additional columns. This list can be empty. - pub additional_elements: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for ExceptSelectItem { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "ExceptSelectItem", - "first_element", - &self.first_element, - "additional_elements", - &&self.additional_elements, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ExceptSelectItem { - #[inline] - fn clone(&self) -> ExceptSelectItem { - ExceptSelectItem { - first_element: ::core::clone::Clone::clone(&self.first_element), - additional_elements: ::core::clone::Clone::clone( - &self.additional_elements, - ), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ExceptSelectItem {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ExceptSelectItem { - #[inline] - fn eq(&self, other: &ExceptSelectItem) -> bool { - self.first_element == other.first_element - && self.additional_elements == other.additional_elements - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ExceptSelectItem { - #[inline] - fn partial_cmp( - &self, - other: &ExceptSelectItem, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.first_element, - &other.first_element, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.additional_elements, - &other.additional_elements, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ExceptSelectItem { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ExceptSelectItem { - #[inline] - fn cmp(&self, other: &ExceptSelectItem) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.first_element, &other.first_element) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp( - &self.additional_elements, - &other.additional_elements, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ExceptSelectItem { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.first_element, state); - ::core::hash::Hash::hash(&self.additional_elements, state) - } - } - impl fmt::Display for ExceptSelectItem { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("EXCEPT "))?; - if self.additional_elements.is_empty() { - f.write_fmt(format_args!("({0})", self.first_element))?; - } else { - f.write_fmt( - format_args!( - "({0}, {1})", - self.first_element, - display_comma_separated(&self.additional_elements), - ), - )?; - } - Ok(()) - } - } - /// Bigquery `REPLACE` information. - /// - /// # Syntax - /// ```plaintext - /// REPLACE ( [AS] ) - /// REPLACE ( [AS] , [AS] , ...) - /// ``` - pub struct ReplaceSelectItem { - pub items: Vec>, - } - #[automatically_derived] - impl ::core::fmt::Debug for ReplaceSelectItem { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "ReplaceSelectItem", - "items", - &&self.items, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ReplaceSelectItem { - #[inline] - fn clone(&self) -> ReplaceSelectItem { - ReplaceSelectItem { - items: ::core::clone::Clone::clone(&self.items), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ReplaceSelectItem {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ReplaceSelectItem { - #[inline] - fn eq(&self, other: &ReplaceSelectItem) -> bool { - self.items == other.items - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ReplaceSelectItem { - #[inline] - fn partial_cmp( - &self, - other: &ReplaceSelectItem, - ) -> ::core::option::Option<::core::cmp::Ordering> { - ::core::cmp::PartialOrd::partial_cmp(&self.items, &other.items) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ReplaceSelectItem { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ReplaceSelectItem { - #[inline] - fn cmp(&self, other: &ReplaceSelectItem) -> ::core::cmp::Ordering { - ::core::cmp::Ord::cmp(&self.items, &other.items) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ReplaceSelectItem { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.items, state) - } - } - impl fmt::Display for ReplaceSelectItem { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("REPLACE"))?; - f.write_fmt( - format_args!(" ({0})", display_comma_separated(&self.items)), - )?; - Ok(()) - } - } - /// # Syntax - /// ```plaintext - /// [AS] - /// ``` - pub struct ReplaceSelectElement { - pub expr: Expr, - pub column_name: Ident, - pub as_keyword: bool, - } - #[automatically_derived] - impl ::core::fmt::Debug for ReplaceSelectElement { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ReplaceSelectElement", - "expr", - &self.expr, - "column_name", - &self.column_name, - "as_keyword", - &&self.as_keyword, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ReplaceSelectElement { - #[inline] - fn clone(&self) -> ReplaceSelectElement { - ReplaceSelectElement { - expr: ::core::clone::Clone::clone(&self.expr), - column_name: ::core::clone::Clone::clone(&self.column_name), - as_keyword: ::core::clone::Clone::clone(&self.as_keyword), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ReplaceSelectElement {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ReplaceSelectElement { - #[inline] - fn eq(&self, other: &ReplaceSelectElement) -> bool { - self.expr == other.expr && self.column_name == other.column_name - && self.as_keyword == other.as_keyword - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ReplaceSelectElement { - #[inline] - fn partial_cmp( - &self, - other: &ReplaceSelectElement, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.expr, &other.expr) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.column_name, - &other.column_name, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.as_keyword, - &other.as_keyword, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ReplaceSelectElement { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ReplaceSelectElement { - #[inline] - fn cmp(&self, other: &ReplaceSelectElement) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.expr, &other.expr) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.column_name, - &other.column_name, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.as_keyword, &other.as_keyword) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ReplaceSelectElement { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.expr, state); - ::core::hash::Hash::hash(&self.column_name, state); - ::core::hash::Hash::hash(&self.as_keyword, state) - } - } - impl fmt::Display for ReplaceSelectElement { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if self.as_keyword { - f.write_fmt(format_args!("{0} AS {1}", self.expr, self.column_name)) - } else { - f.write_fmt(format_args!("{0} {1}", self.expr, self.column_name)) - } - } - } - impl fmt::Display for SelectItem { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match &self { - SelectItem::UnnamedExpr(expr) => { - f.write_fmt(format_args!("{0}", expr)) - } - SelectItem::ExprWithAlias { expr, alias } => { - f.write_fmt(format_args!("{0} AS {1}", expr, alias)) - } - SelectItem::QualifiedWildcard(kind, additional_options) => { - f.write_fmt(format_args!("{0}", kind))?; - f.write_fmt(format_args!("{0}", additional_options))?; - Ok(()) - } - SelectItem::Wildcard(additional_options) => { - f.write_fmt(format_args!("*"))?; - f.write_fmt(format_args!("{0}", additional_options))?; - Ok(()) - } - } - } - } - pub struct TableWithJoins { - pub relation: TableFactor, - pub joins: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for TableWithJoins { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "TableWithJoins", - "relation", - &self.relation, - "joins", - &&self.joins, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableWithJoins { - #[inline] - fn clone(&self) -> TableWithJoins { - TableWithJoins { - relation: ::core::clone::Clone::clone(&self.relation), - joins: ::core::clone::Clone::clone(&self.joins), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableWithJoins {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableWithJoins { - #[inline] - fn eq(&self, other: &TableWithJoins) -> bool { - self.relation == other.relation && self.joins == other.joins - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableWithJoins { - #[inline] - fn partial_cmp( - &self, - other: &TableWithJoins, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.relation, - &other.relation, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.joins, &other.joins) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableWithJoins { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TableWithJoins { - #[inline] - fn cmp(&self, other: &TableWithJoins) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.relation, &other.relation) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.joins, &other.joins) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableWithJoins { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.relation, state); - ::core::hash::Hash::hash(&self.joins, state) - } - } - impl fmt::Display for TableWithJoins { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0}", self.relation))?; - for join in &self.joins { - f.write_fmt(format_args!("{0}", join))?; - } - Ok(()) - } - } - /// Joins a table to itself to process hierarchical data in the table. - /// - /// See . - pub struct ConnectBy { - /// START WITH - pub condition: Expr, - /// CONNECT BY - pub relationships: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for ConnectBy { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "ConnectBy", - "condition", - &self.condition, - "relationships", - &&self.relationships, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ConnectBy { - #[inline] - fn clone(&self) -> ConnectBy { - ConnectBy { - condition: ::core::clone::Clone::clone(&self.condition), - relationships: ::core::clone::Clone::clone(&self.relationships), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ConnectBy {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ConnectBy { - #[inline] - fn eq(&self, other: &ConnectBy) -> bool { - self.condition == other.condition - && self.relationships == other.relationships - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ConnectBy { - #[inline] - fn partial_cmp( - &self, - other: &ConnectBy, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.condition, - &other.condition, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.relationships, - &other.relationships, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ConnectBy { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ConnectBy { - #[inline] - fn cmp(&self, other: &ConnectBy) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.condition, &other.condition) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.relationships, &other.relationships) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ConnectBy { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.condition, state); - ::core::hash::Hash::hash(&self.relationships, state) - } - } - impl fmt::Display for ConnectBy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - "START WITH {0} CONNECT BY {1}", - self.condition, - display_comma_separated(&self.relationships), - ), - ) - } - } - pub struct Setting { - pub key: Ident, - pub value: Value, - } - #[automatically_derived] - impl ::core::fmt::Debug for Setting { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Setting", - "key", - &self.key, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Setting { - #[inline] - fn clone(&self) -> Setting { - Setting { - key: ::core::clone::Clone::clone(&self.key), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Setting {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Setting { - #[inline] - fn eq(&self, other: &Setting) -> bool { - self.key == other.key && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Setting { - #[inline] - fn partial_cmp( - &self, - other: &Setting, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.key, &other.key) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Setting { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Setting { - #[inline] - fn cmp(&self, other: &Setting) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.key, &other.key) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Setting { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.key, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl fmt::Display for Setting { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0} = {1}", self.key, self.value)) - } - } - /// An expression optionally followed by an alias. - /// - /// Example: - /// ```sql - /// 42 AS myint - /// ``` - pub struct ExprWithAlias { - pub expr: Expr, - pub alias: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for ExprWithAlias { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "ExprWithAlias", - "expr", - &self.expr, - "alias", - &&self.alias, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ExprWithAlias { - #[inline] - fn clone(&self) -> ExprWithAlias { - ExprWithAlias { - expr: ::core::clone::Clone::clone(&self.expr), - alias: ::core::clone::Clone::clone(&self.alias), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ExprWithAlias {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ExprWithAlias { - #[inline] - fn eq(&self, other: &ExprWithAlias) -> bool { - self.expr == other.expr && self.alias == other.alias - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ExprWithAlias { - #[inline] - fn partial_cmp( - &self, - other: &ExprWithAlias, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.expr, &other.expr) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.alias, &other.alias) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ExprWithAlias { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ExprWithAlias { - #[inline] - fn cmp(&self, other: &ExprWithAlias) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.expr, &other.expr) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.alias, &other.alias) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ExprWithAlias { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.expr, state); - ::core::hash::Hash::hash(&self.alias, state) - } - } - impl fmt::Display for ExprWithAlias { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let ExprWithAlias { expr, alias } = self; - f.write_fmt(format_args!("{0}", expr))?; - if let Some(alias) = alias { - f.write_fmt(format_args!(" AS {0}", alias))?; - } - Ok(()) - } - } - /// Arguments to a table-valued function - pub struct TableFunctionArgs { - pub args: Vec, - /// ClickHouse-specific SETTINGS clause. - /// For example, - /// `SELECT * FROM executable('generate_random.py', TabSeparated, 'id UInt32, random String', SETTINGS send_chunk_header = false, pool_size = 16)` - /// [`executable` table function](https://clickhouse.com/docs/en/engines/table-functions/executable) - pub settings: Option>, - } - #[automatically_derived] - impl ::core::fmt::Debug for TableFunctionArgs { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "TableFunctionArgs", - "args", - &self.args, - "settings", - &&self.settings, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableFunctionArgs { - #[inline] - fn clone(&self) -> TableFunctionArgs { - TableFunctionArgs { - args: ::core::clone::Clone::clone(&self.args), - settings: ::core::clone::Clone::clone(&self.settings), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableFunctionArgs {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableFunctionArgs { - #[inline] - fn eq(&self, other: &TableFunctionArgs) -> bool { - self.args == other.args && self.settings == other.settings - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableFunctionArgs { - #[inline] - fn partial_cmp( - &self, - other: &TableFunctionArgs, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.args, &other.args) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.settings, - &other.settings, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableFunctionArgs { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TableFunctionArgs { - #[inline] - fn cmp(&self, other: &TableFunctionArgs) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.args, &other.args) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.settings, &other.settings) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableFunctionArgs { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.args, state); - ::core::hash::Hash::hash(&self.settings, state) - } - } - pub enum TableIndexHintType { - Use, - Ignore, - Force, - } - #[automatically_derived] - impl ::core::fmt::Debug for TableIndexHintType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - TableIndexHintType::Use => "Use", - TableIndexHintType::Ignore => "Ignore", - TableIndexHintType::Force => "Force", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableIndexHintType { - #[inline] - fn clone(&self) -> TableIndexHintType { - match self { - TableIndexHintType::Use => TableIndexHintType::Use, - TableIndexHintType::Ignore => TableIndexHintType::Ignore, - TableIndexHintType::Force => TableIndexHintType::Force, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableIndexHintType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableIndexHintType { - #[inline] - fn eq(&self, other: &TableIndexHintType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableIndexHintType { - #[inline] - fn partial_cmp( - &self, - other: &TableIndexHintType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableIndexHintType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for TableIndexHintType { - #[inline] - fn cmp(&self, other: &TableIndexHintType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableIndexHintType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for TableIndexHintType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - TableIndexHintType::Use => "USE", - TableIndexHintType::Ignore => "IGNORE", - TableIndexHintType::Force => "FORCE", - }, - ) - } - } - pub enum TableIndexType { - Index, - Key, - } - #[automatically_derived] - impl ::core::fmt::Debug for TableIndexType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - TableIndexType::Index => "Index", - TableIndexType::Key => "Key", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableIndexType { - #[inline] - fn clone(&self) -> TableIndexType { - match self { - TableIndexType::Index => TableIndexType::Index, - TableIndexType::Key => TableIndexType::Key, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableIndexType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableIndexType { - #[inline] - fn eq(&self, other: &TableIndexType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableIndexType { - #[inline] - fn partial_cmp( - &self, - other: &TableIndexType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableIndexType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for TableIndexType { - #[inline] - fn cmp(&self, other: &TableIndexType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableIndexType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for TableIndexType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - TableIndexType::Index => "INDEX", - TableIndexType::Key => "KEY", - }, - ) - } - } - pub enum TableIndexHintForClause { - Join, - OrderBy, - GroupBy, - } - #[automatically_derived] - impl ::core::fmt::Debug for TableIndexHintForClause { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - TableIndexHintForClause::Join => "Join", - TableIndexHintForClause::OrderBy => "OrderBy", - TableIndexHintForClause::GroupBy => "GroupBy", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableIndexHintForClause { - #[inline] - fn clone(&self) -> TableIndexHintForClause { - match self { - TableIndexHintForClause::Join => TableIndexHintForClause::Join, - TableIndexHintForClause::OrderBy => TableIndexHintForClause::OrderBy, - TableIndexHintForClause::GroupBy => TableIndexHintForClause::GroupBy, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableIndexHintForClause {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableIndexHintForClause { - #[inline] - fn eq(&self, other: &TableIndexHintForClause) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableIndexHintForClause { - #[inline] - fn partial_cmp( - &self, - other: &TableIndexHintForClause, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableIndexHintForClause { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for TableIndexHintForClause { - #[inline] - fn cmp(&self, other: &TableIndexHintForClause) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableIndexHintForClause { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for TableIndexHintForClause { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - TableIndexHintForClause::Join => "JOIN", - TableIndexHintForClause::OrderBy => "ORDER BY", - TableIndexHintForClause::GroupBy => "GROUP BY", - }, - ) - } - } - pub struct TableIndexHints { - pub hint_type: TableIndexHintType, - pub index_type: TableIndexType, - pub for_clause: Option, - pub index_names: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for TableIndexHints { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "TableIndexHints", - "hint_type", - &self.hint_type, - "index_type", - &self.index_type, - "for_clause", - &self.for_clause, - "index_names", - &&self.index_names, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableIndexHints { - #[inline] - fn clone(&self) -> TableIndexHints { - TableIndexHints { - hint_type: ::core::clone::Clone::clone(&self.hint_type), - index_type: ::core::clone::Clone::clone(&self.index_type), - for_clause: ::core::clone::Clone::clone(&self.for_clause), - index_names: ::core::clone::Clone::clone(&self.index_names), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableIndexHints {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableIndexHints { - #[inline] - fn eq(&self, other: &TableIndexHints) -> bool { - self.hint_type == other.hint_type && self.index_type == other.index_type - && self.for_clause == other.for_clause - && self.index_names == other.index_names - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableIndexHints { - #[inline] - fn partial_cmp( - &self, - other: &TableIndexHints, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.hint_type, - &other.hint_type, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.index_type, - &other.index_type, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.for_clause, - &other.for_clause, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.index_names, - &other.index_names, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableIndexHints { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TableIndexHints { - #[inline] - fn cmp(&self, other: &TableIndexHints) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.hint_type, &other.hint_type) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.index_type, - &other.index_type, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.for_clause, - &other.for_clause, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.index_names, &other.index_names) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableIndexHints { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.hint_type, state); - ::core::hash::Hash::hash(&self.index_type, state); - ::core::hash::Hash::hash(&self.for_clause, state); - ::core::hash::Hash::hash(&self.index_names, state) - } - } - impl fmt::Display for TableIndexHints { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0} {1} ", self.hint_type, self.index_type))?; - if let Some(for_clause) = &self.for_clause { - f.write_fmt(format_args!("FOR {0} ", for_clause))?; - } - f.write_fmt( - format_args!("({0})", display_comma_separated(&self.index_names)), - ) - } - } - /// A table name or a parenthesized subquery with an optional alias - pub enum TableFactor { - Table { - name: ObjectName, - alias: Option, - /// Arguments of a table-valued function, as supported by Postgres - /// and MSSQL. Note that deprecated MSSQL `FROM foo (NOLOCK)` syntax - /// will also be parsed as `args`. - /// - /// This field's value is `Some(v)`, where `v` is a (possibly empty) - /// vector of arguments, in the case of a table-valued function call, - /// whereas it's `None` in the case of a regular table name. - args: Option, - /// MSSQL-specific `WITH (...)` hints such as NOLOCK. - with_hints: Vec, - /// Optional version qualifier to facilitate table time-travel, as - /// supported by BigQuery and MSSQL. - version: Option, - /// For example, `SELECT * FROM generate_series(1, 10) WITH ORDINALITY AS t(a, b);` - /// [WITH ORDINALITY](https://www.postgresql.org/docs/current/functions-srf.html), supported by Postgres. - with_ordinality: bool, - /// [Partition selection](https://dev.mysql.com/doc/refman/8.0/en/partitioning-selection.html), supported by MySQL. - partitions: Vec, - /// Optional PartiQL JsonPath: - json_path: Option, - /// Optional table sample modifier - /// See: - sample: Option, - /// Optional index hints(mysql) - /// See: - index_hints: Vec, - }, - Derived { lateral: bool, subquery: Box, alias: Option }, - /// `TABLE()[ AS ]` - TableFunction { expr: Expr, alias: Option }, - /// `e.g. LATERAL FLATTEN()[ AS ]` - Function { - lateral: bool, - name: ObjectName, - args: Vec, - alias: Option, - }, - /// ```sql - /// SELECT * FROM UNNEST ([10,20,30]) as numbers WITH OFFSET; - /// +---------+--------+ - /// | numbers | offset | - /// +---------+--------+ - /// | 10 | 0 | - /// | 20 | 1 | - /// | 30 | 2 | - /// +---------+--------+ - /// ``` - UNNEST { - alias: Option, - array_exprs: Vec, - with_offset: bool, - with_offset_alias: Option, - with_ordinality: bool, - }, - /// The `JSON_TABLE` table-valued function. - /// Part of the SQL standard, but implemented only by MySQL, Oracle, and DB2. - /// - /// - /// - /// - /// ```sql - /// SELECT * FROM JSON_TABLE( - /// '[{"a": 1, "b": 2}, {"a": 3, "b": 4}]', - /// '$[*]' COLUMNS( - /// a INT PATH '$.a' DEFAULT '0' ON EMPTY, - /// b INT PATH '$.b' NULL ON ERROR - /// ) - /// ) AS jt; - /// ```` - JsonTable { - /// The JSON expression to be evaluated. It must evaluate to a json string - json_expr: Expr, - /// The path to the array or object to be iterated over. - /// It must evaluate to a json array or object. - json_path: Value, - /// The columns to be extracted from each element of the array or object. - /// Each column must have a name and a type. - columns: Vec, - /// The alias for the table. - alias: Option, - }, - /// The MSSQL's `OPENJSON` table-valued function. - /// - /// ```sql - /// OPENJSON( jsonExpression [ , path ] ) [ ] - /// - /// ::= WITH ( { colName type [ column_path ] [ AS JSON ] } [ ,...n ] ) - /// ```` - /// - /// Reference: - OpenJsonTable { - /// The JSON expression to be evaluated. It must evaluate to a json string - json_expr: Expr, - /// The path to the array or object to be iterated over. - /// It must evaluate to a json array or object. - json_path: Option, - /// The columns to be extracted from each element of the array or object. - /// Each column must have a name and a type. - columns: Vec, - /// The alias for the table. - alias: Option, - }, - /// Represents a parenthesized table factor. The SQL spec only allows a - /// join expression (`(foo bar [ baz ... ])`) to be nested, - /// possibly several times. - /// - /// The parser may also accept non-standard nesting of bare tables for some - /// dialects, but the information about such nesting is stripped from AST. - NestedJoin { - table_with_joins: Box, - alias: Option, - }, - /// Represents PIVOT operation on a table. - /// For example `FROM monthly_sales PIVOT(sum(amount) FOR MONTH IN ('JAN', 'FEB'))` - /// - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#pivot_operator) - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/constructs/pivot) - Pivot { - table: Box, - aggregate_functions: Vec, - value_column: Vec, - value_source: PivotValueSource, - default_on_null: Option, - alias: Option, - }, - /// An UNPIVOT operation on a table. - /// - /// Syntax: - /// ```sql - /// table UNPIVOT(value FOR name IN (column1, [ column2, ... ])) [ alias ] - /// ``` - /// - /// See . - Unpivot { - table: Box, - value: Ident, - name: Ident, - columns: Vec, - alias: Option, - }, - /// A `MATCH_RECOGNIZE` operation on a table. - /// - /// See . - MatchRecognize { - table: Box, - /// `PARTITION BY [, ... ]` - partition_by: Vec, - /// `ORDER BY [, ... ]` - order_by: Vec, - /// `MEASURES [AS] [, ... ]` - measures: Vec, - /// `ONE ROW PER MATCH | ALL ROWS PER MATCH [ , , ...) AGAINST ( []) - /// - /// = CompoundIdentifier - /// = String literal - /// ``` - /// [(1)]: https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html#function_match - MatchAgainst { - /// `(, , ...)`. - columns: Vec, - /// ``. - match_value: Value, - /// `` - opt_search_modifier: Option, - }, - Wildcard(AttachedToken), - /// Qualified wildcard, e.g. `alias.*` or `schema.table.*`. - /// (Same caveats apply to `QualifiedWildcard` as to `Wildcard`.) - QualifiedWildcard(ObjectName, AttachedToken), - /// Some dialects support an older syntax for outer joins where columns are - /// marked with the `(+)` operator in the WHERE clause, for example: - /// - /// ```sql - /// SELECT t1.c1, t2.c2 FROM t1, t2 WHERE t1.c1 = t2.c2 (+) - /// ``` - /// - /// which is equivalent to - /// - /// ```sql - /// SELECT t1.c1, t2.c2 FROM t1 LEFT OUTER JOIN t2 ON t1.c1 = t2.c2 - /// ``` - /// - /// See . - OuterJoin(Box), - /// A reference to the prior level in a CONNECT BY clause. - Prior(Box), - /// A lambda function. - /// - /// Syntax: - /// ```plaintext - /// param -> expr | (param1, ...) -> expr - /// ``` - /// - /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/functions#higher-order-functions---operator-and-lambdaparams-expr-function) - /// [Databricks](https://docs.databricks.com/en/sql/language-manual/sql-ref-lambda-functions.html) - /// [DuckDb](https://duckdb.org/docs/sql/functions/lambda.html) - Lambda(LambdaFunction), - } - #[automatically_derived] - impl ::core::fmt::Debug for Expr { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Expr::Identifier(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Identifier", - &__self_0, - ) - } - Expr::CompoundIdentifier(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "CompoundIdentifier", - &__self_0, - ) - } - Expr::CompoundFieldAccess { root: __self_0, access_chain: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "CompoundFieldAccess", - "root", - __self_0, - "access_chain", - &__self_1, - ) - } - Expr::JsonAccess { value: __self_0, path: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "JsonAccess", - "value", - __self_0, - "path", - &__self_1, - ) - } - Expr::CompositeAccess { expr: __self_0, key: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "CompositeAccess", - "expr", - __self_0, - "key", - &__self_1, - ) - } - Expr::IsFalse(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsFalse", - &__self_0, - ) - } - Expr::IsNotFalse(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsNotFalse", - &__self_0, - ) - } - Expr::IsTrue(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsTrue", - &__self_0, - ) - } - Expr::IsNotTrue(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsNotTrue", - &__self_0, - ) - } - Expr::IsNull(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsNull", - &__self_0, - ) - } - Expr::IsNotNull(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsNotNull", - &__self_0, - ) - } - Expr::IsUnknown(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsUnknown", - &__self_0, - ) - } - Expr::IsNotUnknown(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsNotUnknown", - &__self_0, - ) - } - Expr::IsDistinctFrom(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "IsDistinctFrom", - __self_0, - &__self_1, - ) - } - Expr::IsNotDistinctFrom(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "IsNotDistinctFrom", - __self_0, - &__self_1, - ) - } - Expr::IsNormalized { - expr: __self_0, - form: __self_1, - negated: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "IsNormalized", - "expr", - __self_0, - "form", - __self_1, - "negated", - &__self_2, - ) - } - Expr::InList { expr: __self_0, list: __self_1, negated: __self_2 } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "InList", - "expr", - __self_0, - "list", - __self_1, - "negated", - &__self_2, - ) - } - Expr::InSubquery { - expr: __self_0, - subquery: __self_1, - negated: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "InSubquery", - "expr", - __self_0, - "subquery", - __self_1, - "negated", - &__self_2, - ) - } - Expr::InUnnest { - expr: __self_0, - array_expr: __self_1, - negated: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "InUnnest", - "expr", - __self_0, - "array_expr", - __self_1, - "negated", - &__self_2, - ) - } - Expr::Between { - expr: __self_0, - negated: __self_1, - low: __self_2, - high: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Between", - "expr", - __self_0, - "negated", - __self_1, - "low", - __self_2, - "high", - &__self_3, - ) - } - Expr::BinaryOp { left: __self_0, op: __self_1, right: __self_2 } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "BinaryOp", - "left", - __self_0, - "op", - __self_1, - "right", - &__self_2, - ) - } - Expr::Like { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "Like", - "negated", - __self_0, - "any", - __self_1, - "expr", - __self_2, - "pattern", - __self_3, - "escape_char", - &__self_4, - ) - } - Expr::ILike { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "ILike", - "negated", - __self_0, - "any", - __self_1, - "expr", - __self_2, - "pattern", - __self_3, - "escape_char", - &__self_4, - ) - } - Expr::SimilarTo { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - escape_char: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "SimilarTo", - "negated", - __self_0, - "expr", - __self_1, - "pattern", - __self_2, - "escape_char", - &__self_3, - ) - } - Expr::RLike { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - regexp: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "RLike", - "negated", - __self_0, - "expr", - __self_1, - "pattern", - __self_2, - "regexp", - &__self_3, - ) - } - Expr::AnyOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - is_some: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "AnyOp", - "left", - __self_0, - "compare_op", - __self_1, - "right", - __self_2, - "is_some", - &__self_3, - ) - } - Expr::AllOp { left: __self_0, compare_op: __self_1, right: __self_2 } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "AllOp", - "left", - __self_0, - "compare_op", - __self_1, - "right", - &__self_2, - ) - } - Expr::UnaryOp { op: __self_0, expr: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "UnaryOp", - "op", - __self_0, - "expr", - &__self_1, - ) - } - Expr::Convert { - is_try: __self_0, - expr: __self_1, - data_type: __self_2, - charset: __self_3, - target_before_value: __self_4, - styles: __self_5, - } => { - let names: &'static _ = &[ - "is_try", - "expr", - "data_type", - "charset", - "target_before_value", - "styles", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Convert", - names, - values, - ) - } - Expr::Cast { - kind: __self_0, - expr: __self_1, - data_type: __self_2, - format: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Cast", - "kind", - __self_0, - "expr", - __self_1, - "data_type", - __self_2, - "format", - &__self_3, - ) - } - Expr::AtTimeZone { timestamp: __self_0, time_zone: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "AtTimeZone", - "timestamp", - __self_0, - "time_zone", - &__self_1, - ) - } - Expr::Extract { field: __self_0, syntax: __self_1, expr: __self_2 } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Extract", - "field", - __self_0, - "syntax", - __self_1, - "expr", - &__self_2, - ) - } - Expr::Ceil { expr: __self_0, field: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Ceil", - "expr", - __self_0, - "field", - &__self_1, - ) - } - Expr::Floor { expr: __self_0, field: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Floor", - "expr", - __self_0, - "field", - &__self_1, - ) - } - Expr::Position { expr: __self_0, r#in: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Position", - "expr", - __self_0, - "in", - &__self_1, - ) - } - Expr::Substring { - expr: __self_0, - substring_from: __self_1, - substring_for: __self_2, - special: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Substring", - "expr", - __self_0, - "substring_from", - __self_1, - "substring_for", - __self_2, - "special", - &__self_3, - ) - } - Expr::Trim { - expr: __self_0, - trim_where: __self_1, - trim_what: __self_2, - trim_characters: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Trim", - "expr", - __self_0, - "trim_where", - __self_1, - "trim_what", - __self_2, - "trim_characters", - &__self_3, - ) - } - Expr::Overlay { - expr: __self_0, - overlay_what: __self_1, - overlay_from: __self_2, - overlay_for: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Overlay", - "expr", - __self_0, - "overlay_what", - __self_1, - "overlay_from", - __self_2, - "overlay_for", - &__self_3, - ) - } - Expr::Collate { expr: __self_0, collation: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Collate", - "expr", - __self_0, - "collation", - &__self_1, - ) - } - Expr::Nested(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Nested", - &__self_0, - ) - } - Expr::Value(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Value", - &__self_0, - ) - } - Expr::IntroducedString { introducer: __self_0, value: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "IntroducedString", - "introducer", - __self_0, - "value", - &__self_1, - ) - } - Expr::TypedString { data_type: __self_0, value: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "TypedString", - "data_type", - __self_0, - "value", - &__self_1, - ) - } - Expr::Function(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Function", - &__self_0, - ) - } - Expr::Method(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Method", - &__self_0, - ) - } - Expr::Case { - operand: __self_0, - conditions: __self_1, - results: __self_2, - else_result: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Case", - "operand", - __self_0, - "conditions", - __self_1, - "results", - __self_2, - "else_result", - &__self_3, - ) - } - Expr::Exists { subquery: __self_0, negated: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Exists", - "subquery", - __self_0, - "negated", - &__self_1, - ) - } - Expr::Subquery(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Subquery", - &__self_0, - ) - } - Expr::GroupingSets(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "GroupingSets", - &__self_0, - ) - } - Expr::Cube(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Cube", - &__self_0, - ) - } - Expr::Rollup(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Rollup", - &__self_0, - ) - } - Expr::Tuple(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Tuple", - &__self_0, - ) - } - Expr::Struct { values: __self_0, fields: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Struct", - "values", - __self_0, - "fields", - &__self_1, - ) - } - Expr::Named { expr: __self_0, name: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Named", - "expr", - __self_0, - "name", - &__self_1, - ) - } - Expr::Dictionary(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Dictionary", - &__self_0, - ) - } - Expr::Map(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Map", - &__self_0, - ) - } - Expr::Array(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Array", - &__self_0, - ) - } - Expr::Interval(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Interval", - &__self_0, - ) - } - Expr::MatchAgainst { - columns: __self_0, - match_value: __self_1, - opt_search_modifier: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "MatchAgainst", - "columns", - __self_0, - "match_value", - __self_1, - "opt_search_modifier", - &__self_2, - ) - } - Expr::Wildcard(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Wildcard", - &__self_0, - ) - } - Expr::QualifiedWildcard(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "QualifiedWildcard", - __self_0, - &__self_1, - ) - } - Expr::OuterJoin(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "OuterJoin", - &__self_0, - ) - } - Expr::Prior(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Prior", - &__self_0, - ) - } - Expr::Lambda(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Lambda", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for Expr { - #[inline] - fn clone(&self) -> Expr { - match self { - Expr::Identifier(__self_0) => { - Expr::Identifier(::core::clone::Clone::clone(__self_0)) - } - Expr::CompoundIdentifier(__self_0) => { - Expr::CompoundIdentifier(::core::clone::Clone::clone(__self_0)) - } - Expr::CompoundFieldAccess { root: __self_0, access_chain: __self_1 } => { - Expr::CompoundFieldAccess { - root: ::core::clone::Clone::clone(__self_0), - access_chain: ::core::clone::Clone::clone(__self_1), - } - } - Expr::JsonAccess { value: __self_0, path: __self_1 } => { - Expr::JsonAccess { - value: ::core::clone::Clone::clone(__self_0), - path: ::core::clone::Clone::clone(__self_1), - } - } - Expr::CompositeAccess { expr: __self_0, key: __self_1 } => { - Expr::CompositeAccess { - expr: ::core::clone::Clone::clone(__self_0), - key: ::core::clone::Clone::clone(__self_1), - } - } - Expr::IsFalse(__self_0) => { - Expr::IsFalse(::core::clone::Clone::clone(__self_0)) - } - Expr::IsNotFalse(__self_0) => { - Expr::IsNotFalse(::core::clone::Clone::clone(__self_0)) - } - Expr::IsTrue(__self_0) => { - Expr::IsTrue(::core::clone::Clone::clone(__self_0)) - } - Expr::IsNotTrue(__self_0) => { - Expr::IsNotTrue(::core::clone::Clone::clone(__self_0)) - } - Expr::IsNull(__self_0) => { - Expr::IsNull(::core::clone::Clone::clone(__self_0)) - } - Expr::IsNotNull(__self_0) => { - Expr::IsNotNull(::core::clone::Clone::clone(__self_0)) - } - Expr::IsUnknown(__self_0) => { - Expr::IsUnknown(::core::clone::Clone::clone(__self_0)) - } - Expr::IsNotUnknown(__self_0) => { - Expr::IsNotUnknown(::core::clone::Clone::clone(__self_0)) - } - Expr::IsDistinctFrom(__self_0, __self_1) => { - Expr::IsDistinctFrom( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - Expr::IsNotDistinctFrom(__self_0, __self_1) => { - Expr::IsNotDistinctFrom( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - Expr::IsNormalized { - expr: __self_0, - form: __self_1, - negated: __self_2, - } => { - Expr::IsNormalized { - expr: ::core::clone::Clone::clone(__self_0), - form: ::core::clone::Clone::clone(__self_1), - negated: ::core::clone::Clone::clone(__self_2), - } - } - Expr::InList { expr: __self_0, list: __self_1, negated: __self_2 } => { - Expr::InList { - expr: ::core::clone::Clone::clone(__self_0), - list: ::core::clone::Clone::clone(__self_1), - negated: ::core::clone::Clone::clone(__self_2), - } - } - Expr::InSubquery { - expr: __self_0, - subquery: __self_1, - negated: __self_2, - } => { - Expr::InSubquery { - expr: ::core::clone::Clone::clone(__self_0), - subquery: ::core::clone::Clone::clone(__self_1), - negated: ::core::clone::Clone::clone(__self_2), - } - } - Expr::InUnnest { - expr: __self_0, - array_expr: __self_1, - negated: __self_2, - } => { - Expr::InUnnest { - expr: ::core::clone::Clone::clone(__self_0), - array_expr: ::core::clone::Clone::clone(__self_1), - negated: ::core::clone::Clone::clone(__self_2), - } - } - Expr::Between { - expr: __self_0, - negated: __self_1, - low: __self_2, - high: __self_3, - } => { - Expr::Between { - expr: ::core::clone::Clone::clone(__self_0), - negated: ::core::clone::Clone::clone(__self_1), - low: ::core::clone::Clone::clone(__self_2), - high: ::core::clone::Clone::clone(__self_3), - } - } - Expr::BinaryOp { left: __self_0, op: __self_1, right: __self_2 } => { - Expr::BinaryOp { - left: ::core::clone::Clone::clone(__self_0), - op: ::core::clone::Clone::clone(__self_1), - right: ::core::clone::Clone::clone(__self_2), - } - } - Expr::Like { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - } => { - Expr::Like { - negated: ::core::clone::Clone::clone(__self_0), - any: ::core::clone::Clone::clone(__self_1), - expr: ::core::clone::Clone::clone(__self_2), - pattern: ::core::clone::Clone::clone(__self_3), - escape_char: ::core::clone::Clone::clone(__self_4), - } - } - Expr::ILike { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - } => { - Expr::ILike { - negated: ::core::clone::Clone::clone(__self_0), - any: ::core::clone::Clone::clone(__self_1), - expr: ::core::clone::Clone::clone(__self_2), - pattern: ::core::clone::Clone::clone(__self_3), - escape_char: ::core::clone::Clone::clone(__self_4), - } - } - Expr::SimilarTo { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - escape_char: __self_3, - } => { - Expr::SimilarTo { - negated: ::core::clone::Clone::clone(__self_0), - expr: ::core::clone::Clone::clone(__self_1), - pattern: ::core::clone::Clone::clone(__self_2), - escape_char: ::core::clone::Clone::clone(__self_3), - } - } - Expr::RLike { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - regexp: __self_3, - } => { - Expr::RLike { - negated: ::core::clone::Clone::clone(__self_0), - expr: ::core::clone::Clone::clone(__self_1), - pattern: ::core::clone::Clone::clone(__self_2), - regexp: ::core::clone::Clone::clone(__self_3), - } - } - Expr::AnyOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - is_some: __self_3, - } => { - Expr::AnyOp { - left: ::core::clone::Clone::clone(__self_0), - compare_op: ::core::clone::Clone::clone(__self_1), - right: ::core::clone::Clone::clone(__self_2), - is_some: ::core::clone::Clone::clone(__self_3), - } - } - Expr::AllOp { left: __self_0, compare_op: __self_1, right: __self_2 } => { - Expr::AllOp { - left: ::core::clone::Clone::clone(__self_0), - compare_op: ::core::clone::Clone::clone(__self_1), - right: ::core::clone::Clone::clone(__self_2), - } - } - Expr::UnaryOp { op: __self_0, expr: __self_1 } => { - Expr::UnaryOp { - op: ::core::clone::Clone::clone(__self_0), - expr: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Convert { - is_try: __self_0, - expr: __self_1, - data_type: __self_2, - charset: __self_3, - target_before_value: __self_4, - styles: __self_5, - } => { - Expr::Convert { - is_try: ::core::clone::Clone::clone(__self_0), - expr: ::core::clone::Clone::clone(__self_1), - data_type: ::core::clone::Clone::clone(__self_2), - charset: ::core::clone::Clone::clone(__self_3), - target_before_value: ::core::clone::Clone::clone(__self_4), - styles: ::core::clone::Clone::clone(__self_5), - } - } - Expr::Cast { - kind: __self_0, - expr: __self_1, - data_type: __self_2, - format: __self_3, - } => { - Expr::Cast { - kind: ::core::clone::Clone::clone(__self_0), - expr: ::core::clone::Clone::clone(__self_1), - data_type: ::core::clone::Clone::clone(__self_2), - format: ::core::clone::Clone::clone(__self_3), - } - } - Expr::AtTimeZone { timestamp: __self_0, time_zone: __self_1 } => { - Expr::AtTimeZone { - timestamp: ::core::clone::Clone::clone(__self_0), - time_zone: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Extract { field: __self_0, syntax: __self_1, expr: __self_2 } => { - Expr::Extract { - field: ::core::clone::Clone::clone(__self_0), - syntax: ::core::clone::Clone::clone(__self_1), - expr: ::core::clone::Clone::clone(__self_2), - } - } - Expr::Ceil { expr: __self_0, field: __self_1 } => { - Expr::Ceil { - expr: ::core::clone::Clone::clone(__self_0), - field: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Floor { expr: __self_0, field: __self_1 } => { - Expr::Floor { - expr: ::core::clone::Clone::clone(__self_0), - field: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Position { expr: __self_0, r#in: __self_1 } => { - Expr::Position { - expr: ::core::clone::Clone::clone(__self_0), - r#in: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Substring { - expr: __self_0, - substring_from: __self_1, - substring_for: __self_2, - special: __self_3, - } => { - Expr::Substring { - expr: ::core::clone::Clone::clone(__self_0), - substring_from: ::core::clone::Clone::clone(__self_1), - substring_for: ::core::clone::Clone::clone(__self_2), - special: ::core::clone::Clone::clone(__self_3), - } - } - Expr::Trim { - expr: __self_0, - trim_where: __self_1, - trim_what: __self_2, - trim_characters: __self_3, - } => { - Expr::Trim { - expr: ::core::clone::Clone::clone(__self_0), - trim_where: ::core::clone::Clone::clone(__self_1), - trim_what: ::core::clone::Clone::clone(__self_2), - trim_characters: ::core::clone::Clone::clone(__self_3), - } - } - Expr::Overlay { - expr: __self_0, - overlay_what: __self_1, - overlay_from: __self_2, - overlay_for: __self_3, - } => { - Expr::Overlay { - expr: ::core::clone::Clone::clone(__self_0), - overlay_what: ::core::clone::Clone::clone(__self_1), - overlay_from: ::core::clone::Clone::clone(__self_2), - overlay_for: ::core::clone::Clone::clone(__self_3), - } - } - Expr::Collate { expr: __self_0, collation: __self_1 } => { - Expr::Collate { - expr: ::core::clone::Clone::clone(__self_0), - collation: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Nested(__self_0) => { - Expr::Nested(::core::clone::Clone::clone(__self_0)) - } - Expr::Value(__self_0) => { - Expr::Value(::core::clone::Clone::clone(__self_0)) - } - Expr::IntroducedString { introducer: __self_0, value: __self_1 } => { - Expr::IntroducedString { - introducer: ::core::clone::Clone::clone(__self_0), - value: ::core::clone::Clone::clone(__self_1), - } - } - Expr::TypedString { data_type: __self_0, value: __self_1 } => { - Expr::TypedString { - data_type: ::core::clone::Clone::clone(__self_0), - value: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Function(__self_0) => { - Expr::Function(::core::clone::Clone::clone(__self_0)) - } - Expr::Method(__self_0) => { - Expr::Method(::core::clone::Clone::clone(__self_0)) - } - Expr::Case { - operand: __self_0, - conditions: __self_1, - results: __self_2, - else_result: __self_3, - } => { - Expr::Case { - operand: ::core::clone::Clone::clone(__self_0), - conditions: ::core::clone::Clone::clone(__self_1), - results: ::core::clone::Clone::clone(__self_2), - else_result: ::core::clone::Clone::clone(__self_3), - } - } - Expr::Exists { subquery: __self_0, negated: __self_1 } => { - Expr::Exists { - subquery: ::core::clone::Clone::clone(__self_0), - negated: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Subquery(__self_0) => { - Expr::Subquery(::core::clone::Clone::clone(__self_0)) - } - Expr::GroupingSets(__self_0) => { - Expr::GroupingSets(::core::clone::Clone::clone(__self_0)) - } - Expr::Cube(__self_0) => Expr::Cube(::core::clone::Clone::clone(__self_0)), - Expr::Rollup(__self_0) => { - Expr::Rollup(::core::clone::Clone::clone(__self_0)) - } - Expr::Tuple(__self_0) => { - Expr::Tuple(::core::clone::Clone::clone(__self_0)) - } - Expr::Struct { values: __self_0, fields: __self_1 } => { - Expr::Struct { - values: ::core::clone::Clone::clone(__self_0), - fields: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Named { expr: __self_0, name: __self_1 } => { - Expr::Named { - expr: ::core::clone::Clone::clone(__self_0), - name: ::core::clone::Clone::clone(__self_1), - } - } - Expr::Dictionary(__self_0) => { - Expr::Dictionary(::core::clone::Clone::clone(__self_0)) - } - Expr::Map(__self_0) => Expr::Map(::core::clone::Clone::clone(__self_0)), - Expr::Array(__self_0) => { - Expr::Array(::core::clone::Clone::clone(__self_0)) - } - Expr::Interval(__self_0) => { - Expr::Interval(::core::clone::Clone::clone(__self_0)) - } - Expr::MatchAgainst { - columns: __self_0, - match_value: __self_1, - opt_search_modifier: __self_2, - } => { - Expr::MatchAgainst { - columns: ::core::clone::Clone::clone(__self_0), - match_value: ::core::clone::Clone::clone(__self_1), - opt_search_modifier: ::core::clone::Clone::clone(__self_2), - } - } - Expr::Wildcard(__self_0) => { - Expr::Wildcard(::core::clone::Clone::clone(__self_0)) - } - Expr::QualifiedWildcard(__self_0, __self_1) => { - Expr::QualifiedWildcard( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - Expr::OuterJoin(__self_0) => { - Expr::OuterJoin(::core::clone::Clone::clone(__self_0)) - } - Expr::Prior(__self_0) => { - Expr::Prior(::core::clone::Clone::clone(__self_0)) - } - Expr::Lambda(__self_0) => { - Expr::Lambda(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Expr {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Expr { - #[inline] - fn eq(&self, other: &Expr) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (Expr::Identifier(__self_0), Expr::Identifier(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Expr::CompoundIdentifier(__self_0), - Expr::CompoundIdentifier(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Expr::CompoundFieldAccess { - root: __self_0, - access_chain: __self_1, - }, - Expr::CompoundFieldAccess { - root: __arg1_0, - access_chain: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::JsonAccess { value: __self_0, path: __self_1 }, - Expr::JsonAccess { value: __arg1_0, path: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::CompositeAccess { expr: __self_0, key: __self_1 }, - Expr::CompositeAccess { expr: __arg1_0, key: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (Expr::IsFalse(__self_0), Expr::IsFalse(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::IsNotFalse(__self_0), Expr::IsNotFalse(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::IsTrue(__self_0), Expr::IsTrue(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::IsNotTrue(__self_0), Expr::IsNotTrue(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::IsNull(__self_0), Expr::IsNull(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::IsNotNull(__self_0), Expr::IsNotNull(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::IsUnknown(__self_0), Expr::IsUnknown(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::IsNotUnknown(__self_0), Expr::IsNotUnknown(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Expr::IsDistinctFrom(__self_0, __self_1), - Expr::IsDistinctFrom(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::IsNotDistinctFrom(__self_0, __self_1), - Expr::IsNotDistinctFrom(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::IsNormalized { - expr: __self_0, - form: __self_1, - negated: __self_2, - }, - Expr::IsNormalized { - expr: __arg1_0, - form: __arg1_1, - negated: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Expr::InList { - expr: __self_0, - list: __self_1, - negated: __self_2, - }, - Expr::InList { - expr: __arg1_0, - list: __arg1_1, - negated: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Expr::InSubquery { - expr: __self_0, - subquery: __self_1, - negated: __self_2, - }, - Expr::InSubquery { - expr: __arg1_0, - subquery: __arg1_1, - negated: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Expr::InUnnest { - expr: __self_0, - array_expr: __self_1, - negated: __self_2, - }, - Expr::InUnnest { - expr: __arg1_0, - array_expr: __arg1_1, - negated: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Expr::Between { - expr: __self_0, - negated: __self_1, - low: __self_2, - high: __self_3, - }, - Expr::Between { - expr: __arg1_0, - negated: __arg1_1, - low: __arg1_2, - high: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::BinaryOp { left: __self_0, op: __self_1, right: __self_2 }, - Expr::BinaryOp { left: __arg1_0, op: __arg1_1, right: __arg1_2 }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Expr::Like { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - }, - Expr::Like { - negated: __arg1_0, - any: __arg1_1, - expr: __arg1_2, - pattern: __arg1_3, - escape_char: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Expr::ILike { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - }, - Expr::ILike { - negated: __arg1_0, - any: __arg1_1, - expr: __arg1_2, - pattern: __arg1_3, - escape_char: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Expr::SimilarTo { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - escape_char: __self_3, - }, - Expr::SimilarTo { - negated: __arg1_0, - expr: __arg1_1, - pattern: __arg1_2, - escape_char: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::RLike { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - regexp: __self_3, - }, - Expr::RLike { - negated: __arg1_0, - expr: __arg1_1, - pattern: __arg1_2, - regexp: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::AnyOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - is_some: __self_3, - }, - Expr::AnyOp { - left: __arg1_0, - compare_op: __arg1_1, - right: __arg1_2, - is_some: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::AllOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - }, - Expr::AllOp { - left: __arg1_0, - compare_op: __arg1_1, - right: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Expr::UnaryOp { op: __self_0, expr: __self_1 }, - Expr::UnaryOp { op: __arg1_0, expr: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::Convert { - is_try: __self_0, - expr: __self_1, - data_type: __self_2, - charset: __self_3, - target_before_value: __self_4, - styles: __self_5, - }, - Expr::Convert { - is_try: __arg1_0, - expr: __arg1_1, - data_type: __arg1_2, - charset: __arg1_3, - target_before_value: __arg1_4, - styles: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - ( - Expr::Cast { - kind: __self_0, - expr: __self_1, - data_type: __self_2, - format: __self_3, - }, - Expr::Cast { - kind: __arg1_0, - expr: __arg1_1, - data_type: __arg1_2, - format: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::AtTimeZone { timestamp: __self_0, time_zone: __self_1 }, - Expr::AtTimeZone { timestamp: __arg1_0, time_zone: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::Extract { - field: __self_0, - syntax: __self_1, - expr: __self_2, - }, - Expr::Extract { - field: __arg1_0, - syntax: __arg1_1, - expr: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Expr::Ceil { expr: __self_0, field: __self_1 }, - Expr::Ceil { expr: __arg1_0, field: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::Floor { expr: __self_0, field: __self_1 }, - Expr::Floor { expr: __arg1_0, field: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::Position { expr: __self_0, r#in: __self_1 }, - Expr::Position { expr: __arg1_0, r#in: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::Substring { - expr: __self_0, - substring_from: __self_1, - substring_for: __self_2, - special: __self_3, - }, - Expr::Substring { - expr: __arg1_0, - substring_from: __arg1_1, - substring_for: __arg1_2, - special: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::Trim { - expr: __self_0, - trim_where: __self_1, - trim_what: __self_2, - trim_characters: __self_3, - }, - Expr::Trim { - expr: __arg1_0, - trim_where: __arg1_1, - trim_what: __arg1_2, - trim_characters: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::Overlay { - expr: __self_0, - overlay_what: __self_1, - overlay_from: __self_2, - overlay_for: __self_3, - }, - Expr::Overlay { - expr: __arg1_0, - overlay_what: __arg1_1, - overlay_from: __arg1_2, - overlay_for: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::Collate { expr: __self_0, collation: __self_1 }, - Expr::Collate { expr: __arg1_0, collation: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (Expr::Nested(__self_0), Expr::Nested(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Value(__self_0), Expr::Value(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Expr::IntroducedString { introducer: __self_0, value: __self_1 }, - Expr::IntroducedString { introducer: __arg1_0, value: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::TypedString { data_type: __self_0, value: __self_1 }, - Expr::TypedString { data_type: __arg1_0, value: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (Expr::Function(__self_0), Expr::Function(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Method(__self_0), Expr::Method(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Expr::Case { - operand: __self_0, - conditions: __self_1, - results: __self_2, - else_result: __self_3, - }, - Expr::Case { - operand: __arg1_0, - conditions: __arg1_1, - results: __arg1_2, - else_result: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Expr::Exists { subquery: __self_0, negated: __self_1 }, - Expr::Exists { subquery: __arg1_0, negated: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (Expr::Subquery(__self_0), Expr::Subquery(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::GroupingSets(__self_0), Expr::GroupingSets(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Cube(__self_0), Expr::Cube(__arg1_0)) => __self_0 == __arg1_0, - (Expr::Rollup(__self_0), Expr::Rollup(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Tuple(__self_0), Expr::Tuple(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Expr::Struct { values: __self_0, fields: __self_1 }, - Expr::Struct { values: __arg1_0, fields: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Expr::Named { expr: __self_0, name: __self_1 }, - Expr::Named { expr: __arg1_0, name: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (Expr::Dictionary(__self_0), Expr::Dictionary(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Map(__self_0), Expr::Map(__arg1_0)) => __self_0 == __arg1_0, - (Expr::Array(__self_0), Expr::Array(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Interval(__self_0), Expr::Interval(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Expr::MatchAgainst { - columns: __self_0, - match_value: __self_1, - opt_search_modifier: __self_2, - }, - Expr::MatchAgainst { - columns: __arg1_0, - match_value: __arg1_1, - opt_search_modifier: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - (Expr::Wildcard(__self_0), Expr::Wildcard(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Expr::QualifiedWildcard(__self_0, __self_1), - Expr::QualifiedWildcard(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (Expr::OuterJoin(__self_0), Expr::OuterJoin(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Prior(__self_0), Expr::Prior(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Expr::Lambda(__self_0), Expr::Lambda(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Expr { - #[inline] - fn partial_cmp( - &self, - other: &Expr, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (Expr::Identifier(__self_0), Expr::Identifier(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Expr::CompoundIdentifier(__self_0), - Expr::CompoundIdentifier(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Expr::CompoundFieldAccess { root: __self_0, access_chain: __self_1 }, - Expr::CompoundFieldAccess { root: __arg1_0, access_chain: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::JsonAccess { value: __self_0, path: __self_1 }, - Expr::JsonAccess { value: __arg1_0, path: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::CompositeAccess { expr: __self_0, key: __self_1 }, - Expr::CompositeAccess { expr: __arg1_0, key: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::IsFalse(__self_0), Expr::IsFalse(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::IsNotFalse(__self_0), Expr::IsNotFalse(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::IsTrue(__self_0), Expr::IsTrue(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::IsNotTrue(__self_0), Expr::IsNotTrue(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::IsNull(__self_0), Expr::IsNull(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::IsNotNull(__self_0), Expr::IsNotNull(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::IsUnknown(__self_0), Expr::IsUnknown(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::IsNotUnknown(__self_0), Expr::IsNotUnknown(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Expr::IsDistinctFrom(__self_0, __self_1), - Expr::IsDistinctFrom(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::IsNotDistinctFrom(__self_0, __self_1), - Expr::IsNotDistinctFrom(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::IsNormalized { - expr: __self_0, - form: __self_1, - negated: __self_2, - }, - Expr::IsNormalized { - expr: __arg1_0, - form: __arg1_1, - negated: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::InList { expr: __self_0, list: __self_1, negated: __self_2 }, - Expr::InList { expr: __arg1_0, list: __arg1_1, negated: __arg1_2 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::InSubquery { - expr: __self_0, - subquery: __self_1, - negated: __self_2, - }, - Expr::InSubquery { - expr: __arg1_0, - subquery: __arg1_1, - negated: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::InUnnest { - expr: __self_0, - array_expr: __self_1, - negated: __self_2, - }, - Expr::InUnnest { - expr: __arg1_0, - array_expr: __arg1_1, - negated: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Between { - expr: __self_0, - negated: __self_1, - low: __self_2, - high: __self_3, - }, - Expr::Between { - expr: __arg1_0, - negated: __arg1_1, - low: __arg1_2, - high: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::BinaryOp { left: __self_0, op: __self_1, right: __self_2 }, - Expr::BinaryOp { left: __arg1_0, op: __arg1_1, right: __arg1_2 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Like { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - }, - Expr::Like { - negated: __arg1_0, - any: __arg1_1, - expr: __arg1_2, - pattern: __arg1_3, - escape_char: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::ILike { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - }, - Expr::ILike { - negated: __arg1_0, - any: __arg1_1, - expr: __arg1_2, - pattern: __arg1_3, - escape_char: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::SimilarTo { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - escape_char: __self_3, - }, - Expr::SimilarTo { - negated: __arg1_0, - expr: __arg1_1, - pattern: __arg1_2, - escape_char: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::RLike { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - regexp: __self_3, - }, - Expr::RLike { - negated: __arg1_0, - expr: __arg1_1, - pattern: __arg1_2, - regexp: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::AnyOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - is_some: __self_3, - }, - Expr::AnyOp { - left: __arg1_0, - compare_op: __arg1_1, - right: __arg1_2, - is_some: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::AllOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - }, - Expr::AllOp { left: __arg1_0, compare_op: __arg1_1, right: __arg1_2 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::UnaryOp { op: __self_0, expr: __self_1 }, - Expr::UnaryOp { op: __arg1_0, expr: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Convert { - is_try: __self_0, - expr: __self_1, - data_type: __self_2, - charset: __self_3, - target_before_value: __self_4, - styles: __self_5, - }, - Expr::Convert { - is_try: __arg1_0, - expr: __arg1_1, - data_type: __arg1_2, - charset: __arg1_3, - target_before_value: __arg1_4, - styles: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Cast { - kind: __self_0, - expr: __self_1, - data_type: __self_2, - format: __self_3, - }, - Expr::Cast { - kind: __arg1_0, - expr: __arg1_1, - data_type: __arg1_2, - format: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::AtTimeZone { timestamp: __self_0, time_zone: __self_1 }, - Expr::AtTimeZone { timestamp: __arg1_0, time_zone: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Extract { field: __self_0, syntax: __self_1, expr: __self_2 }, - Expr::Extract { field: __arg1_0, syntax: __arg1_1, expr: __arg1_2 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Ceil { expr: __self_0, field: __self_1 }, - Expr::Ceil { expr: __arg1_0, field: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Floor { expr: __self_0, field: __self_1 }, - Expr::Floor { expr: __arg1_0, field: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Position { expr: __self_0, r#in: __self_1 }, - Expr::Position { expr: __arg1_0, r#in: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Substring { - expr: __self_0, - substring_from: __self_1, - substring_for: __self_2, - special: __self_3, - }, - Expr::Substring { - expr: __arg1_0, - substring_from: __arg1_1, - substring_for: __arg1_2, - special: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Trim { - expr: __self_0, - trim_where: __self_1, - trim_what: __self_2, - trim_characters: __self_3, - }, - Expr::Trim { - expr: __arg1_0, - trim_where: __arg1_1, - trim_what: __arg1_2, - trim_characters: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Overlay { - expr: __self_0, - overlay_what: __self_1, - overlay_from: __self_2, - overlay_for: __self_3, - }, - Expr::Overlay { - expr: __arg1_0, - overlay_what: __arg1_1, - overlay_from: __arg1_2, - overlay_for: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Collate { expr: __self_0, collation: __self_1 }, - Expr::Collate { expr: __arg1_0, collation: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Nested(__self_0), Expr::Nested(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Value(__self_0), Expr::Value(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Expr::IntroducedString { introducer: __self_0, value: __self_1 }, - Expr::IntroducedString { introducer: __arg1_0, value: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::TypedString { data_type: __self_0, value: __self_1 }, - Expr::TypedString { data_type: __arg1_0, value: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Function(__self_0), Expr::Function(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Method(__self_0), Expr::Method(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Expr::Case { - operand: __self_0, - conditions: __self_1, - results: __self_2, - else_result: __self_3, - }, - Expr::Case { - operand: __arg1_0, - conditions: __arg1_1, - results: __arg1_2, - else_result: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Exists { subquery: __self_0, negated: __self_1 }, - Expr::Exists { subquery: __arg1_0, negated: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Subquery(__self_0), Expr::Subquery(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::GroupingSets(__self_0), Expr::GroupingSets(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Cube(__self_0), Expr::Cube(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Rollup(__self_0), Expr::Rollup(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Tuple(__self_0), Expr::Tuple(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Expr::Struct { values: __self_0, fields: __self_1 }, - Expr::Struct { values: __arg1_0, fields: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Named { expr: __self_0, name: __self_1 }, - Expr::Named { expr: __arg1_0, name: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Dictionary(__self_0), Expr::Dictionary(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Map(__self_0), Expr::Map(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Array(__self_0), Expr::Array(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Interval(__self_0), Expr::Interval(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Expr::MatchAgainst { - columns: __self_0, - match_value: __self_1, - opt_search_modifier: __self_2, - }, - Expr::MatchAgainst { - columns: __arg1_0, - match_value: __arg1_1, - opt_search_modifier: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Expr::Wildcard(__self_0), Expr::Wildcard(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Expr::QualifiedWildcard(__self_0, __self_1), - Expr::QualifiedWildcard(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::OuterJoin(__self_0), Expr::OuterJoin(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Prior(__self_0), Expr::Prior(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Expr::Lambda(__self_0), Expr::Lambda(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Expr { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Expr { - #[inline] - fn cmp(&self, other: &Expr) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (Expr::Identifier(__self_0), Expr::Identifier(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Expr::CompoundIdentifier(__self_0), - Expr::CompoundIdentifier(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Expr::CompoundFieldAccess { - root: __self_0, - access_chain: __self_1, - }, - Expr::CompoundFieldAccess { - root: __arg1_0, - access_chain: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::JsonAccess { value: __self_0, path: __self_1 }, - Expr::JsonAccess { value: __arg1_0, path: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::CompositeAccess { expr: __self_0, key: __self_1 }, - Expr::CompositeAccess { expr: __arg1_0, key: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::IsFalse(__self_0), Expr::IsFalse(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::IsNotFalse(__self_0), Expr::IsNotFalse(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::IsTrue(__self_0), Expr::IsTrue(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::IsNotTrue(__self_0), Expr::IsNotTrue(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::IsNull(__self_0), Expr::IsNull(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::IsNotNull(__self_0), Expr::IsNotNull(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::IsUnknown(__self_0), Expr::IsUnknown(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::IsNotUnknown(__self_0), Expr::IsNotUnknown(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Expr::IsDistinctFrom(__self_0, __self_1), - Expr::IsDistinctFrom(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::IsNotDistinctFrom(__self_0, __self_1), - Expr::IsNotDistinctFrom(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::IsNormalized { - expr: __self_0, - form: __self_1, - negated: __self_2, - }, - Expr::IsNormalized { - expr: __arg1_0, - form: __arg1_1, - negated: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::InList { - expr: __self_0, - list: __self_1, - negated: __self_2, - }, - Expr::InList { - expr: __arg1_0, - list: __arg1_1, - negated: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::InSubquery { - expr: __self_0, - subquery: __self_1, - negated: __self_2, - }, - Expr::InSubquery { - expr: __arg1_0, - subquery: __arg1_1, - negated: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::InUnnest { - expr: __self_0, - array_expr: __self_1, - negated: __self_2, - }, - Expr::InUnnest { - expr: __arg1_0, - array_expr: __arg1_1, - negated: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Between { - expr: __self_0, - negated: __self_1, - low: __self_2, - high: __self_3, - }, - Expr::Between { - expr: __arg1_0, - negated: __arg1_1, - low: __arg1_2, - high: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::BinaryOp { - left: __self_0, - op: __self_1, - right: __self_2, - }, - Expr::BinaryOp { - left: __arg1_0, - op: __arg1_1, - right: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Like { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - }, - Expr::Like { - negated: __arg1_0, - any: __arg1_1, - expr: __arg1_2, - pattern: __arg1_3, - escape_char: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::ILike { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - }, - Expr::ILike { - negated: __arg1_0, - any: __arg1_1, - expr: __arg1_2, - pattern: __arg1_3, - escape_char: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::SimilarTo { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - escape_char: __self_3, - }, - Expr::SimilarTo { - negated: __arg1_0, - expr: __arg1_1, - pattern: __arg1_2, - escape_char: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::RLike { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - regexp: __self_3, - }, - Expr::RLike { - negated: __arg1_0, - expr: __arg1_1, - pattern: __arg1_2, - regexp: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::AnyOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - is_some: __self_3, - }, - Expr::AnyOp { - left: __arg1_0, - compare_op: __arg1_1, - right: __arg1_2, - is_some: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::AllOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - }, - Expr::AllOp { - left: __arg1_0, - compare_op: __arg1_1, - right: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::UnaryOp { op: __self_0, expr: __self_1 }, - Expr::UnaryOp { op: __arg1_0, expr: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Convert { - is_try: __self_0, - expr: __self_1, - data_type: __self_2, - charset: __self_3, - target_before_value: __self_4, - styles: __self_5, - }, - Expr::Convert { - is_try: __arg1_0, - expr: __arg1_1, - data_type: __arg1_2, - charset: __arg1_3, - target_before_value: __arg1_4, - styles: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Cast { - kind: __self_0, - expr: __self_1, - data_type: __self_2, - format: __self_3, - }, - Expr::Cast { - kind: __arg1_0, - expr: __arg1_1, - data_type: __arg1_2, - format: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::AtTimeZone { - timestamp: __self_0, - time_zone: __self_1, - }, - Expr::AtTimeZone { timestamp: __arg1_0, time_zone: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Extract { - field: __self_0, - syntax: __self_1, - expr: __self_2, - }, - Expr::Extract { - field: __arg1_0, - syntax: __arg1_1, - expr: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Ceil { expr: __self_0, field: __self_1 }, - Expr::Ceil { expr: __arg1_0, field: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Floor { expr: __self_0, field: __self_1 }, - Expr::Floor { expr: __arg1_0, field: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Position { expr: __self_0, r#in: __self_1 }, - Expr::Position { expr: __arg1_0, r#in: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Substring { - expr: __self_0, - substring_from: __self_1, - substring_for: __self_2, - special: __self_3, - }, - Expr::Substring { - expr: __arg1_0, - substring_from: __arg1_1, - substring_for: __arg1_2, - special: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Trim { - expr: __self_0, - trim_where: __self_1, - trim_what: __self_2, - trim_characters: __self_3, - }, - Expr::Trim { - expr: __arg1_0, - trim_where: __arg1_1, - trim_what: __arg1_2, - trim_characters: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Overlay { - expr: __self_0, - overlay_what: __self_1, - overlay_from: __self_2, - overlay_for: __self_3, - }, - Expr::Overlay { - expr: __arg1_0, - overlay_what: __arg1_1, - overlay_from: __arg1_2, - overlay_for: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Collate { expr: __self_0, collation: __self_1 }, - Expr::Collate { expr: __arg1_0, collation: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Nested(__self_0), Expr::Nested(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Value(__self_0), Expr::Value(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Expr::IntroducedString { - introducer: __self_0, - value: __self_1, - }, - Expr::IntroducedString { - introducer: __arg1_0, - value: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::TypedString { data_type: __self_0, value: __self_1 }, - Expr::TypedString { data_type: __arg1_0, value: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Function(__self_0), Expr::Function(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Method(__self_0), Expr::Method(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Expr::Case { - operand: __self_0, - conditions: __self_1, - results: __self_2, - else_result: __self_3, - }, - Expr::Case { - operand: __arg1_0, - conditions: __arg1_1, - results: __arg1_2, - else_result: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Expr::Exists { subquery: __self_0, negated: __self_1 }, - Expr::Exists { subquery: __arg1_0, negated: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Subquery(__self_0), Expr::Subquery(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::GroupingSets(__self_0), Expr::GroupingSets(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Cube(__self_0), Expr::Cube(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Rollup(__self_0), Expr::Rollup(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Tuple(__self_0), Expr::Tuple(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Expr::Struct { values: __self_0, fields: __self_1 }, - Expr::Struct { values: __arg1_0, fields: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Expr::Named { expr: __self_0, name: __self_1 }, - Expr::Named { expr: __arg1_0, name: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::Dictionary(__self_0), Expr::Dictionary(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Map(__self_0), Expr::Map(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Array(__self_0), Expr::Array(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Interval(__self_0), Expr::Interval(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Expr::MatchAgainst { - columns: __self_0, - match_value: __self_1, - opt_search_modifier: __self_2, - }, - Expr::MatchAgainst { - columns: __arg1_0, - match_value: __arg1_1, - opt_search_modifier: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Expr::Wildcard(__self_0), Expr::Wildcard(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Expr::QualifiedWildcard(__self_0, __self_1), - Expr::QualifiedWildcard(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Expr::OuterJoin(__self_0), Expr::OuterJoin(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Prior(__self_0), Expr::Prior(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Expr::Lambda(__self_0), Expr::Lambda(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Expr { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Expr::Identifier(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::CompoundIdentifier(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Expr::CompoundFieldAccess { root: __self_0, access_chain: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::JsonAccess { value: __self_0, path: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::CompositeAccess { expr: __self_0, key: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::IsFalse(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsNotFalse(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsTrue(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsNotTrue(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsNull(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsNotNull(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsUnknown(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsNotUnknown(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IsDistinctFrom(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::IsNotDistinctFrom(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::IsNormalized { - expr: __self_0, - form: __self_1, - negated: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::InList { expr: __self_0, list: __self_1, negated: __self_2 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::InSubquery { - expr: __self_0, - subquery: __self_1, - negated: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::InUnnest { - expr: __self_0, - array_expr: __self_1, - negated: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::Between { - expr: __self_0, - negated: __self_1, - low: __self_2, - high: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::BinaryOp { left: __self_0, op: __self_1, right: __self_2 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::Like { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Expr::ILike { - negated: __self_0, - any: __self_1, - expr: __self_2, - pattern: __self_3, - escape_char: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Expr::SimilarTo { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - escape_char: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::RLike { - negated: __self_0, - expr: __self_1, - pattern: __self_2, - regexp: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::AnyOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - is_some: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::AllOp { - left: __self_0, - compare_op: __self_1, - right: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::UnaryOp { op: __self_0, expr: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Convert { - is_try: __self_0, - expr: __self_1, - data_type: __self_2, - charset: __self_3, - target_before_value: __self_4, - styles: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Expr::Cast { - kind: __self_0, - expr: __self_1, - data_type: __self_2, - format: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::AtTimeZone { timestamp: __self_0, time_zone: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Extract { field: __self_0, syntax: __self_1, expr: __self_2 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::Ceil { expr: __self_0, field: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Floor { expr: __self_0, field: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Position { expr: __self_0, r#in: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Substring { - expr: __self_0, - substring_from: __self_1, - substring_for: __self_2, - special: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::Trim { - expr: __self_0, - trim_where: __self_1, - trim_what: __self_2, - trim_characters: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::Overlay { - expr: __self_0, - overlay_what: __self_1, - overlay_from: __self_2, - overlay_for: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::Collate { expr: __self_0, collation: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Nested(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Value(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::IntroducedString { introducer: __self_0, value: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::TypedString { data_type: __self_0, value: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Function(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Method(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Case { - operand: __self_0, - conditions: __self_1, - results: __self_2, - else_result: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Expr::Exists { subquery: __self_0, negated: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Subquery(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::GroupingSets(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Cube(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Rollup(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Tuple(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Struct { values: __self_0, fields: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Named { expr: __self_0, name: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::Dictionary(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Map(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Array(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Interval(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::MatchAgainst { - columns: __self_0, - match_value: __self_1, - opt_search_modifier: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Expr::Wildcard(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::QualifiedWildcard(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Expr::OuterJoin(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Prior(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Expr::Lambda(__self_0) => ::core::hash::Hash::hash(__self_0, state), - } - } - } - /// The contents inside the `[` and `]` in a subscript expression. - pub enum Subscript { - /// Accesses the element of the array at the given index. - Index { index: Expr }, - /// Accesses a slice of an array on PostgreSQL, e.g. - /// - /// ```plaintext - /// => select (array[1,2,3,4,5,6])[2:5]; - /// ----------- - /// {2,3,4,5} - /// ``` - /// - /// The lower and/or upper bound can be omitted to slice from the start or - /// end of the array respectively. - /// - /// See . - /// - /// Also supports an optional "stride" as the last element (this is not - /// supported by postgres), e.g. - /// - /// ```plaintext - /// => select (array[1,2,3,4,5,6])[1:6:2]; - /// ----------- - /// {1,3,5} - /// ``` - Slice { - lower_bound: Option, - upper_bound: Option, - stride: Option, - }, - } - #[automatically_derived] - impl ::core::fmt::Debug for Subscript { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Subscript::Index { index: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Index", - "index", - &__self_0, - ) - } - Subscript::Slice { - lower_bound: __self_0, - upper_bound: __self_1, - stride: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Slice", - "lower_bound", - __self_0, - "upper_bound", - __self_1, - "stride", - &__self_2, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for Subscript { - #[inline] - fn clone(&self) -> Subscript { - match self { - Subscript::Index { index: __self_0 } => { - Subscript::Index { - index: ::core::clone::Clone::clone(__self_0), - } - } - Subscript::Slice { - lower_bound: __self_0, - upper_bound: __self_1, - stride: __self_2, - } => { - Subscript::Slice { - lower_bound: ::core::clone::Clone::clone(__self_0), - upper_bound: ::core::clone::Clone::clone(__self_1), - stride: ::core::clone::Clone::clone(__self_2), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Subscript {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Subscript { - #[inline] - fn eq(&self, other: &Subscript) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - Subscript::Index { index: __self_0 }, - Subscript::Index { index: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Subscript::Slice { - lower_bound: __self_0, - upper_bound: __self_1, - stride: __self_2, - }, - Subscript::Slice { - lower_bound: __arg1_0, - upper_bound: __arg1_1, - stride: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Subscript { - #[inline] - fn partial_cmp( - &self, - other: &Subscript, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - Subscript::Index { index: __self_0 }, - Subscript::Index { index: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Subscript::Slice { - lower_bound: __self_0, - upper_bound: __self_1, - stride: __self_2, - }, - Subscript::Slice { - lower_bound: __arg1_0, - upper_bound: __arg1_1, - stride: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Subscript { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Subscript { - #[inline] - fn cmp(&self, other: &Subscript) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - Subscript::Index { index: __self_0 }, - Subscript::Index { index: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Subscript::Slice { - lower_bound: __self_0, - upper_bound: __self_1, - stride: __self_2, - }, - Subscript::Slice { - lower_bound: __arg1_0, - upper_bound: __arg1_1, - stride: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Subscript { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Subscript::Index { index: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Subscript::Slice { - lower_bound: __self_0, - upper_bound: __self_1, - stride: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - } - } - } - impl fmt::Display for Subscript { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Subscript::Index { index } => f.write_fmt(format_args!("{0}", index)), - Subscript::Slice { lower_bound, upper_bound, stride } => { - if let Some(lower) = lower_bound { - f.write_fmt(format_args!("{0}", lower))?; - } - f.write_fmt(format_args!(":"))?; - if let Some(upper) = upper_bound { - f.write_fmt(format_args!("{0}", upper))?; - } - if let Some(stride) = stride { - f.write_fmt(format_args!(":"))?; - f.write_fmt(format_args!("{0}", stride))?; - } - Ok(()) - } - } - } - } - /// An element of a [`Expr::CompoundFieldAccess`]. - /// It can be an expression or a subscript. - pub enum AccessExpr { - /// Accesses a field using dot notation, e.g. `foo.bar.baz`. - Dot(Expr), - /// Accesses a field or array element using bracket notation, e.g. `foo['bar']`. - Subscript(Subscript), - } - #[automatically_derived] - impl ::core::fmt::Debug for AccessExpr { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - AccessExpr::Dot(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Dot", - &__self_0, - ) - } - AccessExpr::Subscript(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Subscript", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for AccessExpr { - #[inline] - fn clone(&self) -> AccessExpr { - match self { - AccessExpr::Dot(__self_0) => { - AccessExpr::Dot(::core::clone::Clone::clone(__self_0)) - } - AccessExpr::Subscript(__self_0) => { - AccessExpr::Subscript(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for AccessExpr {} - #[automatically_derived] - impl ::core::cmp::PartialEq for AccessExpr { - #[inline] - fn eq(&self, other: &AccessExpr) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (AccessExpr::Dot(__self_0), AccessExpr::Dot(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - AccessExpr::Subscript(__self_0), - AccessExpr::Subscript(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for AccessExpr { - #[inline] - fn partial_cmp( - &self, - other: &AccessExpr, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (AccessExpr::Dot(__self_0), AccessExpr::Dot(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (AccessExpr::Subscript(__self_0), AccessExpr::Subscript(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for AccessExpr { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for AccessExpr { - #[inline] - fn cmp(&self, other: &AccessExpr) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (AccessExpr::Dot(__self_0), AccessExpr::Dot(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - AccessExpr::Subscript(__self_0), - AccessExpr::Subscript(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for AccessExpr { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - AccessExpr::Dot(__self_0) => ::core::hash::Hash::hash(__self_0, state), - AccessExpr::Subscript(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for AccessExpr { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - AccessExpr::Dot(expr) => f.write_fmt(format_args!(".{0}", expr)), - AccessExpr::Subscript(subscript) => { - f.write_fmt(format_args!("[{0}]", subscript)) - } - } - } - } - /// A lambda function. - pub struct LambdaFunction { - /// The parameters to the lambda function. - pub params: OneOrManyWithParens, - /// The body of the lambda function. - pub body: Box, - } - #[automatically_derived] - impl ::core::fmt::Debug for LambdaFunction { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "LambdaFunction", - "params", - &self.params, - "body", - &&self.body, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for LambdaFunction { - #[inline] - fn clone(&self) -> LambdaFunction { - LambdaFunction { - params: ::core::clone::Clone::clone(&self.params), - body: ::core::clone::Clone::clone(&self.body), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for LambdaFunction {} - #[automatically_derived] - impl ::core::cmp::PartialEq for LambdaFunction { - #[inline] - fn eq(&self, other: &LambdaFunction) -> bool { - self.params == other.params && self.body == other.body - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for LambdaFunction { - #[inline] - fn partial_cmp( - &self, - other: &LambdaFunction, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.params, &other.params) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.body, &other.body) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for LambdaFunction { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for LambdaFunction { - #[inline] - fn cmp(&self, other: &LambdaFunction) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.params, &other.params) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.body, &other.body) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for LambdaFunction { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.params, state); - ::core::hash::Hash::hash(&self.body, state) - } - } - impl fmt::Display for LambdaFunction { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_fmt(format_args!("{0} -> {1}", self.params, self.body)) - } - } - /// Encapsulates the common pattern in SQL where either one unparenthesized item - /// such as an identifier or expression is permitted, or multiple of the same - /// item in a parenthesized list. For accessing items regardless of the form, - /// `OneOrManyWithParens` implements `Deref` and `IntoIterator`, - /// so you can call slice methods on it and iterate over items - /// # Examples - /// Accessing as a slice: - /// ``` - /// # use sqlparser::ast::OneOrManyWithParens; - /// let one = OneOrManyWithParens::One("a"); - /// - /// assert_eq!(one[0], "a"); - /// assert_eq!(one.len(), 1); - /// ``` - /// Iterating: - /// ``` - /// # use sqlparser::ast::OneOrManyWithParens; - /// let one = OneOrManyWithParens::One("a"); - /// let many = OneOrManyWithParens::Many(vec!["a", "b"]); - /// - /// assert_eq!(one.into_iter().chain(many).collect::>(), vec!["a", "a", "b"] ); - /// ``` - pub enum OneOrManyWithParens { - /// A single `T`, unparenthesized. - One(T), - /// One or more `T`s, parenthesized. - Many(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for OneOrManyWithParens { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - OneOrManyWithParens::One(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "One", - &__self_0, - ) - } - OneOrManyWithParens::Many(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Many", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for OneOrManyWithParens { - #[inline] - fn clone(&self) -> OneOrManyWithParens { - match self { - OneOrManyWithParens::One(__self_0) => { - OneOrManyWithParens::One(::core::clone::Clone::clone(__self_0)) - } - OneOrManyWithParens::Many(__self_0) => { - OneOrManyWithParens::Many(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for OneOrManyWithParens {} - #[automatically_derived] - impl ::core::cmp::PartialEq for OneOrManyWithParens { - #[inline] - fn eq(&self, other: &OneOrManyWithParens) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - OneOrManyWithParens::One(__self_0), - OneOrManyWithParens::One(__arg1_0), - ) => __self_0 == __arg1_0, - ( - OneOrManyWithParens::Many(__self_0), - OneOrManyWithParens::Many(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for OneOrManyWithParens { - #[inline] - fn partial_cmp( - &self, - other: &OneOrManyWithParens, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - OneOrManyWithParens::One(__self_0), - OneOrManyWithParens::One(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - OneOrManyWithParens::Many(__self_0), - OneOrManyWithParens::Many(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for OneOrManyWithParens { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for OneOrManyWithParens { - #[inline] - fn cmp(&self, other: &OneOrManyWithParens) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - OneOrManyWithParens::One(__self_0), - OneOrManyWithParens::One(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - OneOrManyWithParens::Many(__self_0), - OneOrManyWithParens::Many(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for OneOrManyWithParens { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - OneOrManyWithParens::One(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - OneOrManyWithParens::Many(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl Deref for OneOrManyWithParens { - type Target = [T]; - fn deref(&self) -> &[T] { - match self { - OneOrManyWithParens::One(one) => core::slice::from_ref(one), - OneOrManyWithParens::Many(many) => many, - } - } - } - impl AsRef<[T]> for OneOrManyWithParens { - fn as_ref(&self) -> &[T] { - self - } - } - impl<'a, T> IntoIterator for &'a OneOrManyWithParens { - type Item = &'a T; - type IntoIter = core::slice::Iter<'a, T>; - fn into_iter(self) -> Self::IntoIter { - self.iter() - } - } - /// Owned iterator implementation of `OneOrManyWithParens` - pub struct OneOrManyWithParensIntoIter { - inner: OneOrManyWithParensIntoIterInner, - } - #[automatically_derived] - impl ::core::fmt::Debug for OneOrManyWithParensIntoIter { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "OneOrManyWithParensIntoIter", - "inner", - &&self.inner, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone - for OneOrManyWithParensIntoIter { - #[inline] - fn clone(&self) -> OneOrManyWithParensIntoIter { - OneOrManyWithParensIntoIter { - inner: ::core::clone::Clone::clone(&self.inner), - } - } - } - enum OneOrManyWithParensIntoIterInner { - One(core::iter::Once), - Many( as IntoIterator>::IntoIter), - } - #[automatically_derived] - impl ::core::fmt::Debug - for OneOrManyWithParensIntoIterInner { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - OneOrManyWithParensIntoIterInner::One(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "One", - &__self_0, - ) - } - OneOrManyWithParensIntoIterInner::Many(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Many", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone - for OneOrManyWithParensIntoIterInner { - #[inline] - fn clone(&self) -> OneOrManyWithParensIntoIterInner { - match self { - OneOrManyWithParensIntoIterInner::One(__self_0) => { - OneOrManyWithParensIntoIterInner::One( - ::core::clone::Clone::clone(__self_0), - ) - } - OneOrManyWithParensIntoIterInner::Many(__self_0) => { - OneOrManyWithParensIntoIterInner::Many( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - impl core::iter::FusedIterator for OneOrManyWithParensIntoIter - where - core::iter::Once: core::iter::FusedIterator, - as IntoIterator>::IntoIter: core::iter::FusedIterator, - {} - impl core::iter::ExactSizeIterator for OneOrManyWithParensIntoIter - where - core::iter::Once: core::iter::ExactSizeIterator, - as IntoIterator>::IntoIter: core::iter::ExactSizeIterator, - {} - impl core::iter::Iterator for OneOrManyWithParensIntoIter { - type Item = T; - fn next(&mut self) -> Option { - match &mut self.inner { - OneOrManyWithParensIntoIterInner::One(one) => one.next(), - OneOrManyWithParensIntoIterInner::Many(many) => many.next(), - } - } - fn size_hint(&self) -> (usize, Option) { - match &self.inner { - OneOrManyWithParensIntoIterInner::One(one) => one.size_hint(), - OneOrManyWithParensIntoIterInner::Many(many) => many.size_hint(), - } - } - fn count(self) -> usize - where - Self: Sized, - { - match self.inner { - OneOrManyWithParensIntoIterInner::One(one) => one.count(), - OneOrManyWithParensIntoIterInner::Many(many) => many.count(), - } - } - fn fold(mut self, init: B, f: F) -> B - where - Self: Sized, - F: FnMut(B, Self::Item) -> B, - { - match &mut self.inner { - OneOrManyWithParensIntoIterInner::One(one) => one.fold(init, f), - OneOrManyWithParensIntoIterInner::Many(many) => many.fold(init, f), - } - } - } - impl core::iter::DoubleEndedIterator for OneOrManyWithParensIntoIter { - fn next_back(&mut self) -> Option { - match &mut self.inner { - OneOrManyWithParensIntoIterInner::One(one) => one.next_back(), - OneOrManyWithParensIntoIterInner::Many(many) => many.next_back(), - } - } - } - impl IntoIterator for OneOrManyWithParens { - type Item = T; - type IntoIter = OneOrManyWithParensIntoIter; - fn into_iter(self) -> Self::IntoIter { - let inner = match self { - OneOrManyWithParens::One(one) => { - OneOrManyWithParensIntoIterInner::One(core::iter::once(one)) - } - OneOrManyWithParens::Many(many) => { - OneOrManyWithParensIntoIterInner::Many(many.into_iter()) - } - }; - OneOrManyWithParensIntoIter { - inner, - } - } - } - impl fmt::Display for OneOrManyWithParens - where - T: fmt::Display, - { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - OneOrManyWithParens::One(value) => { - f.write_fmt(format_args!("{0}", value)) - } - OneOrManyWithParens::Many(values) => { - f.write_fmt(format_args!("({0})", display_comma_separated(values))) - } - } - } - } - impl fmt::Display for CastFormat { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CastFormat::Value(v) => f.write_fmt(format_args!("{0}", v)), - CastFormat::ValueAtTimeZone(v, tz) => { - f.write_fmt(format_args!("{0} AT TIME ZONE {1}", v, tz)) - } - } - } - } - impl fmt::Display for Expr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - ::recursive::__impl::stacker::maybe_grow( - ::recursive::get_minimum_stack_size(), - ::recursive::get_stack_allocation_size(), - move || -> fmt::Result { - { - match self { - Expr::Identifier(s) => f.write_fmt(format_args!("{0}", s)), - Expr::Wildcard(_) => f.write_str("*"), - Expr::QualifiedWildcard(prefix, _) => { - f.write_fmt(format_args!("{0}.*", prefix)) - } - Expr::CompoundIdentifier(s) => { - f.write_fmt(format_args!("{0}", display_separated(s, "."))) - } - Expr::CompoundFieldAccess { root, access_chain } => { - f.write_fmt(format_args!("{0}", root))?; - for field in access_chain { - f.write_fmt(format_args!("{0}", field))?; - } - Ok(()) - } - Expr::IsTrue(ast) => { - f.write_fmt(format_args!("{0} IS TRUE", ast)) - } - Expr::IsNotTrue(ast) => { - f.write_fmt(format_args!("{0} IS NOT TRUE", ast)) - } - Expr::IsFalse(ast) => { - f.write_fmt(format_args!("{0} IS FALSE", ast)) - } - Expr::IsNotFalse(ast) => { - f.write_fmt(format_args!("{0} IS NOT FALSE", ast)) - } - Expr::IsNull(ast) => { - f.write_fmt(format_args!("{0} IS NULL", ast)) - } - Expr::IsNotNull(ast) => { - f.write_fmt(format_args!("{0} IS NOT NULL", ast)) - } - Expr::IsUnknown(ast) => { - f.write_fmt(format_args!("{0} IS UNKNOWN", ast)) - } - Expr::IsNotUnknown(ast) => { - f.write_fmt(format_args!("{0} IS NOT UNKNOWN", ast)) - } - Expr::InList { expr, list, negated } => { - f.write_fmt( - format_args!( - "{0} {1}IN ({2})", - expr, - if *negated { "NOT " } else { "" }, - display_comma_separated(list), - ), - ) - } - Expr::InSubquery { expr, subquery, negated } => { - f.write_fmt( - format_args!( - "{0} {1}IN ({2})", - expr, - if *negated { "NOT " } else { "" }, - subquery, - ), - ) - } - Expr::InUnnest { expr, array_expr, negated } => { - f.write_fmt( - format_args!( - "{0} {1}IN UNNEST({2})", - expr, - if *negated { "NOT " } else { "" }, - array_expr, - ), - ) - } - Expr::Between { expr, negated, low, high } => { - f.write_fmt( - format_args!( - "{0} {1}BETWEEN {2} AND {3}", - expr, - if *negated { "NOT " } else { "" }, - low, - high, - ), - ) - } - Expr::BinaryOp { left, op, right } => { - f.write_fmt(format_args!("{0} {1} {2}", left, op, right)) - } - Expr::Like { negated, expr, pattern, escape_char, any } => { - match escape_char { - Some(ch) => { - f.write_fmt( - format_args!( - "{0} {1}LIKE {2}{3} ESCAPE \'{4}\'", - expr, - if *negated { "NOT " } else { "" }, - if *any { "ANY " } else { "" }, - pattern, - ch, - ), - ) - } - _ => { - f.write_fmt( - format_args!( - "{0} {1}LIKE {2}{3}", - expr, - if *negated { "NOT " } else { "" }, - if *any { "ANY " } else { "" }, - pattern, - ), - ) - } - } - } - Expr::ILike { negated, expr, pattern, escape_char, any } => { - match escape_char { - Some(ch) => { - f.write_fmt( - format_args!( - "{0} {1}ILIKE {2}{3} ESCAPE \'{4}\'", - expr, - if *negated { "NOT " } else { "" }, - if *any { "ANY" } else { "" }, - pattern, - ch, - ), - ) - } - _ => { - f.write_fmt( - format_args!( - "{0} {1}ILIKE {2}{3}", - expr, - if *negated { "NOT " } else { "" }, - if *any { "ANY " } else { "" }, - pattern, - ), - ) - } - } - } - Expr::RLike { negated, expr, pattern, regexp } => { - f.write_fmt( - format_args!( - "{0} {1}{2} {3}", - expr, - if *negated { "NOT " } else { "" }, - if *regexp { "REGEXP" } else { "RLIKE" }, - pattern, - ), - ) - } - Expr::IsNormalized { expr, form, negated } => { - let not_ = if *negated { "NOT " } else { "" }; - if form.is_none() { - f.write_fmt( - format_args!("{0} IS {1}NORMALIZED", expr, not_), - ) - } else { - f.write_fmt( - format_args!( - "{0} IS {1}{2} NORMALIZED", - expr, - not_, - form.as_ref().unwrap(), - ), - ) - } - } - Expr::SimilarTo { negated, expr, pattern, escape_char } => { - match escape_char { - Some(ch) => { - f.write_fmt( - format_args!( - "{0} {1}SIMILAR TO {2} ESCAPE \'{3}\'", - expr, - if *negated { "NOT " } else { "" }, - pattern, - ch, - ), - ) - } - _ => { - f.write_fmt( - format_args!( - "{0} {1}SIMILAR TO {2}", - expr, - if *negated { "NOT " } else { "" }, - pattern, - ), - ) - } - } - } - Expr::AnyOp { left, compare_op, right, is_some } => { - let add_parens = !match right.as_ref() { - Expr::Subquery(_) => true, - _ => false, - }; - f.write_fmt( - format_args!( - "{3} {4} {0}{1}{5}{2}", - if *is_some { "SOME" } else { "ANY" }, - if add_parens { "(" } else { "" }, - if add_parens { ")" } else { "" }, - left, - compare_op, - right, - ), - ) - } - Expr::AllOp { left, compare_op, right } => { - let add_parens = !match right.as_ref() { - Expr::Subquery(_) => true, - _ => false, - }; - f.write_fmt( - format_args!( - "{2} {3} ALL{0}{4}{1}", - if add_parens { "(" } else { "" }, - if add_parens { ")" } else { "" }, - left, - compare_op, - right, - ), - ) - } - Expr::UnaryOp { op, expr } => { - if op == &UnaryOperator::PGPostfixFactorial { - f.write_fmt(format_args!("{0}{1}", expr, op)) - } else if op == &UnaryOperator::Not { - f.write_fmt(format_args!("{0} {1}", op, expr)) - } else { - f.write_fmt(format_args!("{0}{1}", op, expr)) - } - } - Expr::Convert { - is_try, - expr, - target_before_value, - data_type, - charset, - styles, - } => { - f.write_fmt( - format_args!( - "{0}CONVERT(", - if *is_try { "TRY_" } else { "" }, - ), - )?; - if let Some(data_type) = data_type { - if let Some(charset) = charset { - f.write_fmt( - format_args!( - "{0}, {1} CHARACTER SET {2}", - expr, - data_type, - charset, - ), - ) - } else if *target_before_value { - f.write_fmt(format_args!("{0}, {1}", data_type, expr)) - } else { - f.write_fmt(format_args!("{0}, {1}", expr, data_type)) - } - } else if let Some(charset) = charset { - f.write_fmt(format_args!("{0} USING {1}", expr, charset)) - } else { - f.write_fmt(format_args!("{0}", expr)) - }?; - if !styles.is_empty() { - f.write_fmt( - format_args!(", {0}", display_comma_separated(styles)), - )?; - } - f.write_fmt(format_args!(")")) - } - Expr::Cast { kind, expr, data_type, format } => { - match kind { - CastKind::Cast => { - if let Some(format) = format { - f.write_fmt( - format_args!( - "CAST({0} AS {1} FORMAT {2})", - expr, - data_type, - format, - ), - ) - } else { - f.write_fmt( - format_args!("CAST({0} AS {1})", expr, data_type), - ) - } - } - CastKind::TryCast => { - if let Some(format) = format { - f.write_fmt( - format_args!( - "TRY_CAST({0} AS {1} FORMAT {2})", - expr, - data_type, - format, - ), - ) - } else { - f.write_fmt( - format_args!("TRY_CAST({0} AS {1})", expr, data_type), - ) - } - } - CastKind::SafeCast => { - if let Some(format) = format { - f.write_fmt( - format_args!( - "SAFE_CAST({0} AS {1} FORMAT {2})", - expr, - data_type, - format, - ), - ) - } else { - f.write_fmt( - format_args!("SAFE_CAST({0} AS {1})", expr, data_type), - ) - } - } - CastKind::DoubleColon => { - f.write_fmt(format_args!("{0}::{1}", expr, data_type)) - } - } - } - Expr::Extract { field, syntax, expr } => { - match syntax { - ExtractSyntax::From => { - f.write_fmt( - format_args!("EXTRACT({0} FROM {1})", field, expr), - ) - } - ExtractSyntax::Comma => { - f.write_fmt(format_args!("EXTRACT({0}, {1})", field, expr)) - } - } - } - Expr::Ceil { expr, field } => { - match field { - CeilFloorKind::DateTimeField(DateTimeField::NoDateTime) => { - f.write_fmt(format_args!("CEIL({0})", expr)) - } - CeilFloorKind::DateTimeField(dt_field) => { - f.write_fmt( - format_args!("CEIL({0} TO {1})", expr, dt_field), - ) - } - CeilFloorKind::Scale(s) => { - f.write_fmt(format_args!("CEIL({0}, {1})", expr, s)) - } - } - } - Expr::Floor { expr, field } => { - match field { - CeilFloorKind::DateTimeField(DateTimeField::NoDateTime) => { - f.write_fmt(format_args!("FLOOR({0})", expr)) - } - CeilFloorKind::DateTimeField(dt_field) => { - f.write_fmt( - format_args!("FLOOR({0} TO {1})", expr, dt_field), - ) - } - CeilFloorKind::Scale(s) => { - f.write_fmt(format_args!("FLOOR({0}, {1})", expr, s)) - } - } - } - Expr::Position { expr, r#in } => { - f.write_fmt( - format_args!("POSITION({0} IN {1})", expr, r#in), - ) - } - Expr::Collate { expr, collation } => { - f.write_fmt( - format_args!("{0} COLLATE {1}", expr, collation), - ) - } - Expr::Nested(ast) => f.write_fmt(format_args!("({0})", ast)), - Expr::Value(v) => f.write_fmt(format_args!("{0}", v)), - Expr::IntroducedString { introducer, value } => { - f.write_fmt(format_args!("{0} {1}", introducer, value)) - } - Expr::TypedString { data_type, value } => { - f.write_fmt(format_args!("{0}", data_type))?; - f.write_fmt(format_args!(" {0}", value)) - } - Expr::Function(fun) => f.write_fmt(format_args!("{0}", fun)), - Expr::Method(method) => { - f.write_fmt(format_args!("{0}", method)) - } - Expr::Case { operand, conditions, results, else_result } => { - f.write_fmt(format_args!("CASE"))?; - if let Some(operand) = operand { - f.write_fmt(format_args!(" {0}", operand))?; - } - for (c, r) in conditions.iter().zip(results) { - f.write_fmt(format_args!(" WHEN {0} THEN {1}", c, r))?; - } - if let Some(else_result) = else_result { - f.write_fmt(format_args!(" ELSE {0}", else_result))?; - } - f.write_fmt(format_args!(" END")) - } - Expr::Exists { subquery, negated } => { - f.write_fmt( - format_args!( - "{0}EXISTS ({1})", - if *negated { "NOT " } else { "" }, - subquery, - ), - ) - } - Expr::Subquery(s) => f.write_fmt(format_args!("({0})", s)), - Expr::GroupingSets(sets) => { - f.write_fmt(format_args!("GROUPING SETS ("))?; - let mut sep = ""; - for set in sets { - f.write_fmt(format_args!("{0}", sep))?; - sep = ", "; - f.write_fmt( - format_args!("({0})", display_comma_separated(set)), - )?; - } - f.write_fmt(format_args!(")")) - } - Expr::Cube(sets) => { - f.write_fmt(format_args!("CUBE ("))?; - let mut sep = ""; - for set in sets { - f.write_fmt(format_args!("{0}", sep))?; - sep = ", "; - if set.len() == 1 { - f.write_fmt(format_args!("{0}", set[0]))?; - } else { - f.write_fmt( - format_args!("({0})", display_comma_separated(set)), - )?; - } - } - f.write_fmt(format_args!(")")) - } - Expr::Rollup(sets) => { - f.write_fmt(format_args!("ROLLUP ("))?; - let mut sep = ""; - for set in sets { - f.write_fmt(format_args!("{0}", sep))?; - sep = ", "; - if set.len() == 1 { - f.write_fmt(format_args!("{0}", set[0]))?; - } else { - f.write_fmt( - format_args!("({0})", display_comma_separated(set)), - )?; - } - } - f.write_fmt(format_args!(")")) - } - Expr::Substring { - expr, - substring_from, - substring_for, - special, - } => { - f.write_fmt(format_args!("SUBSTRING({0}", expr))?; - if let Some(from_part) = substring_from { - if *special { - f.write_fmt(format_args!(", {0}", from_part))?; - } else { - f.write_fmt(format_args!(" FROM {0}", from_part))?; - } - } - if let Some(for_part) = substring_for { - if *special { - f.write_fmt(format_args!(", {0}", for_part))?; - } else { - f.write_fmt(format_args!(" FOR {0}", for_part))?; - } - } - f.write_fmt(format_args!(")")) - } - Expr::Overlay { - expr, - overlay_what, - overlay_from, - overlay_for, - } => { - f.write_fmt( - format_args!( - "OVERLAY({0} PLACING {1} FROM {2}", - expr, - overlay_what, - overlay_from, - ), - )?; - if let Some(for_part) = overlay_for { - f.write_fmt(format_args!(" FOR {0}", for_part))?; - } - f.write_fmt(format_args!(")")) - } - Expr::IsDistinctFrom(a, b) => { - f.write_fmt(format_args!("{0} IS DISTINCT FROM {1}", a, b)) - } - Expr::IsNotDistinctFrom(a, b) => { - f.write_fmt( - format_args!("{0} IS NOT DISTINCT FROM {1}", a, b), - ) - } - Expr::Trim { - expr, - trim_where, - trim_what, - trim_characters, - } => { - f.write_fmt(format_args!("TRIM("))?; - if let Some(ident) = trim_where { - f.write_fmt(format_args!("{0} ", ident))?; - } - if let Some(trim_char) = trim_what { - f.write_fmt(format_args!("{0} FROM {1}", trim_char, expr))?; - } else { - f.write_fmt(format_args!("{0}", expr))?; - } - if let Some(characters) = trim_characters { - f.write_fmt( - format_args!(", {0}", display_comma_separated(characters)), - )?; - } - f.write_fmt(format_args!(")")) - } - Expr::Tuple(exprs) => { - f.write_fmt( - format_args!("({0})", display_comma_separated(exprs)), - ) - } - Expr::Struct { values, fields } => { - if !fields.is_empty() { - f.write_fmt( - format_args!( - "STRUCT<{0}>({1})", - display_comma_separated(fields), - display_comma_separated(values), - ), - ) - } else { - f.write_fmt( - format_args!("STRUCT({0})", display_comma_separated(values)), - ) - } - } - Expr::Named { expr, name } => { - f.write_fmt(format_args!("{0} AS {1}", expr, name)) - } - Expr::Dictionary(fields) => { - f.write_fmt( - format_args!("{{{0}}}", display_comma_separated(fields)), - ) - } - Expr::Map(map) => f.write_fmt(format_args!("{0}", map)), - Expr::Array(set) => f.write_fmt(format_args!("{0}", set)), - Expr::JsonAccess { value, path } => { - f.write_fmt(format_args!("{0}{1}", value, path)) - } - Expr::CompositeAccess { expr, key } => { - f.write_fmt(format_args!("{0}.{1}", expr, key)) - } - Expr::AtTimeZone { timestamp, time_zone } => { - f.write_fmt( - format_args!("{0} AT TIME ZONE {1}", timestamp, time_zone), - ) - } - Expr::Interval(interval) => { - f.write_fmt(format_args!("{0}", interval)) - } - Expr::MatchAgainst { - columns, - match_value: match_expr, - opt_search_modifier, - } => { - f.write_fmt( - format_args!( - "MATCH ({0}) AGAINST ", - display_comma_separated(columns), - ), - )?; - if let Some(search_modifier) = opt_search_modifier { - f.write_fmt( - format_args!("({0} {1})", match_expr, search_modifier), - )?; - } else { - f.write_fmt(format_args!("({0})", match_expr))?; - } - Ok(()) - } - Expr::OuterJoin(expr) => { - f.write_fmt(format_args!("{0} (+)", expr)) - } - Expr::Prior(expr) => { - f.write_fmt(format_args!("PRIOR {0}", expr)) - } - Expr::Lambda(lambda) => { - f.write_fmt(format_args!("{0}", lambda)) - } - } - } - }, - ) - } - } - pub enum WindowType { - WindowSpec(WindowSpec), - NamedWindow(Ident), - } - #[automatically_derived] - impl ::core::fmt::Debug for WindowType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - WindowType::WindowSpec(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "WindowSpec", - &__self_0, - ) - } - WindowType::NamedWindow(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "NamedWindow", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for WindowType { - #[inline] - fn clone(&self) -> WindowType { - match self { - WindowType::WindowSpec(__self_0) => { - WindowType::WindowSpec(::core::clone::Clone::clone(__self_0)) - } - WindowType::NamedWindow(__self_0) => { - WindowType::NamedWindow(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for WindowType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for WindowType { - #[inline] - fn eq(&self, other: &WindowType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - WindowType::WindowSpec(__self_0), - WindowType::WindowSpec(__arg1_0), - ) => __self_0 == __arg1_0, - ( - WindowType::NamedWindow(__self_0), - WindowType::NamedWindow(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for WindowType { - #[inline] - fn partial_cmp( - &self, - other: &WindowType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (WindowType::WindowSpec(__self_0), WindowType::WindowSpec(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - WindowType::NamedWindow(__self_0), - WindowType::NamedWindow(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for WindowType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for WindowType { - #[inline] - fn cmp(&self, other: &WindowType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - WindowType::WindowSpec(__self_0), - WindowType::WindowSpec(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - WindowType::NamedWindow(__self_0), - WindowType::NamedWindow(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for WindowType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - WindowType::WindowSpec(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - WindowType::NamedWindow(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl Display for WindowType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - WindowType::WindowSpec(spec) => f.write_fmt(format_args!("({0})", spec)), - WindowType::NamedWindow(name) => f.write_fmt(format_args!("{0}", name)), - } - } - } - /// A window specification (i.e. `OVER ([window_name] PARTITION BY .. ORDER BY .. etc.)`) - pub struct WindowSpec { - /// Optional window name. - /// - /// You can find it at least in [MySQL][1], [BigQuery][2], [PostgreSQL][3] - /// - /// [1]: https://dev.mysql.com/doc/refman/8.0/en/window-functions-named-windows.html - /// [2]: https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls - /// [3]: https://www.postgresql.org/docs/current/sql-expressions.html#SYNTAX-WINDOW-FUNCTIONS - pub window_name: Option, - /// `OVER (PARTITION BY ...)` - pub partition_by: Vec, - /// `OVER (ORDER BY ...)` - pub order_by: Vec, - /// `OVER (window frame)` - pub window_frame: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for WindowSpec { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "WindowSpec", - "window_name", - &self.window_name, - "partition_by", - &self.partition_by, - "order_by", - &self.order_by, - "window_frame", - &&self.window_frame, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for WindowSpec { - #[inline] - fn clone(&self) -> WindowSpec { - WindowSpec { - window_name: ::core::clone::Clone::clone(&self.window_name), - partition_by: ::core::clone::Clone::clone(&self.partition_by), - order_by: ::core::clone::Clone::clone(&self.order_by), - window_frame: ::core::clone::Clone::clone(&self.window_frame), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for WindowSpec {} - #[automatically_derived] - impl ::core::cmp::PartialEq for WindowSpec { - #[inline] - fn eq(&self, other: &WindowSpec) -> bool { - self.window_name == other.window_name - && self.partition_by == other.partition_by - && self.order_by == other.order_by - && self.window_frame == other.window_frame - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for WindowSpec { - #[inline] - fn partial_cmp( - &self, - other: &WindowSpec, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.window_name, - &other.window_name, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.partition_by, - &other.partition_by, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.order_by, - &other.order_by, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.window_frame, - &other.window_frame, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for WindowSpec { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for WindowSpec { - #[inline] - fn cmp(&self, other: &WindowSpec) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.window_name, &other.window_name) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.partition_by, - &other.partition_by, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.order_by, - &other.order_by, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp( - &self.window_frame, - &other.window_frame, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for WindowSpec { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.window_name, state); - ::core::hash::Hash::hash(&self.partition_by, state); - ::core::hash::Hash::hash(&self.order_by, state); - ::core::hash::Hash::hash(&self.window_frame, state) - } - } - impl fmt::Display for WindowSpec { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let mut delim = ""; - if let Some(window_name) = &self.window_name { - delim = " "; - f.write_fmt(format_args!("{0}", window_name))?; - } - if !self.partition_by.is_empty() { - f.write_str(delim)?; - delim = " "; - f.write_fmt( - format_args!( - "PARTITION BY {0}", - display_comma_separated(&self.partition_by), - ), - )?; - } - if !self.order_by.is_empty() { - f.write_str(delim)?; - delim = " "; - f.write_fmt( - format_args!("ORDER BY {0}", display_comma_separated(&self.order_by)), - )?; - } - if let Some(window_frame) = &self.window_frame { - f.write_str(delim)?; - if let Some(end_bound) = &window_frame.end_bound { - f.write_fmt( - format_args!( - "{0} BETWEEN {1} AND {2}", - window_frame.units, - window_frame.start_bound, - end_bound, - ), - )?; - } else { - f.write_fmt( - format_args!( - "{0} {1}", - window_frame.units, - window_frame.start_bound, - ), - )?; - } - } - Ok(()) - } - } - /// Specifies the data processed by a window function, e.g. - /// `RANGE UNBOUNDED PRECEDING` or `ROWS BETWEEN 5 PRECEDING AND CURRENT ROW`. - /// - /// Note: The parser does not validate the specified bounds; the caller should - /// reject invalid bounds like `ROWS UNBOUNDED FOLLOWING` before execution. - pub struct WindowFrame { - pub units: WindowFrameUnits, - pub start_bound: WindowFrameBound, - /// The right bound of the `BETWEEN .. AND` clause. The end bound of `None` - /// indicates the shorthand form (e.g. `ROWS 1 PRECEDING`), which must - /// behave the same as `end_bound = WindowFrameBound::CurrentRow`. - pub end_bound: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for WindowFrame { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "WindowFrame", - "units", - &self.units, - "start_bound", - &self.start_bound, - "end_bound", - &&self.end_bound, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for WindowFrame { - #[inline] - fn clone(&self) -> WindowFrame { - WindowFrame { - units: ::core::clone::Clone::clone(&self.units), - start_bound: ::core::clone::Clone::clone(&self.start_bound), - end_bound: ::core::clone::Clone::clone(&self.end_bound), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for WindowFrame {} - #[automatically_derived] - impl ::core::cmp::PartialEq for WindowFrame { - #[inline] - fn eq(&self, other: &WindowFrame) -> bool { - self.units == other.units && self.start_bound == other.start_bound - && self.end_bound == other.end_bound - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for WindowFrame { - #[inline] - fn partial_cmp( - &self, - other: &WindowFrame, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.units, &other.units) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.start_bound, - &other.start_bound, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.end_bound, - &other.end_bound, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for WindowFrame { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for WindowFrame { - #[inline] - fn cmp(&self, other: &WindowFrame) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.units, &other.units) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.start_bound, &other.start_bound) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.end_bound, &other.end_bound) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for WindowFrame { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.units, state); - ::core::hash::Hash::hash(&self.start_bound, state); - ::core::hash::Hash::hash(&self.end_bound, state) - } - } - impl Default for WindowFrame { - /// Returns default value for window frame - /// - /// See [this page](https://www.sqlite.org/windowfunctions.html#frame_specifications) for more details. - fn default() -> Self { - Self { - units: WindowFrameUnits::Range, - start_bound: WindowFrameBound::Preceding(None), - end_bound: None, - } - } - } - pub enum WindowFrameUnits { - Rows, - Range, - Groups, - } - #[automatically_derived] - impl ::core::fmt::Debug for WindowFrameUnits { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - WindowFrameUnits::Rows => "Rows", - WindowFrameUnits::Range => "Range", - WindowFrameUnits::Groups => "Groups", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for WindowFrameUnits {} - #[automatically_derived] - impl ::core::clone::Clone for WindowFrameUnits { - #[inline] - fn clone(&self) -> WindowFrameUnits { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for WindowFrameUnits {} - #[automatically_derived] - impl ::core::cmp::PartialEq for WindowFrameUnits { - #[inline] - fn eq(&self, other: &WindowFrameUnits) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for WindowFrameUnits { - #[inline] - fn partial_cmp( - &self, - other: &WindowFrameUnits, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for WindowFrameUnits { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for WindowFrameUnits { - #[inline] - fn cmp(&self, other: &WindowFrameUnits) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for WindowFrameUnits { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for WindowFrameUnits { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - WindowFrameUnits::Rows => "ROWS", - WindowFrameUnits::Range => "RANGE", - WindowFrameUnits::Groups => "GROUPS", - }, - ) - } - } - /// Specifies Ignore / Respect NULL within window functions. - /// For example - /// `FIRST_VALUE(column2) IGNORE NULLS OVER (PARTITION BY column1)` - pub enum NullTreatment { - IgnoreNulls, - RespectNulls, - } - #[automatically_derived] - impl ::core::fmt::Debug for NullTreatment { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - NullTreatment::IgnoreNulls => "IgnoreNulls", - NullTreatment::RespectNulls => "RespectNulls", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for NullTreatment {} - #[automatically_derived] - impl ::core::clone::Clone for NullTreatment { - #[inline] - fn clone(&self) -> NullTreatment { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for NullTreatment {} - #[automatically_derived] - impl ::core::cmp::PartialEq for NullTreatment { - #[inline] - fn eq(&self, other: &NullTreatment) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for NullTreatment { - #[inline] - fn partial_cmp( - &self, - other: &NullTreatment, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for NullTreatment { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for NullTreatment { - #[inline] - fn cmp(&self, other: &NullTreatment) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for NullTreatment { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for NullTreatment { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - NullTreatment::IgnoreNulls => "IGNORE NULLS", - NullTreatment::RespectNulls => "RESPECT NULLS", - }, - ) - } - } - /// Specifies [WindowFrame]'s `start_bound` and `end_bound` - pub enum WindowFrameBound { - /// `CURRENT ROW` - CurrentRow, - /// ` PRECEDING` or `UNBOUNDED PRECEDING` - Preceding(Option>), - /// ` FOLLOWING` or `UNBOUNDED FOLLOWING`. - Following(Option>), - } - #[automatically_derived] - impl ::core::fmt::Debug for WindowFrameBound { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - WindowFrameBound::CurrentRow => { - ::core::fmt::Formatter::write_str(f, "CurrentRow") - } - WindowFrameBound::Preceding(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Preceding", - &__self_0, - ) - } - WindowFrameBound::Following(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Following", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for WindowFrameBound { - #[inline] - fn clone(&self) -> WindowFrameBound { - match self { - WindowFrameBound::CurrentRow => WindowFrameBound::CurrentRow, - WindowFrameBound::Preceding(__self_0) => { - WindowFrameBound::Preceding(::core::clone::Clone::clone(__self_0)) - } - WindowFrameBound::Following(__self_0) => { - WindowFrameBound::Following(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for WindowFrameBound {} - #[automatically_derived] - impl ::core::cmp::PartialEq for WindowFrameBound { - #[inline] - fn eq(&self, other: &WindowFrameBound) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - WindowFrameBound::Preceding(__self_0), - WindowFrameBound::Preceding(__arg1_0), - ) => __self_0 == __arg1_0, - ( - WindowFrameBound::Following(__self_0), - WindowFrameBound::Following(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for WindowFrameBound { - #[inline] - fn partial_cmp( - &self, - other: &WindowFrameBound, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - WindowFrameBound::Preceding(__self_0), - WindowFrameBound::Preceding(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - WindowFrameBound::Following(__self_0), - WindowFrameBound::Following(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for WindowFrameBound { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for WindowFrameBound { - #[inline] - fn cmp(&self, other: &WindowFrameBound) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - WindowFrameBound::Preceding(__self_0), - WindowFrameBound::Preceding(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - WindowFrameBound::Following(__self_0), - WindowFrameBound::Following(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for WindowFrameBound { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - WindowFrameBound::Preceding(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - WindowFrameBound::Following(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for WindowFrameBound { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - WindowFrameBound::CurrentRow => f.write_str("CURRENT ROW"), - WindowFrameBound::Preceding(None) => f.write_str("UNBOUNDED PRECEDING"), - WindowFrameBound::Following(None) => f.write_str("UNBOUNDED FOLLOWING"), - WindowFrameBound::Preceding(Some(n)) => { - f.write_fmt(format_args!("{0} PRECEDING", n)) - } - WindowFrameBound::Following(Some(n)) => { - f.write_fmt(format_args!("{0} FOLLOWING", n)) - } - } - } - } - pub enum AddDropSync { - ADD, - DROP, - SYNC, - } - #[automatically_derived] - impl ::core::fmt::Debug for AddDropSync { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - AddDropSync::ADD => "ADD", - AddDropSync::DROP => "DROP", - AddDropSync::SYNC => "SYNC", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for AddDropSync {} - #[automatically_derived] - impl ::core::clone::Clone for AddDropSync { - #[inline] - fn clone(&self) -> AddDropSync { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for AddDropSync {} - #[automatically_derived] - impl ::core::cmp::PartialEq for AddDropSync { - #[inline] - fn eq(&self, other: &AddDropSync) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for AddDropSync { - #[inline] - fn partial_cmp( - &self, - other: &AddDropSync, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for AddDropSync { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for AddDropSync { - #[inline] - fn cmp(&self, other: &AddDropSync) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for AddDropSync { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for AddDropSync { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - AddDropSync::SYNC => f.write_str("SYNC PARTITIONS"), - AddDropSync::DROP => f.write_str("DROP PARTITIONS"), - AddDropSync::ADD => f.write_str("ADD PARTITIONS"), - } - } - } - pub enum ShowCreateObject { - Event, - Function, - Procedure, - Table, - Trigger, - View, - } - #[automatically_derived] - impl ::core::fmt::Debug for ShowCreateObject { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ShowCreateObject::Event => "Event", - ShowCreateObject::Function => "Function", - ShowCreateObject::Procedure => "Procedure", - ShowCreateObject::Table => "Table", - ShowCreateObject::Trigger => "Trigger", - ShowCreateObject::View => "View", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for ShowCreateObject {} - #[automatically_derived] - impl ::core::clone::Clone for ShowCreateObject { - #[inline] - fn clone(&self) -> ShowCreateObject { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ShowCreateObject {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ShowCreateObject { - #[inline] - fn eq(&self, other: &ShowCreateObject) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ShowCreateObject { - #[inline] - fn partial_cmp( - &self, - other: &ShowCreateObject, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ShowCreateObject { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ShowCreateObject { - #[inline] - fn cmp(&self, other: &ShowCreateObject) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ShowCreateObject { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ShowCreateObject { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ShowCreateObject::Event => f.write_str("EVENT"), - ShowCreateObject::Function => f.write_str("FUNCTION"), - ShowCreateObject::Procedure => f.write_str("PROCEDURE"), - ShowCreateObject::Table => f.write_str("TABLE"), - ShowCreateObject::Trigger => f.write_str("TRIGGER"), - ShowCreateObject::View => f.write_str("VIEW"), - } - } - } - pub enum CommentObject { - Column, - Table, - Extension, - Schema, - Database, - User, - Role, - } - #[automatically_derived] - impl ::core::fmt::Debug for CommentObject { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - CommentObject::Column => "Column", - CommentObject::Table => "Table", - CommentObject::Extension => "Extension", - CommentObject::Schema => "Schema", - CommentObject::Database => "Database", - CommentObject::User => "User", - CommentObject::Role => "Role", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for CommentObject {} - #[automatically_derived] - impl ::core::clone::Clone for CommentObject { - #[inline] - fn clone(&self) -> CommentObject { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CommentObject {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CommentObject { - #[inline] - fn eq(&self, other: &CommentObject) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CommentObject { - #[inline] - fn partial_cmp( - &self, - other: &CommentObject, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CommentObject { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for CommentObject { - #[inline] - fn cmp(&self, other: &CommentObject) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for CommentObject { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for CommentObject { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CommentObject::Column => f.write_str("COLUMN"), - CommentObject::Table => f.write_str("TABLE"), - CommentObject::Extension => f.write_str("EXTENSION"), - CommentObject::Schema => f.write_str("SCHEMA"), - CommentObject::Database => f.write_str("DATABASE"), - CommentObject::User => f.write_str("USER"), - CommentObject::Role => f.write_str("ROLE"), - } - } - } - pub enum Password { - Password(Expr), - NullPassword, - } - #[automatically_derived] - impl ::core::fmt::Debug for Password { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Password::Password(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Password", - &__self_0, - ) - } - Password::NullPassword => { - ::core::fmt::Formatter::write_str(f, "NullPassword") - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for Password { - #[inline] - fn clone(&self) -> Password { - match self { - Password::Password(__self_0) => { - Password::Password(::core::clone::Clone::clone(__self_0)) - } - Password::NullPassword => Password::NullPassword, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Password {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Password { - #[inline] - fn eq(&self, other: &Password) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (Password::Password(__self_0), Password::Password(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Password { - #[inline] - fn partial_cmp( - &self, - other: &Password, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (Password::Password(__self_0), Password::Password(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Password { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Password { - #[inline] - fn cmp(&self, other: &Password) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (Password::Password(__self_0), Password::Password(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Password { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Password::Password(__self_0) => ::core::hash::Hash::hash(__self_0, state), - _ => {} - } - } - } - /// Represents an expression assignment within a variable `DECLARE` statement. - /// - /// Examples: - /// ```sql - /// DECLARE variable_name := 42 - /// DECLARE variable_name DEFAULT 42 - /// ``` - pub enum DeclareAssignment { - /// Plain expression specified. - Expr(Box), - /// Expression assigned via the `DEFAULT` keyword - Default(Box), - /// Expression assigned via the `:=` syntax - /// - /// Example: - /// ```sql - /// DECLARE variable_name := 42; - /// ``` - DuckAssignment(Box), - /// Expression via the `FOR` keyword - /// - /// Example: - /// ```sql - /// DECLARE c1 CURSOR FOR res - /// ``` - For(Box), - /// Expression via the `=` syntax. - /// - /// Example: - /// ```sql - /// DECLARE @variable AS INT = 100 - /// ``` - MsSqlAssignment(Box), - } - #[automatically_derived] - impl ::core::fmt::Debug for DeclareAssignment { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - DeclareAssignment::Expr(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Expr", - &__self_0, - ) - } - DeclareAssignment::Default(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Default", - &__self_0, - ) - } - DeclareAssignment::DuckAssignment(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "DuckAssignment", - &__self_0, - ) - } - DeclareAssignment::For(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "For", - &__self_0, - ) - } - DeclareAssignment::MsSqlAssignment(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "MsSqlAssignment", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for DeclareAssignment { - #[inline] - fn clone(&self) -> DeclareAssignment { - match self { - DeclareAssignment::Expr(__self_0) => { - DeclareAssignment::Expr(::core::clone::Clone::clone(__self_0)) - } - DeclareAssignment::Default(__self_0) => { - DeclareAssignment::Default(::core::clone::Clone::clone(__self_0)) - } - DeclareAssignment::DuckAssignment(__self_0) => { - DeclareAssignment::DuckAssignment( - ::core::clone::Clone::clone(__self_0), - ) - } - DeclareAssignment::For(__self_0) => { - DeclareAssignment::For(::core::clone::Clone::clone(__self_0)) - } - DeclareAssignment::MsSqlAssignment(__self_0) => { - DeclareAssignment::MsSqlAssignment( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for DeclareAssignment {} - #[automatically_derived] - impl ::core::cmp::PartialEq for DeclareAssignment { - #[inline] - fn eq(&self, other: &DeclareAssignment) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - DeclareAssignment::Expr(__self_0), - DeclareAssignment::Expr(__arg1_0), - ) => __self_0 == __arg1_0, - ( - DeclareAssignment::Default(__self_0), - DeclareAssignment::Default(__arg1_0), - ) => __self_0 == __arg1_0, - ( - DeclareAssignment::DuckAssignment(__self_0), - DeclareAssignment::DuckAssignment(__arg1_0), - ) => __self_0 == __arg1_0, - ( - DeclareAssignment::For(__self_0), - DeclareAssignment::For(__arg1_0), - ) => __self_0 == __arg1_0, - ( - DeclareAssignment::MsSqlAssignment(__self_0), - DeclareAssignment::MsSqlAssignment(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for DeclareAssignment { - #[inline] - fn partial_cmp( - &self, - other: &DeclareAssignment, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - DeclareAssignment::Expr(__self_0), - DeclareAssignment::Expr(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - DeclareAssignment::Default(__self_0), - DeclareAssignment::Default(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - DeclareAssignment::DuckAssignment(__self_0), - DeclareAssignment::DuckAssignment(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (DeclareAssignment::For(__self_0), DeclareAssignment::For(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - DeclareAssignment::MsSqlAssignment(__self_0), - DeclareAssignment::MsSqlAssignment(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for DeclareAssignment { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for DeclareAssignment { - #[inline] - fn cmp(&self, other: &DeclareAssignment) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - DeclareAssignment::Expr(__self_0), - DeclareAssignment::Expr(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - DeclareAssignment::Default(__self_0), - DeclareAssignment::Default(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - DeclareAssignment::DuckAssignment(__self_0), - DeclareAssignment::DuckAssignment(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - DeclareAssignment::For(__self_0), - DeclareAssignment::For(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - DeclareAssignment::MsSqlAssignment(__self_0), - DeclareAssignment::MsSqlAssignment(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for DeclareAssignment { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - DeclareAssignment::Expr(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - DeclareAssignment::Default(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - DeclareAssignment::DuckAssignment(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - DeclareAssignment::For(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - DeclareAssignment::MsSqlAssignment(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for DeclareAssignment { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - DeclareAssignment::Expr(expr) => f.write_fmt(format_args!("{0}", expr)), - DeclareAssignment::Default(expr) => { - f.write_fmt(format_args!("DEFAULT {0}", expr)) - } - DeclareAssignment::DuckAssignment(expr) => { - f.write_fmt(format_args!(":= {0}", expr)) - } - DeclareAssignment::MsSqlAssignment(expr) => { - f.write_fmt(format_args!("= {0}", expr)) - } - DeclareAssignment::For(expr) => { - f.write_fmt(format_args!("FOR {0}", expr)) - } - } - } - } - /// Represents the type of a `DECLARE` statement. - pub enum DeclareType { - /// Cursor variable type. e.g. [Snowflake] [Postgres] - /// - /// [Snowflake]: https://docs.snowflake.com/en/developer-guide/snowflake-scripting/cursors#declaring-a-cursor - /// [Postgres]: https://www.postgresql.org/docs/current/plpgsql-cursors.html - Cursor, - /// Result set variable type. [Snowflake] - /// - /// Syntax: - /// ```text - /// RESULTSET [ { DEFAULT | := } ( ) ] ; - /// ``` - /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/snowflake-scripting/declare#resultset-declaration-syntax - ResultSet, - /// Exception declaration syntax. [Snowflake] - /// - /// Syntax: - /// ```text - /// EXCEPTION [ ( , '' ) ] ; - /// ``` - /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/snowflake-scripting/declare#exception-declaration-syntax - Exception, - } - #[automatically_derived] - impl ::core::fmt::Debug for DeclareType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - DeclareType::Cursor => "Cursor", - DeclareType::ResultSet => "ResultSet", - DeclareType::Exception => "Exception", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for DeclareType { - #[inline] - fn clone(&self) -> DeclareType { - match self { - DeclareType::Cursor => DeclareType::Cursor, - DeclareType::ResultSet => DeclareType::ResultSet, - DeclareType::Exception => DeclareType::Exception, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for DeclareType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for DeclareType { - #[inline] - fn eq(&self, other: &DeclareType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for DeclareType { - #[inline] - fn partial_cmp( - &self, - other: &DeclareType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for DeclareType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for DeclareType { - #[inline] - fn cmp(&self, other: &DeclareType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for DeclareType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for DeclareType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - DeclareType::Cursor => f.write_fmt(format_args!("CURSOR")), - DeclareType::ResultSet => f.write_fmt(format_args!("RESULTSET")), - DeclareType::Exception => f.write_fmt(format_args!("EXCEPTION")), - } - } - } - /// A `DECLARE` statement. - /// [Postgres] [Snowflake] [BigQuery] - /// - /// Examples: - /// ```sql - /// DECLARE variable_name := 42 - /// DECLARE liahona CURSOR FOR SELECT * FROM films; - /// ``` - /// - /// [Postgres]: https://www.postgresql.org/docs/current/sql-declare.html - /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/snowflake-scripting/declare - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#declare - pub struct Declare { - /// The name(s) being declared. - /// Example: `DECLARE a, b, c DEFAULT 42; - pub names: Vec, - /// Data-type assigned to the declared variable. - /// Example: `DECLARE x INT64 DEFAULT 42; - pub data_type: Option, - /// Expression being assigned to the declared variable. - pub assignment: Option, - /// Represents the type of the declared variable. - pub declare_type: Option, - /// Causes the cursor to return data in binary rather than in text format. - pub binary: Option, - /// None = Not specified - /// Some(true) = INSENSITIVE - /// Some(false) = ASENSITIVE - pub sensitive: Option, - /// None = Not specified - /// Some(true) = SCROLL - /// Some(false) = NO SCROLL - pub scroll: Option, - /// None = Not specified - /// Some(true) = WITH HOLD, specifies that the cursor can continue to be used after the transaction that created it successfully commits - /// Some(false) = WITHOUT HOLD, specifies that the cursor cannot be used outside of the transaction that created it - pub hold: Option, - /// `FOR ` clause in a CURSOR declaration. - pub for_query: Option>, - } - #[automatically_derived] - impl ::core::fmt::Debug for Declare { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - let names: &'static _ = &[ - "names", - "data_type", - "assignment", - "declare_type", - "binary", - "sensitive", - "scroll", - "hold", - "for_query", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - &self.names, - &self.data_type, - &self.assignment, - &self.declare_type, - &self.binary, - &self.sensitive, - &self.scroll, - &self.hold, - &&self.for_query, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Declare", - names, - values, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Declare { - #[inline] - fn clone(&self) -> Declare { - Declare { - names: ::core::clone::Clone::clone(&self.names), - data_type: ::core::clone::Clone::clone(&self.data_type), - assignment: ::core::clone::Clone::clone(&self.assignment), - declare_type: ::core::clone::Clone::clone(&self.declare_type), - binary: ::core::clone::Clone::clone(&self.binary), - sensitive: ::core::clone::Clone::clone(&self.sensitive), - scroll: ::core::clone::Clone::clone(&self.scroll), - hold: ::core::clone::Clone::clone(&self.hold), - for_query: ::core::clone::Clone::clone(&self.for_query), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Declare {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Declare { - #[inline] - fn eq(&self, other: &Declare) -> bool { - self.names == other.names && self.data_type == other.data_type - && self.assignment == other.assignment - && self.declare_type == other.declare_type && self.binary == other.binary - && self.sensitive == other.sensitive && self.scroll == other.scroll - && self.hold == other.hold && self.for_query == other.for_query - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Declare { - #[inline] - fn partial_cmp( - &self, - other: &Declare, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.names, &other.names) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.data_type, - &other.data_type, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.assignment, - &other.assignment, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.declare_type, - &other.declare_type, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.binary, - &other.binary, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.sensitive, - &other.sensitive, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.scroll, - &other.scroll, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.hold, - &other.hold, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.for_query, - &other.for_query, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Declare { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Declare { - #[inline] - fn cmp(&self, other: &Declare) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.names, &other.names) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.data_type, &other.data_type) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.assignment, - &other.assignment, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.declare_type, - &other.declare_type, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.binary, &other.binary) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.sensitive, - &other.sensitive, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.scroll, &other.scroll) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.hold, &other.hold) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.for_query, &other.for_query) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Declare { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.names, state); - ::core::hash::Hash::hash(&self.data_type, state); - ::core::hash::Hash::hash(&self.assignment, state); - ::core::hash::Hash::hash(&self.declare_type, state); - ::core::hash::Hash::hash(&self.binary, state); - ::core::hash::Hash::hash(&self.sensitive, state); - ::core::hash::Hash::hash(&self.scroll, state); - ::core::hash::Hash::hash(&self.hold, state); - ::core::hash::Hash::hash(&self.for_query, state) - } - } - impl fmt::Display for Declare { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let Declare { - names, - data_type, - assignment, - declare_type, - binary, - sensitive, - scroll, - hold, - for_query, - } = self; - f.write_fmt(format_args!("{0}", display_comma_separated(names)))?; - if let Some(true) = binary { - f.write_fmt(format_args!(" BINARY"))?; - } - if let Some(sensitive) = sensitive { - if *sensitive { - f.write_fmt(format_args!(" INSENSITIVE"))?; - } else { - f.write_fmt(format_args!(" ASENSITIVE"))?; - } - } - if let Some(scroll) = scroll { - if *scroll { - f.write_fmt(format_args!(" SCROLL"))?; - } else { - f.write_fmt(format_args!(" NO SCROLL"))?; - } - } - if let Some(declare_type) = declare_type { - f.write_fmt(format_args!(" {0}", declare_type))?; - } - if let Some(hold) = hold { - if *hold { - f.write_fmt(format_args!(" WITH HOLD"))?; - } else { - f.write_fmt(format_args!(" WITHOUT HOLD"))?; - } - } - if let Some(query) = for_query { - f.write_fmt(format_args!(" FOR {0}", query))?; - } - if let Some(data_type) = data_type { - f.write_fmt(format_args!(" {0}", data_type))?; - } - if let Some(expr) = assignment { - f.write_fmt(format_args!(" {0}", expr))?; - } - Ok(()) - } - } - /// Sql options of a `CREATE TABLE` statement. - pub enum CreateTableOptions { - None, - /// Options specified using the `WITH` keyword. - /// e.g. `WITH (description = "123")` - /// - /// - /// - /// MSSQL supports more specific options that's not only key-value pairs. - /// - /// WITH ( - /// DISTRIBUTION = ROUND_ROBIN, - /// CLUSTERED INDEX (column_a DESC, column_b) - /// ) - /// - /// - With(Vec), - /// Options specified using the `OPTIONS` keyword. - /// e.g. `OPTIONS(description = "123")` - /// - /// - Options(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for CreateTableOptions { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CreateTableOptions::None => ::core::fmt::Formatter::write_str(f, "None"), - CreateTableOptions::With(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "With", - &__self_0, - ) - } - CreateTableOptions::Options(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Options", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreateTableOptions { - #[inline] - fn clone(&self) -> CreateTableOptions { - match self { - CreateTableOptions::None => CreateTableOptions::None, - CreateTableOptions::With(__self_0) => { - CreateTableOptions::With(::core::clone::Clone::clone(__self_0)) - } - CreateTableOptions::Options(__self_0) => { - CreateTableOptions::Options(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreateTableOptions {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreateTableOptions { - #[inline] - fn eq(&self, other: &CreateTableOptions) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CreateTableOptions::With(__self_0), - CreateTableOptions::With(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CreateTableOptions::Options(__self_0), - CreateTableOptions::Options(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreateTableOptions { - #[inline] - fn partial_cmp( - &self, - other: &CreateTableOptions, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CreateTableOptions::With(__self_0), - CreateTableOptions::With(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CreateTableOptions::Options(__self_0), - CreateTableOptions::Options(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreateTableOptions { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CreateTableOptions { - #[inline] - fn cmp(&self, other: &CreateTableOptions) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CreateTableOptions::With(__self_0), - CreateTableOptions::With(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CreateTableOptions::Options(__self_0), - CreateTableOptions::Options(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreateTableOptions { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CreateTableOptions::With(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CreateTableOptions::Options(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for CreateTableOptions { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CreateTableOptions::With(with_options) => { - f.write_fmt( - format_args!("WITH ({0})", display_comma_separated(with_options)), - ) - } - CreateTableOptions::Options(options) => { - f.write_fmt( - format_args!("OPTIONS({0})", display_comma_separated(options)), - ) - } - CreateTableOptions::None => Ok(()), - } - } - } - /// A `FROM` clause within a `DELETE` statement. - /// - /// Syntax - /// ```sql - /// [FROM] table - /// ``` - pub enum FromTable { - /// An explicit `FROM` keyword was specified. - WithFromKeyword(Vec), - /// BigQuery: `FROM` keyword was omitted. - /// - WithoutKeyword(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for FromTable { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - FromTable::WithFromKeyword(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "WithFromKeyword", - &__self_0, - ) - } - FromTable::WithoutKeyword(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "WithoutKeyword", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for FromTable { - #[inline] - fn clone(&self) -> FromTable { - match self { - FromTable::WithFromKeyword(__self_0) => { - FromTable::WithFromKeyword(::core::clone::Clone::clone(__self_0)) - } - FromTable::WithoutKeyword(__self_0) => { - FromTable::WithoutKeyword(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FromTable {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FromTable { - #[inline] - fn eq(&self, other: &FromTable) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - FromTable::WithFromKeyword(__self_0), - FromTable::WithFromKeyword(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FromTable::WithoutKeyword(__self_0), - FromTable::WithoutKeyword(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FromTable { - #[inline] - fn partial_cmp( - &self, - other: &FromTable, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - FromTable::WithFromKeyword(__self_0), - FromTable::WithFromKeyword(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FromTable::WithoutKeyword(__self_0), - FromTable::WithoutKeyword(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FromTable { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FromTable { - #[inline] - fn cmp(&self, other: &FromTable) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - FromTable::WithFromKeyword(__self_0), - FromTable::WithFromKeyword(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FromTable::WithoutKeyword(__self_0), - FromTable::WithoutKeyword(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FromTable { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - FromTable::WithFromKeyword(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FromTable::WithoutKeyword(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl Display for FromTable { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - FromTable::WithFromKeyword(tables) => { - f.write_fmt( - format_args!("FROM {0}", display_comma_separated(tables)), - ) - } - FromTable::WithoutKeyword(tables) => { - f.write_fmt(format_args!("{0}", display_comma_separated(tables))) - } - } - } - } - /// Policy type for a `CREATE POLICY` statement. - /// ```sql - /// AS [ PERMISSIVE | RESTRICTIVE ] - /// ``` - /// [PostgreSQL](https://www.postgresql.org/docs/current/sql-createpolicy.html) - pub enum CreatePolicyType { - Permissive, - Restrictive, - } - #[automatically_derived] - impl ::core::fmt::Debug for CreatePolicyType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - CreatePolicyType::Permissive => "Permissive", - CreatePolicyType::Restrictive => "Restrictive", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreatePolicyType { - #[inline] - fn clone(&self) -> CreatePolicyType { - match self { - CreatePolicyType::Permissive => CreatePolicyType::Permissive, - CreatePolicyType::Restrictive => CreatePolicyType::Restrictive, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreatePolicyType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreatePolicyType { - #[inline] - fn eq(&self, other: &CreatePolicyType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreatePolicyType { - #[inline] - fn partial_cmp( - &self, - other: &CreatePolicyType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreatePolicyType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for CreatePolicyType { - #[inline] - fn cmp(&self, other: &CreatePolicyType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreatePolicyType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - /// Policy command for a `CREATE POLICY` statement. - /// ```sql - /// FOR [ALL | SELECT | INSERT | UPDATE | DELETE] - /// ``` - /// [PostgreSQL](https://www.postgresql.org/docs/current/sql-createpolicy.html) - pub enum CreatePolicyCommand { - All, - Select, - Insert, - Update, - Delete, - } - #[automatically_derived] - impl ::core::fmt::Debug for CreatePolicyCommand { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - CreatePolicyCommand::All => "All", - CreatePolicyCommand::Select => "Select", - CreatePolicyCommand::Insert => "Insert", - CreatePolicyCommand::Update => "Update", - CreatePolicyCommand::Delete => "Delete", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreatePolicyCommand { - #[inline] - fn clone(&self) -> CreatePolicyCommand { - match self { - CreatePolicyCommand::All => CreatePolicyCommand::All, - CreatePolicyCommand::Select => CreatePolicyCommand::Select, - CreatePolicyCommand::Insert => CreatePolicyCommand::Insert, - CreatePolicyCommand::Update => CreatePolicyCommand::Update, - CreatePolicyCommand::Delete => CreatePolicyCommand::Delete, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreatePolicyCommand {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreatePolicyCommand { - #[inline] - fn eq(&self, other: &CreatePolicyCommand) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreatePolicyCommand { - #[inline] - fn partial_cmp( - &self, - other: &CreatePolicyCommand, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreatePolicyCommand { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for CreatePolicyCommand { - #[inline] - fn cmp(&self, other: &CreatePolicyCommand) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreatePolicyCommand { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - /// A top-level statement (SELECT, INSERT, CREATE, etc.) - #[allow(clippy::large_enum_variant)] - pub enum Statement { - /// ```sql - /// ANALYZE - /// ``` - /// Analyze (Hive) - Analyze { - table_name: ObjectName, - partitions: Option>, - for_columns: bool, - columns: Vec, - cache_metadata: bool, - noscan: bool, - compute_statistics: bool, - has_table_keyword: bool, - }, - /// ```sql - /// TRUNCATE - /// ``` - /// Truncate (Hive) - Truncate { - table_names: Vec, - partitions: Option>, - /// TABLE - optional keyword; - table: bool, - /// Postgres-specific option - /// [ TRUNCATE TABLE ONLY ] - only: bool, - /// Postgres-specific option - /// [ RESTART IDENTITY | CONTINUE IDENTITY ] - identity: Option, - /// Postgres-specific option - /// [ CASCADE | RESTRICT ] - cascade: Option, - /// ClickHouse-specific option - /// [ ON CLUSTER cluster_name ] - /// - /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/truncate/) - on_cluster: Option, - }, - /// ```sql - /// MSCK - /// ``` - /// Msck (Hive) - Msck { - table_name: ObjectName, - repair: bool, - partition_action: Option, - }, - /// ```sql - /// SELECT - /// ``` - Query(Box), - /// ```sql - /// INSERT - /// ``` - Insert(Insert), - /// ```sql - /// INSTALL - /// ``` - Install { - /// Only for DuckDB - extension_name: Ident, - }, - /// ```sql - /// LOAD - /// ``` - Load { - /// Only for DuckDB - extension_name: Ident, - }, - Directory { - overwrite: bool, - local: bool, - path: String, - file_format: Option, - source: Box, - }, - /// ```sql - /// CALL - /// ``` - Call(Function), - /// ```sql - /// COPY [TO | FROM] ... - /// ``` - Copy { - /// The source of 'COPY TO', or the target of 'COPY FROM' - source: CopySource, - /// If true, is a 'COPY TO' statement. If false is a 'COPY FROM' - to: bool, - /// The target of 'COPY TO', or the source of 'COPY FROM' - target: CopyTarget, - /// WITH options (from PostgreSQL version 9.0) - options: Vec, - /// WITH options (before PostgreSQL version 9.0) - legacy_options: Vec, - /// VALUES a vector of values to be copied - values: Vec>, - }, - /// ```sql - /// COPY INTO - /// ``` - /// See - /// Copy Into syntax available for Snowflake is different than the one implemented in - /// Postgres. Although they share common prefix, it is reasonable to implement them - /// in different enums. This can be refactored later once custom dialects - /// are allowed to have custom Statements. - CopyIntoSnowflake { - into: ObjectName, - from_stage: ObjectName, - from_stage_alias: Option, - stage_params: StageParamsObject, - from_transformations: Option>, - files: Option>, - pattern: Option, - file_format: DataLoadingOptions, - copy_options: DataLoadingOptions, - validation_mode: Option, - }, - /// ```sql - /// CLOSE - /// ``` - /// Closes the portal underlying an open cursor. - Close { - /// Cursor name - cursor: CloseCursor, - }, - /// ```sql - /// UPDATE - /// ``` - Update { - /// TABLE - table: TableWithJoins, - /// Column assignments - assignments: Vec, - /// Table which provide value to be set - from: Option, - /// WHERE - selection: Option, - /// RETURNING - returning: Option>, - /// SQLite-specific conflict resolution clause - or: Option, - }, - /// ```sql - /// DELETE - /// ``` - Delete(Delete), - /// ```sql - /// CREATE VIEW - /// ``` - CreateView { - or_replace: bool, - materialized: bool, - /// View name - name: ObjectName, - columns: Vec, - query: Box, - options: CreateTableOptions, - cluster_by: Vec, - /// Snowflake: Views can have comments in Snowflake. - /// - comment: Option, - /// if true, has RedShift [`WITH NO SCHEMA BINDING`] clause - with_no_schema_binding: bool, - /// if true, has SQLite `IF NOT EXISTS` clause - if_not_exists: bool, - /// if true, has SQLite `TEMP` or `TEMPORARY` clause - temporary: bool, - /// if not None, has Clickhouse `TO` clause, specify the table into which to insert results - /// - to: Option, - /// MySQL: Optional parameters for the view algorithm, definer, and security context - params: Option, - }, - /// ```sql - /// CREATE TABLE - /// ``` - CreateTable(CreateTable), - /// ```sql - /// CREATE VIRTUAL TABLE .. USING ()` - /// ``` - /// Sqlite specific statement - CreateVirtualTable { - name: ObjectName, - if_not_exists: bool, - module_name: Ident, - module_args: Vec, - }, - /// ```sql - /// `CREATE INDEX` - /// ``` - CreateIndex(CreateIndex), - /// ```sql - /// CREATE ROLE - /// ``` - /// See [postgres](https://www.postgresql.org/docs/current/sql-createrole.html) - CreateRole { - names: Vec, - if_not_exists: bool, - login: Option, - inherit: Option, - bypassrls: Option, - password: Option, - superuser: Option, - create_db: Option, - create_role: Option, - replication: Option, - connection_limit: Option, - valid_until: Option, - in_role: Vec, - in_group: Vec, - role: Vec, - user: Vec, - admin: Vec, - authorization_owner: Option, - }, - /// ```sql - /// CREATE SECRET - /// ``` - /// See [duckdb](https://duckdb.org/docs/sql/statements/create_secret.html) - CreateSecret { - or_replace: bool, - temporary: Option, - if_not_exists: bool, - name: Option, - storage_specifier: Option, - secret_type: Ident, - options: Vec, - }, - /// ```sql - /// CREATE POLICY - /// ``` - /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-createpolicy.html) - CreatePolicy { - name: Ident, - table_name: ObjectName, - policy_type: Option, - command: Option, - to: Option>, - using: Option, - with_check: Option, - }, - /// ```sql - /// CREATE CONNECTOR - /// ``` - /// See [Hive](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=27362034#LanguageManualDDL-CreateDataConnectorCreateConnector) - CreateConnector(CreateConnector), - /// ```sql - /// ALTER TABLE - /// ``` - AlterTable { - /// Table name - name: ObjectName, - if_exists: bool, - only: bool, - operations: Vec, - location: Option, - /// ClickHouse dialect supports `ON CLUSTER` clause for ALTER TABLE - /// For example: `ALTER TABLE table_name ON CLUSTER cluster_name ADD COLUMN c UInt32` - /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/alter/update) - on_cluster: Option, - }, - /// ```sql - /// ALTER INDEX - /// ``` - AlterIndex { name: ObjectName, operation: AlterIndexOperation }, - /// ```sql - /// ALTER VIEW - /// ``` - AlterView { - /// View name - name: ObjectName, - columns: Vec, - query: Box, - with_options: Vec, - }, - /// ```sql - /// ALTER ROLE - /// ``` - AlterRole { name: Ident, operation: AlterRoleOperation }, - /// ```sql - /// ALTER POLICY ON
[] - /// ``` - /// (Postgresql-specific) - AlterPolicy { - name: Ident, - table_name: ObjectName, - operation: AlterPolicyOperation, - }, - /// ```sql - /// ALTER CONNECTOR connector_name SET DCPROPERTIES(property_name=property_value, ...); - /// or - /// ALTER CONNECTOR connector_name SET URL new_url; - /// or - /// ALTER CONNECTOR connector_name SET OWNER [USER|ROLE] user_or_role; - /// ``` - /// (Hive-specific) - AlterConnector { - name: Ident, - properties: Option>, - url: Option, - owner: Option, - }, - /// ```sql - /// ATTACH DATABASE 'path/to/file' AS alias - /// ``` - /// (SQLite-specific) - AttachDatabase { - /// The name to bind to the newly attached database - schema_name: Ident, - /// An expression that indicates the path to the database file - database_file_name: Expr, - /// true if the syntax is 'ATTACH DATABASE', false if it's just 'ATTACH' - database: bool, - }, - /// (DuckDB-specific) - /// ```sql - /// ATTACH 'sqlite_file.db' AS sqlite_db (READ_ONLY, TYPE SQLITE); - /// ``` - /// See - AttachDuckDBDatabase { - if_not_exists: bool, - /// true if the syntax is 'ATTACH DATABASE', false if it's just 'ATTACH' - database: bool, - /// An expression that indicates the path to the database file - database_path: Ident, - database_alias: Option, - attach_options: Vec, - }, - /// (DuckDB-specific) - /// ```sql - /// DETACH db_alias; - /// ``` - /// See - DetachDuckDBDatabase { - if_exists: bool, - /// true if the syntax is 'DETACH DATABASE', false if it's just 'DETACH' - database: bool, - database_alias: Ident, - }, - /// ```sql - /// DROP [TABLE, VIEW, ...] - /// ``` - Drop { - /// The type of the object to drop: TABLE, VIEW, etc. - object_type: ObjectType, - /// An optional `IF EXISTS` clause. (Non-standard.) - if_exists: bool, - /// One or more objects to drop. (ANSI SQL requires exactly one.) - names: Vec, - /// Whether `CASCADE` was specified. This will be `false` when - /// `RESTRICT` or no drop behavior at all was specified. - cascade: bool, - /// Whether `RESTRICT` was specified. This will be `false` when - /// `CASCADE` or no drop behavior at all was specified. - restrict: bool, - /// Hive allows you specify whether the table's stored data will be - /// deleted along with the dropped table - purge: bool, - /// MySQL-specific "TEMPORARY" keyword - temporary: bool, - }, - /// ```sql - /// DROP FUNCTION - /// ``` - DropFunction { - if_exists: bool, - /// One or more function to drop - func_desc: Vec, - /// `CASCADE` or `RESTRICT` - drop_behavior: Option, - }, - /// ```sql - /// DROP PROCEDURE - /// ``` - DropProcedure { - if_exists: bool, - /// One or more function to drop - proc_desc: Vec, - /// `CASCADE` or `RESTRICT` - drop_behavior: Option, - }, - /// ```sql - /// DROP SECRET - /// ``` - DropSecret { - if_exists: bool, - temporary: Option, - name: Ident, - storage_specifier: Option, - }, - ///```sql - /// DROP POLICY - /// ``` - /// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-droppolicy.html) - DropPolicy { - if_exists: bool, - name: Ident, - table_name: ObjectName, - drop_behavior: Option, - }, - /// ```sql - /// DROP CONNECTOR - /// ``` - /// See [Hive](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=27362034#LanguageManualDDL-DropConnector) - DropConnector { if_exists: bool, name: Ident }, - /// ```sql - /// DECLARE - /// ``` - /// Declare Cursor Variables - /// - /// Note: this is a PostgreSQL-specific statement, - /// but may also compatible with other SQL. - Declare { stmts: Vec }, - /// ```sql - /// CREATE EXTENSION [ IF NOT EXISTS ] extension_name - /// [ WITH ] [ SCHEMA schema_name ] - /// [ VERSION version ] - /// [ CASCADE ] - /// ``` - /// - /// Note: this is a PostgreSQL-specific statement, - CreateExtension { - name: Ident, - if_not_exists: bool, - cascade: bool, - schema: Option, - version: Option, - }, - /// ```sql - /// DROP EXTENSION [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] - /// - /// Note: this is a PostgreSQL-specific statement. - /// https://www.postgresql.org/docs/current/sql-dropextension.html - /// ``` - DropExtension { - names: Vec, - if_exists: bool, - /// `CASCADE` or `RESTRICT` - cascade_or_restrict: Option, - }, - /// ```sql - /// FETCH - /// ``` - /// Retrieve rows from a query using a cursor - /// - /// Note: this is a PostgreSQL-specific statement, - /// but may also compatible with other SQL. - Fetch { - /// Cursor name - name: Ident, - direction: FetchDirection, - /// Optional, It's possible to fetch rows form cursor to the table - into: Option, - }, - /// ```sql - /// FLUSH [NO_WRITE_TO_BINLOG | LOCAL] flush_option [, flush_option] ... | tables_option - /// ``` - /// - /// Note: this is a Mysql-specific statement, - /// but may also compatible with other SQL. - Flush { - object_type: FlushType, - location: Option, - channel: Option, - read_lock: bool, - export: bool, - tables: Vec, - }, - /// ```sql - /// DISCARD [ ALL | PLANS | SEQUENCES | TEMPORARY | TEMP ] - /// ``` - /// - /// Note: this is a PostgreSQL-specific statement, - /// but may also compatible with other SQL. - Discard { object_type: DiscardObject }, - /// ```sql - /// SET [ SESSION | LOCAL ] ROLE role_name - /// ``` - /// - /// Sets session state. Examples: [ANSI][1], [Postgresql][2], [MySQL][3], and [Oracle][4] - /// - /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#set-role-statement - /// [2]: https://www.postgresql.org/docs/14/sql-set-role.html - /// [3]: https://dev.mysql.com/doc/refman/8.0/en/set-role.html - /// [4]: https://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_10004.htm - SetRole { - /// Non-ANSI optional identifier to inform if the role is defined inside the current session (`SESSION`) or transaction (`LOCAL`). - context_modifier: ContextModifier, - /// Role name. If NONE is specified, then the current role name is removed. - role_name: Option, - }, - /// ```sql - /// SET = expression; - /// SET (variable[, ...]) = (expression[, ...]); - /// ``` - /// - /// Note: this is not a standard SQL statement, but it is supported by at - /// least MySQL and PostgreSQL. Not all MySQL-specific syntactic forms are - /// supported yet. - SetVariable { - local: bool, - hivevar: bool, - variables: OneOrManyWithParens, - value: Vec, - }, - /// ```sql - /// SET TIME ZONE - /// ``` - /// - /// Note: this is a PostgreSQL-specific statements - /// `SET TIME ZONE ` is an alias for `SET timezone TO ` in PostgreSQL - SetTimeZone { local: bool, value: Expr }, - /// ```sql - /// SET NAMES 'charset_name' [COLLATE 'collation_name'] - /// ``` - /// - /// Note: this is a MySQL-specific statement. - SetNames { charset_name: String, collation_name: Option }, - /// ```sql - /// SET NAMES DEFAULT - /// ``` - /// - /// Note: this is a MySQL-specific statement. - SetNamesDefault {}, - /// `SHOW FUNCTIONS` - /// - /// Note: this is a Presto-specific statement. - ShowFunctions { filter: Option }, - /// ```sql - /// SHOW - /// ``` - /// - /// Note: this is a PostgreSQL-specific statement. - ShowVariable { variable: Vec }, - /// ```sql - /// SHOW [GLOBAL | SESSION] STATUS [LIKE 'pattern' | WHERE expr] - /// ``` - /// - /// Note: this is a MySQL-specific statement. - ShowStatus { filter: Option, global: bool, session: bool }, - /// ```sql - /// SHOW VARIABLES - /// ``` - /// - /// Note: this is a MySQL-specific statement. - ShowVariables { - filter: Option, - global: bool, - session: bool, - }, - /// ```sql - /// SHOW CREATE TABLE - /// ``` - /// - /// Note: this is a MySQL-specific statement. - ShowCreate { obj_type: ShowCreateObject, obj_name: ObjectName }, - /// ```sql - /// SHOW COLUMNS - /// ``` - ShowColumns { extended: bool, full: bool, show_options: ShowStatementOptions }, - /// ```sql - /// SHOW DATABASES - /// ``` - ShowDatabases { terse: bool, history: bool, show_options: ShowStatementOptions }, - /// ```sql - /// SHOW SCHEMAS - /// ``` - ShowSchemas { terse: bool, history: bool, show_options: ShowStatementOptions }, - /// ```sql - /// SHOW TABLES - /// ``` - ShowTables { - terse: bool, - history: bool, - extended: bool, - full: bool, - external: bool, - show_options: ShowStatementOptions, - }, - /// ```sql - /// SHOW VIEWS - /// ``` - ShowViews { - terse: bool, - materialized: bool, - show_options: ShowStatementOptions, - }, - /// ```sql - /// SHOW COLLATION - /// ``` - /// - /// Note: this is a MySQL-specific statement. - ShowCollation { filter: Option }, - /// ```sql - /// `USE ...` - /// ``` - Use(Use), - /// ```sql - /// START [ TRANSACTION | WORK ] | START TRANSACTION } ... - /// ``` - /// If `begin` is false. - /// - /// ```sql - /// `BEGIN [ TRANSACTION | WORK ] | START TRANSACTION } ...` - /// ``` - /// If `begin` is true - StartTransaction { - modes: Vec, - begin: bool, - transaction: Option, - modifier: Option, - }, - /// ```sql - /// SET TRANSACTION ... - /// ``` - SetTransaction { - modes: Vec, - snapshot: Option, - session: bool, - }, - /// ```sql - /// COMMENT ON ... - /// ``` - /// - /// Note: this is a PostgreSQL-specific statement. - Comment { - object_type: CommentObject, - object_name: ObjectName, - comment: Option, - /// An optional `IF EXISTS` clause. (Non-standard.) - /// See - if_exists: bool, - }, - /// ```sql - /// COMMIT [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ] - /// ``` - /// If `end` is false - /// - /// ```sql - /// END [ TRY | CATCH ] - /// ``` - /// If `end` is true - Commit { chain: bool, end: bool, modifier: Option }, - /// ```sql - /// ROLLBACK [ TRANSACTION | WORK ] [ AND [ NO ] CHAIN ] [ TO [ SAVEPOINT ] savepoint_name ] - /// ``` - Rollback { chain: bool, savepoint: Option }, - /// ```sql - /// CREATE SCHEMA - /// ``` - CreateSchema { - /// ` | AUTHORIZATION | AUTHORIZATION ` - schema_name: SchemaName, - if_not_exists: bool, - }, - /// ```sql - /// CREATE DATABASE - /// ``` - CreateDatabase { - db_name: ObjectName, - if_not_exists: bool, - location: Option, - managed_location: Option, - }, - /// ```sql - /// CREATE FUNCTION - /// ``` - /// - /// Supported variants: - /// 1. [Hive](https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Create/Drop/ReloadFunction) - /// 2. [Postgres](https://www.postgresql.org/docs/15/sql-createfunction.html) - /// 3. [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement) - CreateFunction(CreateFunction), - /// CREATE TRIGGER - /// - /// Examples: - /// - /// ```sql - /// CREATE TRIGGER trigger_name - /// BEFORE INSERT ON table_name - /// FOR EACH ROW - /// EXECUTE FUNCTION trigger_function(); - /// ``` - /// - /// Postgres: - CreateTrigger { - /// The `OR REPLACE` clause is used to re-create the trigger if it already exists. - /// - /// Example: - /// ```sql - /// CREATE OR REPLACE TRIGGER trigger_name - /// AFTER INSERT ON table_name - /// FOR EACH ROW - /// EXECUTE FUNCTION trigger_function(); - /// ``` - or_replace: bool, - /// The `CONSTRAINT` keyword is used to create a trigger as a constraint. - is_constraint: bool, - /// The name of the trigger to be created. - name: ObjectName, - /// Determines whether the function is called before, after, or instead of the event. - /// - /// Example of BEFORE: - /// - /// ```sql - /// CREATE TRIGGER trigger_name - /// BEFORE INSERT ON table_name - /// FOR EACH ROW - /// EXECUTE FUNCTION trigger_function(); - /// ``` - /// - /// Example of AFTER: - /// - /// ```sql - /// CREATE TRIGGER trigger_name - /// AFTER INSERT ON table_name - /// FOR EACH ROW - /// EXECUTE FUNCTION trigger_function(); - /// ``` - /// - /// Example of INSTEAD OF: - /// - /// ```sql - /// CREATE TRIGGER trigger_name - /// INSTEAD OF INSERT ON table_name - /// FOR EACH ROW - /// EXECUTE FUNCTION trigger_function(); - /// ``` - period: TriggerPeriod, - /// Multiple events can be specified using OR, such as `INSERT`, `UPDATE`, `DELETE`, or `TRUNCATE`. - events: Vec, - /// The table on which the trigger is to be created. - table_name: ObjectName, - /// The optional referenced table name that can be referenced via - /// the `FROM` keyword. - referenced_table_name: Option, - /// This keyword immediately precedes the declaration of one or two relation names that provide access to the transition relations of the triggering statement. - referencing: Vec, - /// This specifies whether the trigger function should be fired once for - /// every row affected by the trigger event, or just once per SQL statement. - trigger_object: TriggerObject, - /// Whether to include the `EACH` term of the `FOR EACH`, as it is optional syntax. - include_each: bool, - /// Triggering conditions - condition: Option, - /// Execute logic block - exec_body: TriggerExecBody, - /// The characteristic of the trigger, which include whether the trigger is `DEFERRABLE`, `INITIALLY DEFERRED`, or `INITIALLY IMMEDIATE`, - characteristics: Option, - }, - /// DROP TRIGGER - /// - /// ```sql - /// DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ] - /// ``` - /// - DropTrigger { - if_exists: bool, - trigger_name: ObjectName, - table_name: ObjectName, - /// `CASCADE` or `RESTRICT` - option: Option, - }, - /// ```sql - /// CREATE PROCEDURE - /// ``` - CreateProcedure { - or_alter: bool, - name: ObjectName, - params: Option>, - body: Vec, - }, - /// ```sql - /// CREATE MACRO - /// ``` - /// - /// Supported variants: - /// 1. [DuckDB](https://duckdb.org/docs/sql/statements/create_macro) - CreateMacro { - or_replace: bool, - temporary: bool, - name: ObjectName, - args: Option>, - definition: MacroDefinition, - }, - /// ```sql - /// CREATE STAGE - /// ``` - /// See - CreateStage { - or_replace: bool, - temporary: bool, - if_not_exists: bool, - name: ObjectName, - stage_params: StageParamsObject, - directory_table_params: DataLoadingOptions, - file_format: DataLoadingOptions, - copy_options: DataLoadingOptions, - comment: Option, - }, - /// ```sql - /// ASSERT [AS ] - /// ``` - Assert { condition: Expr, message: Option }, - /// ```sql - /// GRANT privileges ON objects TO grantees - /// ``` - Grant { - privileges: Privileges, - objects: Option, - grantees: Vec, - with_grant_option: bool, - granted_by: Option, - }, - /// ```sql - /// REVOKE privileges ON objects FROM grantees - /// ``` - Revoke { - privileges: Privileges, - objects: Option, - grantees: Vec, - granted_by: Option, - cascade: Option, - }, - /// ```sql - /// DEALLOCATE [ PREPARE ] { name | ALL } - /// ``` - /// - /// Note: this is a PostgreSQL-specific statement. - Deallocate { name: Ident, prepare: bool }, - /// ```sql - /// EXECUTE name [ ( parameter [, ...] ) ] [USING ] - /// ``` - /// - /// Note: this statement is supported by Postgres and MSSQL, with slight differences in syntax. - /// - /// Postgres: - /// MSSQL: - Execute { - name: ObjectName, - parameters: Vec, - has_parentheses: bool, - using: Vec, - }, - /// ```sql - /// PREPARE name [ ( data_type [, ...] ) ] AS statement - /// ``` - /// - /// Note: this is a PostgreSQL-specific statement. - Prepare { name: Ident, data_types: Vec, statement: Box }, - /// ```sql - /// KILL [CONNECTION | QUERY | MUTATION] - /// ``` - /// - /// See - /// See - Kill { modifier: Option, id: u64 }, - /// ```sql - /// [EXPLAIN | DESC | DESCRIBE] TABLE - /// ``` - /// Note: this is a MySQL-specific statement. See - ExplainTable { - /// `EXPLAIN | DESC | DESCRIBE` - describe_alias: DescribeAlias, - /// Hive style `FORMATTED | EXTENDED` - hive_format: Option, - /// Snowflake and ClickHouse support `DESC|DESCRIBE TABLE ` syntax - /// - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/desc-table.html) - /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/describe-table) - has_table_keyword: bool, - /// Table name - table_name: ObjectName, - }, - /// ```sql - /// [EXPLAIN | DESC | DESCRIBE] - /// ``` - Explain { - /// `EXPLAIN | DESC | DESCRIBE` - describe_alias: DescribeAlias, - /// Carry out the command and show actual run times and other statistics. - analyze: bool, - verbose: bool, - /// `EXPLAIN QUERY PLAN` - /// Display the query plan without running the query. - /// - /// [SQLite](https://sqlite.org/lang_explain.html) - query_plan: bool, - /// `EXPLAIN ESTIMATE` - /// [Clickhouse](https://clickhouse.com/docs/en/sql-reference/statements/explain#explain-estimate) - estimate: bool, - /// A SQL query that specifies what to explain - statement: Box, - /// Optional output format of explain - format: Option, - /// Postgres style utility options, `(analyze, verbose true)` - options: Option>, - }, - /// ```sql - /// SAVEPOINT - /// ``` - /// Define a new savepoint within the current transaction - Savepoint { name: Ident }, - /// ```sql - /// RELEASE [ SAVEPOINT ] savepoint_name - /// ``` - ReleaseSavepoint { name: Ident }, - /// A `MERGE` statement. - /// - /// ```sql - /// MERGE INTO USING ON { matchedClause | notMatchedClause } [ ... ] - /// ``` - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/merge) - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - Merge { - /// optional INTO keyword - into: bool, - /// Specifies the table to merge - table: TableFactor, - /// Specifies the table or subquery to join with the target table - source: TableFactor, - /// Specifies the expression on which to join the target table and source - on: Box, - /// Specifies the actions to perform when values match or do not match. - clauses: Vec, - }, - /// ```sql - /// CACHE [ FLAG ] TABLE [ OPTIONS('K1' = 'V1', 'K2' = V2) ] [ AS ] [ ] - /// ``` - /// - /// See [Spark SQL docs] for more details. - /// - /// [Spark SQL docs]: https://docs.databricks.com/spark/latest/spark-sql/language-manual/sql-ref-syntax-aux-cache-cache-table.html - Cache { - /// Table flag - table_flag: Option, - /// Table name - table_name: ObjectName, - has_as: bool, - /// Table confs - options: Vec, - /// Cache table as a Query - query: Option>, - }, - /// ```sql - /// UNCACHE TABLE [ IF EXISTS ] - /// ``` - UNCache { - /// Table name - table_name: ObjectName, - if_exists: bool, - }, - /// ```sql - /// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] - /// ``` - /// Define a new sequence: - CreateSequence { - temporary: bool, - if_not_exists: bool, - name: ObjectName, - data_type: Option, - sequence_options: Vec, - owned_by: Option, - }, - /// ```sql - /// CREATE TYPE - /// ``` - CreateType { name: ObjectName, representation: UserDefinedTypeRepresentation }, - /// ```sql - /// PRAGMA . = - /// ``` - Pragma { name: ObjectName, value: Option, is_eq: bool }, - /// ```sql - /// LOCK TABLES [READ [LOCAL] | [LOW_PRIORITY] WRITE] - /// ``` - /// Note: this is a MySQL-specific statement. See - LockTables { tables: Vec }, - /// ```sql - /// UNLOCK TABLES - /// ``` - /// Note: this is a MySQL-specific statement. See - UnlockTables, - /// ```sql - /// UNLOAD(statement) TO [ WITH options ] - /// ``` - /// See Redshift and - Unload { query: Box, to: Ident, with: Vec }, - /// ```sql - /// OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE [BY expression]] - /// ``` - /// - /// See ClickHouse - OptimizeTable { - name: ObjectName, - on_cluster: Option, - partition: Option, - include_final: bool, - deduplicate: Option, - }, - /// ```sql - /// LISTEN - /// ``` - /// listen for a notification channel - /// - /// See Postgres - LISTEN { channel: Ident }, - /// ```sql - /// UNLISTEN - /// ``` - /// stop listening for a notification - /// - /// See Postgres - UNLISTEN { channel: Ident }, - /// ```sql - /// NOTIFY channel [ , payload ] - /// ``` - /// send a notification event together with an optional “payload” string to channel - /// - /// See Postgres - NOTIFY { channel: Ident, payload: Option }, - /// ```sql - /// LOAD DATA [LOCAL] INPATH 'filepath' [OVERWRITE] INTO TABLE tablename - /// [PARTITION (partcol1=val1, partcol2=val2 ...)] - /// [INPUTFORMAT 'inputformat' SERDE 'serde'] - /// ``` - /// Loading files into tables - /// - /// See Hive - LoadData { - local: bool, - inpath: String, - overwrite: bool, - table_name: ObjectName, - partitioned: Option>, - table_format: Option, - }, - /// ```sql - /// Rename TABLE tbl_name TO new_tbl_name[, tbl_name2 TO new_tbl_name2] ... - /// ``` - /// Renames one or more tables - /// - /// See Mysql - RenameTable(Vec), - /// Snowflake `LIST` - /// See: - List(FileStagingCommand), - /// Snowflake `REMOVE` - /// See: - Remove(FileStagingCommand), - /// MS-SQL session - /// - /// See - SetSessionParam(SetSessionParamKind), - /// RaiseError (MSSQL) - /// RAISERROR ( { msg_id | msg_str | @local_variable } - /// { , severity , state } - /// [ , argument [ , ...n ] ] ) - /// [ WITH option [ , ...n ] ] - /// See - RaisError { - message: Box, - severity: Box, - state: Box, - arguments: Vec, - options: Vec, - }, - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::fmt::Debug for Statement { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Statement::Analyze { - table_name: __self_0, - partitions: __self_1, - for_columns: __self_2, - columns: __self_3, - cache_metadata: __self_4, - noscan: __self_5, - compute_statistics: __self_6, - has_table_keyword: __self_7, - } => { - let names: &'static _ = &[ - "table_name", - "partitions", - "for_columns", - "columns", - "cache_metadata", - "noscan", - "compute_statistics", - "has_table_keyword", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - __self_6, - &__self_7, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Analyze", - names, - values, - ) - } - Statement::Truncate { - table_names: __self_0, - partitions: __self_1, - table: __self_2, - only: __self_3, - identity: __self_4, - cascade: __self_5, - on_cluster: __self_6, - } => { - let names: &'static _ = &[ - "table_names", - "partitions", - "table", - "only", - "identity", - "cascade", - "on_cluster", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - &__self_6, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Truncate", - names, - values, - ) - } - Statement::Msck { - table_name: __self_0, - repair: __self_1, - partition_action: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Msck", - "table_name", - __self_0, - "repair", - __self_1, - "partition_action", - &__self_2, - ) - } - Statement::Query(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Query", - &__self_0, - ) - } - Statement::Insert(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Insert", - &__self_0, - ) - } - Statement::Install { extension_name: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Install", - "extension_name", - &__self_0, - ) - } - Statement::Load { extension_name: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Load", - "extension_name", - &__self_0, - ) - } - Statement::Directory { - overwrite: __self_0, - local: __self_1, - path: __self_2, - file_format: __self_3, - source: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "Directory", - "overwrite", - __self_0, - "local", - __self_1, - "path", - __self_2, - "file_format", - __self_3, - "source", - &__self_4, - ) - } - Statement::Call(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Call", - &__self_0, - ) - } - Statement::Copy { - source: __self_0, - to: __self_1, - target: __self_2, - options: __self_3, - legacy_options: __self_4, - values: __self_5, - } => { - let names: &'static _ = &[ - "source", - "to", - "target", - "options", - "legacy_options", - "values", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Copy", - names, - values, - ) - } - Statement::CopyIntoSnowflake { - into: __self_0, - from_stage: __self_1, - from_stage_alias: __self_2, - stage_params: __self_3, - from_transformations: __self_4, - files: __self_5, - pattern: __self_6, - file_format: __self_7, - copy_options: __self_8, - validation_mode: __self_9, - } => { - let names: &'static _ = &[ - "into", - "from_stage", - "from_stage_alias", - "stage_params", - "from_transformations", - "files", - "pattern", - "file_format", - "copy_options", - "validation_mode", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - __self_6, - __self_7, - __self_8, - &__self_9, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CopyIntoSnowflake", - names, - values, - ) - } - Statement::Close { cursor: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Close", - "cursor", - &__self_0, - ) - } - Statement::Update { - table: __self_0, - assignments: __self_1, - from: __self_2, - selection: __self_3, - returning: __self_4, - or: __self_5, - } => { - let names: &'static _ = &[ - "table", - "assignments", - "from", - "selection", - "returning", - "or", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Update", - names, - values, - ) - } - Statement::Delete(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Delete", - &__self_0, - ) - } - Statement::CreateView { - or_replace: __self_0, - materialized: __self_1, - name: __self_2, - columns: __self_3, - query: __self_4, - options: __self_5, - cluster_by: __self_6, - comment: __self_7, - with_no_schema_binding: __self_8, - if_not_exists: __self_9, - temporary: __self_10, - to: __self_11, - params: __self_12, - } => { - let names: &'static _ = &[ - "or_replace", - "materialized", - "name", - "columns", - "query", - "options", - "cluster_by", - "comment", - "with_no_schema_binding", - "if_not_exists", - "temporary", - "to", - "params", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - __self_6, - __self_7, - __self_8, - __self_9, - __self_10, - __self_11, - &__self_12, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CreateView", - names, - values, - ) - } - Statement::CreateTable(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "CreateTable", - &__self_0, - ) - } - Statement::CreateVirtualTable { - name: __self_0, - if_not_exists: __self_1, - module_name: __self_2, - module_args: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "CreateVirtualTable", - "name", - __self_0, - "if_not_exists", - __self_1, - "module_name", - __self_2, - "module_args", - &__self_3, - ) - } - Statement::CreateIndex(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "CreateIndex", - &__self_0, - ) - } - Statement::CreateRole { - names: __self_0, - if_not_exists: __self_1, - login: __self_2, - inherit: __self_3, - bypassrls: __self_4, - password: __self_5, - superuser: __self_6, - create_db: __self_7, - create_role: __self_8, - replication: __self_9, - connection_limit: __self_10, - valid_until: __self_11, - in_role: __self_12, - in_group: __self_13, - role: __self_14, - user: __self_15, - admin: __self_16, - authorization_owner: __self_17, - } => { - let names: &'static _ = &[ - "names", - "if_not_exists", - "login", - "inherit", - "bypassrls", - "password", - "superuser", - "create_db", - "create_role", - "replication", - "connection_limit", - "valid_until", - "in_role", - "in_group", - "role", - "user", - "admin", - "authorization_owner", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - __self_6, - __self_7, - __self_8, - __self_9, - __self_10, - __self_11, - __self_12, - __self_13, - __self_14, - __self_15, - __self_16, - &__self_17, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CreateRole", - names, - values, - ) - } - Statement::CreateSecret { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - storage_specifier: __self_4, - secret_type: __self_5, - options: __self_6, - } => { - let names: &'static _ = &[ - "or_replace", - "temporary", - "if_not_exists", - "name", - "storage_specifier", - "secret_type", - "options", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - &__self_6, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CreateSecret", - names, - values, - ) - } - Statement::CreatePolicy { - name: __self_0, - table_name: __self_1, - policy_type: __self_2, - command: __self_3, - to: __self_4, - using: __self_5, - with_check: __self_6, - } => { - let names: &'static _ = &[ - "name", - "table_name", - "policy_type", - "command", - "to", - "using", - "with_check", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - &__self_6, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CreatePolicy", - names, - values, - ) - } - Statement::CreateConnector(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "CreateConnector", - &__self_0, - ) - } - Statement::AlterTable { - name: __self_0, - if_exists: __self_1, - only: __self_2, - operations: __self_3, - location: __self_4, - on_cluster: __self_5, - } => { - let names: &'static _ = &[ - "name", - "if_exists", - "only", - "operations", - "location", - "on_cluster", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "AlterTable", - names, - values, - ) - } - Statement::AlterIndex { name: __self_0, operation: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "AlterIndex", - "name", - __self_0, - "operation", - &__self_1, - ) - } - Statement::AlterView { - name: __self_0, - columns: __self_1, - query: __self_2, - with_options: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "AlterView", - "name", - __self_0, - "columns", - __self_1, - "query", - __self_2, - "with_options", - &__self_3, - ) - } - Statement::AlterRole { name: __self_0, operation: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "AlterRole", - "name", - __self_0, - "operation", - &__self_1, - ) - } - Statement::AlterPolicy { - name: __self_0, - table_name: __self_1, - operation: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "AlterPolicy", - "name", - __self_0, - "table_name", - __self_1, - "operation", - &__self_2, - ) - } - Statement::AlterConnector { - name: __self_0, - properties: __self_1, - url: __self_2, - owner: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "AlterConnector", - "name", - __self_0, - "properties", - __self_1, - "url", - __self_2, - "owner", - &__self_3, - ) - } - Statement::AttachDatabase { - schema_name: __self_0, - database_file_name: __self_1, - database: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "AttachDatabase", - "schema_name", - __self_0, - "database_file_name", - __self_1, - "database", - &__self_2, - ) - } - Statement::AttachDuckDBDatabase { - if_not_exists: __self_0, - database: __self_1, - database_path: __self_2, - database_alias: __self_3, - attach_options: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "AttachDuckDBDatabase", - "if_not_exists", - __self_0, - "database", - __self_1, - "database_path", - __self_2, - "database_alias", - __self_3, - "attach_options", - &__self_4, - ) - } - Statement::DetachDuckDBDatabase { - if_exists: __self_0, - database: __self_1, - database_alias: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "DetachDuckDBDatabase", - "if_exists", - __self_0, - "database", - __self_1, - "database_alias", - &__self_2, - ) - } - Statement::Drop { - object_type: __self_0, - if_exists: __self_1, - names: __self_2, - cascade: __self_3, - restrict: __self_4, - purge: __self_5, - temporary: __self_6, - } => { - let names: &'static _ = &[ - "object_type", - "if_exists", - "names", - "cascade", - "restrict", - "purge", - "temporary", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - &__self_6, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Drop", - names, - values, - ) - } - Statement::DropFunction { - if_exists: __self_0, - func_desc: __self_1, - drop_behavior: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "DropFunction", - "if_exists", - __self_0, - "func_desc", - __self_1, - "drop_behavior", - &__self_2, - ) - } - Statement::DropProcedure { - if_exists: __self_0, - proc_desc: __self_1, - drop_behavior: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "DropProcedure", - "if_exists", - __self_0, - "proc_desc", - __self_1, - "drop_behavior", - &__self_2, - ) - } - Statement::DropSecret { - if_exists: __self_0, - temporary: __self_1, - name: __self_2, - storage_specifier: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "DropSecret", - "if_exists", - __self_0, - "temporary", - __self_1, - "name", - __self_2, - "storage_specifier", - &__self_3, - ) - } - Statement::DropPolicy { - if_exists: __self_0, - name: __self_1, - table_name: __self_2, - drop_behavior: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "DropPolicy", - "if_exists", - __self_0, - "name", - __self_1, - "table_name", - __self_2, - "drop_behavior", - &__self_3, - ) - } - Statement::DropConnector { if_exists: __self_0, name: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "DropConnector", - "if_exists", - __self_0, - "name", - &__self_1, - ) - } - Statement::Declare { stmts: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Declare", - "stmts", - &__self_0, - ) - } - Statement::CreateExtension { - name: __self_0, - if_not_exists: __self_1, - cascade: __self_2, - schema: __self_3, - version: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "CreateExtension", - "name", - __self_0, - "if_not_exists", - __self_1, - "cascade", - __self_2, - "schema", - __self_3, - "version", - &__self_4, - ) - } - Statement::DropExtension { - names: __self_0, - if_exists: __self_1, - cascade_or_restrict: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "DropExtension", - "names", - __self_0, - "if_exists", - __self_1, - "cascade_or_restrict", - &__self_2, - ) - } - Statement::Fetch { - name: __self_0, - direction: __self_1, - into: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Fetch", - "name", - __self_0, - "direction", - __self_1, - "into", - &__self_2, - ) - } - Statement::Flush { - object_type: __self_0, - location: __self_1, - channel: __self_2, - read_lock: __self_3, - export: __self_4, - tables: __self_5, - } => { - let names: &'static _ = &[ - "object_type", - "location", - "channel", - "read_lock", - "export", - "tables", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Flush", - names, - values, - ) - } - Statement::Discard { object_type: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Discard", - "object_type", - &__self_0, - ) - } - Statement::SetRole { - context_modifier: __self_0, - role_name: __self_1, - } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SetRole", - "context_modifier", - __self_0, - "role_name", - &__self_1, - ) - } - Statement::SetVariable { - local: __self_0, - hivevar: __self_1, - variables: __self_2, - value: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "SetVariable", - "local", - __self_0, - "hivevar", - __self_1, - "variables", - __self_2, - "value", - &__self_3, - ) - } - Statement::SetTimeZone { local: __self_0, value: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SetTimeZone", - "local", - __self_0, - "value", - &__self_1, - ) - } - Statement::SetNames { - charset_name: __self_0, - collation_name: __self_1, - } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SetNames", - "charset_name", - __self_0, - "collation_name", - &__self_1, - ) - } - Statement::SetNamesDefault {} => { - ::core::fmt::Formatter::write_str(f, "SetNamesDefault") - } - Statement::ShowFunctions { filter: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "ShowFunctions", - "filter", - &__self_0, - ) - } - Statement::ShowVariable { variable: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "ShowVariable", - "variable", - &__self_0, - ) - } - Statement::ShowStatus { - filter: __self_0, - global: __self_1, - session: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ShowStatus", - "filter", - __self_0, - "global", - __self_1, - "session", - &__self_2, - ) - } - Statement::ShowVariables { - filter: __self_0, - global: __self_1, - session: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ShowVariables", - "filter", - __self_0, - "global", - __self_1, - "session", - &__self_2, - ) - } - Statement::ShowCreate { obj_type: __self_0, obj_name: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "ShowCreate", - "obj_type", - __self_0, - "obj_name", - &__self_1, - ) - } - Statement::ShowColumns { - extended: __self_0, - full: __self_1, - show_options: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ShowColumns", - "extended", - __self_0, - "full", - __self_1, - "show_options", - &__self_2, - ) - } - Statement::ShowDatabases { - terse: __self_0, - history: __self_1, - show_options: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ShowDatabases", - "terse", - __self_0, - "history", - __self_1, - "show_options", - &__self_2, - ) - } - Statement::ShowSchemas { - terse: __self_0, - history: __self_1, - show_options: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ShowSchemas", - "terse", - __self_0, - "history", - __self_1, - "show_options", - &__self_2, - ) - } - Statement::ShowTables { - terse: __self_0, - history: __self_1, - extended: __self_2, - full: __self_3, - external: __self_4, - show_options: __self_5, - } => { - let names: &'static _ = &[ - "terse", - "history", - "extended", - "full", - "external", - "show_options", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "ShowTables", - names, - values, - ) - } - Statement::ShowViews { - terse: __self_0, - materialized: __self_1, - show_options: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ShowViews", - "terse", - __self_0, - "materialized", - __self_1, - "show_options", - &__self_2, - ) - } - Statement::ShowCollation { filter: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "ShowCollation", - "filter", - &__self_0, - ) - } - Statement::Use(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Use", - &__self_0, - ) - } - Statement::StartTransaction { - modes: __self_0, - begin: __self_1, - transaction: __self_2, - modifier: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "StartTransaction", - "modes", - __self_0, - "begin", - __self_1, - "transaction", - __self_2, - "modifier", - &__self_3, - ) - } - Statement::SetTransaction { - modes: __self_0, - snapshot: __self_1, - session: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "SetTransaction", - "modes", - __self_0, - "snapshot", - __self_1, - "session", - &__self_2, - ) - } - Statement::Comment { - object_type: __self_0, - object_name: __self_1, - comment: __self_2, - if_exists: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Comment", - "object_type", - __self_0, - "object_name", - __self_1, - "comment", - __self_2, - "if_exists", - &__self_3, - ) - } - Statement::Commit { - chain: __self_0, - end: __self_1, - modifier: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Commit", - "chain", - __self_0, - "end", - __self_1, - "modifier", - &__self_2, - ) - } - Statement::Rollback { chain: __self_0, savepoint: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Rollback", - "chain", - __self_0, - "savepoint", - &__self_1, - ) - } - Statement::CreateSchema { - schema_name: __self_0, - if_not_exists: __self_1, - } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "CreateSchema", - "schema_name", - __self_0, - "if_not_exists", - &__self_1, - ) - } - Statement::CreateDatabase { - db_name: __self_0, - if_not_exists: __self_1, - location: __self_2, - managed_location: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "CreateDatabase", - "db_name", - __self_0, - "if_not_exists", - __self_1, - "location", - __self_2, - "managed_location", - &__self_3, - ) - } - Statement::CreateFunction(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "CreateFunction", - &__self_0, - ) - } - Statement::CreateTrigger { - or_replace: __self_0, - is_constraint: __self_1, - name: __self_2, - period: __self_3, - events: __self_4, - table_name: __self_5, - referenced_table_name: __self_6, - referencing: __self_7, - trigger_object: __self_8, - include_each: __self_9, - condition: __self_10, - exec_body: __self_11, - characteristics: __self_12, - } => { - let names: &'static _ = &[ - "or_replace", - "is_constraint", - "name", - "period", - "events", - "table_name", - "referenced_table_name", - "referencing", - "trigger_object", - "include_each", - "condition", - "exec_body", - "characteristics", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - __self_6, - __self_7, - __self_8, - __self_9, - __self_10, - __self_11, - &__self_12, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CreateTrigger", - names, - values, - ) - } - Statement::DropTrigger { - if_exists: __self_0, - trigger_name: __self_1, - table_name: __self_2, - option: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "DropTrigger", - "if_exists", - __self_0, - "trigger_name", - __self_1, - "table_name", - __self_2, - "option", - &__self_3, - ) - } - Statement::CreateProcedure { - or_alter: __self_0, - name: __self_1, - params: __self_2, - body: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "CreateProcedure", - "or_alter", - __self_0, - "name", - __self_1, - "params", - __self_2, - "body", - &__self_3, - ) - } - Statement::CreateMacro { - or_replace: __self_0, - temporary: __self_1, - name: __self_2, - args: __self_3, - definition: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "CreateMacro", - "or_replace", - __self_0, - "temporary", - __self_1, - "name", - __self_2, - "args", - __self_3, - "definition", - &__self_4, - ) - } - Statement::CreateStage { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - stage_params: __self_4, - directory_table_params: __self_5, - file_format: __self_6, - copy_options: __self_7, - comment: __self_8, - } => { - let names: &'static _ = &[ - "or_replace", - "temporary", - "if_not_exists", - "name", - "stage_params", - "directory_table_params", - "file_format", - "copy_options", - "comment", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - __self_6, - __self_7, - &__self_8, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CreateStage", - names, - values, - ) - } - Statement::Assert { condition: __self_0, message: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Assert", - "condition", - __self_0, - "message", - &__self_1, - ) - } - Statement::Grant { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - with_grant_option: __self_3, - granted_by: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "Grant", - "privileges", - __self_0, - "objects", - __self_1, - "grantees", - __self_2, - "with_grant_option", - __self_3, - "granted_by", - &__self_4, - ) - } - Statement::Revoke { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - granted_by: __self_3, - cascade: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "Revoke", - "privileges", - __self_0, - "objects", - __self_1, - "grantees", - __self_2, - "granted_by", - __self_3, - "cascade", - &__self_4, - ) - } - Statement::Deallocate { name: __self_0, prepare: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Deallocate", - "name", - __self_0, - "prepare", - &__self_1, - ) - } - Statement::Execute { - name: __self_0, - parameters: __self_1, - has_parentheses: __self_2, - using: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "Execute", - "name", - __self_0, - "parameters", - __self_1, - "has_parentheses", - __self_2, - "using", - &__self_3, - ) - } - Statement::Prepare { - name: __self_0, - data_types: __self_1, - statement: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Prepare", - "name", - __self_0, - "data_types", - __self_1, - "statement", - &__self_2, - ) - } - Statement::Kill { modifier: __self_0, id: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Kill", - "modifier", - __self_0, - "id", - &__self_1, - ) - } - Statement::ExplainTable { - describe_alias: __self_0, - hive_format: __self_1, - has_table_keyword: __self_2, - table_name: __self_3, - } => { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "ExplainTable", - "describe_alias", - __self_0, - "hive_format", - __self_1, - "has_table_keyword", - __self_2, - "table_name", - &__self_3, - ) - } - Statement::Explain { - describe_alias: __self_0, - analyze: __self_1, - verbose: __self_2, - query_plan: __self_3, - estimate: __self_4, - statement: __self_5, - format: __self_6, - options: __self_7, - } => { - let names: &'static _ = &[ - "describe_alias", - "analyze", - "verbose", - "query_plan", - "estimate", - "statement", - "format", - "options", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - __self_5, - __self_6, - &__self_7, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Explain", - names, - values, - ) - } - Statement::Savepoint { name: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Savepoint", - "name", - &__self_0, - ) - } - Statement::ReleaseSavepoint { name: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "ReleaseSavepoint", - "name", - &__self_0, - ) - } - Statement::Merge { - into: __self_0, - table: __self_1, - source: __self_2, - on: __self_3, - clauses: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "Merge", - "into", - __self_0, - "table", - __self_1, - "source", - __self_2, - "on", - __self_3, - "clauses", - &__self_4, - ) - } - Statement::Cache { - table_flag: __self_0, - table_name: __self_1, - has_as: __self_2, - options: __self_3, - query: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "Cache", - "table_flag", - __self_0, - "table_name", - __self_1, - "has_as", - __self_2, - "options", - __self_3, - "query", - &__self_4, - ) - } - Statement::UNCache { table_name: __self_0, if_exists: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "UNCache", - "table_name", - __self_0, - "if_exists", - &__self_1, - ) - } - Statement::CreateSequence { - temporary: __self_0, - if_not_exists: __self_1, - name: __self_2, - data_type: __self_3, - sequence_options: __self_4, - owned_by: __self_5, - } => { - let names: &'static _ = &[ - "temporary", - "if_not_exists", - "name", - "data_type", - "sequence_options", - "owned_by", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "CreateSequence", - names, - values, - ) - } - Statement::CreateType { name: __self_0, representation: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "CreateType", - "name", - __self_0, - "representation", - &__self_1, - ) - } - Statement::Pragma { - name: __self_0, - value: __self_1, - is_eq: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Pragma", - "name", - __self_0, - "value", - __self_1, - "is_eq", - &__self_2, - ) - } - Statement::LockTables { tables: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "LockTables", - "tables", - &__self_0, - ) - } - Statement::UnlockTables => { - ::core::fmt::Formatter::write_str(f, "UnlockTables") - } - Statement::Unload { query: __self_0, to: __self_1, with: __self_2 } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Unload", - "query", - __self_0, - "to", - __self_1, - "with", - &__self_2, - ) - } - Statement::OptimizeTable { - name: __self_0, - on_cluster: __self_1, - partition: __self_2, - include_final: __self_3, - deduplicate: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "OptimizeTable", - "name", - __self_0, - "on_cluster", - __self_1, - "partition", - __self_2, - "include_final", - __self_3, - "deduplicate", - &__self_4, - ) - } - Statement::LISTEN { channel: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "LISTEN", - "channel", - &__self_0, - ) - } - Statement::UNLISTEN { channel: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "UNLISTEN", - "channel", - &__self_0, - ) - } - Statement::NOTIFY { channel: __self_0, payload: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "NOTIFY", - "channel", - __self_0, - "payload", - &__self_1, - ) - } - Statement::LoadData { - local: __self_0, - inpath: __self_1, - overwrite: __self_2, - table_name: __self_3, - partitioned: __self_4, - table_format: __self_5, - } => { - let names: &'static _ = &[ - "local", - "inpath", - "overwrite", - "table_name", - "partitioned", - "table_format", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - __self_0, - __self_1, - __self_2, - __self_3, - __self_4, - &__self_5, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "LoadData", - names, - values, - ) - } - Statement::RenameTable(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "RenameTable", - &__self_0, - ) - } - Statement::List(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "List", - &__self_0, - ) - } - Statement::Remove(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Remove", - &__self_0, - ) - } - Statement::SetSessionParam(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "SetSessionParam", - &__self_0, - ) - } - Statement::RaisError { - message: __self_0, - severity: __self_1, - state: __self_2, - arguments: __self_3, - options: __self_4, - } => { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "RaisError", - "message", - __self_0, - "severity", - __self_1, - "state", - __self_2, - "arguments", - __self_3, - "options", - &__self_4, - ) - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::clone::Clone for Statement { - #[inline] - fn clone(&self) -> Statement { - match self { - Statement::Analyze { - table_name: __self_0, - partitions: __self_1, - for_columns: __self_2, - columns: __self_3, - cache_metadata: __self_4, - noscan: __self_5, - compute_statistics: __self_6, - has_table_keyword: __self_7, - } => { - Statement::Analyze { - table_name: ::core::clone::Clone::clone(__self_0), - partitions: ::core::clone::Clone::clone(__self_1), - for_columns: ::core::clone::Clone::clone(__self_2), - columns: ::core::clone::Clone::clone(__self_3), - cache_metadata: ::core::clone::Clone::clone(__self_4), - noscan: ::core::clone::Clone::clone(__self_5), - compute_statistics: ::core::clone::Clone::clone(__self_6), - has_table_keyword: ::core::clone::Clone::clone(__self_7), - } - } - Statement::Truncate { - table_names: __self_0, - partitions: __self_1, - table: __self_2, - only: __self_3, - identity: __self_4, - cascade: __self_5, - on_cluster: __self_6, - } => { - Statement::Truncate { - table_names: ::core::clone::Clone::clone(__self_0), - partitions: ::core::clone::Clone::clone(__self_1), - table: ::core::clone::Clone::clone(__self_2), - only: ::core::clone::Clone::clone(__self_3), - identity: ::core::clone::Clone::clone(__self_4), - cascade: ::core::clone::Clone::clone(__self_5), - on_cluster: ::core::clone::Clone::clone(__self_6), - } - } - Statement::Msck { - table_name: __self_0, - repair: __self_1, - partition_action: __self_2, - } => { - Statement::Msck { - table_name: ::core::clone::Clone::clone(__self_0), - repair: ::core::clone::Clone::clone(__self_1), - partition_action: ::core::clone::Clone::clone(__self_2), - } - } - Statement::Query(__self_0) => { - Statement::Query(::core::clone::Clone::clone(__self_0)) - } - Statement::Insert(__self_0) => { - Statement::Insert(::core::clone::Clone::clone(__self_0)) - } - Statement::Install { extension_name: __self_0 } => { - Statement::Install { - extension_name: ::core::clone::Clone::clone(__self_0), - } - } - Statement::Load { extension_name: __self_0 } => { - Statement::Load { - extension_name: ::core::clone::Clone::clone(__self_0), - } - } - Statement::Directory { - overwrite: __self_0, - local: __self_1, - path: __self_2, - file_format: __self_3, - source: __self_4, - } => { - Statement::Directory { - overwrite: ::core::clone::Clone::clone(__self_0), - local: ::core::clone::Clone::clone(__self_1), - path: ::core::clone::Clone::clone(__self_2), - file_format: ::core::clone::Clone::clone(__self_3), - source: ::core::clone::Clone::clone(__self_4), - } - } - Statement::Call(__self_0) => { - Statement::Call(::core::clone::Clone::clone(__self_0)) - } - Statement::Copy { - source: __self_0, - to: __self_1, - target: __self_2, - options: __self_3, - legacy_options: __self_4, - values: __self_5, - } => { - Statement::Copy { - source: ::core::clone::Clone::clone(__self_0), - to: ::core::clone::Clone::clone(__self_1), - target: ::core::clone::Clone::clone(__self_2), - options: ::core::clone::Clone::clone(__self_3), - legacy_options: ::core::clone::Clone::clone(__self_4), - values: ::core::clone::Clone::clone(__self_5), - } - } - Statement::CopyIntoSnowflake { - into: __self_0, - from_stage: __self_1, - from_stage_alias: __self_2, - stage_params: __self_3, - from_transformations: __self_4, - files: __self_5, - pattern: __self_6, - file_format: __self_7, - copy_options: __self_8, - validation_mode: __self_9, - } => { - Statement::CopyIntoSnowflake { - into: ::core::clone::Clone::clone(__self_0), - from_stage: ::core::clone::Clone::clone(__self_1), - from_stage_alias: ::core::clone::Clone::clone(__self_2), - stage_params: ::core::clone::Clone::clone(__self_3), - from_transformations: ::core::clone::Clone::clone(__self_4), - files: ::core::clone::Clone::clone(__self_5), - pattern: ::core::clone::Clone::clone(__self_6), - file_format: ::core::clone::Clone::clone(__self_7), - copy_options: ::core::clone::Clone::clone(__self_8), - validation_mode: ::core::clone::Clone::clone(__self_9), - } - } - Statement::Close { cursor: __self_0 } => { - Statement::Close { - cursor: ::core::clone::Clone::clone(__self_0), - } - } - Statement::Update { - table: __self_0, - assignments: __self_1, - from: __self_2, - selection: __self_3, - returning: __self_4, - or: __self_5, - } => { - Statement::Update { - table: ::core::clone::Clone::clone(__self_0), - assignments: ::core::clone::Clone::clone(__self_1), - from: ::core::clone::Clone::clone(__self_2), - selection: ::core::clone::Clone::clone(__self_3), - returning: ::core::clone::Clone::clone(__self_4), - or: ::core::clone::Clone::clone(__self_5), - } - } - Statement::Delete(__self_0) => { - Statement::Delete(::core::clone::Clone::clone(__self_0)) - } - Statement::CreateView { - or_replace: __self_0, - materialized: __self_1, - name: __self_2, - columns: __self_3, - query: __self_4, - options: __self_5, - cluster_by: __self_6, - comment: __self_7, - with_no_schema_binding: __self_8, - if_not_exists: __self_9, - temporary: __self_10, - to: __self_11, - params: __self_12, - } => { - Statement::CreateView { - or_replace: ::core::clone::Clone::clone(__self_0), - materialized: ::core::clone::Clone::clone(__self_1), - name: ::core::clone::Clone::clone(__self_2), - columns: ::core::clone::Clone::clone(__self_3), - query: ::core::clone::Clone::clone(__self_4), - options: ::core::clone::Clone::clone(__self_5), - cluster_by: ::core::clone::Clone::clone(__self_6), - comment: ::core::clone::Clone::clone(__self_7), - with_no_schema_binding: ::core::clone::Clone::clone(__self_8), - if_not_exists: ::core::clone::Clone::clone(__self_9), - temporary: ::core::clone::Clone::clone(__self_10), - to: ::core::clone::Clone::clone(__self_11), - params: ::core::clone::Clone::clone(__self_12), - } - } - Statement::CreateTable(__self_0) => { - Statement::CreateTable(::core::clone::Clone::clone(__self_0)) - } - Statement::CreateVirtualTable { - name: __self_0, - if_not_exists: __self_1, - module_name: __self_2, - module_args: __self_3, - } => { - Statement::CreateVirtualTable { - name: ::core::clone::Clone::clone(__self_0), - if_not_exists: ::core::clone::Clone::clone(__self_1), - module_name: ::core::clone::Clone::clone(__self_2), - module_args: ::core::clone::Clone::clone(__self_3), - } - } - Statement::CreateIndex(__self_0) => { - Statement::CreateIndex(::core::clone::Clone::clone(__self_0)) - } - Statement::CreateRole { - names: __self_0, - if_not_exists: __self_1, - login: __self_2, - inherit: __self_3, - bypassrls: __self_4, - password: __self_5, - superuser: __self_6, - create_db: __self_7, - create_role: __self_8, - replication: __self_9, - connection_limit: __self_10, - valid_until: __self_11, - in_role: __self_12, - in_group: __self_13, - role: __self_14, - user: __self_15, - admin: __self_16, - authorization_owner: __self_17, - } => { - Statement::CreateRole { - names: ::core::clone::Clone::clone(__self_0), - if_not_exists: ::core::clone::Clone::clone(__self_1), - login: ::core::clone::Clone::clone(__self_2), - inherit: ::core::clone::Clone::clone(__self_3), - bypassrls: ::core::clone::Clone::clone(__self_4), - password: ::core::clone::Clone::clone(__self_5), - superuser: ::core::clone::Clone::clone(__self_6), - create_db: ::core::clone::Clone::clone(__self_7), - create_role: ::core::clone::Clone::clone(__self_8), - replication: ::core::clone::Clone::clone(__self_9), - connection_limit: ::core::clone::Clone::clone(__self_10), - valid_until: ::core::clone::Clone::clone(__self_11), - in_role: ::core::clone::Clone::clone(__self_12), - in_group: ::core::clone::Clone::clone(__self_13), - role: ::core::clone::Clone::clone(__self_14), - user: ::core::clone::Clone::clone(__self_15), - admin: ::core::clone::Clone::clone(__self_16), - authorization_owner: ::core::clone::Clone::clone(__self_17), - } - } - Statement::CreateSecret { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - storage_specifier: __self_4, - secret_type: __self_5, - options: __self_6, - } => { - Statement::CreateSecret { - or_replace: ::core::clone::Clone::clone(__self_0), - temporary: ::core::clone::Clone::clone(__self_1), - if_not_exists: ::core::clone::Clone::clone(__self_2), - name: ::core::clone::Clone::clone(__self_3), - storage_specifier: ::core::clone::Clone::clone(__self_4), - secret_type: ::core::clone::Clone::clone(__self_5), - options: ::core::clone::Clone::clone(__self_6), - } - } - Statement::CreatePolicy { - name: __self_0, - table_name: __self_1, - policy_type: __self_2, - command: __self_3, - to: __self_4, - using: __self_5, - with_check: __self_6, - } => { - Statement::CreatePolicy { - name: ::core::clone::Clone::clone(__self_0), - table_name: ::core::clone::Clone::clone(__self_1), - policy_type: ::core::clone::Clone::clone(__self_2), - command: ::core::clone::Clone::clone(__self_3), - to: ::core::clone::Clone::clone(__self_4), - using: ::core::clone::Clone::clone(__self_5), - with_check: ::core::clone::Clone::clone(__self_6), - } - } - Statement::CreateConnector(__self_0) => { - Statement::CreateConnector(::core::clone::Clone::clone(__self_0)) - } - Statement::AlterTable { - name: __self_0, - if_exists: __self_1, - only: __self_2, - operations: __self_3, - location: __self_4, - on_cluster: __self_5, - } => { - Statement::AlterTable { - name: ::core::clone::Clone::clone(__self_0), - if_exists: ::core::clone::Clone::clone(__self_1), - only: ::core::clone::Clone::clone(__self_2), - operations: ::core::clone::Clone::clone(__self_3), - location: ::core::clone::Clone::clone(__self_4), - on_cluster: ::core::clone::Clone::clone(__self_5), - } - } - Statement::AlterIndex { name: __self_0, operation: __self_1 } => { - Statement::AlterIndex { - name: ::core::clone::Clone::clone(__self_0), - operation: ::core::clone::Clone::clone(__self_1), - } - } - Statement::AlterView { - name: __self_0, - columns: __self_1, - query: __self_2, - with_options: __self_3, - } => { - Statement::AlterView { - name: ::core::clone::Clone::clone(__self_0), - columns: ::core::clone::Clone::clone(__self_1), - query: ::core::clone::Clone::clone(__self_2), - with_options: ::core::clone::Clone::clone(__self_3), - } - } - Statement::AlterRole { name: __self_0, operation: __self_1 } => { - Statement::AlterRole { - name: ::core::clone::Clone::clone(__self_0), - operation: ::core::clone::Clone::clone(__self_1), - } - } - Statement::AlterPolicy { - name: __self_0, - table_name: __self_1, - operation: __self_2, - } => { - Statement::AlterPolicy { - name: ::core::clone::Clone::clone(__self_0), - table_name: ::core::clone::Clone::clone(__self_1), - operation: ::core::clone::Clone::clone(__self_2), - } - } - Statement::AlterConnector { - name: __self_0, - properties: __self_1, - url: __self_2, - owner: __self_3, - } => { - Statement::AlterConnector { - name: ::core::clone::Clone::clone(__self_0), - properties: ::core::clone::Clone::clone(__self_1), - url: ::core::clone::Clone::clone(__self_2), - owner: ::core::clone::Clone::clone(__self_3), - } - } - Statement::AttachDatabase { - schema_name: __self_0, - database_file_name: __self_1, - database: __self_2, - } => { - Statement::AttachDatabase { - schema_name: ::core::clone::Clone::clone(__self_0), - database_file_name: ::core::clone::Clone::clone(__self_1), - database: ::core::clone::Clone::clone(__self_2), - } - } - Statement::AttachDuckDBDatabase { - if_not_exists: __self_0, - database: __self_1, - database_path: __self_2, - database_alias: __self_3, - attach_options: __self_4, - } => { - Statement::AttachDuckDBDatabase { - if_not_exists: ::core::clone::Clone::clone(__self_0), - database: ::core::clone::Clone::clone(__self_1), - database_path: ::core::clone::Clone::clone(__self_2), - database_alias: ::core::clone::Clone::clone(__self_3), - attach_options: ::core::clone::Clone::clone(__self_4), - } - } - Statement::DetachDuckDBDatabase { - if_exists: __self_0, - database: __self_1, - database_alias: __self_2, - } => { - Statement::DetachDuckDBDatabase { - if_exists: ::core::clone::Clone::clone(__self_0), - database: ::core::clone::Clone::clone(__self_1), - database_alias: ::core::clone::Clone::clone(__self_2), - } - } - Statement::Drop { - object_type: __self_0, - if_exists: __self_1, - names: __self_2, - cascade: __self_3, - restrict: __self_4, - purge: __self_5, - temporary: __self_6, - } => { - Statement::Drop { - object_type: ::core::clone::Clone::clone(__self_0), - if_exists: ::core::clone::Clone::clone(__self_1), - names: ::core::clone::Clone::clone(__self_2), - cascade: ::core::clone::Clone::clone(__self_3), - restrict: ::core::clone::Clone::clone(__self_4), - purge: ::core::clone::Clone::clone(__self_5), - temporary: ::core::clone::Clone::clone(__self_6), - } - } - Statement::DropFunction { - if_exists: __self_0, - func_desc: __self_1, - drop_behavior: __self_2, - } => { - Statement::DropFunction { - if_exists: ::core::clone::Clone::clone(__self_0), - func_desc: ::core::clone::Clone::clone(__self_1), - drop_behavior: ::core::clone::Clone::clone(__self_2), - } - } - Statement::DropProcedure { - if_exists: __self_0, - proc_desc: __self_1, - drop_behavior: __self_2, - } => { - Statement::DropProcedure { - if_exists: ::core::clone::Clone::clone(__self_0), - proc_desc: ::core::clone::Clone::clone(__self_1), - drop_behavior: ::core::clone::Clone::clone(__self_2), - } - } - Statement::DropSecret { - if_exists: __self_0, - temporary: __self_1, - name: __self_2, - storage_specifier: __self_3, - } => { - Statement::DropSecret { - if_exists: ::core::clone::Clone::clone(__self_0), - temporary: ::core::clone::Clone::clone(__self_1), - name: ::core::clone::Clone::clone(__self_2), - storage_specifier: ::core::clone::Clone::clone(__self_3), - } - } - Statement::DropPolicy { - if_exists: __self_0, - name: __self_1, - table_name: __self_2, - drop_behavior: __self_3, - } => { - Statement::DropPolicy { - if_exists: ::core::clone::Clone::clone(__self_0), - name: ::core::clone::Clone::clone(__self_1), - table_name: ::core::clone::Clone::clone(__self_2), - drop_behavior: ::core::clone::Clone::clone(__self_3), - } - } - Statement::DropConnector { if_exists: __self_0, name: __self_1 } => { - Statement::DropConnector { - if_exists: ::core::clone::Clone::clone(__self_0), - name: ::core::clone::Clone::clone(__self_1), - } - } - Statement::Declare { stmts: __self_0 } => { - Statement::Declare { - stmts: ::core::clone::Clone::clone(__self_0), - } - } - Statement::CreateExtension { - name: __self_0, - if_not_exists: __self_1, - cascade: __self_2, - schema: __self_3, - version: __self_4, - } => { - Statement::CreateExtension { - name: ::core::clone::Clone::clone(__self_0), - if_not_exists: ::core::clone::Clone::clone(__self_1), - cascade: ::core::clone::Clone::clone(__self_2), - schema: ::core::clone::Clone::clone(__self_3), - version: ::core::clone::Clone::clone(__self_4), - } - } - Statement::DropExtension { - names: __self_0, - if_exists: __self_1, - cascade_or_restrict: __self_2, - } => { - Statement::DropExtension { - names: ::core::clone::Clone::clone(__self_0), - if_exists: ::core::clone::Clone::clone(__self_1), - cascade_or_restrict: ::core::clone::Clone::clone(__self_2), - } - } - Statement::Fetch { - name: __self_0, - direction: __self_1, - into: __self_2, - } => { - Statement::Fetch { - name: ::core::clone::Clone::clone(__self_0), - direction: ::core::clone::Clone::clone(__self_1), - into: ::core::clone::Clone::clone(__self_2), - } - } - Statement::Flush { - object_type: __self_0, - location: __self_1, - channel: __self_2, - read_lock: __self_3, - export: __self_4, - tables: __self_5, - } => { - Statement::Flush { - object_type: ::core::clone::Clone::clone(__self_0), - location: ::core::clone::Clone::clone(__self_1), - channel: ::core::clone::Clone::clone(__self_2), - read_lock: ::core::clone::Clone::clone(__self_3), - export: ::core::clone::Clone::clone(__self_4), - tables: ::core::clone::Clone::clone(__self_5), - } - } - Statement::Discard { object_type: __self_0 } => { - Statement::Discard { - object_type: ::core::clone::Clone::clone(__self_0), - } - } - Statement::SetRole { - context_modifier: __self_0, - role_name: __self_1, - } => { - Statement::SetRole { - context_modifier: ::core::clone::Clone::clone(__self_0), - role_name: ::core::clone::Clone::clone(__self_1), - } - } - Statement::SetVariable { - local: __self_0, - hivevar: __self_1, - variables: __self_2, - value: __self_3, - } => { - Statement::SetVariable { - local: ::core::clone::Clone::clone(__self_0), - hivevar: ::core::clone::Clone::clone(__self_1), - variables: ::core::clone::Clone::clone(__self_2), - value: ::core::clone::Clone::clone(__self_3), - } - } - Statement::SetTimeZone { local: __self_0, value: __self_1 } => { - Statement::SetTimeZone { - local: ::core::clone::Clone::clone(__self_0), - value: ::core::clone::Clone::clone(__self_1), - } - } - Statement::SetNames { - charset_name: __self_0, - collation_name: __self_1, - } => { - Statement::SetNames { - charset_name: ::core::clone::Clone::clone(__self_0), - collation_name: ::core::clone::Clone::clone(__self_1), - } - } - Statement::SetNamesDefault {} => Statement::SetNamesDefault {}, - Statement::ShowFunctions { filter: __self_0 } => { - Statement::ShowFunctions { - filter: ::core::clone::Clone::clone(__self_0), - } - } - Statement::ShowVariable { variable: __self_0 } => { - Statement::ShowVariable { - variable: ::core::clone::Clone::clone(__self_0), - } - } - Statement::ShowStatus { - filter: __self_0, - global: __self_1, - session: __self_2, - } => { - Statement::ShowStatus { - filter: ::core::clone::Clone::clone(__self_0), - global: ::core::clone::Clone::clone(__self_1), - session: ::core::clone::Clone::clone(__self_2), - } - } - Statement::ShowVariables { - filter: __self_0, - global: __self_1, - session: __self_2, - } => { - Statement::ShowVariables { - filter: ::core::clone::Clone::clone(__self_0), - global: ::core::clone::Clone::clone(__self_1), - session: ::core::clone::Clone::clone(__self_2), - } - } - Statement::ShowCreate { obj_type: __self_0, obj_name: __self_1 } => { - Statement::ShowCreate { - obj_type: ::core::clone::Clone::clone(__self_0), - obj_name: ::core::clone::Clone::clone(__self_1), - } - } - Statement::ShowColumns { - extended: __self_0, - full: __self_1, - show_options: __self_2, - } => { - Statement::ShowColumns { - extended: ::core::clone::Clone::clone(__self_0), - full: ::core::clone::Clone::clone(__self_1), - show_options: ::core::clone::Clone::clone(__self_2), - } - } - Statement::ShowDatabases { - terse: __self_0, - history: __self_1, - show_options: __self_2, - } => { - Statement::ShowDatabases { - terse: ::core::clone::Clone::clone(__self_0), - history: ::core::clone::Clone::clone(__self_1), - show_options: ::core::clone::Clone::clone(__self_2), - } - } - Statement::ShowSchemas { - terse: __self_0, - history: __self_1, - show_options: __self_2, - } => { - Statement::ShowSchemas { - terse: ::core::clone::Clone::clone(__self_0), - history: ::core::clone::Clone::clone(__self_1), - show_options: ::core::clone::Clone::clone(__self_2), - } - } - Statement::ShowTables { - terse: __self_0, - history: __self_1, - extended: __self_2, - full: __self_3, - external: __self_4, - show_options: __self_5, - } => { - Statement::ShowTables { - terse: ::core::clone::Clone::clone(__self_0), - history: ::core::clone::Clone::clone(__self_1), - extended: ::core::clone::Clone::clone(__self_2), - full: ::core::clone::Clone::clone(__self_3), - external: ::core::clone::Clone::clone(__self_4), - show_options: ::core::clone::Clone::clone(__self_5), - } - } - Statement::ShowViews { - terse: __self_0, - materialized: __self_1, - show_options: __self_2, - } => { - Statement::ShowViews { - terse: ::core::clone::Clone::clone(__self_0), - materialized: ::core::clone::Clone::clone(__self_1), - show_options: ::core::clone::Clone::clone(__self_2), - } - } - Statement::ShowCollation { filter: __self_0 } => { - Statement::ShowCollation { - filter: ::core::clone::Clone::clone(__self_0), - } - } - Statement::Use(__self_0) => { - Statement::Use(::core::clone::Clone::clone(__self_0)) - } - Statement::StartTransaction { - modes: __self_0, - begin: __self_1, - transaction: __self_2, - modifier: __self_3, - } => { - Statement::StartTransaction { - modes: ::core::clone::Clone::clone(__self_0), - begin: ::core::clone::Clone::clone(__self_1), - transaction: ::core::clone::Clone::clone(__self_2), - modifier: ::core::clone::Clone::clone(__self_3), - } - } - Statement::SetTransaction { - modes: __self_0, - snapshot: __self_1, - session: __self_2, - } => { - Statement::SetTransaction { - modes: ::core::clone::Clone::clone(__self_0), - snapshot: ::core::clone::Clone::clone(__self_1), - session: ::core::clone::Clone::clone(__self_2), - } - } - Statement::Comment { - object_type: __self_0, - object_name: __self_1, - comment: __self_2, - if_exists: __self_3, - } => { - Statement::Comment { - object_type: ::core::clone::Clone::clone(__self_0), - object_name: ::core::clone::Clone::clone(__self_1), - comment: ::core::clone::Clone::clone(__self_2), - if_exists: ::core::clone::Clone::clone(__self_3), - } - } - Statement::Commit { - chain: __self_0, - end: __self_1, - modifier: __self_2, - } => { - Statement::Commit { - chain: ::core::clone::Clone::clone(__self_0), - end: ::core::clone::Clone::clone(__self_1), - modifier: ::core::clone::Clone::clone(__self_2), - } - } - Statement::Rollback { chain: __self_0, savepoint: __self_1 } => { - Statement::Rollback { - chain: ::core::clone::Clone::clone(__self_0), - savepoint: ::core::clone::Clone::clone(__self_1), - } - } - Statement::CreateSchema { - schema_name: __self_0, - if_not_exists: __self_1, - } => { - Statement::CreateSchema { - schema_name: ::core::clone::Clone::clone(__self_0), - if_not_exists: ::core::clone::Clone::clone(__self_1), - } - } - Statement::CreateDatabase { - db_name: __self_0, - if_not_exists: __self_1, - location: __self_2, - managed_location: __self_3, - } => { - Statement::CreateDatabase { - db_name: ::core::clone::Clone::clone(__self_0), - if_not_exists: ::core::clone::Clone::clone(__self_1), - location: ::core::clone::Clone::clone(__self_2), - managed_location: ::core::clone::Clone::clone(__self_3), - } - } - Statement::CreateFunction(__self_0) => { - Statement::CreateFunction(::core::clone::Clone::clone(__self_0)) - } - Statement::CreateTrigger { - or_replace: __self_0, - is_constraint: __self_1, - name: __self_2, - period: __self_3, - events: __self_4, - table_name: __self_5, - referenced_table_name: __self_6, - referencing: __self_7, - trigger_object: __self_8, - include_each: __self_9, - condition: __self_10, - exec_body: __self_11, - characteristics: __self_12, - } => { - Statement::CreateTrigger { - or_replace: ::core::clone::Clone::clone(__self_0), - is_constraint: ::core::clone::Clone::clone(__self_1), - name: ::core::clone::Clone::clone(__self_2), - period: ::core::clone::Clone::clone(__self_3), - events: ::core::clone::Clone::clone(__self_4), - table_name: ::core::clone::Clone::clone(__self_5), - referenced_table_name: ::core::clone::Clone::clone(__self_6), - referencing: ::core::clone::Clone::clone(__self_7), - trigger_object: ::core::clone::Clone::clone(__self_8), - include_each: ::core::clone::Clone::clone(__self_9), - condition: ::core::clone::Clone::clone(__self_10), - exec_body: ::core::clone::Clone::clone(__self_11), - characteristics: ::core::clone::Clone::clone(__self_12), - } - } - Statement::DropTrigger { - if_exists: __self_0, - trigger_name: __self_1, - table_name: __self_2, - option: __self_3, - } => { - Statement::DropTrigger { - if_exists: ::core::clone::Clone::clone(__self_0), - trigger_name: ::core::clone::Clone::clone(__self_1), - table_name: ::core::clone::Clone::clone(__self_2), - option: ::core::clone::Clone::clone(__self_3), - } - } - Statement::CreateProcedure { - or_alter: __self_0, - name: __self_1, - params: __self_2, - body: __self_3, - } => { - Statement::CreateProcedure { - or_alter: ::core::clone::Clone::clone(__self_0), - name: ::core::clone::Clone::clone(__self_1), - params: ::core::clone::Clone::clone(__self_2), - body: ::core::clone::Clone::clone(__self_3), - } - } - Statement::CreateMacro { - or_replace: __self_0, - temporary: __self_1, - name: __self_2, - args: __self_3, - definition: __self_4, - } => { - Statement::CreateMacro { - or_replace: ::core::clone::Clone::clone(__self_0), - temporary: ::core::clone::Clone::clone(__self_1), - name: ::core::clone::Clone::clone(__self_2), - args: ::core::clone::Clone::clone(__self_3), - definition: ::core::clone::Clone::clone(__self_4), - } - } - Statement::CreateStage { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - stage_params: __self_4, - directory_table_params: __self_5, - file_format: __self_6, - copy_options: __self_7, - comment: __self_8, - } => { - Statement::CreateStage { - or_replace: ::core::clone::Clone::clone(__self_0), - temporary: ::core::clone::Clone::clone(__self_1), - if_not_exists: ::core::clone::Clone::clone(__self_2), - name: ::core::clone::Clone::clone(__self_3), - stage_params: ::core::clone::Clone::clone(__self_4), - directory_table_params: ::core::clone::Clone::clone(__self_5), - file_format: ::core::clone::Clone::clone(__self_6), - copy_options: ::core::clone::Clone::clone(__self_7), - comment: ::core::clone::Clone::clone(__self_8), - } - } - Statement::Assert { condition: __self_0, message: __self_1 } => { - Statement::Assert { - condition: ::core::clone::Clone::clone(__self_0), - message: ::core::clone::Clone::clone(__self_1), - } - } - Statement::Grant { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - with_grant_option: __self_3, - granted_by: __self_4, - } => { - Statement::Grant { - privileges: ::core::clone::Clone::clone(__self_0), - objects: ::core::clone::Clone::clone(__self_1), - grantees: ::core::clone::Clone::clone(__self_2), - with_grant_option: ::core::clone::Clone::clone(__self_3), - granted_by: ::core::clone::Clone::clone(__self_4), - } - } - Statement::Revoke { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - granted_by: __self_3, - cascade: __self_4, - } => { - Statement::Revoke { - privileges: ::core::clone::Clone::clone(__self_0), - objects: ::core::clone::Clone::clone(__self_1), - grantees: ::core::clone::Clone::clone(__self_2), - granted_by: ::core::clone::Clone::clone(__self_3), - cascade: ::core::clone::Clone::clone(__self_4), - } - } - Statement::Deallocate { name: __self_0, prepare: __self_1 } => { - Statement::Deallocate { - name: ::core::clone::Clone::clone(__self_0), - prepare: ::core::clone::Clone::clone(__self_1), - } - } - Statement::Execute { - name: __self_0, - parameters: __self_1, - has_parentheses: __self_2, - using: __self_3, - } => { - Statement::Execute { - name: ::core::clone::Clone::clone(__self_0), - parameters: ::core::clone::Clone::clone(__self_1), - has_parentheses: ::core::clone::Clone::clone(__self_2), - using: ::core::clone::Clone::clone(__self_3), - } - } - Statement::Prepare { - name: __self_0, - data_types: __self_1, - statement: __self_2, - } => { - Statement::Prepare { - name: ::core::clone::Clone::clone(__self_0), - data_types: ::core::clone::Clone::clone(__self_1), - statement: ::core::clone::Clone::clone(__self_2), - } - } - Statement::Kill { modifier: __self_0, id: __self_1 } => { - Statement::Kill { - modifier: ::core::clone::Clone::clone(__self_0), - id: ::core::clone::Clone::clone(__self_1), - } - } - Statement::ExplainTable { - describe_alias: __self_0, - hive_format: __self_1, - has_table_keyword: __self_2, - table_name: __self_3, - } => { - Statement::ExplainTable { - describe_alias: ::core::clone::Clone::clone(__self_0), - hive_format: ::core::clone::Clone::clone(__self_1), - has_table_keyword: ::core::clone::Clone::clone(__self_2), - table_name: ::core::clone::Clone::clone(__self_3), - } - } - Statement::Explain { - describe_alias: __self_0, - analyze: __self_1, - verbose: __self_2, - query_plan: __self_3, - estimate: __self_4, - statement: __self_5, - format: __self_6, - options: __self_7, - } => { - Statement::Explain { - describe_alias: ::core::clone::Clone::clone(__self_0), - analyze: ::core::clone::Clone::clone(__self_1), - verbose: ::core::clone::Clone::clone(__self_2), - query_plan: ::core::clone::Clone::clone(__self_3), - estimate: ::core::clone::Clone::clone(__self_4), - statement: ::core::clone::Clone::clone(__self_5), - format: ::core::clone::Clone::clone(__self_6), - options: ::core::clone::Clone::clone(__self_7), - } - } - Statement::Savepoint { name: __self_0 } => { - Statement::Savepoint { - name: ::core::clone::Clone::clone(__self_0), - } - } - Statement::ReleaseSavepoint { name: __self_0 } => { - Statement::ReleaseSavepoint { - name: ::core::clone::Clone::clone(__self_0), - } - } - Statement::Merge { - into: __self_0, - table: __self_1, - source: __self_2, - on: __self_3, - clauses: __self_4, - } => { - Statement::Merge { - into: ::core::clone::Clone::clone(__self_0), - table: ::core::clone::Clone::clone(__self_1), - source: ::core::clone::Clone::clone(__self_2), - on: ::core::clone::Clone::clone(__self_3), - clauses: ::core::clone::Clone::clone(__self_4), - } - } - Statement::Cache { - table_flag: __self_0, - table_name: __self_1, - has_as: __self_2, - options: __self_3, - query: __self_4, - } => { - Statement::Cache { - table_flag: ::core::clone::Clone::clone(__self_0), - table_name: ::core::clone::Clone::clone(__self_1), - has_as: ::core::clone::Clone::clone(__self_2), - options: ::core::clone::Clone::clone(__self_3), - query: ::core::clone::Clone::clone(__self_4), - } - } - Statement::UNCache { table_name: __self_0, if_exists: __self_1 } => { - Statement::UNCache { - table_name: ::core::clone::Clone::clone(__self_0), - if_exists: ::core::clone::Clone::clone(__self_1), - } - } - Statement::CreateSequence { - temporary: __self_0, - if_not_exists: __self_1, - name: __self_2, - data_type: __self_3, - sequence_options: __self_4, - owned_by: __self_5, - } => { - Statement::CreateSequence { - temporary: ::core::clone::Clone::clone(__self_0), - if_not_exists: ::core::clone::Clone::clone(__self_1), - name: ::core::clone::Clone::clone(__self_2), - data_type: ::core::clone::Clone::clone(__self_3), - sequence_options: ::core::clone::Clone::clone(__self_4), - owned_by: ::core::clone::Clone::clone(__self_5), - } - } - Statement::CreateType { name: __self_0, representation: __self_1 } => { - Statement::CreateType { - name: ::core::clone::Clone::clone(__self_0), - representation: ::core::clone::Clone::clone(__self_1), - } - } - Statement::Pragma { - name: __self_0, - value: __self_1, - is_eq: __self_2, - } => { - Statement::Pragma { - name: ::core::clone::Clone::clone(__self_0), - value: ::core::clone::Clone::clone(__self_1), - is_eq: ::core::clone::Clone::clone(__self_2), - } - } - Statement::LockTables { tables: __self_0 } => { - Statement::LockTables { - tables: ::core::clone::Clone::clone(__self_0), - } - } - Statement::UnlockTables => Statement::UnlockTables, - Statement::Unload { query: __self_0, to: __self_1, with: __self_2 } => { - Statement::Unload { - query: ::core::clone::Clone::clone(__self_0), - to: ::core::clone::Clone::clone(__self_1), - with: ::core::clone::Clone::clone(__self_2), - } - } - Statement::OptimizeTable { - name: __self_0, - on_cluster: __self_1, - partition: __self_2, - include_final: __self_3, - deduplicate: __self_4, - } => { - Statement::OptimizeTable { - name: ::core::clone::Clone::clone(__self_0), - on_cluster: ::core::clone::Clone::clone(__self_1), - partition: ::core::clone::Clone::clone(__self_2), - include_final: ::core::clone::Clone::clone(__self_3), - deduplicate: ::core::clone::Clone::clone(__self_4), - } - } - Statement::LISTEN { channel: __self_0 } => { - Statement::LISTEN { - channel: ::core::clone::Clone::clone(__self_0), - } - } - Statement::UNLISTEN { channel: __self_0 } => { - Statement::UNLISTEN { - channel: ::core::clone::Clone::clone(__self_0), - } - } - Statement::NOTIFY { channel: __self_0, payload: __self_1 } => { - Statement::NOTIFY { - channel: ::core::clone::Clone::clone(__self_0), - payload: ::core::clone::Clone::clone(__self_1), - } - } - Statement::LoadData { - local: __self_0, - inpath: __self_1, - overwrite: __self_2, - table_name: __self_3, - partitioned: __self_4, - table_format: __self_5, - } => { - Statement::LoadData { - local: ::core::clone::Clone::clone(__self_0), - inpath: ::core::clone::Clone::clone(__self_1), - overwrite: ::core::clone::Clone::clone(__self_2), - table_name: ::core::clone::Clone::clone(__self_3), - partitioned: ::core::clone::Clone::clone(__self_4), - table_format: ::core::clone::Clone::clone(__self_5), - } - } - Statement::RenameTable(__self_0) => { - Statement::RenameTable(::core::clone::Clone::clone(__self_0)) - } - Statement::List(__self_0) => { - Statement::List(::core::clone::Clone::clone(__self_0)) - } - Statement::Remove(__self_0) => { - Statement::Remove(::core::clone::Clone::clone(__self_0)) - } - Statement::SetSessionParam(__self_0) => { - Statement::SetSessionParam(::core::clone::Clone::clone(__self_0)) - } - Statement::RaisError { - message: __self_0, - severity: __self_1, - state: __self_2, - arguments: __self_3, - options: __self_4, - } => { - Statement::RaisError { - message: ::core::clone::Clone::clone(__self_0), - severity: ::core::clone::Clone::clone(__self_1), - state: ::core::clone::Clone::clone(__self_2), - arguments: ::core::clone::Clone::clone(__self_3), - options: ::core::clone::Clone::clone(__self_4), - } - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::marker::StructuralPartialEq for Statement {} - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialEq for Statement { - #[inline] - fn eq(&self, other: &Statement) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - Statement::Analyze { - table_name: __self_0, - partitions: __self_1, - for_columns: __self_2, - columns: __self_3, - cache_metadata: __self_4, - noscan: __self_5, - compute_statistics: __self_6, - has_table_keyword: __self_7, - }, - Statement::Analyze { - table_name: __arg1_0, - partitions: __arg1_1, - for_columns: __arg1_2, - columns: __arg1_3, - cache_metadata: __arg1_4, - noscan: __arg1_5, - compute_statistics: __arg1_6, - has_table_keyword: __arg1_7, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 && __self_7 == __arg1_7 - } - ( - Statement::Truncate { - table_names: __self_0, - partitions: __self_1, - table: __self_2, - only: __self_3, - identity: __self_4, - cascade: __self_5, - on_cluster: __self_6, - }, - Statement::Truncate { - table_names: __arg1_0, - partitions: __arg1_1, - table: __arg1_2, - only: __arg1_3, - identity: __arg1_4, - cascade: __arg1_5, - on_cluster: __arg1_6, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 - } - ( - Statement::Msck { - table_name: __self_0, - repair: __self_1, - partition_action: __self_2, - }, - Statement::Msck { - table_name: __arg1_0, - repair: __arg1_1, - partition_action: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - (Statement::Query(__self_0), Statement::Query(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Statement::Insert(__self_0), Statement::Insert(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Statement::Install { extension_name: __self_0 }, - Statement::Install { extension_name: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::Load { extension_name: __self_0 }, - Statement::Load { extension_name: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::Directory { - overwrite: __self_0, - local: __self_1, - path: __self_2, - file_format: __self_3, - source: __self_4, - }, - Statement::Directory { - overwrite: __arg1_0, - local: __arg1_1, - path: __arg1_2, - file_format: __arg1_3, - source: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - (Statement::Call(__self_0), Statement::Call(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Statement::Copy { - source: __self_0, - to: __self_1, - target: __self_2, - options: __self_3, - legacy_options: __self_4, - values: __self_5, - }, - Statement::Copy { - source: __arg1_0, - to: __arg1_1, - target: __arg1_2, - options: __arg1_3, - legacy_options: __arg1_4, - values: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - ( - Statement::CopyIntoSnowflake { - into: __self_0, - from_stage: __self_1, - from_stage_alias: __self_2, - stage_params: __self_3, - from_transformations: __self_4, - files: __self_5, - pattern: __self_6, - file_format: __self_7, - copy_options: __self_8, - validation_mode: __self_9, - }, - Statement::CopyIntoSnowflake { - into: __arg1_0, - from_stage: __arg1_1, - from_stage_alias: __arg1_2, - stage_params: __arg1_3, - from_transformations: __arg1_4, - files: __arg1_5, - pattern: __arg1_6, - file_format: __arg1_7, - copy_options: __arg1_8, - validation_mode: __arg1_9, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 && __self_7 == __arg1_7 - && __self_8 == __arg1_8 && __self_9 == __arg1_9 - } - ( - Statement::Close { cursor: __self_0 }, - Statement::Close { cursor: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::Update { - table: __self_0, - assignments: __self_1, - from: __self_2, - selection: __self_3, - returning: __self_4, - or: __self_5, - }, - Statement::Update { - table: __arg1_0, - assignments: __arg1_1, - from: __arg1_2, - selection: __arg1_3, - returning: __arg1_4, - or: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - (Statement::Delete(__self_0), Statement::Delete(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Statement::CreateView { - or_replace: __self_0, - materialized: __self_1, - name: __self_2, - columns: __self_3, - query: __self_4, - options: __self_5, - cluster_by: __self_6, - comment: __self_7, - with_no_schema_binding: __self_8, - if_not_exists: __self_9, - temporary: __self_10, - to: __self_11, - params: __self_12, - }, - Statement::CreateView { - or_replace: __arg1_0, - materialized: __arg1_1, - name: __arg1_2, - columns: __arg1_3, - query: __arg1_4, - options: __arg1_5, - cluster_by: __arg1_6, - comment: __arg1_7, - with_no_schema_binding: __arg1_8, - if_not_exists: __arg1_9, - temporary: __arg1_10, - to: __arg1_11, - params: __arg1_12, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 && __self_7 == __arg1_7 - && __self_8 == __arg1_8 && __self_9 == __arg1_9 - && __self_10 == __arg1_10 && __self_11 == __arg1_11 - && __self_12 == __arg1_12 - } - ( - Statement::CreateTable(__self_0), - Statement::CreateTable(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Statement::CreateVirtualTable { - name: __self_0, - if_not_exists: __self_1, - module_name: __self_2, - module_args: __self_3, - }, - Statement::CreateVirtualTable { - name: __arg1_0, - if_not_exists: __arg1_1, - module_name: __arg1_2, - module_args: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::CreateIndex(__self_0), - Statement::CreateIndex(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Statement::CreateRole { - names: __self_0, - if_not_exists: __self_1, - login: __self_2, - inherit: __self_3, - bypassrls: __self_4, - password: __self_5, - superuser: __self_6, - create_db: __self_7, - create_role: __self_8, - replication: __self_9, - connection_limit: __self_10, - valid_until: __self_11, - in_role: __self_12, - in_group: __self_13, - role: __self_14, - user: __self_15, - admin: __self_16, - authorization_owner: __self_17, - }, - Statement::CreateRole { - names: __arg1_0, - if_not_exists: __arg1_1, - login: __arg1_2, - inherit: __arg1_3, - bypassrls: __arg1_4, - password: __arg1_5, - superuser: __arg1_6, - create_db: __arg1_7, - create_role: __arg1_8, - replication: __arg1_9, - connection_limit: __arg1_10, - valid_until: __arg1_11, - in_role: __arg1_12, - in_group: __arg1_13, - role: __arg1_14, - user: __arg1_15, - admin: __arg1_16, - authorization_owner: __arg1_17, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 && __self_7 == __arg1_7 - && __self_8 == __arg1_8 && __self_9 == __arg1_9 - && __self_10 == __arg1_10 && __self_11 == __arg1_11 - && __self_12 == __arg1_12 && __self_13 == __arg1_13 - && __self_14 == __arg1_14 && __self_15 == __arg1_15 - && __self_16 == __arg1_16 && __self_17 == __arg1_17 - } - ( - Statement::CreateSecret { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - storage_specifier: __self_4, - secret_type: __self_5, - options: __self_6, - }, - Statement::CreateSecret { - or_replace: __arg1_0, - temporary: __arg1_1, - if_not_exists: __arg1_2, - name: __arg1_3, - storage_specifier: __arg1_4, - secret_type: __arg1_5, - options: __arg1_6, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 - } - ( - Statement::CreatePolicy { - name: __self_0, - table_name: __self_1, - policy_type: __self_2, - command: __self_3, - to: __self_4, - using: __self_5, - with_check: __self_6, - }, - Statement::CreatePolicy { - name: __arg1_0, - table_name: __arg1_1, - policy_type: __arg1_2, - command: __arg1_3, - to: __arg1_4, - using: __arg1_5, - with_check: __arg1_6, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 - } - ( - Statement::CreateConnector(__self_0), - Statement::CreateConnector(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Statement::AlterTable { - name: __self_0, - if_exists: __self_1, - only: __self_2, - operations: __self_3, - location: __self_4, - on_cluster: __self_5, - }, - Statement::AlterTable { - name: __arg1_0, - if_exists: __arg1_1, - only: __arg1_2, - operations: __arg1_3, - location: __arg1_4, - on_cluster: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - ( - Statement::AlterIndex { name: __self_0, operation: __self_1 }, - Statement::AlterIndex { name: __arg1_0, operation: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::AlterView { - name: __self_0, - columns: __self_1, - query: __self_2, - with_options: __self_3, - }, - Statement::AlterView { - name: __arg1_0, - columns: __arg1_1, - query: __arg1_2, - with_options: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::AlterRole { name: __self_0, operation: __self_1 }, - Statement::AlterRole { name: __arg1_0, operation: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::AlterPolicy { - name: __self_0, - table_name: __self_1, - operation: __self_2, - }, - Statement::AlterPolicy { - name: __arg1_0, - table_name: __arg1_1, - operation: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::AlterConnector { - name: __self_0, - properties: __self_1, - url: __self_2, - owner: __self_3, - }, - Statement::AlterConnector { - name: __arg1_0, - properties: __arg1_1, - url: __arg1_2, - owner: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::AttachDatabase { - schema_name: __self_0, - database_file_name: __self_1, - database: __self_2, - }, - Statement::AttachDatabase { - schema_name: __arg1_0, - database_file_name: __arg1_1, - database: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::AttachDuckDBDatabase { - if_not_exists: __self_0, - database: __self_1, - database_path: __self_2, - database_alias: __self_3, - attach_options: __self_4, - }, - Statement::AttachDuckDBDatabase { - if_not_exists: __arg1_0, - database: __arg1_1, - database_path: __arg1_2, - database_alias: __arg1_3, - attach_options: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::DetachDuckDBDatabase { - if_exists: __self_0, - database: __self_1, - database_alias: __self_2, - }, - Statement::DetachDuckDBDatabase { - if_exists: __arg1_0, - database: __arg1_1, - database_alias: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::Drop { - object_type: __self_0, - if_exists: __self_1, - names: __self_2, - cascade: __self_3, - restrict: __self_4, - purge: __self_5, - temporary: __self_6, - }, - Statement::Drop { - object_type: __arg1_0, - if_exists: __arg1_1, - names: __arg1_2, - cascade: __arg1_3, - restrict: __arg1_4, - purge: __arg1_5, - temporary: __arg1_6, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 - } - ( - Statement::DropFunction { - if_exists: __self_0, - func_desc: __self_1, - drop_behavior: __self_2, - }, - Statement::DropFunction { - if_exists: __arg1_0, - func_desc: __arg1_1, - drop_behavior: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::DropProcedure { - if_exists: __self_0, - proc_desc: __self_1, - drop_behavior: __self_2, - }, - Statement::DropProcedure { - if_exists: __arg1_0, - proc_desc: __arg1_1, - drop_behavior: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::DropSecret { - if_exists: __self_0, - temporary: __self_1, - name: __self_2, - storage_specifier: __self_3, - }, - Statement::DropSecret { - if_exists: __arg1_0, - temporary: __arg1_1, - name: __arg1_2, - storage_specifier: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::DropPolicy { - if_exists: __self_0, - name: __self_1, - table_name: __self_2, - drop_behavior: __self_3, - }, - Statement::DropPolicy { - if_exists: __arg1_0, - name: __arg1_1, - table_name: __arg1_2, - drop_behavior: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::DropConnector { if_exists: __self_0, name: __self_1 }, - Statement::DropConnector { if_exists: __arg1_0, name: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::Declare { stmts: __self_0 }, - Statement::Declare { stmts: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::CreateExtension { - name: __self_0, - if_not_exists: __self_1, - cascade: __self_2, - schema: __self_3, - version: __self_4, - }, - Statement::CreateExtension { - name: __arg1_0, - if_not_exists: __arg1_1, - cascade: __arg1_2, - schema: __arg1_3, - version: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::DropExtension { - names: __self_0, - if_exists: __self_1, - cascade_or_restrict: __self_2, - }, - Statement::DropExtension { - names: __arg1_0, - if_exists: __arg1_1, - cascade_or_restrict: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::Fetch { - name: __self_0, - direction: __self_1, - into: __self_2, - }, - Statement::Fetch { - name: __arg1_0, - direction: __arg1_1, - into: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::Flush { - object_type: __self_0, - location: __self_1, - channel: __self_2, - read_lock: __self_3, - export: __self_4, - tables: __self_5, - }, - Statement::Flush { - object_type: __arg1_0, - location: __arg1_1, - channel: __arg1_2, - read_lock: __arg1_3, - export: __arg1_4, - tables: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - ( - Statement::Discard { object_type: __self_0 }, - Statement::Discard { object_type: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::SetRole { - context_modifier: __self_0, - role_name: __self_1, - }, - Statement::SetRole { - context_modifier: __arg1_0, - role_name: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::SetVariable { - local: __self_0, - hivevar: __self_1, - variables: __self_2, - value: __self_3, - }, - Statement::SetVariable { - local: __arg1_0, - hivevar: __arg1_1, - variables: __arg1_2, - value: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::SetTimeZone { local: __self_0, value: __self_1 }, - Statement::SetTimeZone { local: __arg1_0, value: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::SetNames { - charset_name: __self_0, - collation_name: __self_1, - }, - Statement::SetNames { - charset_name: __arg1_0, - collation_name: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::ShowFunctions { filter: __self_0 }, - Statement::ShowFunctions { filter: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::ShowVariable { variable: __self_0 }, - Statement::ShowVariable { variable: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::ShowStatus { - filter: __self_0, - global: __self_1, - session: __self_2, - }, - Statement::ShowStatus { - filter: __arg1_0, - global: __arg1_1, - session: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::ShowVariables { - filter: __self_0, - global: __self_1, - session: __self_2, - }, - Statement::ShowVariables { - filter: __arg1_0, - global: __arg1_1, - session: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::ShowCreate { obj_type: __self_0, obj_name: __self_1 }, - Statement::ShowCreate { obj_type: __arg1_0, obj_name: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::ShowColumns { - extended: __self_0, - full: __self_1, - show_options: __self_2, - }, - Statement::ShowColumns { - extended: __arg1_0, - full: __arg1_1, - show_options: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::ShowDatabases { - terse: __self_0, - history: __self_1, - show_options: __self_2, - }, - Statement::ShowDatabases { - terse: __arg1_0, - history: __arg1_1, - show_options: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::ShowSchemas { - terse: __self_0, - history: __self_1, - show_options: __self_2, - }, - Statement::ShowSchemas { - terse: __arg1_0, - history: __arg1_1, - show_options: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::ShowTables { - terse: __self_0, - history: __self_1, - extended: __self_2, - full: __self_3, - external: __self_4, - show_options: __self_5, - }, - Statement::ShowTables { - terse: __arg1_0, - history: __arg1_1, - extended: __arg1_2, - full: __arg1_3, - external: __arg1_4, - show_options: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - ( - Statement::ShowViews { - terse: __self_0, - materialized: __self_1, - show_options: __self_2, - }, - Statement::ShowViews { - terse: __arg1_0, - materialized: __arg1_1, - show_options: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::ShowCollation { filter: __self_0 }, - Statement::ShowCollation { filter: __arg1_0 }, - ) => __self_0 == __arg1_0, - (Statement::Use(__self_0), Statement::Use(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Statement::StartTransaction { - modes: __self_0, - begin: __self_1, - transaction: __self_2, - modifier: __self_3, - }, - Statement::StartTransaction { - modes: __arg1_0, - begin: __arg1_1, - transaction: __arg1_2, - modifier: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::SetTransaction { - modes: __self_0, - snapshot: __self_1, - session: __self_2, - }, - Statement::SetTransaction { - modes: __arg1_0, - snapshot: __arg1_1, - session: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::Comment { - object_type: __self_0, - object_name: __self_1, - comment: __self_2, - if_exists: __self_3, - }, - Statement::Comment { - object_type: __arg1_0, - object_name: __arg1_1, - comment: __arg1_2, - if_exists: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::Commit { - chain: __self_0, - end: __self_1, - modifier: __self_2, - }, - Statement::Commit { - chain: __arg1_0, - end: __arg1_1, - modifier: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::Rollback { chain: __self_0, savepoint: __self_1 }, - Statement::Rollback { chain: __arg1_0, savepoint: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::CreateSchema { - schema_name: __self_0, - if_not_exists: __self_1, - }, - Statement::CreateSchema { - schema_name: __arg1_0, - if_not_exists: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::CreateDatabase { - db_name: __self_0, - if_not_exists: __self_1, - location: __self_2, - managed_location: __self_3, - }, - Statement::CreateDatabase { - db_name: __arg1_0, - if_not_exists: __arg1_1, - location: __arg1_2, - managed_location: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::CreateFunction(__self_0), - Statement::CreateFunction(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Statement::CreateTrigger { - or_replace: __self_0, - is_constraint: __self_1, - name: __self_2, - period: __self_3, - events: __self_4, - table_name: __self_5, - referenced_table_name: __self_6, - referencing: __self_7, - trigger_object: __self_8, - include_each: __self_9, - condition: __self_10, - exec_body: __self_11, - characteristics: __self_12, - }, - Statement::CreateTrigger { - or_replace: __arg1_0, - is_constraint: __arg1_1, - name: __arg1_2, - period: __arg1_3, - events: __arg1_4, - table_name: __arg1_5, - referenced_table_name: __arg1_6, - referencing: __arg1_7, - trigger_object: __arg1_8, - include_each: __arg1_9, - condition: __arg1_10, - exec_body: __arg1_11, - characteristics: __arg1_12, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 && __self_7 == __arg1_7 - && __self_8 == __arg1_8 && __self_9 == __arg1_9 - && __self_10 == __arg1_10 && __self_11 == __arg1_11 - && __self_12 == __arg1_12 - } - ( - Statement::DropTrigger { - if_exists: __self_0, - trigger_name: __self_1, - table_name: __self_2, - option: __self_3, - }, - Statement::DropTrigger { - if_exists: __arg1_0, - trigger_name: __arg1_1, - table_name: __arg1_2, - option: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::CreateProcedure { - or_alter: __self_0, - name: __self_1, - params: __self_2, - body: __self_3, - }, - Statement::CreateProcedure { - or_alter: __arg1_0, - name: __arg1_1, - params: __arg1_2, - body: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::CreateMacro { - or_replace: __self_0, - temporary: __self_1, - name: __self_2, - args: __self_3, - definition: __self_4, - }, - Statement::CreateMacro { - or_replace: __arg1_0, - temporary: __arg1_1, - name: __arg1_2, - args: __arg1_3, - definition: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::CreateStage { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - stage_params: __self_4, - directory_table_params: __self_5, - file_format: __self_6, - copy_options: __self_7, - comment: __self_8, - }, - Statement::CreateStage { - or_replace: __arg1_0, - temporary: __arg1_1, - if_not_exists: __arg1_2, - name: __arg1_3, - stage_params: __arg1_4, - directory_table_params: __arg1_5, - file_format: __arg1_6, - copy_options: __arg1_7, - comment: __arg1_8, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 && __self_7 == __arg1_7 - && __self_8 == __arg1_8 - } - ( - Statement::Assert { condition: __self_0, message: __self_1 }, - Statement::Assert { condition: __arg1_0, message: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::Grant { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - with_grant_option: __self_3, - granted_by: __self_4, - }, - Statement::Grant { - privileges: __arg1_0, - objects: __arg1_1, - grantees: __arg1_2, - with_grant_option: __arg1_3, - granted_by: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::Revoke { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - granted_by: __self_3, - cascade: __self_4, - }, - Statement::Revoke { - privileges: __arg1_0, - objects: __arg1_1, - grantees: __arg1_2, - granted_by: __arg1_3, - cascade: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::Deallocate { name: __self_0, prepare: __self_1 }, - Statement::Deallocate { name: __arg1_0, prepare: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::Execute { - name: __self_0, - parameters: __self_1, - has_parentheses: __self_2, - using: __self_3, - }, - Statement::Execute { - name: __arg1_0, - parameters: __arg1_1, - has_parentheses: __arg1_2, - using: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::Prepare { - name: __self_0, - data_types: __self_1, - statement: __self_2, - }, - Statement::Prepare { - name: __arg1_0, - data_types: __arg1_1, - statement: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::Kill { modifier: __self_0, id: __self_1 }, - Statement::Kill { modifier: __arg1_0, id: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::ExplainTable { - describe_alias: __self_0, - hive_format: __self_1, - has_table_keyword: __self_2, - table_name: __self_3, - }, - Statement::ExplainTable { - describe_alias: __arg1_0, - hive_format: __arg1_1, - has_table_keyword: __arg1_2, - table_name: __arg1_3, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - } - ( - Statement::Explain { - describe_alias: __self_0, - analyze: __self_1, - verbose: __self_2, - query_plan: __self_3, - estimate: __self_4, - statement: __self_5, - format: __self_6, - options: __self_7, - }, - Statement::Explain { - describe_alias: __arg1_0, - analyze: __arg1_1, - verbose: __arg1_2, - query_plan: __arg1_3, - estimate: __arg1_4, - statement: __arg1_5, - format: __arg1_6, - options: __arg1_7, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - && __self_6 == __arg1_6 && __self_7 == __arg1_7 - } - ( - Statement::Savepoint { name: __self_0 }, - Statement::Savepoint { name: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::ReleaseSavepoint { name: __self_0 }, - Statement::ReleaseSavepoint { name: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::Merge { - into: __self_0, - table: __self_1, - source: __self_2, - on: __self_3, - clauses: __self_4, - }, - Statement::Merge { - into: __arg1_0, - table: __arg1_1, - source: __arg1_2, - on: __arg1_3, - clauses: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::Cache { - table_flag: __self_0, - table_name: __self_1, - has_as: __self_2, - options: __self_3, - query: __self_4, - }, - Statement::Cache { - table_flag: __arg1_0, - table_name: __arg1_1, - has_as: __arg1_2, - options: __arg1_3, - query: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::UNCache { table_name: __self_0, if_exists: __self_1 }, - Statement::UNCache { table_name: __arg1_0, if_exists: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::CreateSequence { - temporary: __self_0, - if_not_exists: __self_1, - name: __self_2, - data_type: __self_3, - sequence_options: __self_4, - owned_by: __self_5, - }, - Statement::CreateSequence { - temporary: __arg1_0, - if_not_exists: __arg1_1, - name: __arg1_2, - data_type: __arg1_3, - sequence_options: __arg1_4, - owned_by: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - ( - Statement::CreateType { - name: __self_0, - representation: __self_1, - }, - Statement::CreateType { - name: __arg1_0, - representation: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::Pragma { - name: __self_0, - value: __self_1, - is_eq: __self_2, - }, - Statement::Pragma { - name: __arg1_0, - value: __arg1_1, - is_eq: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::LockTables { tables: __self_0 }, - Statement::LockTables { tables: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::Unload { - query: __self_0, - to: __self_1, - with: __self_2, - }, - Statement::Unload { - query: __arg1_0, - to: __arg1_1, - with: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - Statement::OptimizeTable { - name: __self_0, - on_cluster: __self_1, - partition: __self_2, - include_final: __self_3, - deduplicate: __self_4, - }, - Statement::OptimizeTable { - name: __arg1_0, - on_cluster: __arg1_1, - partition: __arg1_2, - include_final: __arg1_3, - deduplicate: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - ( - Statement::LISTEN { channel: __self_0 }, - Statement::LISTEN { channel: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::UNLISTEN { channel: __self_0 }, - Statement::UNLISTEN { channel: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Statement::NOTIFY { channel: __self_0, payload: __self_1 }, - Statement::NOTIFY { channel: __arg1_0, payload: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Statement::LoadData { - local: __self_0, - inpath: __self_1, - overwrite: __self_2, - table_name: __self_3, - partitioned: __self_4, - table_format: __self_5, - }, - Statement::LoadData { - local: __arg1_0, - inpath: __arg1_1, - overwrite: __arg1_2, - table_name: __arg1_3, - partitioned: __arg1_4, - table_format: __arg1_5, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 && __self_5 == __arg1_5 - } - ( - Statement::RenameTable(__self_0), - Statement::RenameTable(__arg1_0), - ) => __self_0 == __arg1_0, - (Statement::List(__self_0), Statement::List(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Statement::Remove(__self_0), Statement::Remove(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Statement::SetSessionParam(__self_0), - Statement::SetSessionParam(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Statement::RaisError { - message: __self_0, - severity: __self_1, - state: __self_2, - arguments: __self_3, - options: __self_4, - }, - Statement::RaisError { - message: __arg1_0, - severity: __arg1_1, - state: __arg1_2, - arguments: __arg1_3, - options: __arg1_4, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 && __self_3 == __arg1_3 - && __self_4 == __arg1_4 - } - _ => true, - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialOrd for Statement { - #[inline] - fn partial_cmp( - &self, - other: &Statement, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - Statement::Analyze { - table_name: __self_0, - partitions: __self_1, - for_columns: __self_2, - columns: __self_3, - cache_metadata: __self_4, - noscan: __self_5, - compute_statistics: __self_6, - has_table_keyword: __self_7, - }, - Statement::Analyze { - table_name: __arg1_0, - partitions: __arg1_1, - for_columns: __arg1_2, - columns: __arg1_3, - cache_metadata: __arg1_4, - noscan: __arg1_5, - compute_statistics: __arg1_6, - has_table_keyword: __arg1_7, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_6, - __arg1_6, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_7, __arg1_7) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Truncate { - table_names: __self_0, - partitions: __self_1, - table: __self_2, - only: __self_3, - identity: __self_4, - cascade: __self_5, - on_cluster: __self_6, - }, - Statement::Truncate { - table_names: __arg1_0, - partitions: __arg1_1, - table: __arg1_2, - only: __arg1_3, - identity: __arg1_4, - cascade: __arg1_5, - on_cluster: __arg1_6, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Msck { - table_name: __self_0, - repair: __self_1, - partition_action: __self_2, - }, - Statement::Msck { - table_name: __arg1_0, - repair: __arg1_1, - partition_action: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::Query(__self_0), Statement::Query(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Statement::Insert(__self_0), Statement::Insert(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Statement::Install { extension_name: __self_0 }, - Statement::Install { extension_name: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::Load { extension_name: __self_0 }, - Statement::Load { extension_name: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::Directory { - overwrite: __self_0, - local: __self_1, - path: __self_2, - file_format: __self_3, - source: __self_4, - }, - Statement::Directory { - overwrite: __arg1_0, - local: __arg1_1, - path: __arg1_2, - file_format: __arg1_3, - source: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::Call(__self_0), Statement::Call(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Statement::Copy { - source: __self_0, - to: __self_1, - target: __self_2, - options: __self_3, - legacy_options: __self_4, - values: __self_5, - }, - Statement::Copy { - source: __arg1_0, - to: __arg1_1, - target: __arg1_2, - options: __arg1_3, - legacy_options: __arg1_4, - values: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CopyIntoSnowflake { - into: __self_0, - from_stage: __self_1, - from_stage_alias: __self_2, - stage_params: __self_3, - from_transformations: __self_4, - files: __self_5, - pattern: __self_6, - file_format: __self_7, - copy_options: __self_8, - validation_mode: __self_9, - }, - Statement::CopyIntoSnowflake { - into: __arg1_0, - from_stage: __arg1_1, - from_stage_alias: __arg1_2, - stage_params: __arg1_3, - from_transformations: __arg1_4, - files: __arg1_5, - pattern: __arg1_6, - file_format: __arg1_7, - copy_options: __arg1_8, - validation_mode: __arg1_9, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_6, - __arg1_6, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_7, - __arg1_7, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_8, - __arg1_8, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_9, __arg1_9) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Close { cursor: __self_0 }, - Statement::Close { cursor: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::Update { - table: __self_0, - assignments: __self_1, - from: __self_2, - selection: __self_3, - returning: __self_4, - or: __self_5, - }, - Statement::Update { - table: __arg1_0, - assignments: __arg1_1, - from: __arg1_2, - selection: __arg1_3, - returning: __arg1_4, - or: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::Delete(__self_0), Statement::Delete(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Statement::CreateView { - or_replace: __self_0, - materialized: __self_1, - name: __self_2, - columns: __self_3, - query: __self_4, - options: __self_5, - cluster_by: __self_6, - comment: __self_7, - with_no_schema_binding: __self_8, - if_not_exists: __self_9, - temporary: __self_10, - to: __self_11, - params: __self_12, - }, - Statement::CreateView { - or_replace: __arg1_0, - materialized: __arg1_1, - name: __arg1_2, - columns: __arg1_3, - query: __arg1_4, - options: __arg1_5, - cluster_by: __arg1_6, - comment: __arg1_7, - with_no_schema_binding: __arg1_8, - if_not_exists: __arg1_9, - temporary: __arg1_10, - to: __arg1_11, - params: __arg1_12, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_6, - __arg1_6, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_7, - __arg1_7, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_8, - __arg1_8, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_9, - __arg1_9, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_10, - __arg1_10, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_11, - __arg1_11, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_12, __arg1_12) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::CreateTable(__self_0), Statement::CreateTable(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Statement::CreateVirtualTable { - name: __self_0, - if_not_exists: __self_1, - module_name: __self_2, - module_args: __self_3, - }, - Statement::CreateVirtualTable { - name: __arg1_0, - if_not_exists: __arg1_1, - module_name: __arg1_2, - module_args: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::CreateIndex(__self_0), Statement::CreateIndex(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Statement::CreateRole { - names: __self_0, - if_not_exists: __self_1, - login: __self_2, - inherit: __self_3, - bypassrls: __self_4, - password: __self_5, - superuser: __self_6, - create_db: __self_7, - create_role: __self_8, - replication: __self_9, - connection_limit: __self_10, - valid_until: __self_11, - in_role: __self_12, - in_group: __self_13, - role: __self_14, - user: __self_15, - admin: __self_16, - authorization_owner: __self_17, - }, - Statement::CreateRole { - names: __arg1_0, - if_not_exists: __arg1_1, - login: __arg1_2, - inherit: __arg1_3, - bypassrls: __arg1_4, - password: __arg1_5, - superuser: __arg1_6, - create_db: __arg1_7, - create_role: __arg1_8, - replication: __arg1_9, - connection_limit: __arg1_10, - valid_until: __arg1_11, - in_role: __arg1_12, - in_group: __arg1_13, - role: __arg1_14, - user: __arg1_15, - admin: __arg1_16, - authorization_owner: __arg1_17, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_6, - __arg1_6, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_7, - __arg1_7, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_8, - __arg1_8, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_9, - __arg1_9, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_10, - __arg1_10, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_11, - __arg1_11, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_12, - __arg1_12, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_13, - __arg1_13, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_14, - __arg1_14, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_15, - __arg1_15, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_16, - __arg1_16, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_17, __arg1_17) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateSecret { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - storage_specifier: __self_4, - secret_type: __self_5, - options: __self_6, - }, - Statement::CreateSecret { - or_replace: __arg1_0, - temporary: __arg1_1, - if_not_exists: __arg1_2, - name: __arg1_3, - storage_specifier: __arg1_4, - secret_type: __arg1_5, - options: __arg1_6, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreatePolicy { - name: __self_0, - table_name: __self_1, - policy_type: __self_2, - command: __self_3, - to: __self_4, - using: __self_5, - with_check: __self_6, - }, - Statement::CreatePolicy { - name: __arg1_0, - table_name: __arg1_1, - policy_type: __arg1_2, - command: __arg1_3, - to: __arg1_4, - using: __arg1_5, - with_check: __arg1_6, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateConnector(__self_0), - Statement::CreateConnector(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::AlterTable { - name: __self_0, - if_exists: __self_1, - only: __self_2, - operations: __self_3, - location: __self_4, - on_cluster: __self_5, - }, - Statement::AlterTable { - name: __arg1_0, - if_exists: __arg1_1, - only: __arg1_2, - operations: __arg1_3, - location: __arg1_4, - on_cluster: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AlterIndex { name: __self_0, operation: __self_1 }, - Statement::AlterIndex { name: __arg1_0, operation: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::AlterView { - name: __self_0, - columns: __self_1, - query: __self_2, - with_options: __self_3, - }, - Statement::AlterView { - name: __arg1_0, - columns: __arg1_1, - query: __arg1_2, - with_options: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AlterRole { name: __self_0, operation: __self_1 }, - Statement::AlterRole { name: __arg1_0, operation: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::AlterPolicy { - name: __self_0, - table_name: __self_1, - operation: __self_2, - }, - Statement::AlterPolicy { - name: __arg1_0, - table_name: __arg1_1, - operation: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AlterConnector { - name: __self_0, - properties: __self_1, - url: __self_2, - owner: __self_3, - }, - Statement::AlterConnector { - name: __arg1_0, - properties: __arg1_1, - url: __arg1_2, - owner: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AttachDatabase { - schema_name: __self_0, - database_file_name: __self_1, - database: __self_2, - }, - Statement::AttachDatabase { - schema_name: __arg1_0, - database_file_name: __arg1_1, - database: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AttachDuckDBDatabase { - if_not_exists: __self_0, - database: __self_1, - database_path: __self_2, - database_alias: __self_3, - attach_options: __self_4, - }, - Statement::AttachDuckDBDatabase { - if_not_exists: __arg1_0, - database: __arg1_1, - database_path: __arg1_2, - database_alias: __arg1_3, - attach_options: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DetachDuckDBDatabase { - if_exists: __self_0, - database: __self_1, - database_alias: __self_2, - }, - Statement::DetachDuckDBDatabase { - if_exists: __arg1_0, - database: __arg1_1, - database_alias: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Drop { - object_type: __self_0, - if_exists: __self_1, - names: __self_2, - cascade: __self_3, - restrict: __self_4, - purge: __self_5, - temporary: __self_6, - }, - Statement::Drop { - object_type: __arg1_0, - if_exists: __arg1_1, - names: __arg1_2, - cascade: __arg1_3, - restrict: __arg1_4, - purge: __arg1_5, - temporary: __arg1_6, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropFunction { - if_exists: __self_0, - func_desc: __self_1, - drop_behavior: __self_2, - }, - Statement::DropFunction { - if_exists: __arg1_0, - func_desc: __arg1_1, - drop_behavior: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropProcedure { - if_exists: __self_0, - proc_desc: __self_1, - drop_behavior: __self_2, - }, - Statement::DropProcedure { - if_exists: __arg1_0, - proc_desc: __arg1_1, - drop_behavior: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropSecret { - if_exists: __self_0, - temporary: __self_1, - name: __self_2, - storage_specifier: __self_3, - }, - Statement::DropSecret { - if_exists: __arg1_0, - temporary: __arg1_1, - name: __arg1_2, - storage_specifier: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropPolicy { - if_exists: __self_0, - name: __self_1, - table_name: __self_2, - drop_behavior: __self_3, - }, - Statement::DropPolicy { - if_exists: __arg1_0, - name: __arg1_1, - table_name: __arg1_2, - drop_behavior: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropConnector { if_exists: __self_0, name: __self_1 }, - Statement::DropConnector { if_exists: __arg1_0, name: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Declare { stmts: __self_0 }, - Statement::Declare { stmts: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::CreateExtension { - name: __self_0, - if_not_exists: __self_1, - cascade: __self_2, - schema: __self_3, - version: __self_4, - }, - Statement::CreateExtension { - name: __arg1_0, - if_not_exists: __arg1_1, - cascade: __arg1_2, - schema: __arg1_3, - version: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropExtension { - names: __self_0, - if_exists: __self_1, - cascade_or_restrict: __self_2, - }, - Statement::DropExtension { - names: __arg1_0, - if_exists: __arg1_1, - cascade_or_restrict: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Fetch { - name: __self_0, - direction: __self_1, - into: __self_2, - }, - Statement::Fetch { - name: __arg1_0, - direction: __arg1_1, - into: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Flush { - object_type: __self_0, - location: __self_1, - channel: __self_2, - read_lock: __self_3, - export: __self_4, - tables: __self_5, - }, - Statement::Flush { - object_type: __arg1_0, - location: __arg1_1, - channel: __arg1_2, - read_lock: __arg1_3, - export: __arg1_4, - tables: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Discard { object_type: __self_0 }, - Statement::Discard { object_type: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::SetRole { - context_modifier: __self_0, - role_name: __self_1, - }, - Statement::SetRole { - context_modifier: __arg1_0, - role_name: __arg1_1, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::SetVariable { - local: __self_0, - hivevar: __self_1, - variables: __self_2, - value: __self_3, - }, - Statement::SetVariable { - local: __arg1_0, - hivevar: __arg1_1, - variables: __arg1_2, - value: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::SetTimeZone { local: __self_0, value: __self_1 }, - Statement::SetTimeZone { local: __arg1_0, value: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::SetNames { - charset_name: __self_0, - collation_name: __self_1, - }, - Statement::SetNames { - charset_name: __arg1_0, - collation_name: __arg1_1, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::ShowFunctions { filter: __self_0 }, - Statement::ShowFunctions { filter: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::ShowVariable { variable: __self_0 }, - Statement::ShowVariable { variable: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::ShowStatus { - filter: __self_0, - global: __self_1, - session: __self_2, - }, - Statement::ShowStatus { - filter: __arg1_0, - global: __arg1_1, - session: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowVariables { - filter: __self_0, - global: __self_1, - session: __self_2, - }, - Statement::ShowVariables { - filter: __arg1_0, - global: __arg1_1, - session: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowCreate { obj_type: __self_0, obj_name: __self_1 }, - Statement::ShowCreate { obj_type: __arg1_0, obj_name: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::ShowColumns { - extended: __self_0, - full: __self_1, - show_options: __self_2, - }, - Statement::ShowColumns { - extended: __arg1_0, - full: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowDatabases { - terse: __self_0, - history: __self_1, - show_options: __self_2, - }, - Statement::ShowDatabases { - terse: __arg1_0, - history: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowSchemas { - terse: __self_0, - history: __self_1, - show_options: __self_2, - }, - Statement::ShowSchemas { - terse: __arg1_0, - history: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowTables { - terse: __self_0, - history: __self_1, - extended: __self_2, - full: __self_3, - external: __self_4, - show_options: __self_5, - }, - Statement::ShowTables { - terse: __arg1_0, - history: __arg1_1, - extended: __arg1_2, - full: __arg1_3, - external: __arg1_4, - show_options: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowViews { - terse: __self_0, - materialized: __self_1, - show_options: __self_2, - }, - Statement::ShowViews { - terse: __arg1_0, - materialized: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowCollation { filter: __self_0 }, - Statement::ShowCollation { filter: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (Statement::Use(__self_0), Statement::Use(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Statement::StartTransaction { - modes: __self_0, - begin: __self_1, - transaction: __self_2, - modifier: __self_3, - }, - Statement::StartTransaction { - modes: __arg1_0, - begin: __arg1_1, - transaction: __arg1_2, - modifier: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::SetTransaction { - modes: __self_0, - snapshot: __self_1, - session: __self_2, - }, - Statement::SetTransaction { - modes: __arg1_0, - snapshot: __arg1_1, - session: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Comment { - object_type: __self_0, - object_name: __self_1, - comment: __self_2, - if_exists: __self_3, - }, - Statement::Comment { - object_type: __arg1_0, - object_name: __arg1_1, - comment: __arg1_2, - if_exists: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Commit { - chain: __self_0, - end: __self_1, - modifier: __self_2, - }, - Statement::Commit { - chain: __arg1_0, - end: __arg1_1, - modifier: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Rollback { chain: __self_0, savepoint: __self_1 }, - Statement::Rollback { chain: __arg1_0, savepoint: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::CreateSchema { - schema_name: __self_0, - if_not_exists: __self_1, - }, - Statement::CreateSchema { - schema_name: __arg1_0, - if_not_exists: __arg1_1, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::CreateDatabase { - db_name: __self_0, - if_not_exists: __self_1, - location: __self_2, - managed_location: __self_3, - }, - Statement::CreateDatabase { - db_name: __arg1_0, - if_not_exists: __arg1_1, - location: __arg1_2, - managed_location: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateFunction(__self_0), - Statement::CreateFunction(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::CreateTrigger { - or_replace: __self_0, - is_constraint: __self_1, - name: __self_2, - period: __self_3, - events: __self_4, - table_name: __self_5, - referenced_table_name: __self_6, - referencing: __self_7, - trigger_object: __self_8, - include_each: __self_9, - condition: __self_10, - exec_body: __self_11, - characteristics: __self_12, - }, - Statement::CreateTrigger { - or_replace: __arg1_0, - is_constraint: __arg1_1, - name: __arg1_2, - period: __arg1_3, - events: __arg1_4, - table_name: __arg1_5, - referenced_table_name: __arg1_6, - referencing: __arg1_7, - trigger_object: __arg1_8, - include_each: __arg1_9, - condition: __arg1_10, - exec_body: __arg1_11, - characteristics: __arg1_12, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_6, - __arg1_6, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_7, - __arg1_7, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_8, - __arg1_8, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_9, - __arg1_9, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_10, - __arg1_10, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_11, - __arg1_11, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_12, __arg1_12) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropTrigger { - if_exists: __self_0, - trigger_name: __self_1, - table_name: __self_2, - option: __self_3, - }, - Statement::DropTrigger { - if_exists: __arg1_0, - trigger_name: __arg1_1, - table_name: __arg1_2, - option: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateProcedure { - or_alter: __self_0, - name: __self_1, - params: __self_2, - body: __self_3, - }, - Statement::CreateProcedure { - or_alter: __arg1_0, - name: __arg1_1, - params: __arg1_2, - body: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateMacro { - or_replace: __self_0, - temporary: __self_1, - name: __self_2, - args: __self_3, - definition: __self_4, - }, - Statement::CreateMacro { - or_replace: __arg1_0, - temporary: __arg1_1, - name: __arg1_2, - args: __arg1_3, - definition: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateStage { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - stage_params: __self_4, - directory_table_params: __self_5, - file_format: __self_6, - copy_options: __self_7, - comment: __self_8, - }, - Statement::CreateStage { - or_replace: __arg1_0, - temporary: __arg1_1, - if_not_exists: __arg1_2, - name: __arg1_3, - stage_params: __arg1_4, - directory_table_params: __arg1_5, - file_format: __arg1_6, - copy_options: __arg1_7, - comment: __arg1_8, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_6, - __arg1_6, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_7, - __arg1_7, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_8, __arg1_8) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Assert { condition: __self_0, message: __self_1 }, - Statement::Assert { condition: __arg1_0, message: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Grant { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - with_grant_option: __self_3, - granted_by: __self_4, - }, - Statement::Grant { - privileges: __arg1_0, - objects: __arg1_1, - grantees: __arg1_2, - with_grant_option: __arg1_3, - granted_by: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Revoke { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - granted_by: __self_3, - cascade: __self_4, - }, - Statement::Revoke { - privileges: __arg1_0, - objects: __arg1_1, - grantees: __arg1_2, - granted_by: __arg1_3, - cascade: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Deallocate { name: __self_0, prepare: __self_1 }, - Statement::Deallocate { name: __arg1_0, prepare: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Execute { - name: __self_0, - parameters: __self_1, - has_parentheses: __self_2, - using: __self_3, - }, - Statement::Execute { - name: __arg1_0, - parameters: __arg1_1, - has_parentheses: __arg1_2, - using: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Prepare { - name: __self_0, - data_types: __self_1, - statement: __self_2, - }, - Statement::Prepare { - name: __arg1_0, - data_types: __arg1_1, - statement: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Kill { modifier: __self_0, id: __self_1 }, - Statement::Kill { modifier: __arg1_0, id: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::ExplainTable { - describe_alias: __self_0, - hive_format: __self_1, - has_table_keyword: __self_2, - table_name: __self_3, - }, - Statement::ExplainTable { - describe_alias: __arg1_0, - hive_format: __arg1_1, - has_table_keyword: __arg1_2, - table_name: __arg1_3, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Explain { - describe_alias: __self_0, - analyze: __self_1, - verbose: __self_2, - query_plan: __self_3, - estimate: __self_4, - statement: __self_5, - format: __self_6, - options: __self_7, - }, - Statement::Explain { - describe_alias: __arg1_0, - analyze: __arg1_1, - verbose: __arg1_2, - query_plan: __arg1_3, - estimate: __arg1_4, - statement: __arg1_5, - format: __arg1_6, - options: __arg1_7, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_5, - __arg1_5, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_6, - __arg1_6, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_7, __arg1_7) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Savepoint { name: __self_0 }, - Statement::Savepoint { name: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::ReleaseSavepoint { name: __self_0 }, - Statement::ReleaseSavepoint { name: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::Merge { - into: __self_0, - table: __self_1, - source: __self_2, - on: __self_3, - clauses: __self_4, - }, - Statement::Merge { - into: __arg1_0, - table: __arg1_1, - source: __arg1_2, - on: __arg1_3, - clauses: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Cache { - table_flag: __self_0, - table_name: __self_1, - has_as: __self_2, - options: __self_3, - query: __self_4, - }, - Statement::Cache { - table_flag: __arg1_0, - table_name: __arg1_1, - has_as: __arg1_2, - options: __arg1_3, - query: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::UNCache { table_name: __self_0, if_exists: __self_1 }, - Statement::UNCache { table_name: __arg1_0, if_exists: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::CreateSequence { - temporary: __self_0, - if_not_exists: __self_1, - name: __self_2, - data_type: __self_3, - sequence_options: __self_4, - owned_by: __self_5, - }, - Statement::CreateSequence { - temporary: __arg1_0, - if_not_exists: __arg1_1, - name: __arg1_2, - data_type: __arg1_3, - sequence_options: __arg1_4, - owned_by: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateType { name: __self_0, representation: __self_1 }, - Statement::CreateType { name: __arg1_0, representation: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Pragma { - name: __self_0, - value: __self_1, - is_eq: __self_2, - }, - Statement::Pragma { - name: __arg1_0, - value: __arg1_1, - is_eq: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::LockTables { tables: __self_0 }, - Statement::LockTables { tables: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::Unload { query: __self_0, to: __self_1, with: __self_2 }, - Statement::Unload { query: __arg1_0, to: __arg1_1, with: __arg1_2 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::OptimizeTable { - name: __self_0, - on_cluster: __self_1, - partition: __self_2, - include_final: __self_3, - deduplicate: __self_4, - }, - Statement::OptimizeTable { - name: __arg1_0, - on_cluster: __arg1_1, - partition: __arg1_2, - include_final: __arg1_3, - deduplicate: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::LISTEN { channel: __self_0 }, - Statement::LISTEN { channel: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::UNLISTEN { channel: __self_0 }, - Statement::UNLISTEN { channel: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::NOTIFY { channel: __self_0, payload: __self_1 }, - Statement::NOTIFY { channel: __arg1_0, payload: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::LoadData { - local: __self_0, - inpath: __self_1, - overwrite: __self_2, - table_name: __self_3, - partitioned: __self_4, - table_format: __self_5, - }, - Statement::LoadData { - local: __arg1_0, - inpath: __arg1_1, - overwrite: __arg1_2, - table_name: __arg1_3, - partitioned: __arg1_4, - table_format: __arg1_5, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_4, - __arg1_4, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::RenameTable(__self_0), Statement::RenameTable(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Statement::List(__self_0), Statement::List(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Statement::Remove(__self_0), Statement::Remove(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Statement::SetSessionParam(__self_0), - Statement::SetSessionParam(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Statement::RaisError { - message: __self_0, - severity: __self_1, - state: __self_2, - arguments: __self_3, - options: __self_4, - }, - Statement::RaisError { - message: __arg1_0, - severity: __arg1_1, - state: __arg1_2, - arguments: __arg1_3, - options: __arg1_4, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_2, - __arg1_2, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_3, - __arg1_3, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Eq for Statement { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Ord for Statement { - #[inline] - fn cmp(&self, other: &Statement) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - Statement::Analyze { - table_name: __self_0, - partitions: __self_1, - for_columns: __self_2, - columns: __self_3, - cache_metadata: __self_4, - noscan: __self_5, - compute_statistics: __self_6, - has_table_keyword: __self_7, - }, - Statement::Analyze { - table_name: __arg1_0, - partitions: __arg1_1, - for_columns: __arg1_2, - columns: __arg1_3, - cache_metadata: __arg1_4, - noscan: __arg1_5, - compute_statistics: __arg1_6, - has_table_keyword: __arg1_7, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_7, __arg1_7) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Truncate { - table_names: __self_0, - partitions: __self_1, - table: __self_2, - only: __self_3, - identity: __self_4, - cascade: __self_5, - on_cluster: __self_6, - }, - Statement::Truncate { - table_names: __arg1_0, - partitions: __arg1_1, - table: __arg1_2, - only: __arg1_3, - identity: __arg1_4, - cascade: __arg1_5, - on_cluster: __arg1_6, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Msck { - table_name: __self_0, - repair: __self_1, - partition_action: __self_2, - }, - Statement::Msck { - table_name: __arg1_0, - repair: __arg1_1, - partition_action: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::Query(__self_0), Statement::Query(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Statement::Insert(__self_0), Statement::Insert(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Statement::Install { extension_name: __self_0 }, - Statement::Install { extension_name: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::Load { extension_name: __self_0 }, - Statement::Load { extension_name: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::Directory { - overwrite: __self_0, - local: __self_1, - path: __self_2, - file_format: __self_3, - source: __self_4, - }, - Statement::Directory { - overwrite: __arg1_0, - local: __arg1_1, - path: __arg1_2, - file_format: __arg1_3, - source: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::Call(__self_0), Statement::Call(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Statement::Copy { - source: __self_0, - to: __self_1, - target: __self_2, - options: __self_3, - legacy_options: __self_4, - values: __self_5, - }, - Statement::Copy { - source: __arg1_0, - to: __arg1_1, - target: __arg1_2, - options: __arg1_3, - legacy_options: __arg1_4, - values: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CopyIntoSnowflake { - into: __self_0, - from_stage: __self_1, - from_stage_alias: __self_2, - stage_params: __self_3, - from_transformations: __self_4, - files: __self_5, - pattern: __self_6, - file_format: __self_7, - copy_options: __self_8, - validation_mode: __self_9, - }, - Statement::CopyIntoSnowflake { - into: __arg1_0, - from_stage: __arg1_1, - from_stage_alias: __arg1_2, - stage_params: __arg1_3, - from_transformations: __arg1_4, - files: __arg1_5, - pattern: __arg1_6, - file_format: __arg1_7, - copy_options: __arg1_8, - validation_mode: __arg1_9, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_7, __arg1_7) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_8, __arg1_8) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_9, __arg1_9) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Close { cursor: __self_0 }, - Statement::Close { cursor: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::Update { - table: __self_0, - assignments: __self_1, - from: __self_2, - selection: __self_3, - returning: __self_4, - or: __self_5, - }, - Statement::Update { - table: __arg1_0, - assignments: __arg1_1, - from: __arg1_2, - selection: __arg1_3, - returning: __arg1_4, - or: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (Statement::Delete(__self_0), Statement::Delete(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Statement::CreateView { - or_replace: __self_0, - materialized: __self_1, - name: __self_2, - columns: __self_3, - query: __self_4, - options: __self_5, - cluster_by: __self_6, - comment: __self_7, - with_no_schema_binding: __self_8, - if_not_exists: __self_9, - temporary: __self_10, - to: __self_11, - params: __self_12, - }, - Statement::CreateView { - or_replace: __arg1_0, - materialized: __arg1_1, - name: __arg1_2, - columns: __arg1_3, - query: __arg1_4, - options: __arg1_5, - cluster_by: __arg1_6, - comment: __arg1_7, - with_no_schema_binding: __arg1_8, - if_not_exists: __arg1_9, - temporary: __arg1_10, - to: __arg1_11, - params: __arg1_12, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_7, __arg1_7) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_8, __arg1_8) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_9, __arg1_9) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_10, __arg1_10) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_11, __arg1_11) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_12, __arg1_12) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateTable(__self_0), - Statement::CreateTable(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::CreateVirtualTable { - name: __self_0, - if_not_exists: __self_1, - module_name: __self_2, - module_args: __self_3, - }, - Statement::CreateVirtualTable { - name: __arg1_0, - if_not_exists: __arg1_1, - module_name: __arg1_2, - module_args: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateIndex(__self_0), - Statement::CreateIndex(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::CreateRole { - names: __self_0, - if_not_exists: __self_1, - login: __self_2, - inherit: __self_3, - bypassrls: __self_4, - password: __self_5, - superuser: __self_6, - create_db: __self_7, - create_role: __self_8, - replication: __self_9, - connection_limit: __self_10, - valid_until: __self_11, - in_role: __self_12, - in_group: __self_13, - role: __self_14, - user: __self_15, - admin: __self_16, - authorization_owner: __self_17, - }, - Statement::CreateRole { - names: __arg1_0, - if_not_exists: __arg1_1, - login: __arg1_2, - inherit: __arg1_3, - bypassrls: __arg1_4, - password: __arg1_5, - superuser: __arg1_6, - create_db: __arg1_7, - create_role: __arg1_8, - replication: __arg1_9, - connection_limit: __arg1_10, - valid_until: __arg1_11, - in_role: __arg1_12, - in_group: __arg1_13, - role: __arg1_14, - user: __arg1_15, - admin: __arg1_16, - authorization_owner: __arg1_17, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_7, __arg1_7) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_8, __arg1_8) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_9, __arg1_9) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_10, __arg1_10) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_11, __arg1_11) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_12, __arg1_12) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_13, __arg1_13) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_14, __arg1_14) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_15, __arg1_15) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_16, __arg1_16) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_17, __arg1_17) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateSecret { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - storage_specifier: __self_4, - secret_type: __self_5, - options: __self_6, - }, - Statement::CreateSecret { - or_replace: __arg1_0, - temporary: __arg1_1, - if_not_exists: __arg1_2, - name: __arg1_3, - storage_specifier: __arg1_4, - secret_type: __arg1_5, - options: __arg1_6, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreatePolicy { - name: __self_0, - table_name: __self_1, - policy_type: __self_2, - command: __self_3, - to: __self_4, - using: __self_5, - with_check: __self_6, - }, - Statement::CreatePolicy { - name: __arg1_0, - table_name: __arg1_1, - policy_type: __arg1_2, - command: __arg1_3, - to: __arg1_4, - using: __arg1_5, - with_check: __arg1_6, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateConnector(__self_0), - Statement::CreateConnector(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::AlterTable { - name: __self_0, - if_exists: __self_1, - only: __self_2, - operations: __self_3, - location: __self_4, - on_cluster: __self_5, - }, - Statement::AlterTable { - name: __arg1_0, - if_exists: __arg1_1, - only: __arg1_2, - operations: __arg1_3, - location: __arg1_4, - on_cluster: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AlterIndex { - name: __self_0, - operation: __self_1, - }, - Statement::AlterIndex { name: __arg1_0, operation: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::AlterView { - name: __self_0, - columns: __self_1, - query: __self_2, - with_options: __self_3, - }, - Statement::AlterView { - name: __arg1_0, - columns: __arg1_1, - query: __arg1_2, - with_options: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AlterRole { name: __self_0, operation: __self_1 }, - Statement::AlterRole { name: __arg1_0, operation: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::AlterPolicy { - name: __self_0, - table_name: __self_1, - operation: __self_2, - }, - Statement::AlterPolicy { - name: __arg1_0, - table_name: __arg1_1, - operation: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AlterConnector { - name: __self_0, - properties: __self_1, - url: __self_2, - owner: __self_3, - }, - Statement::AlterConnector { - name: __arg1_0, - properties: __arg1_1, - url: __arg1_2, - owner: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AttachDatabase { - schema_name: __self_0, - database_file_name: __self_1, - database: __self_2, - }, - Statement::AttachDatabase { - schema_name: __arg1_0, - database_file_name: __arg1_1, - database: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::AttachDuckDBDatabase { - if_not_exists: __self_0, - database: __self_1, - database_path: __self_2, - database_alias: __self_3, - attach_options: __self_4, - }, - Statement::AttachDuckDBDatabase { - if_not_exists: __arg1_0, - database: __arg1_1, - database_path: __arg1_2, - database_alias: __arg1_3, - attach_options: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DetachDuckDBDatabase { - if_exists: __self_0, - database: __self_1, - database_alias: __self_2, - }, - Statement::DetachDuckDBDatabase { - if_exists: __arg1_0, - database: __arg1_1, - database_alias: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Drop { - object_type: __self_0, - if_exists: __self_1, - names: __self_2, - cascade: __self_3, - restrict: __self_4, - purge: __self_5, - temporary: __self_6, - }, - Statement::Drop { - object_type: __arg1_0, - if_exists: __arg1_1, - names: __arg1_2, - cascade: __arg1_3, - restrict: __arg1_4, - purge: __arg1_5, - temporary: __arg1_6, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_6, __arg1_6) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropFunction { - if_exists: __self_0, - func_desc: __self_1, - drop_behavior: __self_2, - }, - Statement::DropFunction { - if_exists: __arg1_0, - func_desc: __arg1_1, - drop_behavior: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropProcedure { - if_exists: __self_0, - proc_desc: __self_1, - drop_behavior: __self_2, - }, - Statement::DropProcedure { - if_exists: __arg1_0, - proc_desc: __arg1_1, - drop_behavior: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropSecret { - if_exists: __self_0, - temporary: __self_1, - name: __self_2, - storage_specifier: __self_3, - }, - Statement::DropSecret { - if_exists: __arg1_0, - temporary: __arg1_1, - name: __arg1_2, - storage_specifier: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropPolicy { - if_exists: __self_0, - name: __self_1, - table_name: __self_2, - drop_behavior: __self_3, - }, - Statement::DropPolicy { - if_exists: __arg1_0, - name: __arg1_1, - table_name: __arg1_2, - drop_behavior: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropConnector { - if_exists: __self_0, - name: __self_1, - }, - Statement::DropConnector { - if_exists: __arg1_0, - name: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Declare { stmts: __self_0 }, - Statement::Declare { stmts: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::CreateExtension { - name: __self_0, - if_not_exists: __self_1, - cascade: __self_2, - schema: __self_3, - version: __self_4, - }, - Statement::CreateExtension { - name: __arg1_0, - if_not_exists: __arg1_1, - cascade: __arg1_2, - schema: __arg1_3, - version: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropExtension { - names: __self_0, - if_exists: __self_1, - cascade_or_restrict: __self_2, - }, - Statement::DropExtension { - names: __arg1_0, - if_exists: __arg1_1, - cascade_or_restrict: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Fetch { - name: __self_0, - direction: __self_1, - into: __self_2, - }, - Statement::Fetch { - name: __arg1_0, - direction: __arg1_1, - into: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Flush { - object_type: __self_0, - location: __self_1, - channel: __self_2, - read_lock: __self_3, - export: __self_4, - tables: __self_5, - }, - Statement::Flush { - object_type: __arg1_0, - location: __arg1_1, - channel: __arg1_2, - read_lock: __arg1_3, - export: __arg1_4, - tables: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Discard { object_type: __self_0 }, - Statement::Discard { object_type: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::SetRole { - context_modifier: __self_0, - role_name: __self_1, - }, - Statement::SetRole { - context_modifier: __arg1_0, - role_name: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::SetVariable { - local: __self_0, - hivevar: __self_1, - variables: __self_2, - value: __self_3, - }, - Statement::SetVariable { - local: __arg1_0, - hivevar: __arg1_1, - variables: __arg1_2, - value: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::SetTimeZone { local: __self_0, value: __self_1 }, - Statement::SetTimeZone { local: __arg1_0, value: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::SetNames { - charset_name: __self_0, - collation_name: __self_1, - }, - Statement::SetNames { - charset_name: __arg1_0, - collation_name: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::ShowFunctions { filter: __self_0 }, - Statement::ShowFunctions { filter: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::ShowVariable { variable: __self_0 }, - Statement::ShowVariable { variable: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::ShowStatus { - filter: __self_0, - global: __self_1, - session: __self_2, - }, - Statement::ShowStatus { - filter: __arg1_0, - global: __arg1_1, - session: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowVariables { - filter: __self_0, - global: __self_1, - session: __self_2, - }, - Statement::ShowVariables { - filter: __arg1_0, - global: __arg1_1, - session: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowCreate { - obj_type: __self_0, - obj_name: __self_1, - }, - Statement::ShowCreate { - obj_type: __arg1_0, - obj_name: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::ShowColumns { - extended: __self_0, - full: __self_1, - show_options: __self_2, - }, - Statement::ShowColumns { - extended: __arg1_0, - full: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowDatabases { - terse: __self_0, - history: __self_1, - show_options: __self_2, - }, - Statement::ShowDatabases { - terse: __arg1_0, - history: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowSchemas { - terse: __self_0, - history: __self_1, - show_options: __self_2, - }, - Statement::ShowSchemas { - terse: __arg1_0, - history: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowTables { - terse: __self_0, - history: __self_1, - extended: __self_2, - full: __self_3, - external: __self_4, - show_options: __self_5, - }, - Statement::ShowTables { - terse: __arg1_0, - history: __arg1_1, - extended: __arg1_2, - full: __arg1_3, - external: __arg1_4, - show_options: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowViews { - terse: __self_0, - materialized: __self_1, - show_options: __self_2, - }, - Statement::ShowViews { - terse: __arg1_0, - materialized: __arg1_1, - show_options: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::ShowCollation { filter: __self_0 }, - Statement::ShowCollation { filter: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - (Statement::Use(__self_0), Statement::Use(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Statement::StartTransaction { - modes: __self_0, - begin: __self_1, - transaction: __self_2, - modifier: __self_3, - }, - Statement::StartTransaction { - modes: __arg1_0, - begin: __arg1_1, - transaction: __arg1_2, - modifier: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::SetTransaction { - modes: __self_0, - snapshot: __self_1, - session: __self_2, - }, - Statement::SetTransaction { - modes: __arg1_0, - snapshot: __arg1_1, - session: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Comment { - object_type: __self_0, - object_name: __self_1, - comment: __self_2, - if_exists: __self_3, - }, - Statement::Comment { - object_type: __arg1_0, - object_name: __arg1_1, - comment: __arg1_2, - if_exists: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Commit { - chain: __self_0, - end: __self_1, - modifier: __self_2, - }, - Statement::Commit { - chain: __arg1_0, - end: __arg1_1, - modifier: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Rollback { chain: __self_0, savepoint: __self_1 }, - Statement::Rollback { chain: __arg1_0, savepoint: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::CreateSchema { - schema_name: __self_0, - if_not_exists: __self_1, - }, - Statement::CreateSchema { - schema_name: __arg1_0, - if_not_exists: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::CreateDatabase { - db_name: __self_0, - if_not_exists: __self_1, - location: __self_2, - managed_location: __self_3, - }, - Statement::CreateDatabase { - db_name: __arg1_0, - if_not_exists: __arg1_1, - location: __arg1_2, - managed_location: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateFunction(__self_0), - Statement::CreateFunction(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::CreateTrigger { - or_replace: __self_0, - is_constraint: __self_1, - name: __self_2, - period: __self_3, - events: __self_4, - table_name: __self_5, - referenced_table_name: __self_6, - referencing: __self_7, - trigger_object: __self_8, - include_each: __self_9, - condition: __self_10, - exec_body: __self_11, - characteristics: __self_12, - }, - Statement::CreateTrigger { - or_replace: __arg1_0, - is_constraint: __arg1_1, - name: __arg1_2, - period: __arg1_3, - events: __arg1_4, - table_name: __arg1_5, - referenced_table_name: __arg1_6, - referencing: __arg1_7, - trigger_object: __arg1_8, - include_each: __arg1_9, - condition: __arg1_10, - exec_body: __arg1_11, - characteristics: __arg1_12, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_7, __arg1_7) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_8, __arg1_8) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_9, __arg1_9) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_10, __arg1_10) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_11, __arg1_11) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_12, __arg1_12) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::DropTrigger { - if_exists: __self_0, - trigger_name: __self_1, - table_name: __self_2, - option: __self_3, - }, - Statement::DropTrigger { - if_exists: __arg1_0, - trigger_name: __arg1_1, - table_name: __arg1_2, - option: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateProcedure { - or_alter: __self_0, - name: __self_1, - params: __self_2, - body: __self_3, - }, - Statement::CreateProcedure { - or_alter: __arg1_0, - name: __arg1_1, - params: __arg1_2, - body: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateMacro { - or_replace: __self_0, - temporary: __self_1, - name: __self_2, - args: __self_3, - definition: __self_4, - }, - Statement::CreateMacro { - or_replace: __arg1_0, - temporary: __arg1_1, - name: __arg1_2, - args: __arg1_3, - definition: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateStage { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - stage_params: __self_4, - directory_table_params: __self_5, - file_format: __self_6, - copy_options: __self_7, - comment: __self_8, - }, - Statement::CreateStage { - or_replace: __arg1_0, - temporary: __arg1_1, - if_not_exists: __arg1_2, - name: __arg1_3, - stage_params: __arg1_4, - directory_table_params: __arg1_5, - file_format: __arg1_6, - copy_options: __arg1_7, - comment: __arg1_8, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_7, __arg1_7) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_8, __arg1_8) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Assert { condition: __self_0, message: __self_1 }, - Statement::Assert { condition: __arg1_0, message: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Grant { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - with_grant_option: __self_3, - granted_by: __self_4, - }, - Statement::Grant { - privileges: __arg1_0, - objects: __arg1_1, - grantees: __arg1_2, - with_grant_option: __arg1_3, - granted_by: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Revoke { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - granted_by: __self_3, - cascade: __self_4, - }, - Statement::Revoke { - privileges: __arg1_0, - objects: __arg1_1, - grantees: __arg1_2, - granted_by: __arg1_3, - cascade: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Deallocate { name: __self_0, prepare: __self_1 }, - Statement::Deallocate { name: __arg1_0, prepare: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Execute { - name: __self_0, - parameters: __self_1, - has_parentheses: __self_2, - using: __self_3, - }, - Statement::Execute { - name: __arg1_0, - parameters: __arg1_1, - has_parentheses: __arg1_2, - using: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Prepare { - name: __self_0, - data_types: __self_1, - statement: __self_2, - }, - Statement::Prepare { - name: __arg1_0, - data_types: __arg1_1, - statement: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Kill { modifier: __self_0, id: __self_1 }, - Statement::Kill { modifier: __arg1_0, id: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::ExplainTable { - describe_alias: __self_0, - hive_format: __self_1, - has_table_keyword: __self_2, - table_name: __self_3, - }, - Statement::ExplainTable { - describe_alias: __arg1_0, - hive_format: __arg1_1, - has_table_keyword: __arg1_2, - table_name: __arg1_3, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_3, __arg1_3) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Explain { - describe_alias: __self_0, - analyze: __self_1, - verbose: __self_2, - query_plan: __self_3, - estimate: __self_4, - statement: __self_5, - format: __self_6, - options: __self_7, - }, - Statement::Explain { - describe_alias: __arg1_0, - analyze: __arg1_1, - verbose: __arg1_2, - query_plan: __arg1_3, - estimate: __arg1_4, - statement: __arg1_5, - format: __arg1_6, - options: __arg1_7, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_5, __arg1_5) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_6, __arg1_6) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_7, __arg1_7) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Savepoint { name: __self_0 }, - Statement::Savepoint { name: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::ReleaseSavepoint { name: __self_0 }, - Statement::ReleaseSavepoint { name: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::Merge { - into: __self_0, - table: __self_1, - source: __self_2, - on: __self_3, - clauses: __self_4, - }, - Statement::Merge { - into: __arg1_0, - table: __arg1_1, - source: __arg1_2, - on: __arg1_3, - clauses: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::Cache { - table_flag: __self_0, - table_name: __self_1, - has_as: __self_2, - options: __self_3, - query: __self_4, - }, - Statement::Cache { - table_flag: __arg1_0, - table_name: __arg1_1, - has_as: __arg1_2, - options: __arg1_3, - query: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::UNCache { - table_name: __self_0, - if_exists: __self_1, - }, - Statement::UNCache { - table_name: __arg1_0, - if_exists: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::CreateSequence { - temporary: __self_0, - if_not_exists: __self_1, - name: __self_2, - data_type: __self_3, - sequence_options: __self_4, - owned_by: __self_5, - }, - Statement::CreateSequence { - temporary: __arg1_0, - if_not_exists: __arg1_1, - name: __arg1_2, - data_type: __arg1_3, - sequence_options: __arg1_4, - owned_by: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::CreateType { - name: __self_0, - representation: __self_1, - }, - Statement::CreateType { - name: __arg1_0, - representation: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::Pragma { - name: __self_0, - value: __self_1, - is_eq: __self_2, - }, - Statement::Pragma { - name: __arg1_0, - value: __arg1_1, - is_eq: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::LockTables { tables: __self_0 }, - Statement::LockTables { tables: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::Unload { - query: __self_0, - to: __self_1, - with: __self_2, - }, - Statement::Unload { - query: __arg1_0, - to: __arg1_1, - with: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::OptimizeTable { - name: __self_0, - on_cluster: __self_1, - partition: __self_2, - include_final: __self_3, - deduplicate: __self_4, - }, - Statement::OptimizeTable { - name: __arg1_0, - on_cluster: __arg1_1, - partition: __arg1_2, - include_final: __arg1_3, - deduplicate: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::LISTEN { channel: __self_0 }, - Statement::LISTEN { channel: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::UNLISTEN { channel: __self_0 }, - Statement::UNLISTEN { channel: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::NOTIFY { channel: __self_0, payload: __self_1 }, - Statement::NOTIFY { channel: __arg1_0, payload: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Statement::LoadData { - local: __self_0, - inpath: __self_1, - overwrite: __self_2, - table_name: __self_3, - partitioned: __self_4, - table_format: __self_5, - }, - Statement::LoadData { - local: __arg1_0, - inpath: __arg1_1, - overwrite: __arg1_2, - table_name: __arg1_3, - partitioned: __arg1_4, - table_format: __arg1_5, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_4, __arg1_4) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_5, __arg1_5) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - Statement::RenameTable(__self_0), - Statement::RenameTable(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - (Statement::List(__self_0), Statement::List(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Statement::Remove(__self_0), Statement::Remove(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Statement::SetSessionParam(__self_0), - Statement::SetSessionParam(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Statement::RaisError { - message: __self_0, - severity: __self_1, - state: __self_2, - arguments: __self_3, - options: __self_4, - }, - Statement::RaisError { - message: __arg1_0, - severity: __arg1_1, - state: __arg1_2, - arguments: __arg1_3, - options: __arg1_4, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_2, __arg1_2) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_3, __arg1_3) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_4, __arg1_4) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::hash::Hash for Statement { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Statement::Analyze { - table_name: __self_0, - partitions: __self_1, - for_columns: __self_2, - columns: __self_3, - cache_metadata: __self_4, - noscan: __self_5, - compute_statistics: __self_6, - has_table_keyword: __self_7, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state); - ::core::hash::Hash::hash(__self_7, state) - } - Statement::Truncate { - table_names: __self_0, - partitions: __self_1, - table: __self_2, - only: __self_3, - identity: __self_4, - cascade: __self_5, - on_cluster: __self_6, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state) - } - Statement::Msck { - table_name: __self_0, - repair: __self_1, - partition_action: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::Query(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Statement::Insert(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Statement::Install { extension_name: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::Load { extension_name: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::Directory { - overwrite: __self_0, - local: __self_1, - path: __self_2, - file_format: __self_3, - source: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::Call(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Statement::Copy { - source: __self_0, - to: __self_1, - target: __self_2, - options: __self_3, - legacy_options: __self_4, - values: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Statement::CopyIntoSnowflake { - into: __self_0, - from_stage: __self_1, - from_stage_alias: __self_2, - stage_params: __self_3, - from_transformations: __self_4, - files: __self_5, - pattern: __self_6, - file_format: __self_7, - copy_options: __self_8, - validation_mode: __self_9, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state); - ::core::hash::Hash::hash(__self_7, state); - ::core::hash::Hash::hash(__self_8, state); - ::core::hash::Hash::hash(__self_9, state) - } - Statement::Close { cursor: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::Update { - table: __self_0, - assignments: __self_1, - from: __self_2, - selection: __self_3, - returning: __self_4, - or: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Statement::Delete(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Statement::CreateView { - or_replace: __self_0, - materialized: __self_1, - name: __self_2, - columns: __self_3, - query: __self_4, - options: __self_5, - cluster_by: __self_6, - comment: __self_7, - with_no_schema_binding: __self_8, - if_not_exists: __self_9, - temporary: __self_10, - to: __self_11, - params: __self_12, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state); - ::core::hash::Hash::hash(__self_7, state); - ::core::hash::Hash::hash(__self_8, state); - ::core::hash::Hash::hash(__self_9, state); - ::core::hash::Hash::hash(__self_10, state); - ::core::hash::Hash::hash(__self_11, state); - ::core::hash::Hash::hash(__self_12, state) - } - Statement::CreateTable(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::CreateVirtualTable { - name: __self_0, - if_not_exists: __self_1, - module_name: __self_2, - module_args: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::CreateIndex(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::CreateRole { - names: __self_0, - if_not_exists: __self_1, - login: __self_2, - inherit: __self_3, - bypassrls: __self_4, - password: __self_5, - superuser: __self_6, - create_db: __self_7, - create_role: __self_8, - replication: __self_9, - connection_limit: __self_10, - valid_until: __self_11, - in_role: __self_12, - in_group: __self_13, - role: __self_14, - user: __self_15, - admin: __self_16, - authorization_owner: __self_17, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state); - ::core::hash::Hash::hash(__self_7, state); - ::core::hash::Hash::hash(__self_8, state); - ::core::hash::Hash::hash(__self_9, state); - ::core::hash::Hash::hash(__self_10, state); - ::core::hash::Hash::hash(__self_11, state); - ::core::hash::Hash::hash(__self_12, state); - ::core::hash::Hash::hash(__self_13, state); - ::core::hash::Hash::hash(__self_14, state); - ::core::hash::Hash::hash(__self_15, state); - ::core::hash::Hash::hash(__self_16, state); - ::core::hash::Hash::hash(__self_17, state) - } - Statement::CreateSecret { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - storage_specifier: __self_4, - secret_type: __self_5, - options: __self_6, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state) - } - Statement::CreatePolicy { - name: __self_0, - table_name: __self_1, - policy_type: __self_2, - command: __self_3, - to: __self_4, - using: __self_5, - with_check: __self_6, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state) - } - Statement::CreateConnector(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::AlterTable { - name: __self_0, - if_exists: __self_1, - only: __self_2, - operations: __self_3, - location: __self_4, - on_cluster: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Statement::AlterIndex { name: __self_0, operation: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::AlterView { - name: __self_0, - columns: __self_1, - query: __self_2, - with_options: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::AlterRole { name: __self_0, operation: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::AlterPolicy { - name: __self_0, - table_name: __self_1, - operation: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::AlterConnector { - name: __self_0, - properties: __self_1, - url: __self_2, - owner: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::AttachDatabase { - schema_name: __self_0, - database_file_name: __self_1, - database: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::AttachDuckDBDatabase { - if_not_exists: __self_0, - database: __self_1, - database_path: __self_2, - database_alias: __self_3, - attach_options: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::DetachDuckDBDatabase { - if_exists: __self_0, - database: __self_1, - database_alias: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::Drop { - object_type: __self_0, - if_exists: __self_1, - names: __self_2, - cascade: __self_3, - restrict: __self_4, - purge: __self_5, - temporary: __self_6, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state) - } - Statement::DropFunction { - if_exists: __self_0, - func_desc: __self_1, - drop_behavior: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::DropProcedure { - if_exists: __self_0, - proc_desc: __self_1, - drop_behavior: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::DropSecret { - if_exists: __self_0, - temporary: __self_1, - name: __self_2, - storage_specifier: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::DropPolicy { - if_exists: __self_0, - name: __self_1, - table_name: __self_2, - drop_behavior: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::DropConnector { if_exists: __self_0, name: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::Declare { stmts: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::CreateExtension { - name: __self_0, - if_not_exists: __self_1, - cascade: __self_2, - schema: __self_3, - version: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::DropExtension { - names: __self_0, - if_exists: __self_1, - cascade_or_restrict: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::Fetch { - name: __self_0, - direction: __self_1, - into: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::Flush { - object_type: __self_0, - location: __self_1, - channel: __self_2, - read_lock: __self_3, - export: __self_4, - tables: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Statement::Discard { object_type: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::SetRole { - context_modifier: __self_0, - role_name: __self_1, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::SetVariable { - local: __self_0, - hivevar: __self_1, - variables: __self_2, - value: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::SetTimeZone { local: __self_0, value: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::SetNames { - charset_name: __self_0, - collation_name: __self_1, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::ShowFunctions { filter: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::ShowVariable { variable: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::ShowStatus { - filter: __self_0, - global: __self_1, - session: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::ShowVariables { - filter: __self_0, - global: __self_1, - session: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::ShowCreate { obj_type: __self_0, obj_name: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::ShowColumns { - extended: __self_0, - full: __self_1, - show_options: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::ShowDatabases { - terse: __self_0, - history: __self_1, - show_options: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::ShowSchemas { - terse: __self_0, - history: __self_1, - show_options: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::ShowTables { - terse: __self_0, - history: __self_1, - extended: __self_2, - full: __self_3, - external: __self_4, - show_options: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Statement::ShowViews { - terse: __self_0, - materialized: __self_1, - show_options: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::ShowCollation { filter: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::Use(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Statement::StartTransaction { - modes: __self_0, - begin: __self_1, - transaction: __self_2, - modifier: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::SetTransaction { - modes: __self_0, - snapshot: __self_1, - session: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::Comment { - object_type: __self_0, - object_name: __self_1, - comment: __self_2, - if_exists: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::Commit { - chain: __self_0, - end: __self_1, - modifier: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::Rollback { chain: __self_0, savepoint: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::CreateSchema { - schema_name: __self_0, - if_not_exists: __self_1, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::CreateDatabase { - db_name: __self_0, - if_not_exists: __self_1, - location: __self_2, - managed_location: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::CreateFunction(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::CreateTrigger { - or_replace: __self_0, - is_constraint: __self_1, - name: __self_2, - period: __self_3, - events: __self_4, - table_name: __self_5, - referenced_table_name: __self_6, - referencing: __self_7, - trigger_object: __self_8, - include_each: __self_9, - condition: __self_10, - exec_body: __self_11, - characteristics: __self_12, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state); - ::core::hash::Hash::hash(__self_7, state); - ::core::hash::Hash::hash(__self_8, state); - ::core::hash::Hash::hash(__self_9, state); - ::core::hash::Hash::hash(__self_10, state); - ::core::hash::Hash::hash(__self_11, state); - ::core::hash::Hash::hash(__self_12, state) - } - Statement::DropTrigger { - if_exists: __self_0, - trigger_name: __self_1, - table_name: __self_2, - option: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::CreateProcedure { - or_alter: __self_0, - name: __self_1, - params: __self_2, - body: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::CreateMacro { - or_replace: __self_0, - temporary: __self_1, - name: __self_2, - args: __self_3, - definition: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::CreateStage { - or_replace: __self_0, - temporary: __self_1, - if_not_exists: __self_2, - name: __self_3, - stage_params: __self_4, - directory_table_params: __self_5, - file_format: __self_6, - copy_options: __self_7, - comment: __self_8, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state); - ::core::hash::Hash::hash(__self_7, state); - ::core::hash::Hash::hash(__self_8, state) - } - Statement::Assert { condition: __self_0, message: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::Grant { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - with_grant_option: __self_3, - granted_by: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::Revoke { - privileges: __self_0, - objects: __self_1, - grantees: __self_2, - granted_by: __self_3, - cascade: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::Deallocate { name: __self_0, prepare: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::Execute { - name: __self_0, - parameters: __self_1, - has_parentheses: __self_2, - using: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::Prepare { - name: __self_0, - data_types: __self_1, - statement: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::Kill { modifier: __self_0, id: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::ExplainTable { - describe_alias: __self_0, - hive_format: __self_1, - has_table_keyword: __self_2, - table_name: __self_3, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state) - } - Statement::Explain { - describe_alias: __self_0, - analyze: __self_1, - verbose: __self_2, - query_plan: __self_3, - estimate: __self_4, - statement: __self_5, - format: __self_6, - options: __self_7, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state); - ::core::hash::Hash::hash(__self_6, state); - ::core::hash::Hash::hash(__self_7, state) - } - Statement::Savepoint { name: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::ReleaseSavepoint { name: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::Merge { - into: __self_0, - table: __self_1, - source: __self_2, - on: __self_3, - clauses: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::Cache { - table_flag: __self_0, - table_name: __self_1, - has_as: __self_2, - options: __self_3, - query: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::UNCache { table_name: __self_0, if_exists: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::CreateSequence { - temporary: __self_0, - if_not_exists: __self_1, - name: __self_2, - data_type: __self_3, - sequence_options: __self_4, - owned_by: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Statement::CreateType { name: __self_0, representation: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::Pragma { - name: __self_0, - value: __self_1, - is_eq: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::LockTables { tables: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::Unload { query: __self_0, to: __self_1, with: __self_2 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - Statement::OptimizeTable { - name: __self_0, - on_cluster: __self_1, - partition: __self_2, - include_final: __self_3, - deduplicate: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - Statement::LISTEN { channel: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::UNLISTEN { channel: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::NOTIFY { channel: __self_0, payload: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Statement::LoadData { - local: __self_0, - inpath: __self_1, - overwrite: __self_2, - table_name: __self_3, - partitioned: __self_4, - table_format: __self_5, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state); - ::core::hash::Hash::hash(__self_5, state) - } - Statement::RenameTable(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::List(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Statement::Remove(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Statement::SetSessionParam(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Statement::RaisError { - message: __self_0, - severity: __self_1, - state: __self_2, - arguments: __self_3, - options: __self_4, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state); - ::core::hash::Hash::hash(__self_3, state); - ::core::hash::Hash::hash(__self_4, state) - } - _ => {} - } - } - } - pub enum RaisErrorOption { - Log, - NoWait, - SetError, - } - #[automatically_derived] - impl ::core::fmt::Debug for RaisErrorOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - RaisErrorOption::Log => "Log", - RaisErrorOption::NoWait => "NoWait", - RaisErrorOption::SetError => "SetError", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for RaisErrorOption { - #[inline] - fn clone(&self) -> RaisErrorOption { - match self { - RaisErrorOption::Log => RaisErrorOption::Log, - RaisErrorOption::NoWait => RaisErrorOption::NoWait, - RaisErrorOption::SetError => RaisErrorOption::SetError, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for RaisErrorOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for RaisErrorOption { - #[inline] - fn eq(&self, other: &RaisErrorOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for RaisErrorOption { - #[inline] - fn partial_cmp( - &self, - other: &RaisErrorOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for RaisErrorOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for RaisErrorOption { - #[inline] - fn cmp(&self, other: &RaisErrorOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for RaisErrorOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for RaisErrorOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - RaisErrorOption::Log => f.write_fmt(format_args!("LOG")), - RaisErrorOption::NoWait => f.write_fmt(format_args!("NOWAIT")), - RaisErrorOption::SetError => f.write_fmt(format_args!("SETERROR")), - } - } - } - impl fmt::Display for Statement { - #[allow(clippy::cognitive_complexity)] - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Statement::Flush { - object_type, - location, - channel, - read_lock, - export, - tables, - } => { - f.write_fmt(format_args!("FLUSH"))?; - if let Some(location) = location { - f.write_fmt(format_args!(" {0}", location))?; - } - f.write_fmt(format_args!(" {0}", object_type))?; - if let Some(channel) = channel { - f.write_fmt(format_args!(" FOR CHANNEL {0}", channel))?; - } - f.write_fmt( - format_args!( - "{0}{2}{1}", - if !tables.is_empty() { - " ".to_string() - + &display_comma_separated(tables).to_string() - } else { - "".to_string() - }, - if *export { " FOR EXPORT" } else { "" }, - if *read_lock { " WITH READ LOCK" } else { "" }, - ), - ) - } - Statement::Kill { modifier, id } => { - f.write_fmt(format_args!("KILL "))?; - if let Some(m) = modifier { - f.write_fmt(format_args!("{0} ", m))?; - } - f.write_fmt(format_args!("{0}", id)) - } - Statement::ExplainTable { - describe_alias, - hive_format, - has_table_keyword, - table_name, - } => { - f.write_fmt(format_args!("{0} ", describe_alias))?; - if let Some(format) = hive_format { - f.write_fmt(format_args!("{0} ", format))?; - } - if *has_table_keyword { - f.write_fmt(format_args!("TABLE "))?; - } - f.write_fmt(format_args!("{0}", table_name)) - } - Statement::Explain { - describe_alias, - verbose, - analyze, - query_plan, - estimate, - statement, - format, - options, - } => { - f.write_fmt(format_args!("{0} ", describe_alias))?; - if *query_plan { - f.write_fmt(format_args!("QUERY PLAN "))?; - } - if *analyze { - f.write_fmt(format_args!("ANALYZE "))?; - } - if *estimate { - f.write_fmt(format_args!("ESTIMATE "))?; - } - if *verbose { - f.write_fmt(format_args!("VERBOSE "))?; - } - if let Some(format) = format { - f.write_fmt(format_args!("FORMAT {0} ", format))?; - } - if let Some(options) = options { - f.write_fmt( - format_args!("({0}) ", display_comma_separated(options)), - )?; - } - f.write_fmt(format_args!("{0}", statement)) - } - Statement::Query(s) => f.write_fmt(format_args!("{0}", s)), - Statement::Declare { stmts } => { - f.write_fmt(format_args!("DECLARE "))?; - f.write_fmt(format_args!("{0}", display_separated(stmts, "; "))) - } - Statement::Fetch { name, direction, into } => { - f.write_fmt(format_args!("FETCH {0} ", direction))?; - f.write_fmt(format_args!("IN {0}", name))?; - if let Some(into) = into { - f.write_fmt(format_args!(" INTO {0}", into))?; - } - Ok(()) - } - Statement::Directory { overwrite, local, path, file_format, source } => { - f.write_fmt( - format_args!( - "INSERT{0}{1} DIRECTORY \'{2}\'", - if *overwrite { " OVERWRITE" } else { "" }, - if *local { " LOCAL" } else { "" }, - path, - ), - )?; - if let Some(ref ff) = file_format { - f.write_fmt(format_args!(" STORED AS {0}", ff))? - } - f.write_fmt(format_args!(" {0}", source)) - } - Statement::Msck { table_name, repair, partition_action } => { - f.write_fmt( - format_args!( - "MSCK {0}TABLE {1}", - if *repair { "REPAIR " } else { "" }, - table_name, - ), - )?; - if let Some(pa) = partition_action { - f.write_fmt(format_args!(" {0}", pa))?; - } - Ok(()) - } - Statement::Truncate { - table_names, - partitions, - table, - only, - identity, - cascade, - on_cluster, - } => { - let table = if *table { "TABLE " } else { "" }; - let only = if *only { "ONLY " } else { "" }; - f.write_fmt( - format_args!( - "TRUNCATE {1}{2}{0}", - display_comma_separated(table_names), - table, - only, - ), - )?; - if let Some(identity) = identity { - match identity { - TruncateIdentityOption::Restart => { - f.write_fmt(format_args!(" RESTART IDENTITY"))? - } - TruncateIdentityOption::Continue => { - f.write_fmt(format_args!(" CONTINUE IDENTITY"))? - } - } - } - if let Some(cascade) = cascade { - match cascade { - CascadeOption::Cascade => { - f.write_fmt(format_args!(" CASCADE"))? - } - CascadeOption::Restrict => { - f.write_fmt(format_args!(" RESTRICT"))? - } - } - } - if let Some(ref parts) = partitions { - if !parts.is_empty() { - f.write_fmt( - format_args!( - " PARTITION ({0})", - display_comma_separated(parts), - ), - )?; - } - } - if let Some(on_cluster) = on_cluster { - f.write_fmt(format_args!(" ON CLUSTER {0}", on_cluster))?; - } - Ok(()) - } - Statement::AttachDatabase { - schema_name, - database_file_name, - database, - } => { - let keyword = if *database { "DATABASE " } else { "" }; - f.write_fmt( - format_args!( - "ATTACH {0}{1} AS {2}", - keyword, - database_file_name, - schema_name, - ), - ) - } - Statement::AttachDuckDBDatabase { - if_not_exists, - database, - database_path, - database_alias, - attach_options, - } => { - f.write_fmt( - format_args!( - "ATTACH{0}{1} {2}", - if *database { " DATABASE" } else { "" }, - if *if_not_exists { " IF NOT EXISTS" } else { "" }, - database_path, - ), - )?; - if let Some(alias) = database_alias { - f.write_fmt(format_args!(" AS {0}", alias))?; - } - if !attach_options.is_empty() { - f.write_fmt( - format_args!( - " ({0})", - display_comma_separated(attach_options), - ), - )?; - } - Ok(()) - } - Statement::DetachDuckDBDatabase { - if_exists, - database, - database_alias, - } => { - f.write_fmt( - format_args!( - "DETACH{0}{1} {2}", - if *database { " DATABASE" } else { "" }, - if *if_exists { " IF EXISTS" } else { "" }, - database_alias, - ), - )?; - Ok(()) - } - Statement::Analyze { - table_name, - partitions, - for_columns, - columns, - cache_metadata, - noscan, - compute_statistics, - has_table_keyword, - } => { - f.write_fmt( - format_args!( - "ANALYZE{0}{1}", - if *has_table_keyword { " TABLE " } else { " " }, - table_name, - ), - )?; - if let Some(ref parts) = partitions { - if !parts.is_empty() { - f.write_fmt( - format_args!( - " PARTITION ({0})", - display_comma_separated(parts), - ), - )?; - } - } - if *compute_statistics { - f.write_fmt(format_args!(" COMPUTE STATISTICS"))?; - } - if *noscan { - f.write_fmt(format_args!(" NOSCAN"))?; - } - if *cache_metadata { - f.write_fmt(format_args!(" CACHE METADATA"))?; - } - if *for_columns { - f.write_fmt(format_args!(" FOR COLUMNS"))?; - if !columns.is_empty() { - f.write_fmt( - format_args!(" {0}", display_comma_separated(columns)), - )?; - } - } - Ok(()) - } - Statement::Insert(insert) => f.write_fmt(format_args!("{0}", insert)), - Statement::Install { extension_name: name } => { - f.write_fmt(format_args!("INSTALL {0}", name)) - } - Statement::Load { extension_name: name } => { - f.write_fmt(format_args!("LOAD {0}", name)) - } - Statement::Call(function) => { - f.write_fmt(format_args!("CALL {0}", function)) - } - Statement::Copy { - source, - to, - target, - options, - legacy_options, - values, - } => { - f.write_fmt(format_args!("COPY"))?; - match source { - CopySource::Query(query) => { - f.write_fmt(format_args!(" ({0})", query))? - } - CopySource::Table { table_name, columns } => { - f.write_fmt(format_args!(" {0}", table_name))?; - if !columns.is_empty() { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(columns)), - )?; - } - } - } - f.write_fmt( - format_args!(" {0} {1}", if *to { "TO" } else { "FROM" }, target), - )?; - if !options.is_empty() { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(options)), - )?; - } - if !legacy_options.is_empty() { - f.write_fmt( - format_args!(" {0}", display_separated(legacy_options, " ")), - )?; - } - if !values.is_empty() { - f.write_fmt(format_args!(";\n"))?; - let mut delim = ""; - for v in values { - f.write_fmt(format_args!("{0}", delim))?; - delim = "\t"; - if let Some(v) = v { - f.write_fmt(format_args!("{0}", v))?; - } else { - f.write_fmt(format_args!("\\N"))?; - } - } - f.write_fmt(format_args!("\n\\."))?; - } - Ok(()) - } - Statement::Update { - table, - assignments, - from, - selection, - returning, - or, - } => { - f.write_fmt(format_args!("UPDATE "))?; - if let Some(or) = or { - f.write_fmt(format_args!("{0} ", or))?; - } - f.write_fmt(format_args!("{0}", table))?; - if let Some(UpdateTableFromKind::BeforeSet(from)) = from { - f.write_fmt( - format_args!(" FROM {0}", display_comma_separated(from)), - )?; - } - if !assignments.is_empty() { - f.write_fmt( - format_args!( - " SET {0}", - display_comma_separated(assignments), - ), - )?; - } - if let Some(UpdateTableFromKind::AfterSet(from)) = from { - f.write_fmt( - format_args!(" FROM {0}", display_comma_separated(from)), - )?; - } - if let Some(selection) = selection { - f.write_fmt(format_args!(" WHERE {0}", selection))?; - } - if let Some(returning) = returning { - f.write_fmt( - format_args!( - " RETURNING {0}", - display_comma_separated(returning), - ), - )?; - } - Ok(()) - } - Statement::Delete(delete) => f.write_fmt(format_args!("{0}", delete)), - Statement::Close { cursor } => { - f.write_fmt(format_args!("CLOSE {0}", cursor))?; - Ok(()) - } - Statement::CreateDatabase { - db_name, - if_not_exists, - location, - managed_location, - } => { - f.write_fmt(format_args!("CREATE DATABASE"))?; - if *if_not_exists { - f.write_fmt(format_args!(" IF NOT EXISTS"))?; - } - f.write_fmt(format_args!(" {0}", db_name))?; - if let Some(l) = location { - f.write_fmt(format_args!(" LOCATION \'{0}\'", l))?; - } - if let Some(ml) = managed_location { - f.write_fmt(format_args!(" MANAGEDLOCATION \'{0}\'", ml))?; - } - Ok(()) - } - Statement::CreateFunction(create_function) => create_function.fmt(f), - Statement::CreateTrigger { - or_replace, - is_constraint, - name, - period, - events, - table_name, - referenced_table_name, - referencing, - trigger_object, - condition, - include_each, - exec_body, - characteristics, - } => { - f.write_fmt( - format_args!( - "CREATE {0}{1}TRIGGER {2} {3}", - if *or_replace { "OR REPLACE " } else { "" }, - if *is_constraint { "CONSTRAINT " } else { "" }, - name, - period, - ), - )?; - if !events.is_empty() { - f.write_fmt( - format_args!(" {0}", display_separated(events, " OR ")), - )?; - } - f.write_fmt(format_args!(" ON {0}", table_name))?; - if let Some(referenced_table_name) = referenced_table_name { - f.write_fmt(format_args!(" FROM {0}", referenced_table_name))?; - } - if let Some(characteristics) = characteristics { - f.write_fmt(format_args!(" {0}", characteristics))?; - } - if !referencing.is_empty() { - f.write_fmt( - format_args!( - " REFERENCING {0}", - display_separated(referencing, " "), - ), - )?; - } - if *include_each { - f.write_fmt(format_args!(" FOR EACH {0}", trigger_object))?; - } else { - f.write_fmt(format_args!(" FOR {0}", trigger_object))?; - } - if let Some(condition) = condition { - f.write_fmt(format_args!(" WHEN {0}", condition))?; - } - f.write_fmt(format_args!(" EXECUTE {0}", exec_body)) - } - Statement::DropTrigger { - if_exists, - trigger_name, - table_name, - option, - } => { - f.write_fmt(format_args!("DROP TRIGGER"))?; - if *if_exists { - f.write_fmt(format_args!(" IF EXISTS"))?; - } - f.write_fmt(format_args!(" {0} ON {1}", trigger_name, table_name))?; - if let Some(option) = option { - f.write_fmt(format_args!(" {0}", option))?; - } - Ok(()) - } - Statement::CreateProcedure { name, or_alter, params, body } => { - f.write_fmt( - format_args!( - "CREATE {0}PROCEDURE {1}", - if *or_alter { "OR ALTER " } else { "" }, - name, - ), - )?; - if let Some(p) = params { - if !p.is_empty() { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(p)), - )?; - } - } - f.write_fmt( - format_args!(" AS BEGIN {0} END", display_separated(body, "; ")), - ) - } - Statement::CreateMacro { - or_replace, - temporary, - name, - args, - definition, - } => { - f.write_fmt( - format_args!( - "CREATE {1}{0}MACRO {2}", - if *temporary { "TEMPORARY " } else { "" }, - if *or_replace { "OR REPLACE " } else { "" }, - name, - ), - )?; - if let Some(args) = args { - f.write_fmt( - format_args!("({0})", display_comma_separated(args)), - )?; - } - match definition { - MacroDefinition::Expr(expr) => { - f.write_fmt(format_args!(" AS {0}", expr))? - } - MacroDefinition::Table(query) => { - f.write_fmt(format_args!(" AS TABLE {0}", query))? - } - } - Ok(()) - } - Statement::CreateView { - name, - or_replace, - columns, - query, - materialized, - options, - cluster_by, - comment, - with_no_schema_binding, - if_not_exists, - temporary, - to, - params, - } => { - f.write_fmt( - format_args!( - "CREATE {0}", - if *or_replace { "OR REPLACE " } else { "" }, - ), - )?; - if let Some(params) = params { - params.fmt(f)?; - } - f.write_fmt( - format_args!( - "{0}{2}VIEW {3}{1}{4}", - if *materialized { "MATERIALIZED " } else { "" }, - name, - if *temporary { "TEMPORARY " } else { "" }, - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - to - .as_ref() - .map(|to| ::alloc::__export::must_use({ - let res = ::alloc::fmt::format(format_args!(" TO {0}", to)); - res - })) - .unwrap_or_default(), - ), - )?; - if !columns.is_empty() { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(columns)), - )?; - } - if match options { - CreateTableOptions::With(_) => true, - _ => false, - } { - f.write_fmt(format_args!(" {0}", options))?; - } - if let Some(comment) = comment { - f.write_fmt( - format_args!( - " COMMENT = \'{0}\'", - value::escape_single_quote_string(comment), - ), - )?; - } - if !cluster_by.is_empty() { - f.write_fmt( - format_args!( - " CLUSTER BY ({0})", - display_comma_separated(cluster_by), - ), - )?; - } - if match options { - CreateTableOptions::Options(_) => true, - _ => false, - } { - f.write_fmt(format_args!(" {0}", options))?; - } - f.write_fmt(format_args!(" AS {0}", query))?; - if *with_no_schema_binding { - f.write_fmt(format_args!(" WITH NO SCHEMA BINDING"))?; - } - Ok(()) - } - Statement::CreateTable(create_table) => create_table.fmt(f), - Statement::LoadData { - local, - inpath, - overwrite, - table_name, - partitioned, - table_format, - } => { - f.write_fmt( - format_args!( - "LOAD DATA {0}INPATH \'{1}\' {2}INTO TABLE {3}", - if *local { "LOCAL " } else { "" }, - inpath, - if *overwrite { "OVERWRITE " } else { "" }, - table_name, - ), - )?; - if let Some(ref parts) = &partitioned { - if !parts.is_empty() { - f.write_fmt( - format_args!( - " PARTITION ({0})", - display_comma_separated(parts), - ), - )?; - } - } - if let Some(HiveLoadDataFormat { serde, input_format }) = &table_format { - f.write_fmt( - format_args!( - " INPUTFORMAT {0} SERDE {1}", - input_format, - serde, - ), - )?; - } - Ok(()) - } - Statement::CreateVirtualTable { - name, - if_not_exists, - module_name, - module_args, - } => { - f.write_fmt( - format_args!( - "CREATE VIRTUAL TABLE {0}{1} USING {2}", - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - name, - module_name, - ), - )?; - if !module_args.is_empty() { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(module_args)), - )?; - } - Ok(()) - } - Statement::CreateIndex(create_index) => create_index.fmt(f), - Statement::CreateExtension { - name, - if_not_exists, - cascade, - schema, - version, - } => { - f.write_fmt( - format_args!( - "CREATE EXTENSION {0}{1}", - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - name, - ), - )?; - if *cascade || schema.is_some() || version.is_some() { - f.write_fmt(format_args!(" WITH"))?; - if let Some(name) = schema { - f.write_fmt(format_args!(" SCHEMA {0}", name))?; - } - if let Some(version) = version { - f.write_fmt(format_args!(" VERSION {0}", version))?; - } - if *cascade { - f.write_fmt(format_args!(" CASCADE"))?; - } - } - Ok(()) - } - Statement::DropExtension { names, if_exists, cascade_or_restrict } => { - f.write_fmt(format_args!("DROP EXTENSION"))?; - if *if_exists { - f.write_fmt(format_args!(" IF EXISTS"))?; - } - f.write_fmt(format_args!(" {0}", display_comma_separated(names)))?; - if let Some(cascade_or_restrict) = cascade_or_restrict { - f.write_fmt(format_args!(" {0}", cascade_or_restrict))?; - } - Ok(()) - } - Statement::CreateRole { - names, - if_not_exists, - inherit, - login, - bypassrls, - password, - create_db, - create_role, - superuser, - replication, - connection_limit, - valid_until, - in_role, - in_group, - role, - user, - admin, - authorization_owner, - } => { - f.write_fmt( - format_args!( - "CREATE ROLE {0}{1}{2}{3}{4}{5}{6}{7}{8}", - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - display_separated(names, ", "), - match *superuser { - Some(true) => " SUPERUSER", - Some(false) => " NOSUPERUSER", - None => "", - }, - match *create_db { - Some(true) => " CREATEDB", - Some(false) => " NOCREATEDB", - None => "", - }, - match *create_role { - Some(true) => " CREATEROLE", - Some(false) => " NOCREATEROLE", - None => "", - }, - match *inherit { - Some(true) => " INHERIT", - Some(false) => " NOINHERIT", - None => "", - }, - match *login { - Some(true) => " LOGIN", - Some(false) => " NOLOGIN", - None => "", - }, - match *replication { - Some(true) => " REPLICATION", - Some(false) => " NOREPLICATION", - None => "", - }, - match *bypassrls { - Some(true) => " BYPASSRLS", - Some(false) => " NOBYPASSRLS", - None => "", - }, - ), - )?; - if let Some(limit) = connection_limit { - f.write_fmt(format_args!(" CONNECTION LIMIT {0}", limit))?; - } - match password { - Some(Password::Password(pass)) => { - f.write_fmt(format_args!(" PASSWORD {0}", pass)) - } - Some(Password::NullPassword) => { - f.write_fmt(format_args!(" PASSWORD NULL")) - } - None => Ok(()), - }?; - if let Some(until) = valid_until { - f.write_fmt(format_args!(" VALID UNTIL {0}", until))?; - } - if !in_role.is_empty() { - f.write_fmt( - format_args!( - " IN ROLE {0}", - display_comma_separated(in_role), - ), - )?; - } - if !in_group.is_empty() { - f.write_fmt( - format_args!( - " IN GROUP {0}", - display_comma_separated(in_group), - ), - )?; - } - if !role.is_empty() { - f.write_fmt( - format_args!(" ROLE {0}", display_comma_separated(role)), - )?; - } - if !user.is_empty() { - f.write_fmt( - format_args!(" USER {0}", display_comma_separated(user)), - )?; - } - if !admin.is_empty() { - f.write_fmt( - format_args!(" ADMIN {0}", display_comma_separated(admin)), - )?; - } - if let Some(owner) = authorization_owner { - f.write_fmt(format_args!(" AUTHORIZATION {0}", owner))?; - } - Ok(()) - } - Statement::CreateSecret { - or_replace, - temporary, - if_not_exists, - name, - storage_specifier, - secret_type, - options, - } => { - f.write_fmt( - format_args!( - "CREATE {0}", - if *or_replace { "OR REPLACE " } else { "" }, - ), - )?; - if let Some(t) = temporary { - f.write_fmt( - format_args!( - "{0}", - if *t { "TEMPORARY " } else { "PERSISTENT " }, - ), - )?; - } - f.write_fmt( - format_args!( - "SECRET {0}", - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - ), - )?; - if let Some(n) = name { - f.write_fmt(format_args!("{0} ", n))?; - } - if let Some(s) = storage_specifier { - f.write_fmt(format_args!("IN {0} ", s))?; - } - f.write_fmt(format_args!("( TYPE {0}", secret_type))?; - if !options.is_empty() { - f.write_fmt( - format_args!(", {0}", display_comma_separated(options)), - )?; - } - f.write_fmt(format_args!(" )"))?; - Ok(()) - } - Statement::CreatePolicy { - name, - table_name, - policy_type, - command, - to, - using, - with_check, - } => { - f.write_fmt( - format_args!("CREATE POLICY {0} ON {1}", name, table_name), - )?; - if let Some(policy_type) = policy_type { - match policy_type { - CreatePolicyType::Permissive => { - f.write_fmt(format_args!(" AS PERMISSIVE"))? - } - CreatePolicyType::Restrictive => { - f.write_fmt(format_args!(" AS RESTRICTIVE"))? - } - } - } - if let Some(command) = command { - match command { - CreatePolicyCommand::All => { - f.write_fmt(format_args!(" FOR ALL"))? - } - CreatePolicyCommand::Select => { - f.write_fmt(format_args!(" FOR SELECT"))? - } - CreatePolicyCommand::Insert => { - f.write_fmt(format_args!(" FOR INSERT"))? - } - CreatePolicyCommand::Update => { - f.write_fmt(format_args!(" FOR UPDATE"))? - } - CreatePolicyCommand::Delete => { - f.write_fmt(format_args!(" FOR DELETE"))? - } - } - } - if let Some(to) = to { - f.write_fmt( - format_args!(" TO {0}", display_comma_separated(to)), - )?; - } - if let Some(using) = using { - f.write_fmt(format_args!(" USING ({0})", using))?; - } - if let Some(with_check) = with_check { - f.write_fmt(format_args!(" WITH CHECK ({0})", with_check))?; - } - Ok(()) - } - Statement::CreateConnector(create_connector) => create_connector.fmt(f), - Statement::AlterTable { - name, - if_exists, - only, - operations, - location, - on_cluster, - } => { - f.write_fmt(format_args!("ALTER TABLE "))?; - if *if_exists { - f.write_fmt(format_args!("IF EXISTS "))?; - } - if *only { - f.write_fmt(format_args!("ONLY "))?; - } - f.write_fmt(format_args!("{0} ", name))?; - if let Some(cluster) = on_cluster { - f.write_fmt(format_args!("ON CLUSTER {0} ", cluster))?; - } - f.write_fmt( - format_args!("{0}", display_comma_separated(operations)), - )?; - if let Some(loc) = location { - f.write_fmt(format_args!(" {0}", loc))? - } - Ok(()) - } - Statement::AlterIndex { name, operation } => { - f.write_fmt(format_args!("ALTER INDEX {0} {1}", name, operation)) - } - Statement::AlterView { name, columns, query, with_options } => { - f.write_fmt(format_args!("ALTER VIEW {0}", name))?; - if !with_options.is_empty() { - f.write_fmt( - format_args!( - " WITH ({0})", - display_comma_separated(with_options), - ), - )?; - } - if !columns.is_empty() { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(columns)), - )?; - } - f.write_fmt(format_args!(" AS {0}", query)) - } - Statement::AlterRole { name, operation } => { - f.write_fmt(format_args!("ALTER ROLE {0} {1}", name, operation)) - } - Statement::AlterPolicy { name, table_name, operation } => { - f.write_fmt( - format_args!( - "ALTER POLICY {0} ON {1}{2}", - name, - table_name, - operation, - ), - ) - } - Statement::AlterConnector { name, properties, url, owner } => { - f.write_fmt(format_args!("ALTER CONNECTOR {0}", name))?; - if let Some(properties) = properties { - f.write_fmt( - format_args!( - " SET DCPROPERTIES({0})", - display_comma_separated(properties), - ), - )?; - } - if let Some(url) = url { - f.write_fmt(format_args!(" SET URL \'{0}\'", url))?; - } - if let Some(owner) = owner { - f.write_fmt(format_args!(" SET OWNER {0}", owner))?; - } - Ok(()) - } - Statement::Drop { - object_type, - if_exists, - names, - cascade, - restrict, - purge, - temporary, - } => { - f.write_fmt( - format_args!( - "DROP {0}{1}{2} {3}{4}{5}{6}", - if *temporary { "TEMPORARY " } else { "" }, - object_type, - if *if_exists { " IF EXISTS" } else { "" }, - display_comma_separated(names), - if *cascade { " CASCADE" } else { "" }, - if *restrict { " RESTRICT" } else { "" }, - if *purge { " PURGE" } else { "" }, - ), - ) - } - Statement::DropFunction { if_exists, func_desc, drop_behavior } => { - f.write_fmt( - format_args!( - "DROP FUNCTION{0} {1}", - if *if_exists { " IF EXISTS" } else { "" }, - display_comma_separated(func_desc), - ), - )?; - if let Some(op) = drop_behavior { - f.write_fmt(format_args!(" {0}", op))?; - } - Ok(()) - } - Statement::DropProcedure { if_exists, proc_desc, drop_behavior } => { - f.write_fmt( - format_args!( - "DROP PROCEDURE{0} {1}", - if *if_exists { " IF EXISTS" } else { "" }, - display_comma_separated(proc_desc), - ), - )?; - if let Some(op) = drop_behavior { - f.write_fmt(format_args!(" {0}", op))?; - } - Ok(()) - } - Statement::DropSecret { - if_exists, - temporary, - name, - storage_specifier, - } => { - f.write_fmt(format_args!("DROP "))?; - if let Some(t) = temporary { - f.write_fmt( - format_args!( - "{0}", - if *t { "TEMPORARY " } else { "PERSISTENT " }, - ), - )?; - } - f.write_fmt( - format_args!( - "SECRET {0}{1}", - if *if_exists { "IF EXISTS " } else { "" }, - name, - ), - )?; - if let Some(s) = storage_specifier { - f.write_fmt(format_args!(" FROM {0}", s))?; - } - Ok(()) - } - Statement::DropPolicy { if_exists, name, table_name, drop_behavior } => { - f.write_fmt(format_args!("DROP POLICY"))?; - if *if_exists { - f.write_fmt(format_args!(" IF EXISTS"))?; - } - f.write_fmt(format_args!(" {0} ON {1}", name, table_name))?; - if let Some(drop_behavior) = drop_behavior { - f.write_fmt(format_args!(" {0}", drop_behavior))?; - } - Ok(()) - } - Statement::DropConnector { if_exists, name } => { - f.write_fmt( - format_args!( - "DROP CONNECTOR {0}{1}", - if *if_exists { "IF EXISTS " } else { "" }, - name, - ), - )?; - Ok(()) - } - Statement::Discard { object_type } => { - f.write_fmt(format_args!("DISCARD {0}", object_type))?; - Ok(()) - } - Self::SetRole { context_modifier, role_name } => { - let role_name = role_name - .clone() - .unwrap_or_else(|| Ident::new("NONE")); - f.write_fmt( - format_args!("SET{0} ROLE {1}", context_modifier, role_name), - ) - } - Statement::SetVariable { local, variables, hivevar, value } => { - f.write_str("SET ")?; - if *local { - f.write_str("LOCAL ")?; - } - let parenthesized = match variables { - OneOrManyWithParens::Many(_) => true, - _ => false, - }; - f.write_fmt( - format_args!( - "{0}{1} = {2}{3}{4}", - if *hivevar { "HIVEVAR:" } else { "" }, - variables, - parenthesized.then_some("(").unwrap_or_default(), - display_comma_separated(value), - parenthesized.then_some(")").unwrap_or_default(), - ), - ) - } - Statement::SetTimeZone { local, value } => { - f.write_str("SET ")?; - if *local { - f.write_str("LOCAL ")?; - } - f.write_fmt(format_args!("TIME ZONE {0}", value)) - } - Statement::SetNames { charset_name, collation_name } => { - f.write_str("SET NAMES ")?; - f.write_str(charset_name)?; - if let Some(collation) = collation_name { - f.write_str(" COLLATE ")?; - f.write_str(collation)?; - } - Ok(()) - } - Statement::SetNamesDefault {} => { - f.write_str("SET NAMES DEFAULT")?; - Ok(()) - } - Statement::ShowVariable { variable } => { - f.write_fmt(format_args!("SHOW"))?; - if !variable.is_empty() { - f.write_fmt( - format_args!(" {0}", display_separated(variable, " ")), - )?; - } - Ok(()) - } - Statement::ShowStatus { filter, global, session } => { - f.write_fmt(format_args!("SHOW"))?; - if *global { - f.write_fmt(format_args!(" GLOBAL"))?; - } - if *session { - f.write_fmt(format_args!(" SESSION"))?; - } - f.write_fmt(format_args!(" STATUS"))?; - if filter.is_some() { - f.write_fmt(format_args!(" {0}", filter.as_ref().unwrap()))?; - } - Ok(()) - } - Statement::ShowVariables { filter, global, session } => { - f.write_fmt(format_args!("SHOW"))?; - if *global { - f.write_fmt(format_args!(" GLOBAL"))?; - } - if *session { - f.write_fmt(format_args!(" SESSION"))?; - } - f.write_fmt(format_args!(" VARIABLES"))?; - if filter.is_some() { - f.write_fmt(format_args!(" {0}", filter.as_ref().unwrap()))?; - } - Ok(()) - } - Statement::ShowCreate { obj_type, obj_name } => { - f.write_fmt( - format_args!("SHOW CREATE {0} {1}", obj_type, obj_name), - )?; - Ok(()) - } - Statement::ShowColumns { extended, full, show_options } => { - f.write_fmt( - format_args!( - "SHOW {0}{1}COLUMNS{2}", - if *extended { "EXTENDED " } else { "" }, - if *full { "FULL " } else { "" }, - show_options, - ), - )?; - Ok(()) - } - Statement::ShowDatabases { terse, history, show_options } => { - f.write_fmt( - format_args!( - "SHOW {0}DATABASES{1}{2}", - if *terse { "TERSE " } else { "" }, - if *history { " HISTORY" } else { "" }, - show_options, - ), - )?; - Ok(()) - } - Statement::ShowSchemas { terse, history, show_options } => { - f.write_fmt( - format_args!( - "SHOW {0}SCHEMAS{1}{2}", - if *terse { "TERSE " } else { "" }, - if *history { " HISTORY" } else { "" }, - show_options, - ), - )?; - Ok(()) - } - Statement::ShowTables { - terse, - history, - extended, - full, - external, - show_options, - } => { - f.write_fmt( - format_args!( - "SHOW {0}{1}{2}{3}TABLES{4}{5}", - if *terse { "TERSE " } else { "" }, - if *extended { "EXTENDED " } else { "" }, - if *full { "FULL " } else { "" }, - if *external { "EXTERNAL " } else { "" }, - if *history { " HISTORY" } else { "" }, - show_options, - ), - )?; - Ok(()) - } - Statement::ShowViews { terse, materialized, show_options } => { - f.write_fmt( - format_args!( - "SHOW {0}{1}VIEWS{2}", - if *terse { "TERSE " } else { "" }, - if *materialized { "MATERIALIZED " } else { "" }, - show_options, - ), - )?; - Ok(()) - } - Statement::ShowFunctions { filter } => { - f.write_fmt(format_args!("SHOW FUNCTIONS"))?; - if let Some(filter) = filter { - f.write_fmt(format_args!(" {0}", filter))?; - } - Ok(()) - } - Statement::Use(use_expr) => use_expr.fmt(f), - Statement::ShowCollation { filter } => { - f.write_fmt(format_args!("SHOW COLLATION"))?; - if let Some(filter) = filter { - f.write_fmt(format_args!(" {0}", filter))?; - } - Ok(()) - } - Statement::StartTransaction { - modes, - begin: syntax_begin, - transaction, - modifier, - } => { - if *syntax_begin { - if let Some(modifier) = *modifier { - f.write_fmt(format_args!("BEGIN {0}", modifier))?; - } else { - f.write_fmt(format_args!("BEGIN"))?; - } - } else { - f.write_fmt(format_args!("START"))?; - } - if let Some(transaction) = transaction { - f.write_fmt(format_args!(" {0}", transaction))?; - } - if !modes.is_empty() { - f.write_fmt( - format_args!(" {0}", display_comma_separated(modes)), - )?; - } - Ok(()) - } - Statement::SetTransaction { modes, snapshot, session } => { - if *session { - f.write_fmt( - format_args!("SET SESSION CHARACTERISTICS AS TRANSACTION"), - )?; - } else { - f.write_fmt(format_args!("SET TRANSACTION"))?; - } - if !modes.is_empty() { - f.write_fmt( - format_args!(" {0}", display_comma_separated(modes)), - )?; - } - if let Some(snapshot_id) = snapshot { - f.write_fmt(format_args!(" SNAPSHOT {0}", snapshot_id))?; - } - Ok(()) - } - Statement::Commit { chain, end: end_syntax, modifier } => { - if *end_syntax { - f.write_fmt(format_args!("END"))?; - if let Some(modifier) = *modifier { - f.write_fmt(format_args!(" {0}", modifier))?; - } - if *chain { - f.write_fmt(format_args!(" AND CHAIN"))?; - } - } else { - f.write_fmt( - format_args!( - "COMMIT{0}", - if *chain { " AND CHAIN" } else { "" }, - ), - )?; - } - Ok(()) - } - Statement::Rollback { chain, savepoint } => { - f.write_fmt(format_args!("ROLLBACK"))?; - if *chain { - f.write_fmt(format_args!(" AND CHAIN"))?; - } - if let Some(savepoint) = savepoint { - f.write_fmt(format_args!(" TO SAVEPOINT {0}", savepoint))?; - } - Ok(()) - } - Statement::CreateSchema { schema_name, if_not_exists } => { - f.write_fmt( - format_args!( - "CREATE SCHEMA {0}{1}", - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - schema_name, - ), - ) - } - Statement::Assert { condition, message } => { - f.write_fmt(format_args!("ASSERT {0}", condition))?; - if let Some(m) = message { - f.write_fmt(format_args!(" AS {0}", m))?; - } - Ok(()) - } - Statement::Grant { - privileges, - objects, - grantees, - with_grant_option, - granted_by, - } => { - f.write_fmt(format_args!("GRANT {0} ", privileges))?; - if let Some(objects) = objects { - f.write_fmt(format_args!("ON {0} ", objects))?; - } - f.write_fmt( - format_args!("TO {0}", display_comma_separated(grantees)), - )?; - if *with_grant_option { - f.write_fmt(format_args!(" WITH GRANT OPTION"))?; - } - if let Some(grantor) = granted_by { - f.write_fmt(format_args!(" GRANTED BY {0}", grantor))?; - } - Ok(()) - } - Statement::Revoke { - privileges, - objects, - grantees, - granted_by, - cascade, - } => { - f.write_fmt(format_args!("REVOKE {0} ", privileges))?; - if let Some(objects) = objects { - f.write_fmt(format_args!("ON {0} ", objects))?; - } - f.write_fmt( - format_args!("FROM {0}", display_comma_separated(grantees)), - )?; - if let Some(grantor) = granted_by { - f.write_fmt(format_args!(" GRANTED BY {0}", grantor))?; - } - if let Some(cascade) = cascade { - f.write_fmt(format_args!(" {0}", cascade))?; - } - Ok(()) - } - Statement::Deallocate { name, prepare } => { - f.write_fmt( - format_args!( - "DEALLOCATE {0}{1}", - if *prepare { "PREPARE " } else { "" }, - name, - ), - ) - } - Statement::Execute { name, parameters, has_parentheses, using } => { - let (open, close) = if *has_parentheses { - ("(", ")") - } else { - (if parameters.is_empty() { "" } else { " " }, "") - }; - f.write_fmt( - format_args!( - "EXECUTE {1}{2}{0}{3}", - display_comma_separated(parameters), - name, - open, - close, - ), - )?; - if !using.is_empty() { - f.write_fmt( - format_args!(" USING {0}", display_comma_separated(using)), - )?; - } - Ok(()) - } - Statement::Prepare { name, data_types, statement } => { - f.write_fmt(format_args!("PREPARE {0} ", name))?; - if !data_types.is_empty() { - f.write_fmt( - format_args!("({0}) ", display_comma_separated(data_types)), - )?; - } - f.write_fmt(format_args!("AS {0}", statement)) - } - Statement::Comment { object_type, object_name, comment, if_exists } => { - f.write_fmt(format_args!("COMMENT "))?; - if *if_exists { - f.write_fmt(format_args!("IF EXISTS "))? - } - f.write_fmt( - format_args!("ON {0} {1} IS ", object_type, object_name), - )?; - if let Some(c) = comment { - f.write_fmt(format_args!("\'{0}\'", c)) - } else { - f.write_fmt(format_args!("NULL")) - } - } - Statement::Savepoint { name } => { - f.write_fmt(format_args!("SAVEPOINT "))?; - f.write_fmt(format_args!("{0}", name)) - } - Statement::ReleaseSavepoint { name } => { - f.write_fmt(format_args!("RELEASE SAVEPOINT {0}", name)) - } - Statement::Merge { into, table, source, on, clauses } => { - f.write_fmt( - format_args!( - "MERGE{0} {1} USING {2} ", - if *into { " INTO" } else { "" }, - table, - source, - ), - )?; - f.write_fmt(format_args!("ON {0} ", on))?; - f.write_fmt(format_args!("{0}", display_separated(clauses, " "))) - } - Statement::Cache { table_name, table_flag, has_as, options, query } => { - if let Some(table_flag) = table_flag { - f.write_fmt( - format_args!("CACHE {0} TABLE {1}", table_flag, table_name), - )?; - } else { - f.write_fmt(format_args!("CACHE TABLE {0}", table_name))?; - } - if !options.is_empty() { - f.write_fmt( - format_args!( - " OPTIONS({0})", - display_comma_separated(options), - ), - )?; - } - match (*has_as, query) { - (true, Some(query)) => { - f.write_fmt(format_args!(" AS {0}", query)) - } - (true, None) => f.write_str(" AS"), - (false, Some(query)) => f.write_fmt(format_args!(" {0}", query)), - (false, None) => Ok(()), - } - } - Statement::UNCache { table_name, if_exists } => { - if *if_exists { - f.write_fmt( - format_args!("UNCACHE TABLE IF EXISTS {0}", table_name), - ) - } else { - f.write_fmt(format_args!("UNCACHE TABLE {0}", table_name)) - } - } - Statement::CreateSequence { - temporary, - if_not_exists, - name, - data_type, - sequence_options, - owned_by, - } => { - let as_type: String = if let Some(dt) = data_type.as_ref() { - [" AS ", &dt.to_string()].concat() - } else { - "".to_string() - }; - f.write_fmt( - format_args!( - "CREATE {1}SEQUENCE {0}{2}{3}", - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - if *temporary { "TEMPORARY " } else { "" }, - name, - as_type, - ), - )?; - for sequence_option in sequence_options { - f.write_fmt(format_args!("{0}", sequence_option))?; - } - if let Some(ob) = owned_by.as_ref() { - f.write_fmt(format_args!(" OWNED BY {0}", ob))?; - } - f.write_fmt(format_args!("")) - } - Statement::CreateStage { - or_replace, - temporary, - if_not_exists, - name, - stage_params, - directory_table_params, - file_format, - copy_options, - comment, - .. - } => { - f.write_fmt( - format_args!( - "CREATE {1}{0}STAGE {2}{3}{4}", - if *temporary { "TEMPORARY " } else { "" }, - if *or_replace { "OR REPLACE " } else { "" }, - if *if_not_exists { "IF NOT EXISTS " } else { "" }, - name, - stage_params, - ), - )?; - if !directory_table_params.options.is_empty() { - f.write_fmt( - format_args!(" DIRECTORY=({0})", directory_table_params), - )?; - } - if !file_format.options.is_empty() { - f.write_fmt(format_args!(" FILE_FORMAT=({0})", file_format))?; - } - if !copy_options.options.is_empty() { - f.write_fmt(format_args!(" COPY_OPTIONS=({0})", copy_options))?; - } - if comment.is_some() { - f.write_fmt( - format_args!(" COMMENT=\'{0}\'", comment.as_ref().unwrap()), - )?; - } - Ok(()) - } - Statement::CopyIntoSnowflake { - into, - from_stage, - from_stage_alias, - stage_params, - from_transformations, - files, - pattern, - file_format, - copy_options, - validation_mode, - } => { - f.write_fmt(format_args!("COPY INTO {0}", into))?; - if from_transformations.is_none() { - f.write_fmt( - format_args!(" FROM {0}{1}", from_stage, stage_params), - )?; - if from_stage_alias.as_ref().is_some() { - f.write_fmt( - format_args!(" AS {0}", from_stage_alias.as_ref().unwrap()), - )?; - } - } else { - f.write_fmt( - format_args!( - " FROM (SELECT {0} FROM {1}{2}", - display_separated( - from_transformations.as_ref().unwrap(), - ", ", - ), - from_stage, - stage_params, - ), - )?; - if from_stage_alias.as_ref().is_some() { - f.write_fmt( - format_args!(" AS {0}", from_stage_alias.as_ref().unwrap()), - )?; - } - f.write_fmt(format_args!(")"))?; - } - if files.is_some() { - f.write_fmt( - format_args!( - " FILES = (\'{0}\')", - display_separated(files.as_ref().unwrap(), "', '"), - ), - )?; - } - if pattern.is_some() { - f.write_fmt( - format_args!(" PATTERN = \'{0}\'", pattern.as_ref().unwrap()), - )?; - } - if !file_format.options.is_empty() { - f.write_fmt(format_args!(" FILE_FORMAT=({0})", file_format))?; - } - if !copy_options.options.is_empty() { - f.write_fmt(format_args!(" COPY_OPTIONS=({0})", copy_options))?; - } - if validation_mode.is_some() { - f.write_fmt( - format_args!( - " VALIDATION_MODE = {0}", - validation_mode.as_ref().unwrap(), - ), - )?; - } - Ok(()) - } - Statement::CreateType { name, representation } => { - f.write_fmt( - format_args!("CREATE TYPE {0} AS {1}", name, representation), - ) - } - Statement::Pragma { name, value, is_eq } => { - f.write_fmt(format_args!("PRAGMA {0}", name))?; - if value.is_some() { - let val = value.as_ref().unwrap(); - if *is_eq { - f.write_fmt(format_args!(" = {0}", val))?; - } else { - f.write_fmt(format_args!("({0})", val))?; - } - } - Ok(()) - } - Statement::LockTables { tables } => { - f.write_fmt( - format_args!("LOCK TABLES {0}", display_comma_separated(tables)), - ) - } - Statement::UnlockTables => f.write_fmt(format_args!("UNLOCK TABLES")), - Statement::Unload { query, to, with } => { - f.write_fmt(format_args!("UNLOAD({0}) TO {1}", query, to))?; - if !with.is_empty() { - f.write_fmt( - format_args!(" WITH ({0})", display_comma_separated(with)), - )?; - } - Ok(()) - } - Statement::OptimizeTable { - name, - on_cluster, - partition, - include_final, - deduplicate, - } => { - f.write_fmt(format_args!("OPTIMIZE TABLE {0}", name))?; - if let Some(on_cluster) = on_cluster { - f.write_fmt(format_args!(" ON CLUSTER {0}", on_cluster))?; - } - if let Some(partition) = partition { - f.write_fmt(format_args!(" {0}", partition))?; - } - if *include_final { - f.write_fmt(format_args!(" FINAL"))?; - } - if let Some(deduplicate) = deduplicate { - f.write_fmt(format_args!(" {0}", deduplicate))?; - } - Ok(()) - } - Statement::LISTEN { channel } => { - f.write_fmt(format_args!("LISTEN {0}", channel))?; - Ok(()) - } - Statement::UNLISTEN { channel } => { - f.write_fmt(format_args!("UNLISTEN {0}", channel))?; - Ok(()) - } - Statement::NOTIFY { channel, payload } => { - f.write_fmt(format_args!("NOTIFY {0}", channel))?; - if let Some(payload) = payload { - f.write_fmt(format_args!(", \'{0}\'", payload))?; - } - Ok(()) - } - Statement::RenameTable(rename_tables) => { - f.write_fmt( - format_args!( - "RENAME TABLE {0}", - display_comma_separated(rename_tables), - ), - ) - } - Statement::RaisError { - message, - severity, - state, - arguments, - options, - } => { - f.write_fmt( - format_args!("RAISERROR({0}, {1}, {2}", message, severity, state), - )?; - if !arguments.is_empty() { - f.write_fmt( - format_args!(", {0}", display_comma_separated(arguments)), - )?; - } - f.write_fmt(format_args!(")"))?; - if !options.is_empty() { - f.write_fmt( - format_args!(" WITH {0}", display_comma_separated(options)), - )?; - } - Ok(()) - } - Statement::List(command) => { - f.write_fmt(format_args!("LIST {0}", command)) - } - Statement::Remove(command) => { - f.write_fmt(format_args!("REMOVE {0}", command)) - } - Statement::SetSessionParam(kind) => { - f.write_fmt(format_args!("SET {0}", kind)) - } - } - } - } - /// Can use to describe options in create sequence or table column type identity - /// ```sql - /// [ INCREMENT [ BY ] increment ] - /// [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ] - /// [ START [ WITH ] start ] [ CACHE cache ] [ [ NO ] CYCLE ] - /// ``` - pub enum SequenceOptions { - IncrementBy(Expr, bool), - MinValue(Option), - MaxValue(Option), - StartWith(Expr, bool), - Cache(Expr), - Cycle(bool), - } - #[automatically_derived] - impl ::core::fmt::Debug for SequenceOptions { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - SequenceOptions::IncrementBy(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "IncrementBy", - __self_0, - &__self_1, - ) - } - SequenceOptions::MinValue(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "MinValue", - &__self_0, - ) - } - SequenceOptions::MaxValue(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "MaxValue", - &__self_0, - ) - } - SequenceOptions::StartWith(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "StartWith", - __self_0, - &__self_1, - ) - } - SequenceOptions::Cache(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Cache", - &__self_0, - ) - } - SequenceOptions::Cycle(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Cycle", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for SequenceOptions { - #[inline] - fn clone(&self) -> SequenceOptions { - match self { - SequenceOptions::IncrementBy(__self_0, __self_1) => { - SequenceOptions::IncrementBy( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - SequenceOptions::MinValue(__self_0) => { - SequenceOptions::MinValue(::core::clone::Clone::clone(__self_0)) - } - SequenceOptions::MaxValue(__self_0) => { - SequenceOptions::MaxValue(::core::clone::Clone::clone(__self_0)) - } - SequenceOptions::StartWith(__self_0, __self_1) => { - SequenceOptions::StartWith( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - SequenceOptions::Cache(__self_0) => { - SequenceOptions::Cache(::core::clone::Clone::clone(__self_0)) - } - SequenceOptions::Cycle(__self_0) => { - SequenceOptions::Cycle(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SequenceOptions {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SequenceOptions { - #[inline] - fn eq(&self, other: &SequenceOptions) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - SequenceOptions::IncrementBy(__self_0, __self_1), - SequenceOptions::IncrementBy(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - SequenceOptions::MinValue(__self_0), - SequenceOptions::MinValue(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SequenceOptions::MaxValue(__self_0), - SequenceOptions::MaxValue(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SequenceOptions::StartWith(__self_0, __self_1), - SequenceOptions::StartWith(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - SequenceOptions::Cache(__self_0), - SequenceOptions::Cache(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SequenceOptions::Cycle(__self_0), - SequenceOptions::Cycle(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SequenceOptions { - #[inline] - fn partial_cmp( - &self, - other: &SequenceOptions, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - SequenceOptions::IncrementBy(__self_0, __self_1), - SequenceOptions::IncrementBy(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - SequenceOptions::MinValue(__self_0), - SequenceOptions::MinValue(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SequenceOptions::MaxValue(__self_0), - SequenceOptions::MaxValue(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SequenceOptions::StartWith(__self_0, __self_1), - SequenceOptions::StartWith(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (SequenceOptions::Cache(__self_0), SequenceOptions::Cache(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (SequenceOptions::Cycle(__self_0), SequenceOptions::Cycle(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SequenceOptions { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SequenceOptions { - #[inline] - fn cmp(&self, other: &SequenceOptions) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - SequenceOptions::IncrementBy(__self_0, __self_1), - SequenceOptions::IncrementBy(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - SequenceOptions::MinValue(__self_0), - SequenceOptions::MinValue(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SequenceOptions::MaxValue(__self_0), - SequenceOptions::MaxValue(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SequenceOptions::StartWith(__self_0, __self_1), - SequenceOptions::StartWith(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - SequenceOptions::Cache(__self_0), - SequenceOptions::Cache(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SequenceOptions::Cycle(__self_0), - SequenceOptions::Cycle(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SequenceOptions { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - SequenceOptions::IncrementBy(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - SequenceOptions::MinValue(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SequenceOptions::MaxValue(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SequenceOptions::StartWith(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - SequenceOptions::Cache(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SequenceOptions::Cycle(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for SequenceOptions { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SequenceOptions::IncrementBy(increment, by) => { - f.write_fmt( - format_args!( - " INCREMENT{0} {1}", - if *by { " BY" } else { "" }, - increment, - ), - ) - } - SequenceOptions::MinValue(Some(expr)) => { - f.write_fmt(format_args!(" MINVALUE {0}", expr)) - } - SequenceOptions::MinValue(None) => { - f.write_fmt(format_args!(" NO MINVALUE")) - } - SequenceOptions::MaxValue(Some(expr)) => { - f.write_fmt(format_args!(" MAXVALUE {0}", expr)) - } - SequenceOptions::MaxValue(None) => { - f.write_fmt(format_args!(" NO MAXVALUE")) - } - SequenceOptions::StartWith(start, with) => { - f.write_fmt( - format_args!( - " START{0} {1}", - if *with { " WITH" } else { "" }, - start, - ), - ) - } - SequenceOptions::Cache(cache) => { - f.write_fmt(format_args!(" CACHE {0}", *cache)) - } - SequenceOptions::Cycle(no) => { - f.write_fmt(format_args!(" {0}CYCLE", if *no { "NO " } else { "" })) - } - } - } - } - /// Target of a `TRUNCATE TABLE` command - /// - /// Note this is its own struct because `visit_relation` requires an `ObjectName` (not a `Vec`) - pub struct TruncateTableTarget { - /// name of the table being truncated - pub name: ObjectName, - } - #[automatically_derived] - impl ::core::fmt::Debug for TruncateTableTarget { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "TruncateTableTarget", - "name", - &&self.name, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TruncateTableTarget { - #[inline] - fn clone(&self) -> TruncateTableTarget { - TruncateTableTarget { - name: ::core::clone::Clone::clone(&self.name), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TruncateTableTarget {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TruncateTableTarget { - #[inline] - fn eq(&self, other: &TruncateTableTarget) -> bool { - self.name == other.name - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TruncateTableTarget { - #[inline] - fn partial_cmp( - &self, - other: &TruncateTableTarget, - ) -> ::core::option::Option<::core::cmp::Ordering> { - ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TruncateTableTarget { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TruncateTableTarget { - #[inline] - fn cmp(&self, other: &TruncateTableTarget) -> ::core::cmp::Ordering { - ::core::cmp::Ord::cmp(&self.name, &other.name) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TruncateTableTarget { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.name, state) - } - } - impl fmt::Display for TruncateTableTarget { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0}", self.name)) - } - } - /// PostgreSQL identity option for TRUNCATE table - /// [ RESTART IDENTITY | CONTINUE IDENTITY ] - pub enum TruncateIdentityOption { - Restart, - Continue, - } - #[automatically_derived] - impl ::core::fmt::Debug for TruncateIdentityOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - TruncateIdentityOption::Restart => "Restart", - TruncateIdentityOption::Continue => "Continue", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TruncateIdentityOption { - #[inline] - fn clone(&self) -> TruncateIdentityOption { - match self { - TruncateIdentityOption::Restart => TruncateIdentityOption::Restart, - TruncateIdentityOption::Continue => TruncateIdentityOption::Continue, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TruncateIdentityOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TruncateIdentityOption { - #[inline] - fn eq(&self, other: &TruncateIdentityOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TruncateIdentityOption { - #[inline] - fn partial_cmp( - &self, - other: &TruncateIdentityOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TruncateIdentityOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for TruncateIdentityOption { - #[inline] - fn cmp(&self, other: &TruncateIdentityOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TruncateIdentityOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - /// Cascade/restrict option for Postgres TRUNCATE table, MySQL GRANT/REVOKE, etc. - /// [ CASCADE | RESTRICT ] - pub enum CascadeOption { - Cascade, - Restrict, - } - #[automatically_derived] - impl ::core::fmt::Debug for CascadeOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - CascadeOption::Cascade => "Cascade", - CascadeOption::Restrict => "Restrict", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for CascadeOption { - #[inline] - fn clone(&self) -> CascadeOption { - match self { - CascadeOption::Cascade => CascadeOption::Cascade, - CascadeOption::Restrict => CascadeOption::Restrict, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CascadeOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CascadeOption { - #[inline] - fn eq(&self, other: &CascadeOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CascadeOption { - #[inline] - fn partial_cmp( - &self, - other: &CascadeOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CascadeOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for CascadeOption { - #[inline] - fn cmp(&self, other: &CascadeOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for CascadeOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl Display for CascadeOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CascadeOption::Cascade => f.write_fmt(format_args!("CASCADE")), - CascadeOption::Restrict => f.write_fmt(format_args!("RESTRICT")), - } - } - } - /// Transaction started with [ TRANSACTION | WORK ] - pub enum BeginTransactionKind { - Transaction, - Work, - } - #[automatically_derived] - impl ::core::fmt::Debug for BeginTransactionKind { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - BeginTransactionKind::Transaction => "Transaction", - BeginTransactionKind::Work => "Work", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for BeginTransactionKind { - #[inline] - fn clone(&self) -> BeginTransactionKind { - match self { - BeginTransactionKind::Transaction => BeginTransactionKind::Transaction, - BeginTransactionKind::Work => BeginTransactionKind::Work, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for BeginTransactionKind {} - #[automatically_derived] - impl ::core::cmp::PartialEq for BeginTransactionKind { - #[inline] - fn eq(&self, other: &BeginTransactionKind) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for BeginTransactionKind { - #[inline] - fn partial_cmp( - &self, - other: &BeginTransactionKind, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for BeginTransactionKind { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for BeginTransactionKind { - #[inline] - fn cmp(&self, other: &BeginTransactionKind) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for BeginTransactionKind { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl Display for BeginTransactionKind { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - BeginTransactionKind::Transaction => { - f.write_fmt(format_args!("TRANSACTION")) - } - BeginTransactionKind::Work => f.write_fmt(format_args!("WORK")), - } - } - } - /// Can use to describe options in create sequence or table column type identity - /// [ MINVALUE minvalue | NO MINVALUE ] [ MAXVALUE maxvalue | NO MAXVALUE ] - pub enum MinMaxValue { - Empty, - None, - Some(Expr), - } - #[automatically_derived] - impl ::core::fmt::Debug for MinMaxValue { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - MinMaxValue::Empty => ::core::fmt::Formatter::write_str(f, "Empty"), - MinMaxValue::None => ::core::fmt::Formatter::write_str(f, "None"), - MinMaxValue::Some(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Some", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for MinMaxValue { - #[inline] - fn clone(&self) -> MinMaxValue { - match self { - MinMaxValue::Empty => MinMaxValue::Empty, - MinMaxValue::None => MinMaxValue::None, - MinMaxValue::Some(__self_0) => { - MinMaxValue::Some(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MinMaxValue {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MinMaxValue { - #[inline] - fn eq(&self, other: &MinMaxValue) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (MinMaxValue::Some(__self_0), MinMaxValue::Some(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MinMaxValue { - #[inline] - fn partial_cmp( - &self, - other: &MinMaxValue, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (MinMaxValue::Some(__self_0), MinMaxValue::Some(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MinMaxValue { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for MinMaxValue { - #[inline] - fn cmp(&self, other: &MinMaxValue) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (MinMaxValue::Some(__self_0), MinMaxValue::Some(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for MinMaxValue { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - MinMaxValue::Some(__self_0) => ::core::hash::Hash::hash(__self_0, state), - _ => {} - } - } - } - #[non_exhaustive] - pub enum OnInsert { - /// ON DUPLICATE KEY UPDATE (MySQL when the key already exists, then execute an update instead) - DuplicateKeyUpdate(Vec), - /// ON CONFLICT is a PostgreSQL and Sqlite extension - OnConflict(OnConflict), - } - #[automatically_derived] - impl ::core::fmt::Debug for OnInsert { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - OnInsert::DuplicateKeyUpdate(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "DuplicateKeyUpdate", - &__self_0, - ) - } - OnInsert::OnConflict(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "OnConflict", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for OnInsert { - #[inline] - fn clone(&self) -> OnInsert { - match self { - OnInsert::DuplicateKeyUpdate(__self_0) => { - OnInsert::DuplicateKeyUpdate(::core::clone::Clone::clone(__self_0)) - } - OnInsert::OnConflict(__self_0) => { - OnInsert::OnConflict(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for OnInsert {} - #[automatically_derived] - impl ::core::cmp::PartialEq for OnInsert { - #[inline] - fn eq(&self, other: &OnInsert) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - OnInsert::DuplicateKeyUpdate(__self_0), - OnInsert::DuplicateKeyUpdate(__arg1_0), - ) => __self_0 == __arg1_0, - (OnInsert::OnConflict(__self_0), OnInsert::OnConflict(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for OnInsert { - #[inline] - fn partial_cmp( - &self, - other: &OnInsert, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - OnInsert::DuplicateKeyUpdate(__self_0), - OnInsert::DuplicateKeyUpdate(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (OnInsert::OnConflict(__self_0), OnInsert::OnConflict(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for OnInsert { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for OnInsert { - #[inline] - fn cmp(&self, other: &OnInsert) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - OnInsert::DuplicateKeyUpdate(__self_0), - OnInsert::DuplicateKeyUpdate(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - OnInsert::OnConflict(__self_0), - OnInsert::OnConflict(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for OnInsert { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - OnInsert::DuplicateKeyUpdate(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - OnInsert::OnConflict(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - pub struct InsertAliases { - pub row_alias: ObjectName, - pub col_aliases: Option>, - } - #[automatically_derived] - impl ::core::fmt::Debug for InsertAliases { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "InsertAliases", - "row_alias", - &self.row_alias, - "col_aliases", - &&self.col_aliases, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for InsertAliases { - #[inline] - fn clone(&self) -> InsertAliases { - InsertAliases { - row_alias: ::core::clone::Clone::clone(&self.row_alias), - col_aliases: ::core::clone::Clone::clone(&self.col_aliases), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for InsertAliases {} - #[automatically_derived] - impl ::core::cmp::PartialEq for InsertAliases { - #[inline] - fn eq(&self, other: &InsertAliases) -> bool { - self.row_alias == other.row_alias && self.col_aliases == other.col_aliases - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for InsertAliases { - #[inline] - fn partial_cmp( - &self, - other: &InsertAliases, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.row_alias, - &other.row_alias, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.col_aliases, - &other.col_aliases, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for InsertAliases { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for InsertAliases { - #[inline] - fn cmp(&self, other: &InsertAliases) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.row_alias, &other.row_alias) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.col_aliases, &other.col_aliases) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for InsertAliases { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.row_alias, state); - ::core::hash::Hash::hash(&self.col_aliases, state) - } - } - pub struct OnConflict { - pub conflict_target: Option, - pub action: OnConflictAction, - } - #[automatically_derived] - impl ::core::fmt::Debug for OnConflict { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "OnConflict", - "conflict_target", - &self.conflict_target, - "action", - &&self.action, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for OnConflict { - #[inline] - fn clone(&self) -> OnConflict { - OnConflict { - conflict_target: ::core::clone::Clone::clone(&self.conflict_target), - action: ::core::clone::Clone::clone(&self.action), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for OnConflict {} - #[automatically_derived] - impl ::core::cmp::PartialEq for OnConflict { - #[inline] - fn eq(&self, other: &OnConflict) -> bool { - self.conflict_target == other.conflict_target && self.action == other.action - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for OnConflict { - #[inline] - fn partial_cmp( - &self, - other: &OnConflict, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.conflict_target, - &other.conflict_target, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.action, &other.action) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for OnConflict { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for OnConflict { - #[inline] - fn cmp(&self, other: &OnConflict) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.conflict_target, &other.conflict_target) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.action, &other.action) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for OnConflict { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.conflict_target, state); - ::core::hash::Hash::hash(&self.action, state) - } - } - pub enum ConflictTarget { - Columns(Vec), - OnConstraint(ObjectName), - } - #[automatically_derived] - impl ::core::fmt::Debug for ConflictTarget { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - ConflictTarget::Columns(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Columns", - &__self_0, - ) - } - ConflictTarget::OnConstraint(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "OnConstraint", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for ConflictTarget { - #[inline] - fn clone(&self) -> ConflictTarget { - match self { - ConflictTarget::Columns(__self_0) => { - ConflictTarget::Columns(::core::clone::Clone::clone(__self_0)) - } - ConflictTarget::OnConstraint(__self_0) => { - ConflictTarget::OnConstraint(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ConflictTarget {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ConflictTarget { - #[inline] - fn eq(&self, other: &ConflictTarget) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - ConflictTarget::Columns(__self_0), - ConflictTarget::Columns(__arg1_0), - ) => __self_0 == __arg1_0, - ( - ConflictTarget::OnConstraint(__self_0), - ConflictTarget::OnConstraint(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ConflictTarget { - #[inline] - fn partial_cmp( - &self, - other: &ConflictTarget, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - ConflictTarget::Columns(__self_0), - ConflictTarget::Columns(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - ConflictTarget::OnConstraint(__self_0), - ConflictTarget::OnConstraint(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ConflictTarget { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ConflictTarget { - #[inline] - fn cmp(&self, other: &ConflictTarget) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - ConflictTarget::Columns(__self_0), - ConflictTarget::Columns(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - ConflictTarget::OnConstraint(__self_0), - ConflictTarget::OnConstraint(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ConflictTarget { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - ConflictTarget::Columns(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - ConflictTarget::OnConstraint(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - pub enum OnConflictAction { - DoNothing, - DoUpdate(DoUpdate), - } - #[automatically_derived] - impl ::core::fmt::Debug for OnConflictAction { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - OnConflictAction::DoNothing => { - ::core::fmt::Formatter::write_str(f, "DoNothing") - } - OnConflictAction::DoUpdate(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "DoUpdate", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for OnConflictAction { - #[inline] - fn clone(&self) -> OnConflictAction { - match self { - OnConflictAction::DoNothing => OnConflictAction::DoNothing, - OnConflictAction::DoUpdate(__self_0) => { - OnConflictAction::DoUpdate(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for OnConflictAction {} - #[automatically_derived] - impl ::core::cmp::PartialEq for OnConflictAction { - #[inline] - fn eq(&self, other: &OnConflictAction) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - OnConflictAction::DoUpdate(__self_0), - OnConflictAction::DoUpdate(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for OnConflictAction { - #[inline] - fn partial_cmp( - &self, - other: &OnConflictAction, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - OnConflictAction::DoUpdate(__self_0), - OnConflictAction::DoUpdate(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for OnConflictAction { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for OnConflictAction { - #[inline] - fn cmp(&self, other: &OnConflictAction) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - OnConflictAction::DoUpdate(__self_0), - OnConflictAction::DoUpdate(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for OnConflictAction { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - OnConflictAction::DoUpdate(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - pub struct DoUpdate { - /// Column assignments - pub assignments: Vec, - /// WHERE - pub selection: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for DoUpdate { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "DoUpdate", - "assignments", - &self.assignments, - "selection", - &&self.selection, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for DoUpdate { - #[inline] - fn clone(&self) -> DoUpdate { - DoUpdate { - assignments: ::core::clone::Clone::clone(&self.assignments), - selection: ::core::clone::Clone::clone(&self.selection), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for DoUpdate {} - #[automatically_derived] - impl ::core::cmp::PartialEq for DoUpdate { - #[inline] - fn eq(&self, other: &DoUpdate) -> bool { - self.assignments == other.assignments && self.selection == other.selection - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for DoUpdate { - #[inline] - fn partial_cmp( - &self, - other: &DoUpdate, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.assignments, - &other.assignments, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.selection, - &other.selection, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for DoUpdate { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for DoUpdate { - #[inline] - fn cmp(&self, other: &DoUpdate) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.assignments, &other.assignments) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.selection, &other.selection) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for DoUpdate { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.assignments, state); - ::core::hash::Hash::hash(&self.selection, state) - } - } - impl fmt::Display for OnInsert { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::DuplicateKeyUpdate(expr) => { - f.write_fmt( - format_args!( - " ON DUPLICATE KEY UPDATE {0}", - display_comma_separated(expr), - ), - ) - } - Self::OnConflict(o) => f.write_fmt(format_args!("{0}", o)), - } - } - } - impl fmt::Display for OnConflict { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!(" ON CONFLICT"))?; - if let Some(target) = &self.conflict_target { - f.write_fmt(format_args!("{0}", target))?; - } - f.write_fmt(format_args!(" {0}", self.action)) - } - } - impl fmt::Display for ConflictTarget { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ConflictTarget::Columns(cols) => { - f.write_fmt(format_args!("({0})", display_comma_separated(cols))) - } - ConflictTarget::OnConstraint(name) => { - f.write_fmt(format_args!(" ON CONSTRAINT {0}", name)) - } - } - } - } - impl fmt::Display for OnConflictAction { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::DoNothing => f.write_fmt(format_args!("DO NOTHING")), - Self::DoUpdate(do_update) => { - f.write_fmt(format_args!("DO UPDATE"))?; - if !do_update.assignments.is_empty() { - f.write_fmt( - format_args!( - " SET {0}", - display_comma_separated(&do_update.assignments), - ), - )?; - } - if let Some(selection) = &do_update.selection { - f.write_fmt(format_args!(" WHERE {0}", selection))?; - } - Ok(()) - } - } - } - } - /// Privileges granted in a GRANT statement or revoked in a REVOKE statement. - pub enum Privileges { - /// All privileges applicable to the object type - All { - /// Optional keyword from the spec, ignored in practice - with_privileges_keyword: bool, - }, - /// Specific privileges (e.g. `SELECT`, `INSERT`) - Actions(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for Privileges { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Privileges::All { with_privileges_keyword: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "All", - "with_privileges_keyword", - &__self_0, - ) - } - Privileges::Actions(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Actions", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for Privileges { - #[inline] - fn clone(&self) -> Privileges { - match self { - Privileges::All { with_privileges_keyword: __self_0 } => { - Privileges::All { - with_privileges_keyword: ::core::clone::Clone::clone(__self_0), - } - } - Privileges::Actions(__self_0) => { - Privileges::Actions(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Privileges {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Privileges { - #[inline] - fn eq(&self, other: &Privileges) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - Privileges::All { with_privileges_keyword: __self_0 }, - Privileges::All { with_privileges_keyword: __arg1_0 }, - ) => __self_0 == __arg1_0, - (Privileges::Actions(__self_0), Privileges::Actions(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Privileges { - #[inline] - fn partial_cmp( - &self, - other: &Privileges, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - Privileges::All { with_privileges_keyword: __self_0 }, - Privileges::All { with_privileges_keyword: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (Privileges::Actions(__self_0), Privileges::Actions(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Privileges { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Privileges { - #[inline] - fn cmp(&self, other: &Privileges) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - Privileges::All { with_privileges_keyword: __self_0 }, - Privileges::All { with_privileges_keyword: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Privileges::Actions(__self_0), - Privileges::Actions(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Privileges { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Privileges::All { with_privileges_keyword: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Privileges::Actions(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for Privileges { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Privileges::All { with_privileges_keyword } => { - f.write_fmt( - format_args!( - "ALL{0}", - if *with_privileges_keyword { " PRIVILEGES" } else { "" }, - ), - ) - } - Privileges::Actions(actions) => { - f.write_fmt(format_args!("{0}", display_comma_separated(actions))) - } - } - } - } - /// Specific direction for FETCH statement - pub enum FetchDirection { - Count { limit: Value }, - Next, - Prior, - First, - Last, - Absolute { limit: Value }, - Relative { limit: Value }, - All, - Forward { limit: Option }, - ForwardAll, - Backward { limit: Option }, - BackwardAll, - } - #[automatically_derived] - impl ::core::fmt::Debug for FetchDirection { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - FetchDirection::Count { limit: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Count", - "limit", - &__self_0, - ) - } - FetchDirection::Next => ::core::fmt::Formatter::write_str(f, "Next"), - FetchDirection::Prior => ::core::fmt::Formatter::write_str(f, "Prior"), - FetchDirection::First => ::core::fmt::Formatter::write_str(f, "First"), - FetchDirection::Last => ::core::fmt::Formatter::write_str(f, "Last"), - FetchDirection::Absolute { limit: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Absolute", - "limit", - &__self_0, - ) - } - FetchDirection::Relative { limit: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Relative", - "limit", - &__self_0, - ) - } - FetchDirection::All => ::core::fmt::Formatter::write_str(f, "All"), - FetchDirection::Forward { limit: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Forward", - "limit", - &__self_0, - ) - } - FetchDirection::ForwardAll => { - ::core::fmt::Formatter::write_str(f, "ForwardAll") - } - FetchDirection::Backward { limit: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Backward", - "limit", - &__self_0, - ) - } - FetchDirection::BackwardAll => { - ::core::fmt::Formatter::write_str(f, "BackwardAll") - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for FetchDirection { - #[inline] - fn clone(&self) -> FetchDirection { - match self { - FetchDirection::Count { limit: __self_0 } => { - FetchDirection::Count { - limit: ::core::clone::Clone::clone(__self_0), - } - } - FetchDirection::Next => FetchDirection::Next, - FetchDirection::Prior => FetchDirection::Prior, - FetchDirection::First => FetchDirection::First, - FetchDirection::Last => FetchDirection::Last, - FetchDirection::Absolute { limit: __self_0 } => { - FetchDirection::Absolute { - limit: ::core::clone::Clone::clone(__self_0), - } - } - FetchDirection::Relative { limit: __self_0 } => { - FetchDirection::Relative { - limit: ::core::clone::Clone::clone(__self_0), - } - } - FetchDirection::All => FetchDirection::All, - FetchDirection::Forward { limit: __self_0 } => { - FetchDirection::Forward { - limit: ::core::clone::Clone::clone(__self_0), - } - } - FetchDirection::ForwardAll => FetchDirection::ForwardAll, - FetchDirection::Backward { limit: __self_0 } => { - FetchDirection::Backward { - limit: ::core::clone::Clone::clone(__self_0), - } - } - FetchDirection::BackwardAll => FetchDirection::BackwardAll, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FetchDirection {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FetchDirection { - #[inline] - fn eq(&self, other: &FetchDirection) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - FetchDirection::Count { limit: __self_0 }, - FetchDirection::Count { limit: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - FetchDirection::Absolute { limit: __self_0 }, - FetchDirection::Absolute { limit: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - FetchDirection::Relative { limit: __self_0 }, - FetchDirection::Relative { limit: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - FetchDirection::Forward { limit: __self_0 }, - FetchDirection::Forward { limit: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - FetchDirection::Backward { limit: __self_0 }, - FetchDirection::Backward { limit: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FetchDirection { - #[inline] - fn partial_cmp( - &self, - other: &FetchDirection, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match (self, other) { - ( - FetchDirection::Count { limit: __self_0 }, - FetchDirection::Count { limit: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FetchDirection::Absolute { limit: __self_0 }, - FetchDirection::Absolute { limit: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FetchDirection::Relative { limit: __self_0 }, - FetchDirection::Relative { limit: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FetchDirection::Forward { limit: __self_0 }, - FetchDirection::Forward { limit: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FetchDirection::Backward { limit: __self_0 }, - FetchDirection::Backward { limit: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::option::Option::Some(::core::cmp::Ordering::Equal), - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FetchDirection { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FetchDirection { - #[inline] - fn cmp(&self, other: &FetchDirection) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - FetchDirection::Count { limit: __self_0 }, - FetchDirection::Count { limit: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FetchDirection::Absolute { limit: __self_0 }, - FetchDirection::Absolute { limit: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FetchDirection::Relative { limit: __self_0 }, - FetchDirection::Relative { limit: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FetchDirection::Forward { limit: __self_0 }, - FetchDirection::Forward { limit: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FetchDirection::Backward { limit: __self_0 }, - FetchDirection::Backward { limit: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FetchDirection { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - FetchDirection::Count { limit: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - FetchDirection::Absolute { limit: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - FetchDirection::Relative { limit: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - FetchDirection::Forward { limit: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - FetchDirection::Backward { limit: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for FetchDirection { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FetchDirection::Count { limit } => f.write_str(&limit.to_string())?, - FetchDirection::Next => f.write_str("NEXT")?, - FetchDirection::Prior => f.write_str("PRIOR")?, - FetchDirection::First => f.write_str("FIRST")?, - FetchDirection::Last => f.write_str("LAST")?, - FetchDirection::Absolute { limit } => { - f.write_str("ABSOLUTE ")?; - f.write_str(&limit.to_string())?; - } - FetchDirection::Relative { limit } => { - f.write_str("RELATIVE ")?; - f.write_str(&limit.to_string())?; - } - FetchDirection::All => f.write_str("ALL")?, - FetchDirection::Forward { limit } => { - f.write_str("FORWARD")?; - if let Some(l) = limit { - f.write_str(" ")?; - f.write_str(&l.to_string())?; - } - } - FetchDirection::ForwardAll => f.write_str("FORWARD ALL")?, - FetchDirection::Backward { limit } => { - f.write_str("BACKWARD")?; - if let Some(l) = limit { - f.write_str(" ")?; - f.write_str(&l.to_string())?; - } - } - FetchDirection::BackwardAll => f.write_str("BACKWARD ALL")?, - }; - Ok(()) - } - } - /// A privilege on a database object (table, sequence, etc.). - pub enum Action { - AddSearchOptimization, - Apply { apply_type: ActionApplyType }, - ApplyBudget, - AttachListing, - AttachPolicy, - Audit, - BindServiceEndpoint, - Connect, - Create { obj_type: Option }, - DatabaseRole { role: ObjectName }, - Delete, - EvolveSchema, - Execute { obj_type: Option }, - Failover, - ImportedPrivileges, - ImportShare, - Insert { columns: Option> }, - Manage { manage_type: ActionManageType }, - ManageReleases, - ManageVersions, - Modify { modify_type: ActionModifyType }, - Monitor { monitor_type: ActionMonitorType }, - Operate, - OverrideShareRestrictions, - Ownership, - PurchaseDataExchangeListing, - Read, - ReadSession, - References { columns: Option> }, - Replicate, - ResolveAll, - Role { role: Ident }, - Select { columns: Option> }, - Temporary, - Trigger, - Truncate, - Update { columns: Option> }, - Usage, - } - #[automatically_derived] - impl ::core::fmt::Debug for Action { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Action::AddSearchOptimization => { - ::core::fmt::Formatter::write_str(f, "AddSearchOptimization") - } - Action::Apply { apply_type: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Apply", - "apply_type", - &__self_0, - ) - } - Action::ApplyBudget => { - ::core::fmt::Formatter::write_str(f, "ApplyBudget") - } - Action::AttachListing => { - ::core::fmt::Formatter::write_str(f, "AttachListing") - } - Action::AttachPolicy => { - ::core::fmt::Formatter::write_str(f, "AttachPolicy") - } - Action::Audit => ::core::fmt::Formatter::write_str(f, "Audit"), - Action::BindServiceEndpoint => { - ::core::fmt::Formatter::write_str(f, "BindServiceEndpoint") - } - Action::Connect => ::core::fmt::Formatter::write_str(f, "Connect"), - Action::Create { obj_type: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Create", - "obj_type", - &__self_0, - ) - } - Action::DatabaseRole { role: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "DatabaseRole", - "role", - &__self_0, - ) - } - Action::Delete => ::core::fmt::Formatter::write_str(f, "Delete"), - Action::EvolveSchema => { - ::core::fmt::Formatter::write_str(f, "EvolveSchema") - } - Action::Execute { obj_type: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Execute", - "obj_type", - &__self_0, - ) - } - Action::Failover => ::core::fmt::Formatter::write_str(f, "Failover"), - Action::ImportedPrivileges => { - ::core::fmt::Formatter::write_str(f, "ImportedPrivileges") - } - Action::ImportShare => { - ::core::fmt::Formatter::write_str(f, "ImportShare") - } - Action::Insert { columns: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Insert", - "columns", - &__self_0, - ) - } - Action::Manage { manage_type: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Manage", - "manage_type", - &__self_0, - ) - } - Action::ManageReleases => { - ::core::fmt::Formatter::write_str(f, "ManageReleases") - } - Action::ManageVersions => { - ::core::fmt::Formatter::write_str(f, "ManageVersions") - } - Action::Modify { modify_type: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Modify", - "modify_type", - &__self_0, - ) - } - Action::Monitor { monitor_type: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Monitor", - "monitor_type", - &__self_0, - ) - } - Action::Operate => ::core::fmt::Formatter::write_str(f, "Operate"), - Action::OverrideShareRestrictions => { - ::core::fmt::Formatter::write_str(f, "OverrideShareRestrictions") - } - Action::Ownership => ::core::fmt::Formatter::write_str(f, "Ownership"), - Action::PurchaseDataExchangeListing => { - ::core::fmt::Formatter::write_str(f, "PurchaseDataExchangeListing") - } - Action::Read => ::core::fmt::Formatter::write_str(f, "Read"), - Action::ReadSession => { - ::core::fmt::Formatter::write_str(f, "ReadSession") - } - Action::References { columns: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "References", - "columns", - &__self_0, - ) - } - Action::Replicate => ::core::fmt::Formatter::write_str(f, "Replicate"), - Action::ResolveAll => ::core::fmt::Formatter::write_str(f, "ResolveAll"), - Action::Role { role: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Role", - "role", - &__self_0, - ) - } - Action::Select { columns: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Select", - "columns", - &__self_0, - ) - } - Action::Temporary => ::core::fmt::Formatter::write_str(f, "Temporary"), - Action::Trigger => ::core::fmt::Formatter::write_str(f, "Trigger"), - Action::Truncate => ::core::fmt::Formatter::write_str(f, "Truncate"), - Action::Update { columns: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Update", - "columns", - &__self_0, - ) - } - Action::Usage => ::core::fmt::Formatter::write_str(f, "Usage"), - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for Action { - #[inline] - fn clone(&self) -> Action { - match self { - Action::AddSearchOptimization => Action::AddSearchOptimization, - Action::Apply { apply_type: __self_0 } => { - Action::Apply { - apply_type: ::core::clone::Clone::clone(__self_0), - } - } - Action::ApplyBudget => Action::ApplyBudget, - Action::AttachListing => Action::AttachListing, - Action::AttachPolicy => Action::AttachPolicy, - Action::Audit => Action::Audit, - Action::BindServiceEndpoint => Action::BindServiceEndpoint, - Action::Connect => Action::Connect, - Action::Create { obj_type: __self_0 } => { - Action::Create { - obj_type: ::core::clone::Clone::clone(__self_0), - } - } - Action::DatabaseRole { role: __self_0 } => { - Action::DatabaseRole { - role: ::core::clone::Clone::clone(__self_0), - } - } - Action::Delete => Action::Delete, - Action::EvolveSchema => Action::EvolveSchema, - Action::Execute { obj_type: __self_0 } => { - Action::Execute { - obj_type: ::core::clone::Clone::clone(__self_0), - } - } - Action::Failover => Action::Failover, - Action::ImportedPrivileges => Action::ImportedPrivileges, - Action::ImportShare => Action::ImportShare, - Action::Insert { columns: __self_0 } => { - Action::Insert { - columns: ::core::clone::Clone::clone(__self_0), - } - } - Action::Manage { manage_type: __self_0 } => { - Action::Manage { - manage_type: ::core::clone::Clone::clone(__self_0), - } - } - Action::ManageReleases => Action::ManageReleases, - Action::ManageVersions => Action::ManageVersions, - Action::Modify { modify_type: __self_0 } => { - Action::Modify { - modify_type: ::core::clone::Clone::clone(__self_0), - } - } - Action::Monitor { monitor_type: __self_0 } => { - Action::Monitor { - monitor_type: ::core::clone::Clone::clone(__self_0), - } - } - Action::Operate => Action::Operate, - Action::OverrideShareRestrictions => Action::OverrideShareRestrictions, - Action::Ownership => Action::Ownership, - Action::PurchaseDataExchangeListing => { - Action::PurchaseDataExchangeListing - } - Action::Read => Action::Read, - Action::ReadSession => Action::ReadSession, - Action::References { columns: __self_0 } => { - Action::References { - columns: ::core::clone::Clone::clone(__self_0), - } - } - Action::Replicate => Action::Replicate, - Action::ResolveAll => Action::ResolveAll, - Action::Role { role: __self_0 } => { - Action::Role { - role: ::core::clone::Clone::clone(__self_0), - } - } - Action::Select { columns: __self_0 } => { - Action::Select { - columns: ::core::clone::Clone::clone(__self_0), - } - } - Action::Temporary => Action::Temporary, - Action::Trigger => Action::Trigger, - Action::Truncate => Action::Truncate, - Action::Update { columns: __self_0 } => { - Action::Update { - columns: ::core::clone::Clone::clone(__self_0), - } - } - Action::Usage => Action::Usage, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Action {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Action { - #[inline] - fn eq(&self, other: &Action) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - Action::Apply { apply_type: __self_0 }, - Action::Apply { apply_type: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Create { obj_type: __self_0 }, - Action::Create { obj_type: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::DatabaseRole { role: __self_0 }, - Action::DatabaseRole { role: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Execute { obj_type: __self_0 }, - Action::Execute { obj_type: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Insert { columns: __self_0 }, - Action::Insert { columns: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Manage { manage_type: __self_0 }, - Action::Manage { manage_type: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Modify { modify_type: __self_0 }, - Action::Modify { modify_type: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Monitor { monitor_type: __self_0 }, - Action::Monitor { monitor_type: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::References { columns: __self_0 }, - Action::References { columns: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Role { role: __self_0 }, - Action::Role { role: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Select { columns: __self_0 }, - Action::Select { columns: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - Action::Update { columns: __self_0 }, - Action::Update { columns: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Action { - #[inline] - fn partial_cmp( - &self, - other: &Action, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match (self, other) { - ( - Action::Apply { apply_type: __self_0 }, - Action::Apply { apply_type: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Create { obj_type: __self_0 }, - Action::Create { obj_type: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::DatabaseRole { role: __self_0 }, - Action::DatabaseRole { role: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Execute { obj_type: __self_0 }, - Action::Execute { obj_type: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Insert { columns: __self_0 }, - Action::Insert { columns: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Manage { manage_type: __self_0 }, - Action::Manage { manage_type: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Modify { modify_type: __self_0 }, - Action::Modify { modify_type: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Monitor { monitor_type: __self_0 }, - Action::Monitor { monitor_type: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::References { columns: __self_0 }, - Action::References { columns: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Role { role: __self_0 }, - Action::Role { role: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Select { columns: __self_0 }, - Action::Select { columns: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Action::Update { columns: __self_0 }, - Action::Update { columns: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::option::Option::Some(::core::cmp::Ordering::Equal), - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Action { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Action { - #[inline] - fn cmp(&self, other: &Action) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - Action::Apply { apply_type: __self_0 }, - Action::Apply { apply_type: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Create { obj_type: __self_0 }, - Action::Create { obj_type: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::DatabaseRole { role: __self_0 }, - Action::DatabaseRole { role: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Execute { obj_type: __self_0 }, - Action::Execute { obj_type: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Insert { columns: __self_0 }, - Action::Insert { columns: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Manage { manage_type: __self_0 }, - Action::Manage { manage_type: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Modify { modify_type: __self_0 }, - Action::Modify { modify_type: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Monitor { monitor_type: __self_0 }, - Action::Monitor { monitor_type: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::References { columns: __self_0 }, - Action::References { columns: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Role { role: __self_0 }, - Action::Role { role: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Select { columns: __self_0 }, - Action::Select { columns: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Action::Update { columns: __self_0 }, - Action::Update { columns: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Action { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Action::Apply { apply_type: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Create { obj_type: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::DatabaseRole { role: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Execute { obj_type: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Insert { columns: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Manage { manage_type: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Modify { modify_type: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Monitor { monitor_type: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::References { columns: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Role { role: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Select { columns: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - Action::Update { columns: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for Action { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Action::AddSearchOptimization => f.write_str("ADD SEARCH OPTIMIZATION")?, - Action::Apply { apply_type } => { - f.write_fmt(format_args!("APPLY {0}", apply_type))? - } - Action::ApplyBudget => f.write_str("APPLY BUDGET")?, - Action::AttachListing => f.write_str("ATTACH LISTING")?, - Action::AttachPolicy => f.write_str("ATTACH POLICY")?, - Action::Audit => f.write_str("AUDIT")?, - Action::BindServiceEndpoint => f.write_str("BIND SERVICE ENDPOINT")?, - Action::Connect => f.write_str("CONNECT")?, - Action::Create { obj_type } => { - f.write_str("CREATE")?; - if let Some(obj_type) = obj_type { - f.write_fmt(format_args!(" {0}", obj_type))? - } - } - Action::DatabaseRole { role } => { - f.write_fmt(format_args!("DATABASE ROLE {0}", role))? - } - Action::Delete => f.write_str("DELETE")?, - Action::EvolveSchema => f.write_str("EVOLVE SCHEMA")?, - Action::Execute { obj_type } => { - f.write_str("EXECUTE")?; - if let Some(obj_type) = obj_type { - f.write_fmt(format_args!(" {0}", obj_type))? - } - } - Action::Failover => f.write_str("FAILOVER")?, - Action::ImportedPrivileges => f.write_str("IMPORTED PRIVILEGES")?, - Action::ImportShare => f.write_str("IMPORT SHARE")?, - Action::Insert { .. } => f.write_str("INSERT")?, - Action::Manage { manage_type } => { - f.write_fmt(format_args!("MANAGE {0}", manage_type))? - } - Action::ManageReleases => f.write_str("MANAGE RELEASES")?, - Action::ManageVersions => f.write_str("MANAGE VERSIONS")?, - Action::Modify { modify_type } => { - f.write_fmt(format_args!("MODIFY {0}", modify_type))? - } - Action::Monitor { monitor_type } => { - f.write_fmt(format_args!("MONITOR {0}", monitor_type))? - } - Action::Operate => f.write_str("OPERATE")?, - Action::OverrideShareRestrictions => { - f.write_str("OVERRIDE SHARE RESTRICTIONS")? - } - Action::Ownership => f.write_str("OWNERSHIP")?, - Action::PurchaseDataExchangeListing => { - f.write_str("PURCHASE DATA EXCHANGE LISTING")? - } - Action::Read => f.write_str("READ")?, - Action::ReadSession => f.write_str("READ SESSION")?, - Action::References { .. } => f.write_str("REFERENCES")?, - Action::Replicate => f.write_str("REPLICATE")?, - Action::ResolveAll => f.write_str("RESOLVE ALL")?, - Action::Role { role } => f.write_fmt(format_args!("ROLE {0}", role))?, - Action::Select { .. } => f.write_str("SELECT")?, - Action::Temporary => f.write_str("TEMPORARY")?, - Action::Trigger => f.write_str("TRIGGER")?, - Action::Truncate => f.write_str("TRUNCATE")?, - Action::Update { .. } => f.write_str("UPDATE")?, - Action::Usage => f.write_str("USAGE")?, - }; - match self { - Action::Insert { columns } - | Action::References { columns } - | Action::Select { columns } - | Action::Update { columns } => { - if let Some(columns) = columns { - f.write_fmt( - format_args!(" ({0})", display_comma_separated(columns)), - )?; - } - } - _ => {} - }; - Ok(()) - } - } - /// See - /// under `globalPrivileges` in the `CREATE` privilege. - pub enum ActionCreateObjectType { - Account, - Application, - ApplicationPackage, - ComputePool, - DataExchangeListing, - Database, - ExternalVolume, - FailoverGroup, - Integration, - NetworkPolicy, - OrganiationListing, - ReplicationGroup, - Role, - Share, - User, - Warehouse, - } - #[automatically_derived] - impl ::core::fmt::Debug for ActionCreateObjectType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ActionCreateObjectType::Account => "Account", - ActionCreateObjectType::Application => "Application", - ActionCreateObjectType::ApplicationPackage => "ApplicationPackage", - ActionCreateObjectType::ComputePool => "ComputePool", - ActionCreateObjectType::DataExchangeListing => "DataExchangeListing", - ActionCreateObjectType::Database => "Database", - ActionCreateObjectType::ExternalVolume => "ExternalVolume", - ActionCreateObjectType::FailoverGroup => "FailoverGroup", - ActionCreateObjectType::Integration => "Integration", - ActionCreateObjectType::NetworkPolicy => "NetworkPolicy", - ActionCreateObjectType::OrganiationListing => "OrganiationListing", - ActionCreateObjectType::ReplicationGroup => "ReplicationGroup", - ActionCreateObjectType::Role => "Role", - ActionCreateObjectType::Share => "Share", - ActionCreateObjectType::User => "User", - ActionCreateObjectType::Warehouse => "Warehouse", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ActionCreateObjectType { - #[inline] - fn clone(&self) -> ActionCreateObjectType { - match self { - ActionCreateObjectType::Account => ActionCreateObjectType::Account, - ActionCreateObjectType::Application => { - ActionCreateObjectType::Application - } - ActionCreateObjectType::ApplicationPackage => { - ActionCreateObjectType::ApplicationPackage - } - ActionCreateObjectType::ComputePool => { - ActionCreateObjectType::ComputePool - } - ActionCreateObjectType::DataExchangeListing => { - ActionCreateObjectType::DataExchangeListing - } - ActionCreateObjectType::Database => ActionCreateObjectType::Database, - ActionCreateObjectType::ExternalVolume => { - ActionCreateObjectType::ExternalVolume - } - ActionCreateObjectType::FailoverGroup => { - ActionCreateObjectType::FailoverGroup - } - ActionCreateObjectType::Integration => { - ActionCreateObjectType::Integration - } - ActionCreateObjectType::NetworkPolicy => { - ActionCreateObjectType::NetworkPolicy - } - ActionCreateObjectType::OrganiationListing => { - ActionCreateObjectType::OrganiationListing - } - ActionCreateObjectType::ReplicationGroup => { - ActionCreateObjectType::ReplicationGroup - } - ActionCreateObjectType::Role => ActionCreateObjectType::Role, - ActionCreateObjectType::Share => ActionCreateObjectType::Share, - ActionCreateObjectType::User => ActionCreateObjectType::User, - ActionCreateObjectType::Warehouse => ActionCreateObjectType::Warehouse, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ActionCreateObjectType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ActionCreateObjectType { - #[inline] - fn eq(&self, other: &ActionCreateObjectType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ActionCreateObjectType { - #[inline] - fn partial_cmp( - &self, - other: &ActionCreateObjectType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ActionCreateObjectType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ActionCreateObjectType { - #[inline] - fn cmp(&self, other: &ActionCreateObjectType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ActionCreateObjectType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ActionCreateObjectType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ActionCreateObjectType::Account => f.write_fmt(format_args!("ACCOUNT")), - ActionCreateObjectType::Application => { - f.write_fmt(format_args!("APPLICATION")) - } - ActionCreateObjectType::ApplicationPackage => { - f.write_fmt(format_args!("APPLICATION PACKAGE")) - } - ActionCreateObjectType::ComputePool => { - f.write_fmt(format_args!("COMPUTE POOL")) - } - ActionCreateObjectType::DataExchangeListing => { - f.write_fmt(format_args!("DATA EXCHANGE LISTING")) - } - ActionCreateObjectType::Database => f.write_fmt(format_args!("DATABASE")), - ActionCreateObjectType::ExternalVolume => { - f.write_fmt(format_args!("EXTERNAL VOLUME")) - } - ActionCreateObjectType::FailoverGroup => { - f.write_fmt(format_args!("FAILOVER GROUP")) - } - ActionCreateObjectType::Integration => { - f.write_fmt(format_args!("INTEGRATION")) - } - ActionCreateObjectType::NetworkPolicy => { - f.write_fmt(format_args!("NETWORK POLICY")) - } - ActionCreateObjectType::OrganiationListing => { - f.write_fmt(format_args!("ORGANIZATION LISTING")) - } - ActionCreateObjectType::ReplicationGroup => { - f.write_fmt(format_args!("REPLICATION GROUP")) - } - ActionCreateObjectType::Role => f.write_fmt(format_args!("ROLE")), - ActionCreateObjectType::Share => f.write_fmt(format_args!("SHARE")), - ActionCreateObjectType::User => f.write_fmt(format_args!("USER")), - ActionCreateObjectType::Warehouse => { - f.write_fmt(format_args!("WAREHOUSE")) - } - } - } - } - /// See - /// under `globalPrivileges` in the `APPLY` privilege. - pub enum ActionApplyType { - AggregationPolicy, - AuthenticationPolicy, - JoinPolicy, - MaskingPolicy, - PackagesPolicy, - PasswordPolicy, - ProjectionPolicy, - RowAccessPolicy, - SessionPolicy, - Tag, - } - #[automatically_derived] - impl ::core::fmt::Debug for ActionApplyType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ActionApplyType::AggregationPolicy => "AggregationPolicy", - ActionApplyType::AuthenticationPolicy => "AuthenticationPolicy", - ActionApplyType::JoinPolicy => "JoinPolicy", - ActionApplyType::MaskingPolicy => "MaskingPolicy", - ActionApplyType::PackagesPolicy => "PackagesPolicy", - ActionApplyType::PasswordPolicy => "PasswordPolicy", - ActionApplyType::ProjectionPolicy => "ProjectionPolicy", - ActionApplyType::RowAccessPolicy => "RowAccessPolicy", - ActionApplyType::SessionPolicy => "SessionPolicy", - ActionApplyType::Tag => "Tag", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ActionApplyType { - #[inline] - fn clone(&self) -> ActionApplyType { - match self { - ActionApplyType::AggregationPolicy => ActionApplyType::AggregationPolicy, - ActionApplyType::AuthenticationPolicy => { - ActionApplyType::AuthenticationPolicy - } - ActionApplyType::JoinPolicy => ActionApplyType::JoinPolicy, - ActionApplyType::MaskingPolicy => ActionApplyType::MaskingPolicy, - ActionApplyType::PackagesPolicy => ActionApplyType::PackagesPolicy, - ActionApplyType::PasswordPolicy => ActionApplyType::PasswordPolicy, - ActionApplyType::ProjectionPolicy => ActionApplyType::ProjectionPolicy, - ActionApplyType::RowAccessPolicy => ActionApplyType::RowAccessPolicy, - ActionApplyType::SessionPolicy => ActionApplyType::SessionPolicy, - ActionApplyType::Tag => ActionApplyType::Tag, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ActionApplyType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ActionApplyType { - #[inline] - fn eq(&self, other: &ActionApplyType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ActionApplyType { - #[inline] - fn partial_cmp( - &self, - other: &ActionApplyType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ActionApplyType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ActionApplyType { - #[inline] - fn cmp(&self, other: &ActionApplyType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ActionApplyType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ActionApplyType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ActionApplyType::AggregationPolicy => { - f.write_fmt(format_args!("AGGREGATION POLICY")) - } - ActionApplyType::AuthenticationPolicy => { - f.write_fmt(format_args!("AUTHENTICATION POLICY")) - } - ActionApplyType::JoinPolicy => f.write_fmt(format_args!("JOIN POLICY")), - ActionApplyType::MaskingPolicy => { - f.write_fmt(format_args!("MASKING POLICY")) - } - ActionApplyType::PackagesPolicy => { - f.write_fmt(format_args!("PACKAGES POLICY")) - } - ActionApplyType::PasswordPolicy => { - f.write_fmt(format_args!("PASSWORD POLICY")) - } - ActionApplyType::ProjectionPolicy => { - f.write_fmt(format_args!("PROJECTION POLICY")) - } - ActionApplyType::RowAccessPolicy => { - f.write_fmt(format_args!("ROW ACCESS POLICY")) - } - ActionApplyType::SessionPolicy => { - f.write_fmt(format_args!("SESSION POLICY")) - } - ActionApplyType::Tag => f.write_fmt(format_args!("TAG")), - } - } - } - /// See - /// under `globalPrivileges` in the `EXECUTE` privilege. - pub enum ActionExecuteObjectType { - Alert, - DataMetricFunction, - ManagedAlert, - ManagedTask, - Task, - } - #[automatically_derived] - impl ::core::fmt::Debug for ActionExecuteObjectType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ActionExecuteObjectType::Alert => "Alert", - ActionExecuteObjectType::DataMetricFunction => "DataMetricFunction", - ActionExecuteObjectType::ManagedAlert => "ManagedAlert", - ActionExecuteObjectType::ManagedTask => "ManagedTask", - ActionExecuteObjectType::Task => "Task", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ActionExecuteObjectType { - #[inline] - fn clone(&self) -> ActionExecuteObjectType { - match self { - ActionExecuteObjectType::Alert => ActionExecuteObjectType::Alert, - ActionExecuteObjectType::DataMetricFunction => { - ActionExecuteObjectType::DataMetricFunction - } - ActionExecuteObjectType::ManagedAlert => { - ActionExecuteObjectType::ManagedAlert - } - ActionExecuteObjectType::ManagedTask => { - ActionExecuteObjectType::ManagedTask - } - ActionExecuteObjectType::Task => ActionExecuteObjectType::Task, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ActionExecuteObjectType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ActionExecuteObjectType { - #[inline] - fn eq(&self, other: &ActionExecuteObjectType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ActionExecuteObjectType { - #[inline] - fn partial_cmp( - &self, - other: &ActionExecuteObjectType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ActionExecuteObjectType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ActionExecuteObjectType { - #[inline] - fn cmp(&self, other: &ActionExecuteObjectType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ActionExecuteObjectType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ActionExecuteObjectType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ActionExecuteObjectType::Alert => f.write_fmt(format_args!("ALERT")), - ActionExecuteObjectType::DataMetricFunction => { - f.write_fmt(format_args!("DATA METRIC FUNCTION")) - } - ActionExecuteObjectType::ManagedAlert => { - f.write_fmt(format_args!("MANAGED ALERT")) - } - ActionExecuteObjectType::ManagedTask => { - f.write_fmt(format_args!("MANAGED TASK")) - } - ActionExecuteObjectType::Task => f.write_fmt(format_args!("TASK")), - } - } - } - /// See - /// under `globalPrivileges` in the `MANAGE` privilege. - pub enum ActionManageType { - AccountSupportCases, - EventSharing, - Grants, - ListingAutoFulfillment, - OrganizationSupportCases, - UserSupportCases, - Warehouses, - } - #[automatically_derived] - impl ::core::fmt::Debug for ActionManageType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ActionManageType::AccountSupportCases => "AccountSupportCases", - ActionManageType::EventSharing => "EventSharing", - ActionManageType::Grants => "Grants", - ActionManageType::ListingAutoFulfillment => "ListingAutoFulfillment", - ActionManageType::OrganizationSupportCases => { - "OrganizationSupportCases" - } - ActionManageType::UserSupportCases => "UserSupportCases", - ActionManageType::Warehouses => "Warehouses", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ActionManageType { - #[inline] - fn clone(&self) -> ActionManageType { - match self { - ActionManageType::AccountSupportCases => { - ActionManageType::AccountSupportCases - } - ActionManageType::EventSharing => ActionManageType::EventSharing, - ActionManageType::Grants => ActionManageType::Grants, - ActionManageType::ListingAutoFulfillment => { - ActionManageType::ListingAutoFulfillment - } - ActionManageType::OrganizationSupportCases => { - ActionManageType::OrganizationSupportCases - } - ActionManageType::UserSupportCases => ActionManageType::UserSupportCases, - ActionManageType::Warehouses => ActionManageType::Warehouses, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ActionManageType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ActionManageType { - #[inline] - fn eq(&self, other: &ActionManageType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ActionManageType { - #[inline] - fn partial_cmp( - &self, - other: &ActionManageType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ActionManageType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ActionManageType { - #[inline] - fn cmp(&self, other: &ActionManageType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ActionManageType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ActionManageType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ActionManageType::AccountSupportCases => { - f.write_fmt(format_args!("ACCOUNT SUPPORT CASES")) - } - ActionManageType::EventSharing => { - f.write_fmt(format_args!("EVENT SHARING")) - } - ActionManageType::Grants => f.write_fmt(format_args!("GRANTS")), - ActionManageType::ListingAutoFulfillment => { - f.write_fmt(format_args!("LISTING AUTO FULFILLMENT")) - } - ActionManageType::OrganizationSupportCases => { - f.write_fmt(format_args!("ORGANIZATION SUPPORT CASES")) - } - ActionManageType::UserSupportCases => { - f.write_fmt(format_args!("USER SUPPORT CASES")) - } - ActionManageType::Warehouses => f.write_fmt(format_args!("WAREHOUSES")), - } - } - } - /// See - /// under `globalPrivileges` in the `MODIFY` privilege. - pub enum ActionModifyType { - LogLevel, - TraceLevel, - SessionLogLevel, - SessionTraceLevel, - } - #[automatically_derived] - impl ::core::fmt::Debug for ActionModifyType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ActionModifyType::LogLevel => "LogLevel", - ActionModifyType::TraceLevel => "TraceLevel", - ActionModifyType::SessionLogLevel => "SessionLogLevel", - ActionModifyType::SessionTraceLevel => "SessionTraceLevel", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ActionModifyType { - #[inline] - fn clone(&self) -> ActionModifyType { - match self { - ActionModifyType::LogLevel => ActionModifyType::LogLevel, - ActionModifyType::TraceLevel => ActionModifyType::TraceLevel, - ActionModifyType::SessionLogLevel => ActionModifyType::SessionLogLevel, - ActionModifyType::SessionTraceLevel => { - ActionModifyType::SessionTraceLevel - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ActionModifyType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ActionModifyType { - #[inline] - fn eq(&self, other: &ActionModifyType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ActionModifyType { - #[inline] - fn partial_cmp( - &self, - other: &ActionModifyType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ActionModifyType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ActionModifyType { - #[inline] - fn cmp(&self, other: &ActionModifyType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ActionModifyType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ActionModifyType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ActionModifyType::LogLevel => f.write_fmt(format_args!("LOG LEVEL")), - ActionModifyType::TraceLevel => f.write_fmt(format_args!("TRACE LEVEL")), - ActionModifyType::SessionLogLevel => { - f.write_fmt(format_args!("SESSION LOG LEVEL")) - } - ActionModifyType::SessionTraceLevel => { - f.write_fmt(format_args!("SESSION TRACE LEVEL")) - } - } - } - } - /// See - /// under `globalPrivileges` in the `MONITOR` privilege. - pub enum ActionMonitorType { - Execution, - Security, - Usage, - } - #[automatically_derived] - impl ::core::fmt::Debug for ActionMonitorType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ActionMonitorType::Execution => "Execution", - ActionMonitorType::Security => "Security", - ActionMonitorType::Usage => "Usage", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ActionMonitorType { - #[inline] - fn clone(&self) -> ActionMonitorType { - match self { - ActionMonitorType::Execution => ActionMonitorType::Execution, - ActionMonitorType::Security => ActionMonitorType::Security, - ActionMonitorType::Usage => ActionMonitorType::Usage, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ActionMonitorType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ActionMonitorType { - #[inline] - fn eq(&self, other: &ActionMonitorType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ActionMonitorType { - #[inline] - fn partial_cmp( - &self, - other: &ActionMonitorType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ActionMonitorType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ActionMonitorType { - #[inline] - fn cmp(&self, other: &ActionMonitorType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ActionMonitorType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ActionMonitorType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ActionMonitorType::Execution => f.write_fmt(format_args!("EXECUTION")), - ActionMonitorType::Security => f.write_fmt(format_args!("SECURITY")), - ActionMonitorType::Usage => f.write_fmt(format_args!("USAGE")), - } - } - } - /// The principal that receives the privileges - pub struct Grantee { - pub grantee_type: GranteesType, - pub name: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for Grantee { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Grantee", - "grantee_type", - &self.grantee_type, - "name", - &&self.name, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Grantee { - #[inline] - fn clone(&self) -> Grantee { - Grantee { - grantee_type: ::core::clone::Clone::clone(&self.grantee_type), - name: ::core::clone::Clone::clone(&self.name), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Grantee {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Grantee { - #[inline] - fn eq(&self, other: &Grantee) -> bool { - self.grantee_type == other.grantee_type && self.name == other.name - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Grantee { - #[inline] - fn partial_cmp( - &self, - other: &Grantee, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.grantee_type, - &other.grantee_type, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Grantee { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Grantee { - #[inline] - fn cmp(&self, other: &Grantee) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.grantee_type, &other.grantee_type) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.name, &other.name) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Grantee { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.grantee_type, state); - ::core::hash::Hash::hash(&self.name, state) - } - } - impl fmt::Display for Grantee { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self.grantee_type { - GranteesType::Role => { - f.write_fmt(format_args!("ROLE "))?; - } - GranteesType::Share => { - f.write_fmt(format_args!("SHARE "))?; - } - GranteesType::User => { - f.write_fmt(format_args!("USER "))?; - } - GranteesType::Group => { - f.write_fmt(format_args!("GROUP "))?; - } - GranteesType::Public => { - f.write_fmt(format_args!("PUBLIC "))?; - } - GranteesType::DatabaseRole => { - f.write_fmt(format_args!("DATABASE ROLE "))?; - } - GranteesType::Application => { - f.write_fmt(format_args!("APPLICATION "))?; - } - GranteesType::ApplicationRole => { - f.write_fmt(format_args!("APPLICATION ROLE "))?; - } - GranteesType::None => {} - } - if let Some(ref name) = self.name { - name.fmt(f)?; - } - Ok(()) - } - } - pub enum GranteesType { - Role, - Share, - User, - Group, - Public, - DatabaseRole, - Application, - ApplicationRole, - None, - } - #[automatically_derived] - impl ::core::fmt::Debug for GranteesType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - GranteesType::Role => "Role", - GranteesType::Share => "Share", - GranteesType::User => "User", - GranteesType::Group => "Group", - GranteesType::Public => "Public", - GranteesType::DatabaseRole => "DatabaseRole", - GranteesType::Application => "Application", - GranteesType::ApplicationRole => "ApplicationRole", - GranteesType::None => "None", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for GranteesType { - #[inline] - fn clone(&self) -> GranteesType { - match self { - GranteesType::Role => GranteesType::Role, - GranteesType::Share => GranteesType::Share, - GranteesType::User => GranteesType::User, - GranteesType::Group => GranteesType::Group, - GranteesType::Public => GranteesType::Public, - GranteesType::DatabaseRole => GranteesType::DatabaseRole, - GranteesType::Application => GranteesType::Application, - GranteesType::ApplicationRole => GranteesType::ApplicationRole, - GranteesType::None => GranteesType::None, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for GranteesType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for GranteesType { - #[inline] - fn eq(&self, other: &GranteesType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for GranteesType { - #[inline] - fn partial_cmp( - &self, - other: &GranteesType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for GranteesType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for GranteesType { - #[inline] - fn cmp(&self, other: &GranteesType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for GranteesType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - /// Users/roles designated in a GRANT/REVOKE - pub enum GranteeName { - /// A bare identifier - ObjectName(ObjectName), - /// A MySQL user/host pair such as 'root'@'%' - UserHost { user: Ident, host: Ident }, - } - #[automatically_derived] - impl ::core::fmt::Debug for GranteeName { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - GranteeName::ObjectName(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ObjectName", - &__self_0, - ) - } - GranteeName::UserHost { user: __self_0, host: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "UserHost", - "user", - __self_0, - "host", - &__self_1, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for GranteeName { - #[inline] - fn clone(&self) -> GranteeName { - match self { - GranteeName::ObjectName(__self_0) => { - GranteeName::ObjectName(::core::clone::Clone::clone(__self_0)) - } - GranteeName::UserHost { user: __self_0, host: __self_1 } => { - GranteeName::UserHost { - user: ::core::clone::Clone::clone(__self_0), - host: ::core::clone::Clone::clone(__self_1), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for GranteeName {} - #[automatically_derived] - impl ::core::cmp::PartialEq for GranteeName { - #[inline] - fn eq(&self, other: &GranteeName) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - GranteeName::ObjectName(__self_0), - GranteeName::ObjectName(__arg1_0), - ) => __self_0 == __arg1_0, - ( - GranteeName::UserHost { user: __self_0, host: __self_1 }, - GranteeName::UserHost { user: __arg1_0, host: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for GranteeName { - #[inline] - fn partial_cmp( - &self, - other: &GranteeName, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - GranteeName::ObjectName(__self_0), - GranteeName::ObjectName(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - GranteeName::UserHost { user: __self_0, host: __self_1 }, - GranteeName::UserHost { user: __arg1_0, host: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for GranteeName { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for GranteeName { - #[inline] - fn cmp(&self, other: &GranteeName) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - GranteeName::ObjectName(__self_0), - GranteeName::ObjectName(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GranteeName::UserHost { user: __self_0, host: __self_1 }, - GranteeName::UserHost { user: __arg1_0, host: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for GranteeName { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - GranteeName::ObjectName(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - GranteeName::UserHost { user: __self_0, host: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - } - } - } - impl fmt::Display for GranteeName { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - GranteeName::ObjectName(name) => name.fmt(f), - GranteeName::UserHost { user, host } => { - f.write_fmt(format_args!("{0}@{1}", user, host)) - } - } - } - } - /// Objects on which privileges are granted in a GRANT statement. - pub enum GrantObjects { - /// Grant privileges on `ALL SEQUENCES IN SCHEMA [, ...]` - AllSequencesInSchema { schemas: Vec }, - /// Grant privileges on `ALL TABLES IN SCHEMA [, ...]` - AllTablesInSchema { schemas: Vec }, - /// Grant privileges on specific databases - Databases(Vec), - /// Grant privileges on specific schemas - Schemas(Vec), - /// Grant privileges on specific sequences - Sequences(Vec), - /// Grant privileges on specific tables - Tables(Vec), - /// Grant privileges on specific views - Views(Vec), - /// Grant privileges on specific warehouses - Warehouses(Vec), - /// Grant privileges on specific integrations - Integrations(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for GrantObjects { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - GrantObjects::AllSequencesInSchema { schemas: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "AllSequencesInSchema", - "schemas", - &__self_0, - ) - } - GrantObjects::AllTablesInSchema { schemas: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "AllTablesInSchema", - "schemas", - &__self_0, - ) - } - GrantObjects::Databases(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Databases", - &__self_0, - ) - } - GrantObjects::Schemas(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Schemas", - &__self_0, - ) - } - GrantObjects::Sequences(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Sequences", - &__self_0, - ) - } - GrantObjects::Tables(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Tables", - &__self_0, - ) - } - GrantObjects::Views(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Views", - &__self_0, - ) - } - GrantObjects::Warehouses(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Warehouses", - &__self_0, - ) - } - GrantObjects::Integrations(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Integrations", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for GrantObjects { - #[inline] - fn clone(&self) -> GrantObjects { - match self { - GrantObjects::AllSequencesInSchema { schemas: __self_0 } => { - GrantObjects::AllSequencesInSchema { - schemas: ::core::clone::Clone::clone(__self_0), - } - } - GrantObjects::AllTablesInSchema { schemas: __self_0 } => { - GrantObjects::AllTablesInSchema { - schemas: ::core::clone::Clone::clone(__self_0), - } - } - GrantObjects::Databases(__self_0) => { - GrantObjects::Databases(::core::clone::Clone::clone(__self_0)) - } - GrantObjects::Schemas(__self_0) => { - GrantObjects::Schemas(::core::clone::Clone::clone(__self_0)) - } - GrantObjects::Sequences(__self_0) => { - GrantObjects::Sequences(::core::clone::Clone::clone(__self_0)) - } - GrantObjects::Tables(__self_0) => { - GrantObjects::Tables(::core::clone::Clone::clone(__self_0)) - } - GrantObjects::Views(__self_0) => { - GrantObjects::Views(::core::clone::Clone::clone(__self_0)) - } - GrantObjects::Warehouses(__self_0) => { - GrantObjects::Warehouses(::core::clone::Clone::clone(__self_0)) - } - GrantObjects::Integrations(__self_0) => { - GrantObjects::Integrations(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for GrantObjects {} - #[automatically_derived] - impl ::core::cmp::PartialEq for GrantObjects { - #[inline] - fn eq(&self, other: &GrantObjects) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - GrantObjects::AllSequencesInSchema { schemas: __self_0 }, - GrantObjects::AllSequencesInSchema { schemas: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - GrantObjects::AllTablesInSchema { schemas: __self_0 }, - GrantObjects::AllTablesInSchema { schemas: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - GrantObjects::Databases(__self_0), - GrantObjects::Databases(__arg1_0), - ) => __self_0 == __arg1_0, - ( - GrantObjects::Schemas(__self_0), - GrantObjects::Schemas(__arg1_0), - ) => __self_0 == __arg1_0, - ( - GrantObjects::Sequences(__self_0), - GrantObjects::Sequences(__arg1_0), - ) => __self_0 == __arg1_0, - (GrantObjects::Tables(__self_0), GrantObjects::Tables(__arg1_0)) => { - __self_0 == __arg1_0 - } - (GrantObjects::Views(__self_0), GrantObjects::Views(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - GrantObjects::Warehouses(__self_0), - GrantObjects::Warehouses(__arg1_0), - ) => __self_0 == __arg1_0, - ( - GrantObjects::Integrations(__self_0), - GrantObjects::Integrations(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for GrantObjects { - #[inline] - fn partial_cmp( - &self, - other: &GrantObjects, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - GrantObjects::AllSequencesInSchema { schemas: __self_0 }, - GrantObjects::AllSequencesInSchema { schemas: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - GrantObjects::AllTablesInSchema { schemas: __self_0 }, - GrantObjects::AllTablesInSchema { schemas: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - GrantObjects::Databases(__self_0), - GrantObjects::Databases(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (GrantObjects::Schemas(__self_0), GrantObjects::Schemas(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - GrantObjects::Sequences(__self_0), - GrantObjects::Sequences(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (GrantObjects::Tables(__self_0), GrantObjects::Tables(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (GrantObjects::Views(__self_0), GrantObjects::Views(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - GrantObjects::Warehouses(__self_0), - GrantObjects::Warehouses(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - GrantObjects::Integrations(__self_0), - GrantObjects::Integrations(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for GrantObjects { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for GrantObjects { - #[inline] - fn cmp(&self, other: &GrantObjects) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - GrantObjects::AllSequencesInSchema { schemas: __self_0 }, - GrantObjects::AllSequencesInSchema { schemas: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::AllTablesInSchema { schemas: __self_0 }, - GrantObjects::AllTablesInSchema { schemas: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::Databases(__self_0), - GrantObjects::Databases(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::Schemas(__self_0), - GrantObjects::Schemas(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::Sequences(__self_0), - GrantObjects::Sequences(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::Tables(__self_0), - GrantObjects::Tables(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::Views(__self_0), - GrantObjects::Views(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::Warehouses(__self_0), - GrantObjects::Warehouses(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - GrantObjects::Integrations(__self_0), - GrantObjects::Integrations(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for GrantObjects { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - GrantObjects::AllSequencesInSchema { schemas: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::AllTablesInSchema { schemas: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::Databases(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::Schemas(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::Sequences(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::Tables(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::Views(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::Warehouses(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - GrantObjects::Integrations(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for GrantObjects { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - GrantObjects::Sequences(sequences) => { - f.write_fmt( - format_args!("SEQUENCE {0}", display_comma_separated(sequences)), - ) - } - GrantObjects::Databases(databases) => { - f.write_fmt( - format_args!("DATABASE {0}", display_comma_separated(databases)), - ) - } - GrantObjects::Schemas(schemas) => { - f.write_fmt( - format_args!("SCHEMA {0}", display_comma_separated(schemas)), - ) - } - GrantObjects::Tables(tables) => { - f.write_fmt(format_args!("{0}", display_comma_separated(tables))) - } - GrantObjects::Views(views) => { - f.write_fmt(format_args!("VIEW {0}", display_comma_separated(views))) - } - GrantObjects::Warehouses(warehouses) => { - f.write_fmt( - format_args!( - "WAREHOUSE {0}", - display_comma_separated(warehouses), - ), - ) - } - GrantObjects::Integrations(integrations) => { - f.write_fmt( - format_args!( - "INTEGRATION {0}", - display_comma_separated(integrations), - ), - ) - } - GrantObjects::AllSequencesInSchema { schemas } => { - f.write_fmt( - format_args!( - "ALL SEQUENCES IN SCHEMA {0}", - display_comma_separated(schemas), - ), - ) - } - GrantObjects::AllTablesInSchema { schemas } => { - f.write_fmt( - format_args!( - "ALL TABLES IN SCHEMA {0}", - display_comma_separated(schemas), - ), - ) - } - } - } - } - /// SQL assignment `foo = expr` as used in SQLUpdate - pub struct Assignment { - pub target: AssignmentTarget, - pub value: Expr, - } - #[automatically_derived] - impl ::core::fmt::Debug for Assignment { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Assignment", - "target", - &self.target, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Assignment { - #[inline] - fn clone(&self) -> Assignment { - Assignment { - target: ::core::clone::Clone::clone(&self.target), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Assignment {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Assignment { - #[inline] - fn eq(&self, other: &Assignment) -> bool { - self.target == other.target && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Assignment { - #[inline] - fn partial_cmp( - &self, - other: &Assignment, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.target, &other.target) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Assignment { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Assignment { - #[inline] - fn cmp(&self, other: &Assignment) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.target, &other.target) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Assignment { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.target, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl fmt::Display for Assignment { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0} = {1}", self.target, self.value)) - } - } - /// Left-hand side of an assignment in an UPDATE statement, - /// e.g. `foo` in `foo = 5` (ColumnName assignment) or - /// `(a, b)` in `(a, b) = (1, 2)` (Tuple assignment). - pub enum AssignmentTarget { - /// A single column - ColumnName(ObjectName), - /// A tuple of columns - Tuple(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for AssignmentTarget { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - AssignmentTarget::ColumnName(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ColumnName", - &__self_0, - ) - } - AssignmentTarget::Tuple(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Tuple", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for AssignmentTarget { - #[inline] - fn clone(&self) -> AssignmentTarget { - match self { - AssignmentTarget::ColumnName(__self_0) => { - AssignmentTarget::ColumnName(::core::clone::Clone::clone(__self_0)) - } - AssignmentTarget::Tuple(__self_0) => { - AssignmentTarget::Tuple(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for AssignmentTarget {} - #[automatically_derived] - impl ::core::cmp::PartialEq for AssignmentTarget { - #[inline] - fn eq(&self, other: &AssignmentTarget) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - AssignmentTarget::ColumnName(__self_0), - AssignmentTarget::ColumnName(__arg1_0), - ) => __self_0 == __arg1_0, - ( - AssignmentTarget::Tuple(__self_0), - AssignmentTarget::Tuple(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for AssignmentTarget { - #[inline] - fn partial_cmp( - &self, - other: &AssignmentTarget, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - AssignmentTarget::ColumnName(__self_0), - AssignmentTarget::ColumnName(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - AssignmentTarget::Tuple(__self_0), - AssignmentTarget::Tuple(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for AssignmentTarget { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for AssignmentTarget { - #[inline] - fn cmp(&self, other: &AssignmentTarget) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - AssignmentTarget::ColumnName(__self_0), - AssignmentTarget::ColumnName(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - AssignmentTarget::Tuple(__self_0), - AssignmentTarget::Tuple(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for AssignmentTarget { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - AssignmentTarget::ColumnName(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - AssignmentTarget::Tuple(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for AssignmentTarget { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - AssignmentTarget::ColumnName(column) => { - f.write_fmt(format_args!("{0}", column)) - } - AssignmentTarget::Tuple(columns) => { - f.write_fmt(format_args!("({0})", display_comma_separated(columns))) - } - } - } - } - pub enum FunctionArgExpr { - Expr(Expr), - /// Qualified wildcard, e.g. `alias.*` or `schema.table.*`. - QualifiedWildcard(ObjectName), - /// An unqualified `*` - Wildcard, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionArgExpr { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - FunctionArgExpr::Expr(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Expr", - &__self_0, - ) - } - FunctionArgExpr::QualifiedWildcard(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "QualifiedWildcard", - &__self_0, - ) - } - FunctionArgExpr::Wildcard => { - ::core::fmt::Formatter::write_str(f, "Wildcard") - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionArgExpr { - #[inline] - fn clone(&self) -> FunctionArgExpr { - match self { - FunctionArgExpr::Expr(__self_0) => { - FunctionArgExpr::Expr(::core::clone::Clone::clone(__self_0)) - } - FunctionArgExpr::QualifiedWildcard(__self_0) => { - FunctionArgExpr::QualifiedWildcard( - ::core::clone::Clone::clone(__self_0), - ) - } - FunctionArgExpr::Wildcard => FunctionArgExpr::Wildcard, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionArgExpr {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionArgExpr { - #[inline] - fn eq(&self, other: &FunctionArgExpr) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - FunctionArgExpr::Expr(__self_0), - FunctionArgExpr::Expr(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArgExpr::QualifiedWildcard(__self_0), - FunctionArgExpr::QualifiedWildcard(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionArgExpr { - #[inline] - fn partial_cmp( - &self, - other: &FunctionArgExpr, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (FunctionArgExpr::Expr(__self_0), FunctionArgExpr::Expr(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - FunctionArgExpr::QualifiedWildcard(__self_0), - FunctionArgExpr::QualifiedWildcard(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionArgExpr { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionArgExpr { - #[inline] - fn cmp(&self, other: &FunctionArgExpr) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - FunctionArgExpr::Expr(__self_0), - FunctionArgExpr::Expr(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArgExpr::QualifiedWildcard(__self_0), - FunctionArgExpr::QualifiedWildcard(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionArgExpr { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - FunctionArgExpr::Expr(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArgExpr::QualifiedWildcard(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl From for FunctionArgExpr { - fn from(wildcard_expr: Expr) -> Self { - match wildcard_expr { - Expr::QualifiedWildcard(prefix, _) => Self::QualifiedWildcard(prefix), - Expr::Wildcard(_) => Self::Wildcard, - expr => Self::Expr(expr), - } - } - } - impl fmt::Display for FunctionArgExpr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FunctionArgExpr::Expr(expr) => f.write_fmt(format_args!("{0}", expr)), - FunctionArgExpr::QualifiedWildcard(prefix) => { - f.write_fmt(format_args!("{0}.*", prefix)) - } - FunctionArgExpr::Wildcard => f.write_str("*"), - } - } - } - /// Operator used to separate function arguments - pub enum FunctionArgOperator { - /// function(arg1 = value1) - Equals, - /// function(arg1 => value1) - RightArrow, - /// function(arg1 := value1) - Assignment, - /// function(arg1 : value1) - Colon, - /// function(arg1 VALUE value1) - Value, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionArgOperator { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FunctionArgOperator::Equals => "Equals", - FunctionArgOperator::RightArrow => "RightArrow", - FunctionArgOperator::Assignment => "Assignment", - FunctionArgOperator::Colon => "Colon", - FunctionArgOperator::Value => "Value", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionArgOperator { - #[inline] - fn clone(&self) -> FunctionArgOperator { - match self { - FunctionArgOperator::Equals => FunctionArgOperator::Equals, - FunctionArgOperator::RightArrow => FunctionArgOperator::RightArrow, - FunctionArgOperator::Assignment => FunctionArgOperator::Assignment, - FunctionArgOperator::Colon => FunctionArgOperator::Colon, - FunctionArgOperator::Value => FunctionArgOperator::Value, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionArgOperator {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionArgOperator { - #[inline] - fn eq(&self, other: &FunctionArgOperator) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionArgOperator { - #[inline] - fn partial_cmp( - &self, - other: &FunctionArgOperator, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionArgOperator { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionArgOperator { - #[inline] - fn cmp(&self, other: &FunctionArgOperator) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionArgOperator { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FunctionArgOperator { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FunctionArgOperator::Equals => f.write_str("="), - FunctionArgOperator::RightArrow => f.write_str("=>"), - FunctionArgOperator::Assignment => f.write_str(":="), - FunctionArgOperator::Colon => f.write_str(":"), - FunctionArgOperator::Value => f.write_str("VALUE"), - } - } - } - pub enum FunctionArg { - /// `name` is identifier - /// - /// Enabled when `Dialect::supports_named_fn_args_with_expr_name` returns 'false' - Named { name: Ident, arg: FunctionArgExpr, operator: FunctionArgOperator }, - /// `name` is arbitrary expression - /// - /// Enabled when `Dialect::supports_named_fn_args_with_expr_name` returns 'true' - ExprNamed { name: Expr, arg: FunctionArgExpr, operator: FunctionArgOperator }, - Unnamed(FunctionArgExpr), - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionArg { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - FunctionArg::Named { - name: __self_0, - arg: __self_1, - operator: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Named", - "name", - __self_0, - "arg", - __self_1, - "operator", - &__self_2, - ) - } - FunctionArg::ExprNamed { - name: __self_0, - arg: __self_1, - operator: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ExprNamed", - "name", - __self_0, - "arg", - __self_1, - "operator", - &__self_2, - ) - } - FunctionArg::Unnamed(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Unnamed", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionArg { - #[inline] - fn clone(&self) -> FunctionArg { - match self { - FunctionArg::Named { - name: __self_0, - arg: __self_1, - operator: __self_2, - } => { - FunctionArg::Named { - name: ::core::clone::Clone::clone(__self_0), - arg: ::core::clone::Clone::clone(__self_1), - operator: ::core::clone::Clone::clone(__self_2), - } - } - FunctionArg::ExprNamed { - name: __self_0, - arg: __self_1, - operator: __self_2, - } => { - FunctionArg::ExprNamed { - name: ::core::clone::Clone::clone(__self_0), - arg: ::core::clone::Clone::clone(__self_1), - operator: ::core::clone::Clone::clone(__self_2), - } - } - FunctionArg::Unnamed(__self_0) => { - FunctionArg::Unnamed(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionArg {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionArg { - #[inline] - fn eq(&self, other: &FunctionArg) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - FunctionArg::Named { - name: __self_0, - arg: __self_1, - operator: __self_2, - }, - FunctionArg::Named { - name: __arg1_0, - arg: __arg1_1, - operator: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - ( - FunctionArg::ExprNamed { - name: __self_0, - arg: __self_1, - operator: __self_2, - }, - FunctionArg::ExprNamed { - name: __arg1_0, - arg: __arg1_1, - operator: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - (FunctionArg::Unnamed(__self_0), FunctionArg::Unnamed(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionArg { - #[inline] - fn partial_cmp( - &self, - other: &FunctionArg, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - FunctionArg::Named { - name: __self_0, - arg: __self_1, - operator: __self_2, - }, - FunctionArg::Named { - name: __arg1_0, - arg: __arg1_1, - operator: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - FunctionArg::ExprNamed { - name: __self_0, - arg: __self_1, - operator: __self_2, - }, - FunctionArg::ExprNamed { - name: __arg1_0, - arg: __arg1_1, - operator: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - (FunctionArg::Unnamed(__self_0), FunctionArg::Unnamed(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionArg { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionArg { - #[inline] - fn cmp(&self, other: &FunctionArg) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - FunctionArg::Named { - name: __self_0, - arg: __self_1, - operator: __self_2, - }, - FunctionArg::Named { - name: __arg1_0, - arg: __arg1_1, - operator: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - FunctionArg::ExprNamed { - name: __self_0, - arg: __self_1, - operator: __self_2, - }, - FunctionArg::ExprNamed { - name: __arg1_0, - arg: __arg1_1, - operator: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - ( - FunctionArg::Unnamed(__self_0), - FunctionArg::Unnamed(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionArg { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - FunctionArg::Named { - name: __self_0, - arg: __self_1, - operator: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - FunctionArg::ExprNamed { - name: __self_0, - arg: __self_1, - operator: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - FunctionArg::Unnamed(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for FunctionArg { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FunctionArg::Named { name, arg, operator } => { - f.write_fmt(format_args!("{0} {1} {2}", name, operator, arg)) - } - FunctionArg::ExprNamed { name, arg, operator } => { - f.write_fmt(format_args!("{0} {1} {2}", name, operator, arg)) - } - FunctionArg::Unnamed(unnamed_arg) => { - f.write_fmt(format_args!("{0}", unnamed_arg)) - } - } - } - } - pub enum CloseCursor { - All, - Specific { name: Ident }, - } - #[automatically_derived] - impl ::core::fmt::Debug for CloseCursor { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CloseCursor::All => ::core::fmt::Formatter::write_str(f, "All"), - CloseCursor::Specific { name: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Specific", - "name", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CloseCursor { - #[inline] - fn clone(&self) -> CloseCursor { - match self { - CloseCursor::All => CloseCursor::All, - CloseCursor::Specific { name: __self_0 } => { - CloseCursor::Specific { - name: ::core::clone::Clone::clone(__self_0), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CloseCursor {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CloseCursor { - #[inline] - fn eq(&self, other: &CloseCursor) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CloseCursor::Specific { name: __self_0 }, - CloseCursor::Specific { name: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CloseCursor { - #[inline] - fn partial_cmp( - &self, - other: &CloseCursor, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CloseCursor::Specific { name: __self_0 }, - CloseCursor::Specific { name: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CloseCursor { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CloseCursor { - #[inline] - fn cmp(&self, other: &CloseCursor) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CloseCursor::Specific { name: __self_0 }, - CloseCursor::Specific { name: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CloseCursor { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CloseCursor::Specific { name: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for CloseCursor { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CloseCursor::All => f.write_fmt(format_args!("ALL")), - CloseCursor::Specific { name } => f.write_fmt(format_args!("{0}", name)), - } - } - } - /// A function call - pub struct Function { - pub name: ObjectName, - /// Flags whether this function call uses the [ODBC syntax]. - /// - /// Example: - /// ```sql - /// SELECT {fn CONCAT('foo', 'bar')} - /// ``` - /// - /// [ODBC syntax]: https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/scalar-function-calls?view=sql-server-2017 - pub uses_odbc_syntax: bool, - /// The parameters to the function, including any options specified within the - /// delimiting parentheses. - /// - /// Example: - /// ```plaintext - /// HISTOGRAM(0.5, 0.6)(x, y) - /// ``` - /// - /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/aggregate-functions/parametric-functions) - pub parameters: FunctionArguments, - /// The arguments to the function, including any options specified within the - /// delimiting parentheses. - pub args: FunctionArguments, - /// e.g. `x > 5` in `COUNT(x) FILTER (WHERE x > 5)` - pub filter: Option>, - /// Indicates how `NULL`s should be handled in the calculation. - /// - /// Example: - /// ```plaintext - /// FIRST_VALUE( ) [ { IGNORE | RESPECT } NULLS ] OVER ... - /// ``` - /// - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/functions/first_value) - pub null_treatment: Option, - /// The `OVER` clause, indicating a window function call. - pub over: Option, - /// A clause used with certain aggregate functions to control the ordering - /// within grouped sets before the function is applied. - /// - /// Syntax: - /// ```plaintext - /// (expression) WITHIN GROUP (ORDER BY key [ASC | DESC], ...) - /// ``` - pub within_group: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for Function { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - let names: &'static _ = &[ - "name", - "uses_odbc_syntax", - "parameters", - "args", - "filter", - "null_treatment", - "over", - "within_group", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - &self.name, - &self.uses_odbc_syntax, - &self.parameters, - &self.args, - &self.filter, - &self.null_treatment, - &self.over, - &&self.within_group, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Function", - names, - values, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Function { - #[inline] - fn clone(&self) -> Function { - Function { - name: ::core::clone::Clone::clone(&self.name), - uses_odbc_syntax: ::core::clone::Clone::clone(&self.uses_odbc_syntax), - parameters: ::core::clone::Clone::clone(&self.parameters), - args: ::core::clone::Clone::clone(&self.args), - filter: ::core::clone::Clone::clone(&self.filter), - null_treatment: ::core::clone::Clone::clone(&self.null_treatment), - over: ::core::clone::Clone::clone(&self.over), - within_group: ::core::clone::Clone::clone(&self.within_group), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Function {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Function { - #[inline] - fn eq(&self, other: &Function) -> bool { - self.name == other.name && self.uses_odbc_syntax == other.uses_odbc_syntax - && self.parameters == other.parameters && self.args == other.args - && self.filter == other.filter - && self.null_treatment == other.null_treatment && self.over == other.over - && self.within_group == other.within_group - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Function { - #[inline] - fn partial_cmp( - &self, - other: &Function, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.uses_odbc_syntax, - &other.uses_odbc_syntax, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.parameters, - &other.parameters, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.args, - &other.args, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.filter, - &other.filter, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.null_treatment, - &other.null_treatment, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.over, - &other.over, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.within_group, - &other.within_group, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Function { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Function { - #[inline] - fn cmp(&self, other: &Function) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.name, &other.name) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.uses_odbc_syntax, - &other.uses_odbc_syntax, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.parameters, - &other.parameters, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.args, &other.args) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.filter, &other.filter) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.null_treatment, - &other.null_treatment, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.over, &other.over) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp( - &self.within_group, - &other.within_group, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Function { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.name, state); - ::core::hash::Hash::hash(&self.uses_odbc_syntax, state); - ::core::hash::Hash::hash(&self.parameters, state); - ::core::hash::Hash::hash(&self.args, state); - ::core::hash::Hash::hash(&self.filter, state); - ::core::hash::Hash::hash(&self.null_treatment, state); - ::core::hash::Hash::hash(&self.over, state); - ::core::hash::Hash::hash(&self.within_group, state) - } - } - impl fmt::Display for Function { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if self.uses_odbc_syntax { - f.write_fmt(format_args!("{{fn "))?; - } - f.write_fmt( - format_args!("{0}{1}{2}", self.name, self.parameters, self.args), - )?; - if !self.within_group.is_empty() { - f.write_fmt( - format_args!( - " WITHIN GROUP (ORDER BY {0})", - display_comma_separated(&self.within_group), - ), - )?; - } - if let Some(filter_cond) = &self.filter { - f.write_fmt(format_args!(" FILTER (WHERE {0})", filter_cond))?; - } - if let Some(null_treatment) = &self.null_treatment { - f.write_fmt(format_args!(" {0}", null_treatment))?; - } - if let Some(o) = &self.over { - f.write_fmt(format_args!(" OVER {0}", o))?; - } - if self.uses_odbc_syntax { - f.write_fmt(format_args!("}}"))?; - } - Ok(()) - } - } - /// The arguments passed to a function call. - pub enum FunctionArguments { - /// Used for special functions like `CURRENT_TIMESTAMP` that are invoked - /// without parentheses. - None, - /// On some dialects, a subquery can be passed without surrounding - /// parentheses if it's the sole argument to the function. - Subquery(Box), - /// A normal function argument list, including any clauses within it such as - /// `DISTINCT` or `ORDER BY`. - List(FunctionArgumentList), - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionArguments { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - FunctionArguments::None => ::core::fmt::Formatter::write_str(f, "None"), - FunctionArguments::Subquery(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Subquery", - &__self_0, - ) - } - FunctionArguments::List(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "List", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionArguments { - #[inline] - fn clone(&self) -> FunctionArguments { - match self { - FunctionArguments::None => FunctionArguments::None, - FunctionArguments::Subquery(__self_0) => { - FunctionArguments::Subquery(::core::clone::Clone::clone(__self_0)) - } - FunctionArguments::List(__self_0) => { - FunctionArguments::List(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionArguments {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionArguments { - #[inline] - fn eq(&self, other: &FunctionArguments) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - FunctionArguments::Subquery(__self_0), - FunctionArguments::Subquery(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArguments::List(__self_0), - FunctionArguments::List(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionArguments { - #[inline] - fn partial_cmp( - &self, - other: &FunctionArguments, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - FunctionArguments::Subquery(__self_0), - FunctionArguments::Subquery(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FunctionArguments::List(__self_0), - FunctionArguments::List(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionArguments { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionArguments { - #[inline] - fn cmp(&self, other: &FunctionArguments) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - FunctionArguments::Subquery(__self_0), - FunctionArguments::Subquery(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArguments::List(__self_0), - FunctionArguments::List(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionArguments { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - FunctionArguments::Subquery(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArguments::List(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for FunctionArguments { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - FunctionArguments::None => Ok(()), - FunctionArguments::Subquery(query) => { - f.write_fmt(format_args!("({0})", query)) - } - FunctionArguments::List(args) => f.write_fmt(format_args!("({0})", args)), - } - } - } - /// This represents everything inside the parentheses when calling a function. - pub struct FunctionArgumentList { - /// `[ ALL | DISTINCT ]` - pub duplicate_treatment: Option, - /// The function arguments. - pub args: Vec, - /// Additional clauses specified within the argument list. - pub clauses: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionArgumentList { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "FunctionArgumentList", - "duplicate_treatment", - &self.duplicate_treatment, - "args", - &self.args, - "clauses", - &&self.clauses, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionArgumentList { - #[inline] - fn clone(&self) -> FunctionArgumentList { - FunctionArgumentList { - duplicate_treatment: ::core::clone::Clone::clone( - &self.duplicate_treatment, - ), - args: ::core::clone::Clone::clone(&self.args), - clauses: ::core::clone::Clone::clone(&self.clauses), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionArgumentList {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionArgumentList { - #[inline] - fn eq(&self, other: &FunctionArgumentList) -> bool { - self.duplicate_treatment == other.duplicate_treatment - && self.args == other.args && self.clauses == other.clauses - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionArgumentList { - #[inline] - fn partial_cmp( - &self, - other: &FunctionArgumentList, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.duplicate_treatment, - &other.duplicate_treatment, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp(&self.args, &other.args) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.clauses, - &other.clauses, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionArgumentList { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionArgumentList { - #[inline] - fn cmp(&self, other: &FunctionArgumentList) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp( - &self.duplicate_treatment, - &other.duplicate_treatment, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.args, &other.args) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.clauses, &other.clauses) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionArgumentList { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.duplicate_treatment, state); - ::core::hash::Hash::hash(&self.args, state); - ::core::hash::Hash::hash(&self.clauses, state) - } - } - impl fmt::Display for FunctionArgumentList { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(duplicate_treatment) = self.duplicate_treatment { - f.write_fmt(format_args!("{0} ", duplicate_treatment))?; - } - f.write_fmt(format_args!("{0}", display_comma_separated(&self.args)))?; - if !self.clauses.is_empty() { - if !self.args.is_empty() { - f.write_fmt(format_args!(" "))?; - } - f.write_fmt(format_args!("{0}", display_separated(&self.clauses, " ")))?; - } - Ok(()) - } - } - pub enum FunctionArgumentClause { - /// Indicates how `NULL`s should be handled in the calculation, e.g. in `FIRST_VALUE` on [BigQuery]. - /// - /// Syntax: - /// ```plaintext - /// { IGNORE | RESPECT } NULLS ] - /// ``` - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/navigation_functions#first_value - IgnoreOrRespectNulls(NullTreatment), - /// Specifies the the ordering for some ordered set aggregates, e.g. `ARRAY_AGG` on [BigQuery]. - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#array_agg - OrderBy(Vec), - /// Specifies a limit for the `ARRAY_AGG` and `ARRAY_CONCAT_AGG` functions on BigQuery. - Limit(Expr), - /// Specifies the behavior on overflow of the `LISTAGG` function. - /// - /// See . - OnOverflow(ListAggOnOverflow), - /// Specifies a minimum or maximum bound on the input to [`ANY_VALUE`] on BigQuery. - /// - /// Syntax: - /// ```plaintext - /// HAVING { MAX | MIN } expression - /// ``` - /// - /// [`ANY_VALUE`]: https://cloud.google.com/bigquery/docs/reference/standard-sql/aggregate_functions#any_value - Having(HavingBound), - /// The `SEPARATOR` clause to the [`GROUP_CONCAT`] function in MySQL. - /// - /// [`GROUP_CONCAT`]: https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat - Separator(Value), - /// The json-null-clause to the [`JSON_ARRAY`]/[`JSON_OBJECT`] function in MSSQL. - /// - /// [`JSON_ARRAY`]: - /// [`JSON_OBJECT`]: - JsonNullClause(JsonNullClause), - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionArgumentClause { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - FunctionArgumentClause::IgnoreOrRespectNulls(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IgnoreOrRespectNulls", - &__self_0, - ) - } - FunctionArgumentClause::OrderBy(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "OrderBy", - &__self_0, - ) - } - FunctionArgumentClause::Limit(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Limit", - &__self_0, - ) - } - FunctionArgumentClause::OnOverflow(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "OnOverflow", - &__self_0, - ) - } - FunctionArgumentClause::Having(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Having", - &__self_0, - ) - } - FunctionArgumentClause::Separator(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Separator", - &__self_0, - ) - } - FunctionArgumentClause::JsonNullClause(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "JsonNullClause", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionArgumentClause { - #[inline] - fn clone(&self) -> FunctionArgumentClause { - match self { - FunctionArgumentClause::IgnoreOrRespectNulls(__self_0) => { - FunctionArgumentClause::IgnoreOrRespectNulls( - ::core::clone::Clone::clone(__self_0), - ) - } - FunctionArgumentClause::OrderBy(__self_0) => { - FunctionArgumentClause::OrderBy( - ::core::clone::Clone::clone(__self_0), - ) - } - FunctionArgumentClause::Limit(__self_0) => { - FunctionArgumentClause::Limit(::core::clone::Clone::clone(__self_0)) - } - FunctionArgumentClause::OnOverflow(__self_0) => { - FunctionArgumentClause::OnOverflow( - ::core::clone::Clone::clone(__self_0), - ) - } - FunctionArgumentClause::Having(__self_0) => { - FunctionArgumentClause::Having(::core::clone::Clone::clone(__self_0)) - } - FunctionArgumentClause::Separator(__self_0) => { - FunctionArgumentClause::Separator( - ::core::clone::Clone::clone(__self_0), - ) - } - FunctionArgumentClause::JsonNullClause(__self_0) => { - FunctionArgumentClause::JsonNullClause( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionArgumentClause {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionArgumentClause { - #[inline] - fn eq(&self, other: &FunctionArgumentClause) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - FunctionArgumentClause::IgnoreOrRespectNulls(__self_0), - FunctionArgumentClause::IgnoreOrRespectNulls(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArgumentClause::OrderBy(__self_0), - FunctionArgumentClause::OrderBy(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArgumentClause::Limit(__self_0), - FunctionArgumentClause::Limit(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArgumentClause::OnOverflow(__self_0), - FunctionArgumentClause::OnOverflow(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArgumentClause::Having(__self_0), - FunctionArgumentClause::Having(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArgumentClause::Separator(__self_0), - FunctionArgumentClause::Separator(__arg1_0), - ) => __self_0 == __arg1_0, - ( - FunctionArgumentClause::JsonNullClause(__self_0), - FunctionArgumentClause::JsonNullClause(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionArgumentClause { - #[inline] - fn partial_cmp( - &self, - other: &FunctionArgumentClause, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - FunctionArgumentClause::IgnoreOrRespectNulls(__self_0), - FunctionArgumentClause::IgnoreOrRespectNulls(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::OrderBy(__self_0), - FunctionArgumentClause::OrderBy(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::Limit(__self_0), - FunctionArgumentClause::Limit(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::OnOverflow(__self_0), - FunctionArgumentClause::OnOverflow(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::Having(__self_0), - FunctionArgumentClause::Having(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::Separator(__self_0), - FunctionArgumentClause::Separator(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::JsonNullClause(__self_0), - FunctionArgumentClause::JsonNullClause(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionArgumentClause { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionArgumentClause { - #[inline] - fn cmp(&self, other: &FunctionArgumentClause) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - FunctionArgumentClause::IgnoreOrRespectNulls(__self_0), - FunctionArgumentClause::IgnoreOrRespectNulls(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::OrderBy(__self_0), - FunctionArgumentClause::OrderBy(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::Limit(__self_0), - FunctionArgumentClause::Limit(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::OnOverflow(__self_0), - FunctionArgumentClause::OnOverflow(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::Having(__self_0), - FunctionArgumentClause::Having(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::Separator(__self_0), - FunctionArgumentClause::Separator(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - FunctionArgumentClause::JsonNullClause(__self_0), - FunctionArgumentClause::JsonNullClause(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionArgumentClause { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - FunctionArgumentClause::IgnoreOrRespectNulls(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArgumentClause::OrderBy(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArgumentClause::Limit(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArgumentClause::OnOverflow(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArgumentClause::Having(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArgumentClause::Separator(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - FunctionArgumentClause::JsonNullClause(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for FunctionArgumentClause { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - FunctionArgumentClause::IgnoreOrRespectNulls(null_treatment) => { - f.write_fmt(format_args!("{0}", null_treatment)) - } - FunctionArgumentClause::OrderBy(order_by) => { - f.write_fmt( - format_args!("ORDER BY {0}", display_comma_separated(order_by)), - ) - } - FunctionArgumentClause::Limit(limit) => { - f.write_fmt(format_args!("LIMIT {0}", limit)) - } - FunctionArgumentClause::OnOverflow(on_overflow) => { - f.write_fmt(format_args!("{0}", on_overflow)) - } - FunctionArgumentClause::Having(bound) => { - f.write_fmt(format_args!("{0}", bound)) - } - FunctionArgumentClause::Separator(sep) => { - f.write_fmt(format_args!("SEPARATOR {0}", sep)) - } - FunctionArgumentClause::JsonNullClause(null_clause) => { - f.write_fmt(format_args!("{0}", null_clause)) - } - } - } - } - /// A method call - pub struct Method { - pub expr: Box, - pub method_chain: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for Method { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Method", - "expr", - &self.expr, - "method_chain", - &&self.method_chain, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Method { - #[inline] - fn clone(&self) -> Method { - Method { - expr: ::core::clone::Clone::clone(&self.expr), - method_chain: ::core::clone::Clone::clone(&self.method_chain), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Method {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Method { - #[inline] - fn eq(&self, other: &Method) -> bool { - self.expr == other.expr && self.method_chain == other.method_chain - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Method { - #[inline] - fn partial_cmp( - &self, - other: &Method, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.expr, &other.expr) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.method_chain, - &other.method_chain, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Method { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Method { - #[inline] - fn cmp(&self, other: &Method) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.expr, &other.expr) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.method_chain, &other.method_chain) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Method { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.expr, state); - ::core::hash::Hash::hash(&self.method_chain, state) - } - } - impl fmt::Display for Method { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - "{0}.{1}", - self.expr, - display_separated(&self.method_chain, "."), - ), - ) - } - } - pub enum DuplicateTreatment { - /// Perform the calculation only unique values. - Distinct, - /// Retain all duplicate values (the default). - All, - } - #[automatically_derived] - impl ::core::fmt::Debug for DuplicateTreatment { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - DuplicateTreatment::Distinct => "Distinct", - DuplicateTreatment::All => "All", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for DuplicateTreatment {} - #[automatically_derived] - impl ::core::clone::Clone for DuplicateTreatment { - #[inline] - fn clone(&self) -> DuplicateTreatment { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for DuplicateTreatment {} - #[automatically_derived] - impl ::core::cmp::PartialEq for DuplicateTreatment { - #[inline] - fn eq(&self, other: &DuplicateTreatment) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for DuplicateTreatment { - #[inline] - fn partial_cmp( - &self, - other: &DuplicateTreatment, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for DuplicateTreatment { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for DuplicateTreatment { - #[inline] - fn cmp(&self, other: &DuplicateTreatment) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for DuplicateTreatment { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for DuplicateTreatment { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - DuplicateTreatment::Distinct => f.write_fmt(format_args!("DISTINCT")), - DuplicateTreatment::All => f.write_fmt(format_args!("ALL")), - } - } - } - pub enum AnalyzeFormat { - TEXT, - GRAPHVIZ, - JSON, - } - #[automatically_derived] - impl ::core::fmt::Debug for AnalyzeFormat { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - AnalyzeFormat::TEXT => "TEXT", - AnalyzeFormat::GRAPHVIZ => "GRAPHVIZ", - AnalyzeFormat::JSON => "JSON", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for AnalyzeFormat {} - #[automatically_derived] - impl ::core::clone::Clone for AnalyzeFormat { - #[inline] - fn clone(&self) -> AnalyzeFormat { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for AnalyzeFormat {} - #[automatically_derived] - impl ::core::cmp::PartialEq for AnalyzeFormat { - #[inline] - fn eq(&self, other: &AnalyzeFormat) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for AnalyzeFormat { - #[inline] - fn partial_cmp( - &self, - other: &AnalyzeFormat, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for AnalyzeFormat { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for AnalyzeFormat { - #[inline] - fn cmp(&self, other: &AnalyzeFormat) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for AnalyzeFormat { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for AnalyzeFormat { - fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - f.write_str( - match self { - AnalyzeFormat::TEXT => "TEXT", - AnalyzeFormat::GRAPHVIZ => "GRAPHVIZ", - AnalyzeFormat::JSON => "JSON", - }, - ) - } - } - /// External table's available file format - pub enum FileFormat { - TEXTFILE, - SEQUENCEFILE, - ORC, - PARQUET, - AVRO, - RCFILE, - JSONFILE, - } - #[automatically_derived] - impl ::core::fmt::Debug for FileFormat { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FileFormat::TEXTFILE => "TEXTFILE", - FileFormat::SEQUENCEFILE => "SEQUENCEFILE", - FileFormat::ORC => "ORC", - FileFormat::PARQUET => "PARQUET", - FileFormat::AVRO => "AVRO", - FileFormat::RCFILE => "RCFILE", - FileFormat::JSONFILE => "JSONFILE", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for FileFormat {} - #[automatically_derived] - impl ::core::clone::Clone for FileFormat { - #[inline] - fn clone(&self) -> FileFormat { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FileFormat {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FileFormat { - #[inline] - fn eq(&self, other: &FileFormat) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FileFormat { - #[inline] - fn partial_cmp( - &self, - other: &FileFormat, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FileFormat { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FileFormat { - #[inline] - fn cmp(&self, other: &FileFormat) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FileFormat { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FileFormat { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use self::FileFormat::*; - f.write_str( - match self { - TEXTFILE => "TEXTFILE", - SEQUENCEFILE => "SEQUENCEFILE", - ORC => "ORC", - PARQUET => "PARQUET", - AVRO => "AVRO", - RCFILE => "RCFILE", - JSONFILE => "JSONFILE", - }, - ) - } - } - /// The `ON OVERFLOW` clause of a LISTAGG invocation - pub enum ListAggOnOverflow { - /// `ON OVERFLOW ERROR` - Error, - /// `ON OVERFLOW TRUNCATE [ ] WITH[OUT] COUNT` - Truncate { filler: Option>, with_count: bool }, - } - #[automatically_derived] - impl ::core::fmt::Debug for ListAggOnOverflow { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - ListAggOnOverflow::Error => ::core::fmt::Formatter::write_str(f, "Error"), - ListAggOnOverflow::Truncate { - filler: __self_0, - with_count: __self_1, - } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Truncate", - "filler", - __self_0, - "with_count", - &__self_1, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for ListAggOnOverflow { - #[inline] - fn clone(&self) -> ListAggOnOverflow { - match self { - ListAggOnOverflow::Error => ListAggOnOverflow::Error, - ListAggOnOverflow::Truncate { - filler: __self_0, - with_count: __self_1, - } => { - ListAggOnOverflow::Truncate { - filler: ::core::clone::Clone::clone(__self_0), - with_count: ::core::clone::Clone::clone(__self_1), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ListAggOnOverflow {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ListAggOnOverflow { - #[inline] - fn eq(&self, other: &ListAggOnOverflow) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - ListAggOnOverflow::Truncate { - filler: __self_0, - with_count: __self_1, - }, - ListAggOnOverflow::Truncate { - filler: __arg1_0, - with_count: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ListAggOnOverflow { - #[inline] - fn partial_cmp( - &self, - other: &ListAggOnOverflow, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - ListAggOnOverflow::Truncate { - filler: __self_0, - with_count: __self_1, - }, - ListAggOnOverflow::Truncate { - filler: __arg1_0, - with_count: __arg1_1, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ListAggOnOverflow { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ListAggOnOverflow { - #[inline] - fn cmp(&self, other: &ListAggOnOverflow) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - ListAggOnOverflow::Truncate { - filler: __self_0, - with_count: __self_1, - }, - ListAggOnOverflow::Truncate { - filler: __arg1_0, - with_count: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ListAggOnOverflow { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - ListAggOnOverflow::Truncate { - filler: __self_0, - with_count: __self_1, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - _ => {} - } - } - } - impl fmt::Display for ListAggOnOverflow { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("ON OVERFLOW"))?; - match self { - ListAggOnOverflow::Error => f.write_fmt(format_args!(" ERROR")), - ListAggOnOverflow::Truncate { filler, with_count } => { - f.write_fmt(format_args!(" TRUNCATE"))?; - if let Some(filler) = filler { - f.write_fmt(format_args!(" {0}", filler))?; - } - if *with_count { - f.write_fmt(format_args!(" WITH"))?; - } else { - f.write_fmt(format_args!(" WITHOUT"))?; - } - f.write_fmt(format_args!(" COUNT")) - } - } - } - } - /// The `HAVING` clause in a call to `ANY_VALUE` on BigQuery. - pub struct HavingBound(pub HavingBoundKind, pub Expr); - #[automatically_derived] - impl ::core::fmt::Debug for HavingBound { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "HavingBound", - &self.0, - &&self.1, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for HavingBound { - #[inline] - fn clone(&self) -> HavingBound { - HavingBound( - ::core::clone::Clone::clone(&self.0), - ::core::clone::Clone::clone(&self.1), - ) - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HavingBound {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HavingBound { - #[inline] - fn eq(&self, other: &HavingBound) -> bool { - self.0 == other.0 && self.1 == other.1 - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HavingBound { - #[inline] - fn partial_cmp( - &self, - other: &HavingBound, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.0, &other.0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.1, &other.1) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HavingBound { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for HavingBound { - #[inline] - fn cmp(&self, other: &HavingBound) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.0, &other.0) { - ::core::cmp::Ordering::Equal => ::core::cmp::Ord::cmp(&self.1, &other.1), - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for HavingBound { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.0, state); - ::core::hash::Hash::hash(&self.1, state) - } - } - impl fmt::Display for HavingBound { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_fmt(format_args!("HAVING {0} {1}", self.0, self.1)) - } - } - pub enum HavingBoundKind { - Min, - Max, - } - #[automatically_derived] - impl ::core::fmt::Debug for HavingBoundKind { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - HavingBoundKind::Min => "Min", - HavingBoundKind::Max => "Max", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for HavingBoundKind {} - #[automatically_derived] - impl ::core::clone::Clone for HavingBoundKind { - #[inline] - fn clone(&self) -> HavingBoundKind { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HavingBoundKind {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HavingBoundKind { - #[inline] - fn eq(&self, other: &HavingBoundKind) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HavingBoundKind { - #[inline] - fn partial_cmp( - &self, - other: &HavingBoundKind, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HavingBoundKind { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for HavingBoundKind { - #[inline] - fn cmp(&self, other: &HavingBoundKind) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for HavingBoundKind { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for HavingBoundKind { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - HavingBoundKind::Min => f.write_fmt(format_args!("MIN")), - HavingBoundKind::Max => f.write_fmt(format_args!("MAX")), - } - } - } - pub enum ObjectType { - Table, - View, - Index, - Schema, - Database, - Role, - Sequence, - Stage, - Type, - } - #[automatically_derived] - impl ::core::fmt::Debug for ObjectType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ObjectType::Table => "Table", - ObjectType::View => "View", - ObjectType::Index => "Index", - ObjectType::Schema => "Schema", - ObjectType::Database => "Database", - ObjectType::Role => "Role", - ObjectType::Sequence => "Sequence", - ObjectType::Stage => "Stage", - ObjectType::Type => "Type", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for ObjectType {} - #[automatically_derived] - impl ::core::clone::Clone for ObjectType { - #[inline] - fn clone(&self) -> ObjectType { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ObjectType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ObjectType { - #[inline] - fn eq(&self, other: &ObjectType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ObjectType { - #[inline] - fn partial_cmp( - &self, - other: &ObjectType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ObjectType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ObjectType { - #[inline] - fn cmp(&self, other: &ObjectType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ObjectType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ObjectType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - ObjectType::Table => "TABLE", - ObjectType::View => "VIEW", - ObjectType::Index => "INDEX", - ObjectType::Schema => "SCHEMA", - ObjectType::Database => "DATABASE", - ObjectType::Role => "ROLE", - ObjectType::Sequence => "SEQUENCE", - ObjectType::Stage => "STAGE", - ObjectType::Type => "TYPE", - }, - ) - } - } - pub enum KillType { - Connection, - Query, - Mutation, - } - #[automatically_derived] - impl ::core::fmt::Debug for KillType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - KillType::Connection => "Connection", - KillType::Query => "Query", - KillType::Mutation => "Mutation", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for KillType {} - #[automatically_derived] - impl ::core::clone::Clone for KillType { - #[inline] - fn clone(&self) -> KillType { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for KillType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for KillType { - #[inline] - fn eq(&self, other: &KillType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for KillType { - #[inline] - fn partial_cmp( - &self, - other: &KillType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for KillType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for KillType { - #[inline] - fn cmp(&self, other: &KillType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for KillType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for KillType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_str( - match self { - KillType::Connection => "CONNECTION", - KillType::Query => "QUERY", - KillType::Mutation => "MUTATION", - }, - ) - } - } - pub enum HiveDistributionStyle { - PARTITIONED { columns: Vec }, - SKEWED { - columns: Vec, - on: Vec, - stored_as_directories: bool, - }, - NONE, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveDistributionStyle { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - HiveDistributionStyle::PARTITIONED { columns: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "PARTITIONED", - "columns", - &__self_0, - ) - } - HiveDistributionStyle::SKEWED { - columns: __self_0, - on: __self_1, - stored_as_directories: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "SKEWED", - "columns", - __self_0, - "on", - __self_1, - "stored_as_directories", - &__self_2, - ) - } - HiveDistributionStyle::NONE => { - ::core::fmt::Formatter::write_str(f, "NONE") - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for HiveDistributionStyle { - #[inline] - fn clone(&self) -> HiveDistributionStyle { - match self { - HiveDistributionStyle::PARTITIONED { columns: __self_0 } => { - HiveDistributionStyle::PARTITIONED { - columns: ::core::clone::Clone::clone(__self_0), - } - } - HiveDistributionStyle::SKEWED { - columns: __self_0, - on: __self_1, - stored_as_directories: __self_2, - } => { - HiveDistributionStyle::SKEWED { - columns: ::core::clone::Clone::clone(__self_0), - on: ::core::clone::Clone::clone(__self_1), - stored_as_directories: ::core::clone::Clone::clone(__self_2), - } - } - HiveDistributionStyle::NONE => HiveDistributionStyle::NONE, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveDistributionStyle {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveDistributionStyle { - #[inline] - fn eq(&self, other: &HiveDistributionStyle) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - HiveDistributionStyle::PARTITIONED { columns: __self_0 }, - HiveDistributionStyle::PARTITIONED { columns: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - HiveDistributionStyle::SKEWED { - columns: __self_0, - on: __self_1, - stored_as_directories: __self_2, - }, - HiveDistributionStyle::SKEWED { - columns: __arg1_0, - on: __arg1_1, - stored_as_directories: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveDistributionStyle { - #[inline] - fn partial_cmp( - &self, - other: &HiveDistributionStyle, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - HiveDistributionStyle::PARTITIONED { columns: __self_0 }, - HiveDistributionStyle::PARTITIONED { columns: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - HiveDistributionStyle::SKEWED { - columns: __self_0, - on: __self_1, - stored_as_directories: __self_2, - }, - HiveDistributionStyle::SKEWED { - columns: __arg1_0, - on: __arg1_1, - stored_as_directories: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveDistributionStyle { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveDistributionStyle { - #[inline] - fn cmp(&self, other: &HiveDistributionStyle) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - HiveDistributionStyle::PARTITIONED { columns: __self_0 }, - HiveDistributionStyle::PARTITIONED { columns: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - HiveDistributionStyle::SKEWED { - columns: __self_0, - on: __self_1, - stored_as_directories: __self_2, - }, - HiveDistributionStyle::SKEWED { - columns: __arg1_0, - on: __arg1_1, - stored_as_directories: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveDistributionStyle { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - HiveDistributionStyle::PARTITIONED { columns: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - HiveDistributionStyle::SKEWED { - columns: __self_0, - on: __self_1, - stored_as_directories: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - _ => {} - } - } - } - pub enum HiveRowFormat { - SERDE { class: String }, - DELIMITED { delimiters: Vec }, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveRowFormat { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - HiveRowFormat::SERDE { class: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "SERDE", - "class", - &__self_0, - ) - } - HiveRowFormat::DELIMITED { delimiters: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "DELIMITED", - "delimiters", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for HiveRowFormat { - #[inline] - fn clone(&self) -> HiveRowFormat { - match self { - HiveRowFormat::SERDE { class: __self_0 } => { - HiveRowFormat::SERDE { - class: ::core::clone::Clone::clone(__self_0), - } - } - HiveRowFormat::DELIMITED { delimiters: __self_0 } => { - HiveRowFormat::DELIMITED { - delimiters: ::core::clone::Clone::clone(__self_0), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveRowFormat {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveRowFormat { - #[inline] - fn eq(&self, other: &HiveRowFormat) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - HiveRowFormat::SERDE { class: __self_0 }, - HiveRowFormat::SERDE { class: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - HiveRowFormat::DELIMITED { delimiters: __self_0 }, - HiveRowFormat::DELIMITED { delimiters: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveRowFormat { - #[inline] - fn partial_cmp( - &self, - other: &HiveRowFormat, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - HiveRowFormat::SERDE { class: __self_0 }, - HiveRowFormat::SERDE { class: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - HiveRowFormat::DELIMITED { delimiters: __self_0 }, - HiveRowFormat::DELIMITED { delimiters: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveRowFormat { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveRowFormat { - #[inline] - fn cmp(&self, other: &HiveRowFormat) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - HiveRowFormat::SERDE { class: __self_0 }, - HiveRowFormat::SERDE { class: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - HiveRowFormat::DELIMITED { delimiters: __self_0 }, - HiveRowFormat::DELIMITED { delimiters: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveRowFormat { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - HiveRowFormat::SERDE { class: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - HiveRowFormat::DELIMITED { delimiters: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - pub struct HiveLoadDataFormat { - pub serde: Expr, - pub input_format: Expr, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveLoadDataFormat { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "HiveLoadDataFormat", - "serde", - &self.serde, - "input_format", - &&self.input_format, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for HiveLoadDataFormat { - #[inline] - fn clone(&self) -> HiveLoadDataFormat { - HiveLoadDataFormat { - serde: ::core::clone::Clone::clone(&self.serde), - input_format: ::core::clone::Clone::clone(&self.input_format), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveLoadDataFormat {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveLoadDataFormat { - #[inline] - fn eq(&self, other: &HiveLoadDataFormat) -> bool { - self.serde == other.serde && self.input_format == other.input_format - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveLoadDataFormat { - #[inline] - fn partial_cmp( - &self, - other: &HiveLoadDataFormat, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.serde, &other.serde) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.input_format, - &other.input_format, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveLoadDataFormat { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveLoadDataFormat { - #[inline] - fn cmp(&self, other: &HiveLoadDataFormat) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.serde, &other.serde) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.input_format, &other.input_format) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveLoadDataFormat { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.serde, state); - ::core::hash::Hash::hash(&self.input_format, state) - } - } - pub struct HiveRowDelimiter { - pub delimiter: HiveDelimiter, - pub char: Ident, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveRowDelimiter { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "HiveRowDelimiter", - "delimiter", - &self.delimiter, - "char", - &&self.char, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for HiveRowDelimiter { - #[inline] - fn clone(&self) -> HiveRowDelimiter { - HiveRowDelimiter { - delimiter: ::core::clone::Clone::clone(&self.delimiter), - char: ::core::clone::Clone::clone(&self.char), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveRowDelimiter {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveRowDelimiter { - #[inline] - fn eq(&self, other: &HiveRowDelimiter) -> bool { - self.delimiter == other.delimiter && self.char == other.char - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveRowDelimiter { - #[inline] - fn partial_cmp( - &self, - other: &HiveRowDelimiter, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.delimiter, - &other.delimiter, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.char, &other.char) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveRowDelimiter { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveRowDelimiter { - #[inline] - fn cmp(&self, other: &HiveRowDelimiter) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.delimiter, &other.delimiter) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.char, &other.char) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveRowDelimiter { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.delimiter, state); - ::core::hash::Hash::hash(&self.char, state) - } - } - impl fmt::Display for HiveRowDelimiter { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_fmt(format_args!("{0} ", self.delimiter))?; - f.write_fmt(format_args!("{0}", self.char)) - } - } - pub enum HiveDelimiter { - FieldsTerminatedBy, - FieldsEscapedBy, - CollectionItemsTerminatedBy, - MapKeysTerminatedBy, - LinesTerminatedBy, - NullDefinedAs, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveDelimiter { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - HiveDelimiter::FieldsTerminatedBy => "FieldsTerminatedBy", - HiveDelimiter::FieldsEscapedBy => "FieldsEscapedBy", - HiveDelimiter::CollectionItemsTerminatedBy => { - "CollectionItemsTerminatedBy" - } - HiveDelimiter::MapKeysTerminatedBy => "MapKeysTerminatedBy", - HiveDelimiter::LinesTerminatedBy => "LinesTerminatedBy", - HiveDelimiter::NullDefinedAs => "NullDefinedAs", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for HiveDelimiter {} - #[automatically_derived] - impl ::core::clone::Clone for HiveDelimiter { - #[inline] - fn clone(&self) -> HiveDelimiter { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveDelimiter {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveDelimiter { - #[inline] - fn eq(&self, other: &HiveDelimiter) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveDelimiter { - #[inline] - fn partial_cmp( - &self, - other: &HiveDelimiter, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveDelimiter { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveDelimiter { - #[inline] - fn cmp(&self, other: &HiveDelimiter) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveDelimiter { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for HiveDelimiter { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - use HiveDelimiter::*; - f.write_str( - match self { - FieldsTerminatedBy => "FIELDS TERMINATED BY", - FieldsEscapedBy => "ESCAPED BY", - CollectionItemsTerminatedBy => "COLLECTION ITEMS TERMINATED BY", - MapKeysTerminatedBy => "MAP KEYS TERMINATED BY", - LinesTerminatedBy => "LINES TERMINATED BY", - NullDefinedAs => "NULL DEFINED AS", - }, - ) - } - } - pub enum HiveDescribeFormat { - Extended, - Formatted, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveDescribeFormat { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - HiveDescribeFormat::Extended => "Extended", - HiveDescribeFormat::Formatted => "Formatted", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for HiveDescribeFormat {} - #[automatically_derived] - impl ::core::clone::Clone for HiveDescribeFormat { - #[inline] - fn clone(&self) -> HiveDescribeFormat { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveDescribeFormat {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveDescribeFormat { - #[inline] - fn eq(&self, other: &HiveDescribeFormat) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveDescribeFormat { - #[inline] - fn partial_cmp( - &self, - other: &HiveDescribeFormat, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveDescribeFormat { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveDescribeFormat { - #[inline] - fn cmp(&self, other: &HiveDescribeFormat) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveDescribeFormat { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for HiveDescribeFormat { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - use HiveDescribeFormat::*; - f.write_str( - match self { - Extended => "EXTENDED", - Formatted => "FORMATTED", - }, - ) - } - } - pub enum DescribeAlias { - Describe, - Explain, - Desc, - } - #[automatically_derived] - impl ::core::fmt::Debug for DescribeAlias { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - DescribeAlias::Describe => "Describe", - DescribeAlias::Explain => "Explain", - DescribeAlias::Desc => "Desc", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for DescribeAlias {} - #[automatically_derived] - impl ::core::clone::Clone for DescribeAlias { - #[inline] - fn clone(&self) -> DescribeAlias { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for DescribeAlias {} - #[automatically_derived] - impl ::core::cmp::PartialEq for DescribeAlias { - #[inline] - fn eq(&self, other: &DescribeAlias) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for DescribeAlias { - #[inline] - fn partial_cmp( - &self, - other: &DescribeAlias, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for DescribeAlias { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for DescribeAlias { - #[inline] - fn cmp(&self, other: &DescribeAlias) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for DescribeAlias { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for DescribeAlias { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - use DescribeAlias::*; - f.write_str( - match self { - Describe => "DESCRIBE", - Explain => "EXPLAIN", - Desc => "DESC", - }, - ) - } - } - #[allow(clippy::large_enum_variant)] - pub enum HiveIOFormat { - IOF { input_format: Expr, output_format: Expr }, - FileFormat { format: FileFormat }, - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::fmt::Debug for HiveIOFormat { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - HiveIOFormat::IOF { input_format: __self_0, output_format: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "IOF", - "input_format", - __self_0, - "output_format", - &__self_1, - ) - } - HiveIOFormat::FileFormat { format: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "FileFormat", - "format", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::clone::Clone for HiveIOFormat { - #[inline] - fn clone(&self) -> HiveIOFormat { - match self { - HiveIOFormat::IOF { input_format: __self_0, output_format: __self_1 } => { - HiveIOFormat::IOF { - input_format: ::core::clone::Clone::clone(__self_0), - output_format: ::core::clone::Clone::clone(__self_1), - } - } - HiveIOFormat::FileFormat { format: __self_0 } => { - HiveIOFormat::FileFormat { - format: ::core::clone::Clone::clone(__self_0), - } - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::marker::StructuralPartialEq for HiveIOFormat {} - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialEq for HiveIOFormat { - #[inline] - fn eq(&self, other: &HiveIOFormat) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - HiveIOFormat::IOF { - input_format: __self_0, - output_format: __self_1, - }, - HiveIOFormat::IOF { - input_format: __arg1_0, - output_format: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - HiveIOFormat::FileFormat { format: __self_0 }, - HiveIOFormat::FileFormat { format: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialOrd for HiveIOFormat { - #[inline] - fn partial_cmp( - &self, - other: &HiveIOFormat, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - HiveIOFormat::IOF { - input_format: __self_0, - output_format: __self_1, - }, - HiveIOFormat::IOF { input_format: __arg1_0, output_format: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - HiveIOFormat::FileFormat { format: __self_0 }, - HiveIOFormat::FileFormat { format: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Eq for HiveIOFormat { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Ord for HiveIOFormat { - #[inline] - fn cmp(&self, other: &HiveIOFormat) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - HiveIOFormat::IOF { - input_format: __self_0, - output_format: __self_1, - }, - HiveIOFormat::IOF { - input_format: __arg1_0, - output_format: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - HiveIOFormat::FileFormat { format: __self_0 }, - HiveIOFormat::FileFormat { format: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::hash::Hash for HiveIOFormat { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - HiveIOFormat::IOF { - input_format: __self_0, - output_format: __self_1, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - HiveIOFormat::FileFormat { format: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - pub struct HiveFormat { - pub row_format: Option, - pub serde_properties: Option>, - pub storage: Option, - pub location: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveFormat { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "HiveFormat", - "row_format", - &self.row_format, - "serde_properties", - &self.serde_properties, - "storage", - &self.storage, - "location", - &&self.location, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for HiveFormat { - #[inline] - fn clone(&self) -> HiveFormat { - HiveFormat { - row_format: ::core::clone::Clone::clone(&self.row_format), - serde_properties: ::core::clone::Clone::clone(&self.serde_properties), - storage: ::core::clone::Clone::clone(&self.storage), - location: ::core::clone::Clone::clone(&self.location), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveFormat {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveFormat { - #[inline] - fn eq(&self, other: &HiveFormat) -> bool { - self.row_format == other.row_format - && self.serde_properties == other.serde_properties - && self.storage == other.storage && self.location == other.location - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveFormat { - #[inline] - fn partial_cmp( - &self, - other: &HiveFormat, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.row_format, - &other.row_format, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.serde_properties, - &other.serde_properties, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.storage, - &other.storage, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.location, - &other.location, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveFormat { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveFormat { - #[inline] - fn cmp(&self, other: &HiveFormat) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.row_format, &other.row_format) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.serde_properties, - &other.serde_properties, - ) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.storage, &other.storage) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.location, &other.location) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveFormat { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.row_format, state); - ::core::hash::Hash::hash(&self.serde_properties, state); - ::core::hash::Hash::hash(&self.storage, state); - ::core::hash::Hash::hash(&self.location, state) - } - } - #[automatically_derived] - impl ::core::default::Default for HiveFormat { - #[inline] - fn default() -> HiveFormat { - HiveFormat { - row_format: ::core::default::Default::default(), - serde_properties: ::core::default::Default::default(), - storage: ::core::default::Default::default(), - location: ::core::default::Default::default(), - } - } - } - pub struct ClusteredIndex { - pub name: Ident, - pub asc: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for ClusteredIndex { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "ClusteredIndex", - "name", - &self.name, - "asc", - &&self.asc, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ClusteredIndex { - #[inline] - fn clone(&self) -> ClusteredIndex { - ClusteredIndex { - name: ::core::clone::Clone::clone(&self.name), - asc: ::core::clone::Clone::clone(&self.asc), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ClusteredIndex {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ClusteredIndex { - #[inline] - fn eq(&self, other: &ClusteredIndex) -> bool { - self.name == other.name && self.asc == other.asc - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ClusteredIndex { - #[inline] - fn partial_cmp( - &self, - other: &ClusteredIndex, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.asc, &other.asc) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ClusteredIndex { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ClusteredIndex { - #[inline] - fn cmp(&self, other: &ClusteredIndex) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.name, &other.name) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.asc, &other.asc) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ClusteredIndex { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.name, state); - ::core::hash::Hash::hash(&self.asc, state) - } - } - impl fmt::Display for ClusteredIndex { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0}", self.name))?; - match self.asc { - Some(true) => f.write_fmt(format_args!(" ASC")), - Some(false) => f.write_fmt(format_args!(" DESC")), - _ => Ok(()), - } - } - } - pub enum TableOptionsClustered { - ColumnstoreIndex, - ColumnstoreIndexOrder(Vec), - Index(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for TableOptionsClustered { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - TableOptionsClustered::ColumnstoreIndex => { - ::core::fmt::Formatter::write_str(f, "ColumnstoreIndex") - } - TableOptionsClustered::ColumnstoreIndexOrder(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ColumnstoreIndexOrder", - &__self_0, - ) - } - TableOptionsClustered::Index(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Index", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableOptionsClustered { - #[inline] - fn clone(&self) -> TableOptionsClustered { - match self { - TableOptionsClustered::ColumnstoreIndex => { - TableOptionsClustered::ColumnstoreIndex - } - TableOptionsClustered::ColumnstoreIndexOrder(__self_0) => { - TableOptionsClustered::ColumnstoreIndexOrder( - ::core::clone::Clone::clone(__self_0), - ) - } - TableOptionsClustered::Index(__self_0) => { - TableOptionsClustered::Index(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableOptionsClustered {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableOptionsClustered { - #[inline] - fn eq(&self, other: &TableOptionsClustered) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - TableOptionsClustered::ColumnstoreIndexOrder(__self_0), - TableOptionsClustered::ColumnstoreIndexOrder(__arg1_0), - ) => __self_0 == __arg1_0, - ( - TableOptionsClustered::Index(__self_0), - TableOptionsClustered::Index(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableOptionsClustered { - #[inline] - fn partial_cmp( - &self, - other: &TableOptionsClustered, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - TableOptionsClustered::ColumnstoreIndexOrder(__self_0), - TableOptionsClustered::ColumnstoreIndexOrder(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - TableOptionsClustered::Index(__self_0), - TableOptionsClustered::Index(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableOptionsClustered { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TableOptionsClustered { - #[inline] - fn cmp(&self, other: &TableOptionsClustered) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - TableOptionsClustered::ColumnstoreIndexOrder(__self_0), - TableOptionsClustered::ColumnstoreIndexOrder(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - TableOptionsClustered::Index(__self_0), - TableOptionsClustered::Index(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableOptionsClustered { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - TableOptionsClustered::ColumnstoreIndexOrder(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - TableOptionsClustered::Index(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for TableOptionsClustered { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - TableOptionsClustered::ColumnstoreIndex => { - f.write_fmt(format_args!("CLUSTERED COLUMNSTORE INDEX")) - } - TableOptionsClustered::ColumnstoreIndexOrder(values) => { - f.write_fmt( - format_args!( - "CLUSTERED COLUMNSTORE INDEX ORDER ({0})", - display_comma_separated(values), - ), - ) - } - TableOptionsClustered::Index(values) => { - f.write_fmt( - format_args!( - "CLUSTERED INDEX ({0})", - display_comma_separated(values), - ), - ) - } - } - } - } - /// Specifies which partition the boundary values on table partitioning belongs to. - pub enum PartitionRangeDirection { - Left, - Right, - } - #[automatically_derived] - impl ::core::fmt::Debug for PartitionRangeDirection { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - PartitionRangeDirection::Left => "Left", - PartitionRangeDirection::Right => "Right", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for PartitionRangeDirection { - #[inline] - fn clone(&self) -> PartitionRangeDirection { - match self { - PartitionRangeDirection::Left => PartitionRangeDirection::Left, - PartitionRangeDirection::Right => PartitionRangeDirection::Right, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for PartitionRangeDirection {} - #[automatically_derived] - impl ::core::cmp::PartialEq for PartitionRangeDirection { - #[inline] - fn eq(&self, other: &PartitionRangeDirection) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for PartitionRangeDirection { - #[inline] - fn partial_cmp( - &self, - other: &PartitionRangeDirection, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for PartitionRangeDirection { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for PartitionRangeDirection { - #[inline] - fn cmp(&self, other: &PartitionRangeDirection) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for PartitionRangeDirection { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - pub enum SqlOption { - /// Clustered represents the clustered version of table storage for MSSQL. - /// - /// - Clustered(TableOptionsClustered), - /// Single identifier options, e.g. `HEAP` for MSSQL. - /// - /// - Ident(Ident), - /// Any option that consists of a key value pair where the value is an expression. e.g. - /// - /// WITH(DISTRIBUTION = ROUND_ROBIN) - KeyValue { key: Ident, value: Expr }, - /// One or more table partitions and represents which partition the boundary values belong to, - /// e.g. - /// - /// PARTITION (id RANGE LEFT FOR VALUES (10, 20, 30, 40)) - /// - /// - Partition { - column_name: Ident, - range_direction: Option, - for_values: Vec, - }, - } - #[automatically_derived] - impl ::core::fmt::Debug for SqlOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - SqlOption::Clustered(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Clustered", - &__self_0, - ) - } - SqlOption::Ident(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Ident", - &__self_0, - ) - } - SqlOption::KeyValue { key: __self_0, value: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "KeyValue", - "key", - __self_0, - "value", - &__self_1, - ) - } - SqlOption::Partition { - column_name: __self_0, - range_direction: __self_1, - for_values: __self_2, - } => { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Partition", - "column_name", - __self_0, - "range_direction", - __self_1, - "for_values", - &__self_2, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for SqlOption { - #[inline] - fn clone(&self) -> SqlOption { - match self { - SqlOption::Clustered(__self_0) => { - SqlOption::Clustered(::core::clone::Clone::clone(__self_0)) - } - SqlOption::Ident(__self_0) => { - SqlOption::Ident(::core::clone::Clone::clone(__self_0)) - } - SqlOption::KeyValue { key: __self_0, value: __self_1 } => { - SqlOption::KeyValue { - key: ::core::clone::Clone::clone(__self_0), - value: ::core::clone::Clone::clone(__self_1), - } - } - SqlOption::Partition { - column_name: __self_0, - range_direction: __self_1, - for_values: __self_2, - } => { - SqlOption::Partition { - column_name: ::core::clone::Clone::clone(__self_0), - range_direction: ::core::clone::Clone::clone(__self_1), - for_values: ::core::clone::Clone::clone(__self_2), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SqlOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SqlOption { - #[inline] - fn eq(&self, other: &SqlOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (SqlOption::Clustered(__self_0), SqlOption::Clustered(__arg1_0)) => { - __self_0 == __arg1_0 - } - (SqlOption::Ident(__self_0), SqlOption::Ident(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - SqlOption::KeyValue { key: __self_0, value: __self_1 }, - SqlOption::KeyValue { key: __arg1_0, value: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - SqlOption::Partition { - column_name: __self_0, - range_direction: __self_1, - for_values: __self_2, - }, - SqlOption::Partition { - column_name: __arg1_0, - range_direction: __arg1_1, - for_values: __arg1_2, - }, - ) => { - __self_0 == __arg1_0 && __self_1 == __arg1_1 - && __self_2 == __arg1_2 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SqlOption { - #[inline] - fn partial_cmp( - &self, - other: &SqlOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (SqlOption::Clustered(__self_0), SqlOption::Clustered(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (SqlOption::Ident(__self_0), SqlOption::Ident(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - SqlOption::KeyValue { key: __self_0, value: __self_1 }, - SqlOption::KeyValue { key: __arg1_0, value: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - SqlOption::Partition { - column_name: __self_0, - range_direction: __self_1, - for_values: __self_2, - }, - SqlOption::Partition { - column_name: __arg1_0, - range_direction: __arg1_1, - for_values: __arg1_2, - }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_1, - __arg1_1, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SqlOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SqlOption { - #[inline] - fn cmp(&self, other: &SqlOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - SqlOption::Clustered(__self_0), - SqlOption::Clustered(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - (SqlOption::Ident(__self_0), SqlOption::Ident(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - SqlOption::KeyValue { key: __self_0, value: __self_1 }, - SqlOption::KeyValue { key: __arg1_0, value: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - SqlOption::Partition { - column_name: __self_0, - range_direction: __self_1, - for_values: __self_2, - }, - SqlOption::Partition { - column_name: __arg1_0, - range_direction: __arg1_1, - for_values: __arg1_2, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(__self_1, __arg1_1) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_2, __arg1_2) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SqlOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - SqlOption::Clustered(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SqlOption::Ident(__self_0) => ::core::hash::Hash::hash(__self_0, state), - SqlOption::KeyValue { key: __self_0, value: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - SqlOption::Partition { - column_name: __self_0, - range_direction: __self_1, - for_values: __self_2, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state); - ::core::hash::Hash::hash(__self_2, state) - } - } - } - } - impl fmt::Display for SqlOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SqlOption::Clustered(c) => f.write_fmt(format_args!("{0}", c)), - SqlOption::Ident(ident) => f.write_fmt(format_args!("{0}", ident)), - SqlOption::KeyValue { key: name, value } => { - f.write_fmt(format_args!("{0} = {1}", name, value)) - } - SqlOption::Partition { column_name, range_direction, for_values } => { - let direction = match range_direction { - Some(PartitionRangeDirection::Left) => " LEFT", - Some(PartitionRangeDirection::Right) => " RIGHT", - None => "", - }; - f.write_fmt( - format_args!( - "PARTITION ({0} RANGE{1} FOR VALUES ({2}))", - column_name, - direction, - display_comma_separated(for_values), - ), - ) - } - } - } - } - pub struct SecretOption { - pub key: Ident, - pub value: Ident, - } - #[automatically_derived] - impl ::core::fmt::Debug for SecretOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SecretOption", - "key", - &self.key, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SecretOption { - #[inline] - fn clone(&self) -> SecretOption { - SecretOption { - key: ::core::clone::Clone::clone(&self.key), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SecretOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SecretOption { - #[inline] - fn eq(&self, other: &SecretOption) -> bool { - self.key == other.key && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SecretOption { - #[inline] - fn partial_cmp( - &self, - other: &SecretOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.key, &other.key) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SecretOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SecretOption { - #[inline] - fn cmp(&self, other: &SecretOption) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.key, &other.key) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SecretOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.key, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl fmt::Display for SecretOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0} {1}", self.key, self.value)) - } - } - pub enum AttachDuckDBDatabaseOption { - ReadOnly(Option), - Type(Ident), - } - #[automatically_derived] - impl ::core::fmt::Debug for AttachDuckDBDatabaseOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - AttachDuckDBDatabaseOption::ReadOnly(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ReadOnly", - &__self_0, - ) - } - AttachDuckDBDatabaseOption::Type(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Type", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for AttachDuckDBDatabaseOption { - #[inline] - fn clone(&self) -> AttachDuckDBDatabaseOption { - match self { - AttachDuckDBDatabaseOption::ReadOnly(__self_0) => { - AttachDuckDBDatabaseOption::ReadOnly( - ::core::clone::Clone::clone(__self_0), - ) - } - AttachDuckDBDatabaseOption::Type(__self_0) => { - AttachDuckDBDatabaseOption::Type( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for AttachDuckDBDatabaseOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for AttachDuckDBDatabaseOption { - #[inline] - fn eq(&self, other: &AttachDuckDBDatabaseOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - AttachDuckDBDatabaseOption::ReadOnly(__self_0), - AttachDuckDBDatabaseOption::ReadOnly(__arg1_0), - ) => __self_0 == __arg1_0, - ( - AttachDuckDBDatabaseOption::Type(__self_0), - AttachDuckDBDatabaseOption::Type(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for AttachDuckDBDatabaseOption { - #[inline] - fn partial_cmp( - &self, - other: &AttachDuckDBDatabaseOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - AttachDuckDBDatabaseOption::ReadOnly(__self_0), - AttachDuckDBDatabaseOption::ReadOnly(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - AttachDuckDBDatabaseOption::Type(__self_0), - AttachDuckDBDatabaseOption::Type(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for AttachDuckDBDatabaseOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for AttachDuckDBDatabaseOption { - #[inline] - fn cmp(&self, other: &AttachDuckDBDatabaseOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - AttachDuckDBDatabaseOption::ReadOnly(__self_0), - AttachDuckDBDatabaseOption::ReadOnly(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - AttachDuckDBDatabaseOption::Type(__self_0), - AttachDuckDBDatabaseOption::Type(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for AttachDuckDBDatabaseOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - AttachDuckDBDatabaseOption::ReadOnly(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - AttachDuckDBDatabaseOption::Type(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for AttachDuckDBDatabaseOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - AttachDuckDBDatabaseOption::ReadOnly(Some(true)) => { - f.write_fmt(format_args!("READ_ONLY true")) - } - AttachDuckDBDatabaseOption::ReadOnly(Some(false)) => { - f.write_fmt(format_args!("READ_ONLY false")) - } - AttachDuckDBDatabaseOption::ReadOnly(None) => { - f.write_fmt(format_args!("READ_ONLY")) - } - AttachDuckDBDatabaseOption::Type(t) => { - f.write_fmt(format_args!("TYPE {0}", t)) - } - } - } - } - pub enum TransactionMode { - AccessMode(TransactionAccessMode), - IsolationLevel(TransactionIsolationLevel), - } - #[automatically_derived] - impl ::core::fmt::Debug for TransactionMode { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - TransactionMode::AccessMode(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "AccessMode", - &__self_0, - ) - } - TransactionMode::IsolationLevel(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IsolationLevel", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::Copy for TransactionMode {} - #[automatically_derived] - impl ::core::clone::Clone for TransactionMode { - #[inline] - fn clone(&self) -> TransactionMode { - let _: ::core::clone::AssertParamIsClone; - let _: ::core::clone::AssertParamIsClone; - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TransactionMode {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TransactionMode { - #[inline] - fn eq(&self, other: &TransactionMode) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - TransactionMode::AccessMode(__self_0), - TransactionMode::AccessMode(__arg1_0), - ) => __self_0 == __arg1_0, - ( - TransactionMode::IsolationLevel(__self_0), - TransactionMode::IsolationLevel(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TransactionMode { - #[inline] - fn partial_cmp( - &self, - other: &TransactionMode, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - TransactionMode::AccessMode(__self_0), - TransactionMode::AccessMode(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - TransactionMode::IsolationLevel(__self_0), - TransactionMode::IsolationLevel(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TransactionMode { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TransactionMode { - #[inline] - fn cmp(&self, other: &TransactionMode) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - TransactionMode::AccessMode(__self_0), - TransactionMode::AccessMode(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - TransactionMode::IsolationLevel(__self_0), - TransactionMode::IsolationLevel(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TransactionMode { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - TransactionMode::AccessMode(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - TransactionMode::IsolationLevel(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for TransactionMode { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use TransactionMode::*; - match self { - AccessMode(access_mode) => f.write_fmt(format_args!("{0}", access_mode)), - IsolationLevel(iso_level) => { - f.write_fmt(format_args!("ISOLATION LEVEL {0}", iso_level)) - } - } - } - } - pub enum TransactionAccessMode { - ReadOnly, - ReadWrite, - } - #[automatically_derived] - impl ::core::fmt::Debug for TransactionAccessMode { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - TransactionAccessMode::ReadOnly => "ReadOnly", - TransactionAccessMode::ReadWrite => "ReadWrite", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for TransactionAccessMode {} - #[automatically_derived] - impl ::core::clone::Clone for TransactionAccessMode { - #[inline] - fn clone(&self) -> TransactionAccessMode { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TransactionAccessMode {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TransactionAccessMode { - #[inline] - fn eq(&self, other: &TransactionAccessMode) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TransactionAccessMode { - #[inline] - fn partial_cmp( - &self, - other: &TransactionAccessMode, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TransactionAccessMode { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for TransactionAccessMode { - #[inline] - fn cmp(&self, other: &TransactionAccessMode) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TransactionAccessMode { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for TransactionAccessMode { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use TransactionAccessMode::*; - f.write_str( - match self { - ReadOnly => "READ ONLY", - ReadWrite => "READ WRITE", - }, - ) - } - } - pub enum TransactionIsolationLevel { - ReadUncommitted, - ReadCommitted, - RepeatableRead, - Serializable, - Snapshot, - } - #[automatically_derived] - impl ::core::fmt::Debug for TransactionIsolationLevel { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - TransactionIsolationLevel::ReadUncommitted => "ReadUncommitted", - TransactionIsolationLevel::ReadCommitted => "ReadCommitted", - TransactionIsolationLevel::RepeatableRead => "RepeatableRead", - TransactionIsolationLevel::Serializable => "Serializable", - TransactionIsolationLevel::Snapshot => "Snapshot", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for TransactionIsolationLevel {} - #[automatically_derived] - impl ::core::clone::Clone for TransactionIsolationLevel { - #[inline] - fn clone(&self) -> TransactionIsolationLevel { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TransactionIsolationLevel {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TransactionIsolationLevel { - #[inline] - fn eq(&self, other: &TransactionIsolationLevel) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TransactionIsolationLevel { - #[inline] - fn partial_cmp( - &self, - other: &TransactionIsolationLevel, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TransactionIsolationLevel { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for TransactionIsolationLevel { - #[inline] - fn cmp(&self, other: &TransactionIsolationLevel) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TransactionIsolationLevel { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for TransactionIsolationLevel { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use TransactionIsolationLevel::*; - f.write_str( - match self { - ReadUncommitted => "READ UNCOMMITTED", - ReadCommitted => "READ COMMITTED", - RepeatableRead => "REPEATABLE READ", - Serializable => "SERIALIZABLE", - Snapshot => "SNAPSHOT", - }, - ) - } - } - /// Modifier for the transaction in the `BEGIN` syntax - /// - /// SQLite: - /// MS-SQL: - pub enum TransactionModifier { - Deferred, - Immediate, - Exclusive, - Try, - Catch, - } - #[automatically_derived] - impl ::core::fmt::Debug for TransactionModifier { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - TransactionModifier::Deferred => "Deferred", - TransactionModifier::Immediate => "Immediate", - TransactionModifier::Exclusive => "Exclusive", - TransactionModifier::Try => "Try", - TransactionModifier::Catch => "Catch", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for TransactionModifier {} - #[automatically_derived] - impl ::core::clone::Clone for TransactionModifier { - #[inline] - fn clone(&self) -> TransactionModifier { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TransactionModifier {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TransactionModifier { - #[inline] - fn eq(&self, other: &TransactionModifier) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TransactionModifier { - #[inline] - fn partial_cmp( - &self, - other: &TransactionModifier, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TransactionModifier { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for TransactionModifier { - #[inline] - fn cmp(&self, other: &TransactionModifier) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for TransactionModifier { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for TransactionModifier { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use TransactionModifier::*; - f.write_str( - match self { - Deferred => "DEFERRED", - Immediate => "IMMEDIATE", - Exclusive => "EXCLUSIVE", - Try => "TRY", - Catch => "CATCH", - }, - ) - } - } - pub enum ShowStatementFilter { - Like(String), - ILike(String), - Where(Expr), - NoKeyword(String), - } - #[automatically_derived] - impl ::core::fmt::Debug for ShowStatementFilter { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - ShowStatementFilter::Like(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Like", - &__self_0, - ) - } - ShowStatementFilter::ILike(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ILike", - &__self_0, - ) - } - ShowStatementFilter::Where(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Where", - &__self_0, - ) - } - ShowStatementFilter::NoKeyword(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "NoKeyword", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for ShowStatementFilter { - #[inline] - fn clone(&self) -> ShowStatementFilter { - match self { - ShowStatementFilter::Like(__self_0) => { - ShowStatementFilter::Like(::core::clone::Clone::clone(__self_0)) - } - ShowStatementFilter::ILike(__self_0) => { - ShowStatementFilter::ILike(::core::clone::Clone::clone(__self_0)) - } - ShowStatementFilter::Where(__self_0) => { - ShowStatementFilter::Where(::core::clone::Clone::clone(__self_0)) - } - ShowStatementFilter::NoKeyword(__self_0) => { - ShowStatementFilter::NoKeyword(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ShowStatementFilter {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ShowStatementFilter { - #[inline] - fn eq(&self, other: &ShowStatementFilter) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - ShowStatementFilter::Like(__self_0), - ShowStatementFilter::Like(__arg1_0), - ) => __self_0 == __arg1_0, - ( - ShowStatementFilter::ILike(__self_0), - ShowStatementFilter::ILike(__arg1_0), - ) => __self_0 == __arg1_0, - ( - ShowStatementFilter::Where(__self_0), - ShowStatementFilter::Where(__arg1_0), - ) => __self_0 == __arg1_0, - ( - ShowStatementFilter::NoKeyword(__self_0), - ShowStatementFilter::NoKeyword(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ShowStatementFilter { - #[inline] - fn partial_cmp( - &self, - other: &ShowStatementFilter, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - ShowStatementFilter::Like(__self_0), - ShowStatementFilter::Like(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - ShowStatementFilter::ILike(__self_0), - ShowStatementFilter::ILike(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - ShowStatementFilter::Where(__self_0), - ShowStatementFilter::Where(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - ShowStatementFilter::NoKeyword(__self_0), - ShowStatementFilter::NoKeyword(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ShowStatementFilter { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ShowStatementFilter { - #[inline] - fn cmp(&self, other: &ShowStatementFilter) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - ShowStatementFilter::Like(__self_0), - ShowStatementFilter::Like(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - ShowStatementFilter::ILike(__self_0), - ShowStatementFilter::ILike(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - ShowStatementFilter::Where(__self_0), - ShowStatementFilter::Where(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - ShowStatementFilter::NoKeyword(__self_0), - ShowStatementFilter::NoKeyword(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ShowStatementFilter { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - ShowStatementFilter::Like(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - ShowStatementFilter::ILike(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - ShowStatementFilter::Where(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - ShowStatementFilter::NoKeyword(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for ShowStatementFilter { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use ShowStatementFilter::*; - match self { - Like(pattern) => { - f.write_fmt( - format_args!( - "LIKE \'{0}\'", - value::escape_single_quote_string(pattern), - ), - ) - } - ILike(pattern) => { - f.write_fmt( - format_args!( - "ILIKE {0}", - value::escape_single_quote_string(pattern), - ), - ) - } - Where(expr) => f.write_fmt(format_args!("WHERE {0}", expr)), - NoKeyword(pattern) => { - f.write_fmt( - format_args!( - "\'{0}\'", - value::escape_single_quote_string(pattern), - ), - ) - } - } - } - } - pub enum ShowStatementInClause { - IN, - FROM, - } - #[automatically_derived] - impl ::core::fmt::Debug for ShowStatementInClause { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ShowStatementInClause::IN => "IN", - ShowStatementInClause::FROM => "FROM", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ShowStatementInClause { - #[inline] - fn clone(&self) -> ShowStatementInClause { - match self { - ShowStatementInClause::IN => ShowStatementInClause::IN, - ShowStatementInClause::FROM => ShowStatementInClause::FROM, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ShowStatementInClause {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ShowStatementInClause { - #[inline] - fn eq(&self, other: &ShowStatementInClause) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ShowStatementInClause { - #[inline] - fn partial_cmp( - &self, - other: &ShowStatementInClause, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ShowStatementInClause { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ShowStatementInClause { - #[inline] - fn cmp(&self, other: &ShowStatementInClause) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ShowStatementInClause { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ShowStatementInClause { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use ShowStatementInClause::*; - match self { - FROM => f.write_fmt(format_args!("FROM")), - IN => f.write_fmt(format_args!("IN")), - } - } - } - /// Sqlite specific syntax - /// - /// See [Sqlite documentation](https://sqlite.org/lang_conflict.html) - /// for more details. - pub enum SqliteOnConflict { - Rollback, - Abort, - Fail, - Ignore, - Replace, - } - #[automatically_derived] - impl ::core::fmt::Debug for SqliteOnConflict { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - SqliteOnConflict::Rollback => "Rollback", - SqliteOnConflict::Abort => "Abort", - SqliteOnConflict::Fail => "Fail", - SqliteOnConflict::Ignore => "Ignore", - SqliteOnConflict::Replace => "Replace", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for SqliteOnConflict {} - #[automatically_derived] - impl ::core::clone::Clone for SqliteOnConflict { - #[inline] - fn clone(&self) -> SqliteOnConflict { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SqliteOnConflict {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SqliteOnConflict { - #[inline] - fn eq(&self, other: &SqliteOnConflict) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SqliteOnConflict { - #[inline] - fn partial_cmp( - &self, - other: &SqliteOnConflict, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SqliteOnConflict { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for SqliteOnConflict { - #[inline] - fn cmp(&self, other: &SqliteOnConflict) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for SqliteOnConflict { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for SqliteOnConflict { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use SqliteOnConflict::*; - match self { - Rollback => f.write_fmt(format_args!("OR ROLLBACK")), - Abort => f.write_fmt(format_args!("OR ABORT")), - Fail => f.write_fmt(format_args!("OR FAIL")), - Ignore => f.write_fmt(format_args!("OR IGNORE")), - Replace => f.write_fmt(format_args!("OR REPLACE")), - } - } - } - /// Mysql specific syntax - /// - /// See [Mysql documentation](https://dev.mysql.com/doc/refman/8.0/en/replace.html) - /// See [Mysql documentation](https://dev.mysql.com/doc/refman/8.0/en/insert.html) - /// for more details. - pub enum MysqlInsertPriority { - LowPriority, - Delayed, - HighPriority, - } - #[automatically_derived] - impl ::core::fmt::Debug for MysqlInsertPriority { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - MysqlInsertPriority::LowPriority => "LowPriority", - MysqlInsertPriority::Delayed => "Delayed", - MysqlInsertPriority::HighPriority => "HighPriority", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for MysqlInsertPriority {} - #[automatically_derived] - impl ::core::clone::Clone for MysqlInsertPriority { - #[inline] - fn clone(&self) -> MysqlInsertPriority { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MysqlInsertPriority {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MysqlInsertPriority { - #[inline] - fn eq(&self, other: &MysqlInsertPriority) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MysqlInsertPriority { - #[inline] - fn partial_cmp( - &self, - other: &MysqlInsertPriority, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MysqlInsertPriority { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for MysqlInsertPriority { - #[inline] - fn cmp(&self, other: &MysqlInsertPriority) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for MysqlInsertPriority { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for crate::ast::MysqlInsertPriority { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use MysqlInsertPriority::*; - match self { - LowPriority => f.write_fmt(format_args!("LOW_PRIORITY")), - Delayed => f.write_fmt(format_args!("DELAYED")), - HighPriority => f.write_fmt(format_args!("HIGH_PRIORITY")), - } - } - } - pub enum CopySource { - Table { - /// The name of the table to copy from. - table_name: ObjectName, - /// A list of column names to copy. Empty list means that all columns - /// are copied. - columns: Vec, - }, - Query(Box), - } - #[automatically_derived] - impl ::core::fmt::Debug for CopySource { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CopySource::Table { table_name: __self_0, columns: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Table", - "table_name", - __self_0, - "columns", - &__self_1, - ) - } - CopySource::Query(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Query", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CopySource { - #[inline] - fn clone(&self) -> CopySource { - match self { - CopySource::Table { table_name: __self_0, columns: __self_1 } => { - CopySource::Table { - table_name: ::core::clone::Clone::clone(__self_0), - columns: ::core::clone::Clone::clone(__self_1), - } - } - CopySource::Query(__self_0) => { - CopySource::Query(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CopySource {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CopySource { - #[inline] - fn eq(&self, other: &CopySource) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CopySource::Table { table_name: __self_0, columns: __self_1 }, - CopySource::Table { table_name: __arg1_0, columns: __arg1_1 }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (CopySource::Query(__self_0), CopySource::Query(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CopySource { - #[inline] - fn partial_cmp( - &self, - other: &CopySource, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CopySource::Table { table_name: __self_0, columns: __self_1 }, - CopySource::Table { table_name: __arg1_0, columns: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (CopySource::Query(__self_0), CopySource::Query(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CopySource { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CopySource { - #[inline] - fn cmp(&self, other: &CopySource) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CopySource::Table { - table_name: __self_0, - columns: __self_1, - }, - CopySource::Table { table_name: __arg1_0, columns: __arg1_1 }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (CopySource::Query(__self_0), CopySource::Query(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CopySource { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CopySource::Table { table_name: __self_0, columns: __self_1 } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - CopySource::Query(__self_0) => ::core::hash::Hash::hash(__self_0, state), - } - } - } - pub enum CopyTarget { - Stdin, - Stdout, - File { - /// The path name of the input or output file. - filename: String, - }, - Program { - /// A command to execute - command: String, - }, - } - #[automatically_derived] - impl ::core::fmt::Debug for CopyTarget { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CopyTarget::Stdin => ::core::fmt::Formatter::write_str(f, "Stdin"), - CopyTarget::Stdout => ::core::fmt::Formatter::write_str(f, "Stdout"), - CopyTarget::File { filename: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "File", - "filename", - &__self_0, - ) - } - CopyTarget::Program { command: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Program", - "command", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CopyTarget { - #[inline] - fn clone(&self) -> CopyTarget { - match self { - CopyTarget::Stdin => CopyTarget::Stdin, - CopyTarget::Stdout => CopyTarget::Stdout, - CopyTarget::File { filename: __self_0 } => { - CopyTarget::File { - filename: ::core::clone::Clone::clone(__self_0), - } - } - CopyTarget::Program { command: __self_0 } => { - CopyTarget::Program { - command: ::core::clone::Clone::clone(__self_0), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CopyTarget {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CopyTarget { - #[inline] - fn eq(&self, other: &CopyTarget) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CopyTarget::File { filename: __self_0 }, - CopyTarget::File { filename: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - CopyTarget::Program { command: __self_0 }, - CopyTarget::Program { command: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CopyTarget { - #[inline] - fn partial_cmp( - &self, - other: &CopyTarget, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CopyTarget::File { filename: __self_0 }, - CopyTarget::File { filename: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CopyTarget::Program { command: __self_0 }, - CopyTarget::Program { command: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CopyTarget { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CopyTarget { - #[inline] - fn cmp(&self, other: &CopyTarget) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CopyTarget::File { filename: __self_0 }, - CopyTarget::File { filename: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyTarget::Program { command: __self_0 }, - CopyTarget::Program { command: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CopyTarget { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CopyTarget::File { filename: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyTarget::Program { command: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for CopyTarget { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use CopyTarget::*; - match self { - Stdin { .. } => f.write_fmt(format_args!("STDIN")), - Stdout => f.write_fmt(format_args!("STDOUT")), - File { filename } => { - f.write_fmt( - format_args!( - "\'{0}\'", - value::escape_single_quote_string(filename), - ), - ) - } - Program { command } => { - f.write_fmt( - format_args!( - "PROGRAM \'{0}\'", - value::escape_single_quote_string(command), - ), - ) - } - } - } - } - pub enum OnCommit { - DeleteRows, - PreserveRows, - Drop, - } - #[automatically_derived] - impl ::core::fmt::Debug for OnCommit { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - OnCommit::DeleteRows => "DeleteRows", - OnCommit::PreserveRows => "PreserveRows", - OnCommit::Drop => "Drop", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for OnCommit {} - #[automatically_derived] - impl ::core::clone::Clone for OnCommit { - #[inline] - fn clone(&self) -> OnCommit { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for OnCommit {} - #[automatically_derived] - impl ::core::cmp::PartialEq for OnCommit { - #[inline] - fn eq(&self, other: &OnCommit) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for OnCommit { - #[inline] - fn partial_cmp( - &self, - other: &OnCommit, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for OnCommit { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for OnCommit { - #[inline] - fn cmp(&self, other: &OnCommit) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for OnCommit { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - /// An option in `COPY` statement. - /// - /// - pub enum CopyOption { - /// FORMAT format_name - Format(Ident), - /// FREEZE \[ boolean \] - Freeze(bool), - /// DELIMITER 'delimiter_character' - Delimiter(char), - /// NULL 'null_string' - Null(String), - /// HEADER \[ boolean \] - Header(bool), - /// QUOTE 'quote_character' - Quote(char), - /// ESCAPE 'escape_character' - Escape(char), - /// FORCE_QUOTE { ( column_name [, ...] ) | * } - ForceQuote(Vec), - /// FORCE_NOT_NULL ( column_name [, ...] ) - ForceNotNull(Vec), - /// FORCE_NULL ( column_name [, ...] ) - ForceNull(Vec), - /// ENCODING 'encoding_name' - Encoding(String), - } - #[automatically_derived] - impl ::core::fmt::Debug for CopyOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CopyOption::Format(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Format", - &__self_0, - ) - } - CopyOption::Freeze(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Freeze", - &__self_0, - ) - } - CopyOption::Delimiter(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Delimiter", - &__self_0, - ) - } - CopyOption::Null(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Null", - &__self_0, - ) - } - CopyOption::Header(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Header", - &__self_0, - ) - } - CopyOption::Quote(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Quote", - &__self_0, - ) - } - CopyOption::Escape(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Escape", - &__self_0, - ) - } - CopyOption::ForceQuote(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ForceQuote", - &__self_0, - ) - } - CopyOption::ForceNotNull(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ForceNotNull", - &__self_0, - ) - } - CopyOption::ForceNull(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ForceNull", - &__self_0, - ) - } - CopyOption::Encoding(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Encoding", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CopyOption { - #[inline] - fn clone(&self) -> CopyOption { - match self { - CopyOption::Format(__self_0) => { - CopyOption::Format(::core::clone::Clone::clone(__self_0)) - } - CopyOption::Freeze(__self_0) => { - CopyOption::Freeze(::core::clone::Clone::clone(__self_0)) - } - CopyOption::Delimiter(__self_0) => { - CopyOption::Delimiter(::core::clone::Clone::clone(__self_0)) - } - CopyOption::Null(__self_0) => { - CopyOption::Null(::core::clone::Clone::clone(__self_0)) - } - CopyOption::Header(__self_0) => { - CopyOption::Header(::core::clone::Clone::clone(__self_0)) - } - CopyOption::Quote(__self_0) => { - CopyOption::Quote(::core::clone::Clone::clone(__self_0)) - } - CopyOption::Escape(__self_0) => { - CopyOption::Escape(::core::clone::Clone::clone(__self_0)) - } - CopyOption::ForceQuote(__self_0) => { - CopyOption::ForceQuote(::core::clone::Clone::clone(__self_0)) - } - CopyOption::ForceNotNull(__self_0) => { - CopyOption::ForceNotNull(::core::clone::Clone::clone(__self_0)) - } - CopyOption::ForceNull(__self_0) => { - CopyOption::ForceNull(::core::clone::Clone::clone(__self_0)) - } - CopyOption::Encoding(__self_0) => { - CopyOption::Encoding(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CopyOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CopyOption { - #[inline] - fn eq(&self, other: &CopyOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (CopyOption::Format(__self_0), CopyOption::Format(__arg1_0)) => { - __self_0 == __arg1_0 - } - (CopyOption::Freeze(__self_0), CopyOption::Freeze(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - CopyOption::Delimiter(__self_0), - CopyOption::Delimiter(__arg1_0), - ) => __self_0 == __arg1_0, - (CopyOption::Null(__self_0), CopyOption::Null(__arg1_0)) => { - __self_0 == __arg1_0 - } - (CopyOption::Header(__self_0), CopyOption::Header(__arg1_0)) => { - __self_0 == __arg1_0 - } - (CopyOption::Quote(__self_0), CopyOption::Quote(__arg1_0)) => { - __self_0 == __arg1_0 - } - (CopyOption::Escape(__self_0), CopyOption::Escape(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - CopyOption::ForceQuote(__self_0), - CopyOption::ForceQuote(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CopyOption::ForceNotNull(__self_0), - CopyOption::ForceNotNull(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CopyOption::ForceNull(__self_0), - CopyOption::ForceNull(__arg1_0), - ) => __self_0 == __arg1_0, - (CopyOption::Encoding(__self_0), CopyOption::Encoding(__arg1_0)) => { - __self_0 == __arg1_0 - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CopyOption { - #[inline] - fn partial_cmp( - &self, - other: &CopyOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (CopyOption::Format(__self_0), CopyOption::Format(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::Freeze(__self_0), CopyOption::Freeze(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::Delimiter(__self_0), CopyOption::Delimiter(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::Null(__self_0), CopyOption::Null(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::Header(__self_0), CopyOption::Header(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::Quote(__self_0), CopyOption::Quote(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::Escape(__self_0), CopyOption::Escape(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::ForceQuote(__self_0), CopyOption::ForceQuote(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - CopyOption::ForceNotNull(__self_0), - CopyOption::ForceNotNull(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (CopyOption::ForceNull(__self_0), CopyOption::ForceNull(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyOption::Encoding(__self_0), CopyOption::Encoding(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CopyOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CopyOption { - #[inline] - fn cmp(&self, other: &CopyOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (CopyOption::Format(__self_0), CopyOption::Format(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (CopyOption::Freeze(__self_0), CopyOption::Freeze(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - CopyOption::Delimiter(__self_0), - CopyOption::Delimiter(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - (CopyOption::Null(__self_0), CopyOption::Null(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (CopyOption::Header(__self_0), CopyOption::Header(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (CopyOption::Quote(__self_0), CopyOption::Quote(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (CopyOption::Escape(__self_0), CopyOption::Escape(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - CopyOption::ForceQuote(__self_0), - CopyOption::ForceQuote(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyOption::ForceNotNull(__self_0), - CopyOption::ForceNotNull(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyOption::ForceNull(__self_0), - CopyOption::ForceNull(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyOption::Encoding(__self_0), - CopyOption::Encoding(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CopyOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CopyOption::Format(__self_0) => ::core::hash::Hash::hash(__self_0, state), - CopyOption::Freeze(__self_0) => ::core::hash::Hash::hash(__self_0, state), - CopyOption::Delimiter(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyOption::Null(__self_0) => ::core::hash::Hash::hash(__self_0, state), - CopyOption::Header(__self_0) => ::core::hash::Hash::hash(__self_0, state), - CopyOption::Quote(__self_0) => ::core::hash::Hash::hash(__self_0, state), - CopyOption::Escape(__self_0) => ::core::hash::Hash::hash(__self_0, state), - CopyOption::ForceQuote(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyOption::ForceNotNull(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyOption::ForceNull(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyOption::Encoding(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for CopyOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use CopyOption::*; - match self { - Format(name) => f.write_fmt(format_args!("FORMAT {0}", name)), - Freeze(true) => f.write_fmt(format_args!("FREEZE")), - Freeze(false) => f.write_fmt(format_args!("FREEZE FALSE")), - Delimiter(char) => f.write_fmt(format_args!("DELIMITER \'{0}\'", char)), - Null(string) => { - f.write_fmt( - format_args!( - "NULL \'{0}\'", - value::escape_single_quote_string(string), - ), - ) - } - Header(true) => f.write_fmt(format_args!("HEADER")), - Header(false) => f.write_fmt(format_args!("HEADER FALSE")), - Quote(char) => f.write_fmt(format_args!("QUOTE \'{0}\'", char)), - Escape(char) => f.write_fmt(format_args!("ESCAPE \'{0}\'", char)), - ForceQuote(columns) => { - f.write_fmt( - format_args!( - "FORCE_QUOTE ({0})", - display_comma_separated(columns), - ), - ) - } - ForceNotNull(columns) => { - f.write_fmt( - format_args!( - "FORCE_NOT_NULL ({0})", - display_comma_separated(columns), - ), - ) - } - ForceNull(columns) => { - f.write_fmt( - format_args!( - "FORCE_NULL ({0})", - display_comma_separated(columns), - ), - ) - } - Encoding(name) => { - f.write_fmt( - format_args!( - "ENCODING \'{0}\'", - value::escape_single_quote_string(name), - ), - ) - } - } - } - } - /// An option in `COPY` statement before PostgreSQL version 9.0. - /// - /// - pub enum CopyLegacyOption { - /// BINARY - Binary, - /// DELIMITER \[ AS \] 'delimiter_character' - Delimiter(char), - /// NULL \[ AS \] 'null_string' - Null(String), - /// CSV ... - Csv(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for CopyLegacyOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CopyLegacyOption::Binary => { - ::core::fmt::Formatter::write_str(f, "Binary") - } - CopyLegacyOption::Delimiter(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Delimiter", - &__self_0, - ) - } - CopyLegacyOption::Null(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Null", - &__self_0, - ) - } - CopyLegacyOption::Csv(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Csv", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CopyLegacyOption { - #[inline] - fn clone(&self) -> CopyLegacyOption { - match self { - CopyLegacyOption::Binary => CopyLegacyOption::Binary, - CopyLegacyOption::Delimiter(__self_0) => { - CopyLegacyOption::Delimiter(::core::clone::Clone::clone(__self_0)) - } - CopyLegacyOption::Null(__self_0) => { - CopyLegacyOption::Null(::core::clone::Clone::clone(__self_0)) - } - CopyLegacyOption::Csv(__self_0) => { - CopyLegacyOption::Csv(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CopyLegacyOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CopyLegacyOption { - #[inline] - fn eq(&self, other: &CopyLegacyOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CopyLegacyOption::Delimiter(__self_0), - CopyLegacyOption::Delimiter(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CopyLegacyOption::Null(__self_0), - CopyLegacyOption::Null(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CopyLegacyOption::Csv(__self_0), - CopyLegacyOption::Csv(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CopyLegacyOption { - #[inline] - fn partial_cmp( - &self, - other: &CopyLegacyOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CopyLegacyOption::Delimiter(__self_0), - CopyLegacyOption::Delimiter(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (CopyLegacyOption::Null(__self_0), CopyLegacyOption::Null(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CopyLegacyOption::Csv(__self_0), CopyLegacyOption::Csv(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CopyLegacyOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CopyLegacyOption { - #[inline] - fn cmp(&self, other: &CopyLegacyOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CopyLegacyOption::Delimiter(__self_0), - CopyLegacyOption::Delimiter(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyLegacyOption::Null(__self_0), - CopyLegacyOption::Null(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyLegacyOption::Csv(__self_0), - CopyLegacyOption::Csv(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CopyLegacyOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CopyLegacyOption::Delimiter(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyLegacyOption::Null(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyLegacyOption::Csv(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for CopyLegacyOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use CopyLegacyOption::*; - match self { - Binary => f.write_fmt(format_args!("BINARY")), - Delimiter(char) => f.write_fmt(format_args!("DELIMITER \'{0}\'", char)), - Null(string) => { - f.write_fmt( - format_args!( - "NULL \'{0}\'", - value::escape_single_quote_string(string), - ), - ) - } - Csv(opts) => { - f.write_fmt(format_args!("CSV {0}", display_separated(opts, " "))) - } - } - } - } - /// A `CSV` option in `COPY` statement before PostgreSQL version 9.0. - /// - /// - pub enum CopyLegacyCsvOption { - /// HEADER - Header, - /// QUOTE \[ AS \] 'quote_character' - Quote(char), - /// ESCAPE \[ AS \] 'escape_character' - Escape(char), - /// FORCE QUOTE { column_name [, ...] | * } - ForceQuote(Vec), - /// FORCE NOT NULL column_name [, ...] - ForceNotNull(Vec), - } - #[automatically_derived] - impl ::core::fmt::Debug for CopyLegacyCsvOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CopyLegacyCsvOption::Header => { - ::core::fmt::Formatter::write_str(f, "Header") - } - CopyLegacyCsvOption::Quote(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Quote", - &__self_0, - ) - } - CopyLegacyCsvOption::Escape(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Escape", - &__self_0, - ) - } - CopyLegacyCsvOption::ForceQuote(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ForceQuote", - &__self_0, - ) - } - CopyLegacyCsvOption::ForceNotNull(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ForceNotNull", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CopyLegacyCsvOption { - #[inline] - fn clone(&self) -> CopyLegacyCsvOption { - match self { - CopyLegacyCsvOption::Header => CopyLegacyCsvOption::Header, - CopyLegacyCsvOption::Quote(__self_0) => { - CopyLegacyCsvOption::Quote(::core::clone::Clone::clone(__self_0)) - } - CopyLegacyCsvOption::Escape(__self_0) => { - CopyLegacyCsvOption::Escape(::core::clone::Clone::clone(__self_0)) - } - CopyLegacyCsvOption::ForceQuote(__self_0) => { - CopyLegacyCsvOption::ForceQuote( - ::core::clone::Clone::clone(__self_0), - ) - } - CopyLegacyCsvOption::ForceNotNull(__self_0) => { - CopyLegacyCsvOption::ForceNotNull( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CopyLegacyCsvOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CopyLegacyCsvOption { - #[inline] - fn eq(&self, other: &CopyLegacyCsvOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CopyLegacyCsvOption::Quote(__self_0), - CopyLegacyCsvOption::Quote(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CopyLegacyCsvOption::Escape(__self_0), - CopyLegacyCsvOption::Escape(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CopyLegacyCsvOption::ForceQuote(__self_0), - CopyLegacyCsvOption::ForceQuote(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CopyLegacyCsvOption::ForceNotNull(__self_0), - CopyLegacyCsvOption::ForceNotNull(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CopyLegacyCsvOption { - #[inline] - fn partial_cmp( - &self, - other: &CopyLegacyCsvOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CopyLegacyCsvOption::Quote(__self_0), - CopyLegacyCsvOption::Quote(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CopyLegacyCsvOption::Escape(__self_0), - CopyLegacyCsvOption::Escape(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CopyLegacyCsvOption::ForceQuote(__self_0), - CopyLegacyCsvOption::ForceQuote(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CopyLegacyCsvOption::ForceNotNull(__self_0), - CopyLegacyCsvOption::ForceNotNull(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CopyLegacyCsvOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CopyLegacyCsvOption { - #[inline] - fn cmp(&self, other: &CopyLegacyCsvOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CopyLegacyCsvOption::Quote(__self_0), - CopyLegacyCsvOption::Quote(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyLegacyCsvOption::Escape(__self_0), - CopyLegacyCsvOption::Escape(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyLegacyCsvOption::ForceQuote(__self_0), - CopyLegacyCsvOption::ForceQuote(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CopyLegacyCsvOption::ForceNotNull(__self_0), - CopyLegacyCsvOption::ForceNotNull(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CopyLegacyCsvOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CopyLegacyCsvOption::Quote(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyLegacyCsvOption::Escape(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyLegacyCsvOption::ForceQuote(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CopyLegacyCsvOption::ForceNotNull(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for CopyLegacyCsvOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - use CopyLegacyCsvOption::*; - match self { - Header => f.write_fmt(format_args!("HEADER")), - Quote(char) => f.write_fmt(format_args!("QUOTE \'{0}\'", char)), - Escape(char) => f.write_fmt(format_args!("ESCAPE \'{0}\'", char)), - ForceQuote(columns) => { - f.write_fmt( - format_args!("FORCE QUOTE {0}", display_comma_separated(columns)), - ) - } - ForceNotNull(columns) => { - f.write_fmt( - format_args!( - "FORCE NOT NULL {0}", - display_comma_separated(columns), - ), - ) - } - } - } - } - /// Variant of `WHEN` clause used within a `MERGE` Statement. - /// - /// Example: - /// ```sql - /// MERGE INTO T USING U ON FALSE WHEN MATCHED THEN DELETE - /// ``` - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/merge) - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - pub enum MergeClauseKind { - /// `WHEN MATCHED` - Matched, - /// `WHEN NOT MATCHED` - NotMatched, - /// `WHEN MATCHED BY TARGET` - /// - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - NotMatchedByTarget, - /// `WHEN MATCHED BY SOURCE` - /// - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - NotMatchedBySource, - } - #[automatically_derived] - impl ::core::fmt::Debug for MergeClauseKind { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - MergeClauseKind::Matched => "Matched", - MergeClauseKind::NotMatched => "NotMatched", - MergeClauseKind::NotMatchedByTarget => "NotMatchedByTarget", - MergeClauseKind::NotMatchedBySource => "NotMatchedBySource", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for MergeClauseKind { - #[inline] - fn clone(&self) -> MergeClauseKind { - match self { - MergeClauseKind::Matched => MergeClauseKind::Matched, - MergeClauseKind::NotMatched => MergeClauseKind::NotMatched, - MergeClauseKind::NotMatchedByTarget => { - MergeClauseKind::NotMatchedByTarget - } - MergeClauseKind::NotMatchedBySource => { - MergeClauseKind::NotMatchedBySource - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MergeClauseKind {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MergeClauseKind { - #[inline] - fn eq(&self, other: &MergeClauseKind) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MergeClauseKind { - #[inline] - fn partial_cmp( - &self, - other: &MergeClauseKind, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MergeClauseKind { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for MergeClauseKind { - #[inline] - fn cmp(&self, other: &MergeClauseKind) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for MergeClauseKind { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl Display for MergeClauseKind { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - MergeClauseKind::Matched => f.write_fmt(format_args!("MATCHED")), - MergeClauseKind::NotMatched => f.write_fmt(format_args!("NOT MATCHED")), - MergeClauseKind::NotMatchedByTarget => { - f.write_fmt(format_args!("NOT MATCHED BY TARGET")) - } - MergeClauseKind::NotMatchedBySource => { - f.write_fmt(format_args!("NOT MATCHED BY SOURCE")) - } - } - } - } - /// The type of expression used to insert rows within a `MERGE` statement. - /// - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/merge) - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - pub enum MergeInsertKind { - /// The insert expression is defined from an explicit `VALUES` clause - /// - /// Example: - /// ```sql - /// INSERT VALUES(product, quantity) - /// ``` - Values(Values), - /// The insert expression is defined using only the `ROW` keyword. - /// - /// Example: - /// ```sql - /// INSERT ROW - /// ``` - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - Row, - } - #[automatically_derived] - impl ::core::fmt::Debug for MergeInsertKind { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - MergeInsertKind::Values(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Values", - &__self_0, - ) - } - MergeInsertKind::Row => ::core::fmt::Formatter::write_str(f, "Row"), - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for MergeInsertKind { - #[inline] - fn clone(&self) -> MergeInsertKind { - match self { - MergeInsertKind::Values(__self_0) => { - MergeInsertKind::Values(::core::clone::Clone::clone(__self_0)) - } - MergeInsertKind::Row => MergeInsertKind::Row, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MergeInsertKind {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MergeInsertKind { - #[inline] - fn eq(&self, other: &MergeInsertKind) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - MergeInsertKind::Values(__self_0), - MergeInsertKind::Values(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MergeInsertKind { - #[inline] - fn partial_cmp( - &self, - other: &MergeInsertKind, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - MergeInsertKind::Values(__self_0), - MergeInsertKind::Values(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MergeInsertKind { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for MergeInsertKind { - #[inline] - fn cmp(&self, other: &MergeInsertKind) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - MergeInsertKind::Values(__self_0), - MergeInsertKind::Values(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for MergeInsertKind { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - MergeInsertKind::Values(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl Display for MergeInsertKind { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - MergeInsertKind::Values(values) => { - f.write_fmt(format_args!("{0}", values)) - } - MergeInsertKind::Row => f.write_fmt(format_args!("ROW")), - } - } - } - /// The expression used to insert rows within a `MERGE` statement. - /// - /// Examples - /// ```sql - /// INSERT (product, quantity) VALUES(product, quantity) - /// INSERT ROW - /// ``` - /// - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/merge) - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - pub struct MergeInsertExpr { - /// Columns (if any) specified by the insert. - /// - /// Example: - /// ```sql - /// INSERT (product, quantity) VALUES(product, quantity) - /// INSERT (product, quantity) ROW - /// ``` - pub columns: Vec, - /// The insert type used by the statement. - pub kind: MergeInsertKind, - } - #[automatically_derived] - impl ::core::fmt::Debug for MergeInsertExpr { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "MergeInsertExpr", - "columns", - &self.columns, - "kind", - &&self.kind, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for MergeInsertExpr { - #[inline] - fn clone(&self) -> MergeInsertExpr { - MergeInsertExpr { - columns: ::core::clone::Clone::clone(&self.columns), - kind: ::core::clone::Clone::clone(&self.kind), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MergeInsertExpr {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MergeInsertExpr { - #[inline] - fn eq(&self, other: &MergeInsertExpr) -> bool { - self.columns == other.columns && self.kind == other.kind - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MergeInsertExpr { - #[inline] - fn partial_cmp( - &self, - other: &MergeInsertExpr, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.columns, &other.columns) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.kind, &other.kind) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MergeInsertExpr { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for MergeInsertExpr { - #[inline] - fn cmp(&self, other: &MergeInsertExpr) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.columns, &other.columns) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.kind, &other.kind) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for MergeInsertExpr { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.columns, state); - ::core::hash::Hash::hash(&self.kind, state) - } - } - impl Display for MergeInsertExpr { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if !self.columns.is_empty() { - f.write_fmt( - format_args!( - "({0}) ", - display_comma_separated(self.columns.as_slice()), - ), - )?; - } - f.write_fmt(format_args!("{0}", self.kind)) - } - } - /// Underlying statement of a when clause within a `MERGE` Statement - /// - /// Example - /// ```sql - /// INSERT (product, quantity) VALUES(product, quantity) - /// ``` - /// - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/merge) - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - pub enum MergeAction { - /// An `INSERT` clause - /// - /// Example: - /// ```sql - /// INSERT (product, quantity) VALUES(product, quantity) - /// ``` - Insert(MergeInsertExpr), - /// An `UPDATE` clause - /// - /// Example: - /// ```sql - /// UPDATE SET quantity = T.quantity + S.quantity - /// ``` - Update { assignments: Vec }, - /// A plain `DELETE` clause - Delete, - } - #[automatically_derived] - impl ::core::fmt::Debug for MergeAction { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - MergeAction::Insert(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Insert", - &__self_0, - ) - } - MergeAction::Update { assignments: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Update", - "assignments", - &__self_0, - ) - } - MergeAction::Delete => ::core::fmt::Formatter::write_str(f, "Delete"), - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for MergeAction { - #[inline] - fn clone(&self) -> MergeAction { - match self { - MergeAction::Insert(__self_0) => { - MergeAction::Insert(::core::clone::Clone::clone(__self_0)) - } - MergeAction::Update { assignments: __self_0 } => { - MergeAction::Update { - assignments: ::core::clone::Clone::clone(__self_0), - } - } - MergeAction::Delete => MergeAction::Delete, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MergeAction {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MergeAction { - #[inline] - fn eq(&self, other: &MergeAction) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (MergeAction::Insert(__self_0), MergeAction::Insert(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - MergeAction::Update { assignments: __self_0 }, - MergeAction::Update { assignments: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MergeAction { - #[inline] - fn partial_cmp( - &self, - other: &MergeAction, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (MergeAction::Insert(__self_0), MergeAction::Insert(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - MergeAction::Update { assignments: __self_0 }, - MergeAction::Update { assignments: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MergeAction { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for MergeAction { - #[inline] - fn cmp(&self, other: &MergeAction) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - MergeAction::Insert(__self_0), - MergeAction::Insert(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - MergeAction::Update { assignments: __self_0 }, - MergeAction::Update { assignments: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for MergeAction { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - MergeAction::Insert(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - MergeAction::Update { assignments: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl Display for MergeAction { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - MergeAction::Insert(insert) => { - f.write_fmt(format_args!("INSERT {0}", insert)) - } - MergeAction::Update { assignments } => { - f.write_fmt( - format_args!( - "UPDATE SET {0}", - display_comma_separated(assignments), - ), - ) - } - MergeAction::Delete => f.write_fmt(format_args!("DELETE")), - } - } - } - /// A when clause within a `MERGE` Statement - /// - /// Example: - /// ```sql - /// WHEN NOT MATCHED BY SOURCE AND product LIKE '%washer%' THEN DELETE - /// ``` - /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/merge) - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dml-syntax#merge_statement) - pub struct MergeClause { - pub clause_kind: MergeClauseKind, - pub predicate: Option, - pub action: MergeAction, - } - #[automatically_derived] - impl ::core::fmt::Debug for MergeClause { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "MergeClause", - "clause_kind", - &self.clause_kind, - "predicate", - &self.predicate, - "action", - &&self.action, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for MergeClause { - #[inline] - fn clone(&self) -> MergeClause { - MergeClause { - clause_kind: ::core::clone::Clone::clone(&self.clause_kind), - predicate: ::core::clone::Clone::clone(&self.predicate), - action: ::core::clone::Clone::clone(&self.action), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MergeClause {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MergeClause { - #[inline] - fn eq(&self, other: &MergeClause) -> bool { - self.clause_kind == other.clause_kind && self.predicate == other.predicate - && self.action == other.action - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MergeClause { - #[inline] - fn partial_cmp( - &self, - other: &MergeClause, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.clause_kind, - &other.clause_kind, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.predicate, - &other.predicate, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.action, - &other.action, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MergeClause { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for MergeClause { - #[inline] - fn cmp(&self, other: &MergeClause) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.clause_kind, &other.clause_kind) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.predicate, &other.predicate) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.action, &other.action) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for MergeClause { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.clause_kind, state); - ::core::hash::Hash::hash(&self.predicate, state); - ::core::hash::Hash::hash(&self.action, state) - } - } - impl Display for MergeClause { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let MergeClause { clause_kind, predicate, action } = self; - f.write_fmt(format_args!("WHEN {0}", clause_kind))?; - if let Some(pred) = predicate { - f.write_fmt(format_args!(" AND {0}", pred))?; - } - f.write_fmt(format_args!(" THEN {0}", action)) - } - } - pub enum DiscardObject { - ALL, - PLANS, - SEQUENCES, - TEMP, - } - #[automatically_derived] - impl ::core::fmt::Debug for DiscardObject { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - DiscardObject::ALL => "ALL", - DiscardObject::PLANS => "PLANS", - DiscardObject::SEQUENCES => "SEQUENCES", - DiscardObject::TEMP => "TEMP", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for DiscardObject {} - #[automatically_derived] - impl ::core::clone::Clone for DiscardObject { - #[inline] - fn clone(&self) -> DiscardObject { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for DiscardObject {} - #[automatically_derived] - impl ::core::cmp::PartialEq for DiscardObject { - #[inline] - fn eq(&self, other: &DiscardObject) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for DiscardObject { - #[inline] - fn partial_cmp( - &self, - other: &DiscardObject, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for DiscardObject { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for DiscardObject { - #[inline] - fn cmp(&self, other: &DiscardObject) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for DiscardObject { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for DiscardObject { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - DiscardObject::ALL => f.write_str("ALL"), - DiscardObject::PLANS => f.write_str("PLANS"), - DiscardObject::SEQUENCES => f.write_str("SEQUENCES"), - DiscardObject::TEMP => f.write_str("TEMP"), - } - } - } - pub enum FlushType { - BinaryLogs, - EngineLogs, - ErrorLogs, - GeneralLogs, - Hosts, - Logs, - Privileges, - OptimizerCosts, - RelayLogs, - SlowLogs, - Status, - UserResources, - Tables, - } - #[automatically_derived] - impl ::core::fmt::Debug for FlushType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FlushType::BinaryLogs => "BinaryLogs", - FlushType::EngineLogs => "EngineLogs", - FlushType::ErrorLogs => "ErrorLogs", - FlushType::GeneralLogs => "GeneralLogs", - FlushType::Hosts => "Hosts", - FlushType::Logs => "Logs", - FlushType::Privileges => "Privileges", - FlushType::OptimizerCosts => "OptimizerCosts", - FlushType::RelayLogs => "RelayLogs", - FlushType::SlowLogs => "SlowLogs", - FlushType::Status => "Status", - FlushType::UserResources => "UserResources", - FlushType::Tables => "Tables", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for FlushType {} - #[automatically_derived] - impl ::core::clone::Clone for FlushType { - #[inline] - fn clone(&self) -> FlushType { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FlushType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FlushType { - #[inline] - fn eq(&self, other: &FlushType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FlushType { - #[inline] - fn partial_cmp( - &self, - other: &FlushType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FlushType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FlushType { - #[inline] - fn cmp(&self, other: &FlushType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FlushType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FlushType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FlushType::BinaryLogs => f.write_str("BINARY LOGS"), - FlushType::EngineLogs => f.write_str("ENGINE LOGS"), - FlushType::ErrorLogs => f.write_str("ERROR LOGS"), - FlushType::GeneralLogs => f.write_str("GENERAL LOGS"), - FlushType::Hosts => f.write_str("HOSTS"), - FlushType::Logs => f.write_str("LOGS"), - FlushType::Privileges => f.write_str("PRIVILEGES"), - FlushType::OptimizerCosts => f.write_str("OPTIMIZER_COSTS"), - FlushType::RelayLogs => f.write_str("RELAY LOGS"), - FlushType::SlowLogs => f.write_str("SLOW LOGS"), - FlushType::Status => f.write_str("STATUS"), - FlushType::UserResources => f.write_str("USER_RESOURCES"), - FlushType::Tables => f.write_str("TABLES"), - } - } - } - pub enum FlushLocation { - NoWriteToBinlog, - Local, - } - #[automatically_derived] - impl ::core::fmt::Debug for FlushLocation { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FlushLocation::NoWriteToBinlog => "NoWriteToBinlog", - FlushLocation::Local => "Local", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for FlushLocation {} - #[automatically_derived] - impl ::core::clone::Clone for FlushLocation { - #[inline] - fn clone(&self) -> FlushLocation { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FlushLocation {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FlushLocation { - #[inline] - fn eq(&self, other: &FlushLocation) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FlushLocation { - #[inline] - fn partial_cmp( - &self, - other: &FlushLocation, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FlushLocation { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FlushLocation { - #[inline] - fn cmp(&self, other: &FlushLocation) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FlushLocation { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FlushLocation { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FlushLocation::NoWriteToBinlog => f.write_str("NO_WRITE_TO_BINLOG"), - FlushLocation::Local => f.write_str("LOCAL"), - } - } - } - /// Optional context modifier for statements that can be or `LOCAL`, or `SESSION`. - pub enum ContextModifier { - /// No context defined. Each dialect defines the default in this scenario. - None, - /// `LOCAL` identifier, usually related to transactional states. - Local, - /// `SESSION` identifier - Session, - } - #[automatically_derived] - impl ::core::fmt::Debug for ContextModifier { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ContextModifier::None => "None", - ContextModifier::Local => "Local", - ContextModifier::Session => "Session", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for ContextModifier {} - #[automatically_derived] - impl ::core::clone::Clone for ContextModifier { - #[inline] - fn clone(&self) -> ContextModifier { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ContextModifier {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ContextModifier { - #[inline] - fn eq(&self, other: &ContextModifier) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ContextModifier { - #[inline] - fn partial_cmp( - &self, - other: &ContextModifier, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ContextModifier { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ContextModifier { - #[inline] - fn cmp(&self, other: &ContextModifier) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ContextModifier { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ContextModifier { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::None => f.write_fmt(format_args!("")), - Self::Local => f.write_fmt(format_args!(" LOCAL")), - Self::Session => f.write_fmt(format_args!(" SESSION")), - } - } - } - /// Function describe in DROP FUNCTION. - pub enum DropFunctionOption { - Restrict, - Cascade, - } - #[automatically_derived] - impl ::core::fmt::Debug for DropFunctionOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - DropFunctionOption::Restrict => "Restrict", - DropFunctionOption::Cascade => "Cascade", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for DropFunctionOption { - #[inline] - fn clone(&self) -> DropFunctionOption { - match self { - DropFunctionOption::Restrict => DropFunctionOption::Restrict, - DropFunctionOption::Cascade => DropFunctionOption::Cascade, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for DropFunctionOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for DropFunctionOption { - #[inline] - fn eq(&self, other: &DropFunctionOption) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for DropFunctionOption { - #[inline] - fn partial_cmp( - &self, - other: &DropFunctionOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for DropFunctionOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for DropFunctionOption { - #[inline] - fn cmp(&self, other: &DropFunctionOption) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for DropFunctionOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for DropFunctionOption { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - DropFunctionOption::Restrict => f.write_fmt(format_args!("RESTRICT ")), - DropFunctionOption::Cascade => f.write_fmt(format_args!("CASCADE ")), - } - } - } - /// Generic function description for DROP FUNCTION and CREATE TRIGGER. - pub struct FunctionDesc { - pub name: ObjectName, - pub args: Option>, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionDesc { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "FunctionDesc", - "name", - &self.name, - "args", - &&self.args, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionDesc { - #[inline] - fn clone(&self) -> FunctionDesc { - FunctionDesc { - name: ::core::clone::Clone::clone(&self.name), - args: ::core::clone::Clone::clone(&self.args), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionDesc {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionDesc { - #[inline] - fn eq(&self, other: &FunctionDesc) -> bool { - self.name == other.name && self.args == other.args - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionDesc { - #[inline] - fn partial_cmp( - &self, - other: &FunctionDesc, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.args, &other.args) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionDesc { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionDesc { - #[inline] - fn cmp(&self, other: &FunctionDesc) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.name, &other.name) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.args, &other.args) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionDesc { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.name, state); - ::core::hash::Hash::hash(&self.args, state) - } - } - impl fmt::Display for FunctionDesc { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0}", self.name))?; - if let Some(args) = &self.args { - f.write_fmt(format_args!("({0})", display_comma_separated(args)))?; - } - Ok(()) - } - } - /// Function argument in CREATE OR DROP FUNCTION. - pub struct OperateFunctionArg { - pub mode: Option, - pub name: Option, - pub data_type: DataType, - pub default_expr: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for OperateFunctionArg { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field4_finish( - f, - "OperateFunctionArg", - "mode", - &self.mode, - "name", - &self.name, - "data_type", - &self.data_type, - "default_expr", - &&self.default_expr, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for OperateFunctionArg { - #[inline] - fn clone(&self) -> OperateFunctionArg { - OperateFunctionArg { - mode: ::core::clone::Clone::clone(&self.mode), - name: ::core::clone::Clone::clone(&self.name), - data_type: ::core::clone::Clone::clone(&self.data_type), - default_expr: ::core::clone::Clone::clone(&self.default_expr), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for OperateFunctionArg {} - #[automatically_derived] - impl ::core::cmp::PartialEq for OperateFunctionArg { - #[inline] - fn eq(&self, other: &OperateFunctionArg) -> bool { - self.mode == other.mode && self.name == other.name - && self.data_type == other.data_type - && self.default_expr == other.default_expr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for OperateFunctionArg { - #[inline] - fn partial_cmp( - &self, - other: &OperateFunctionArg, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.mode, &other.mode) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.data_type, - &other.data_type, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.default_expr, - &other.default_expr, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for OperateFunctionArg { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for OperateFunctionArg { - #[inline] - fn cmp(&self, other: &OperateFunctionArg) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.mode, &other.mode) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.name, &other.name) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.data_type, - &other.data_type, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp( - &self.default_expr, - &other.default_expr, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for OperateFunctionArg { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.mode, state); - ::core::hash::Hash::hash(&self.name, state); - ::core::hash::Hash::hash(&self.data_type, state); - ::core::hash::Hash::hash(&self.default_expr, state) - } - } - impl OperateFunctionArg { - /// Returns an unnamed argument. - pub fn unnamed(data_type: DataType) -> Self { - Self { - mode: None, - name: None, - data_type, - default_expr: None, - } - } - /// Returns an argument with name. - pub fn with_name(name: &str, data_type: DataType) -> Self { - Self { - mode: None, - name: Some(name.into()), - data_type, - default_expr: None, - } - } - } - impl fmt::Display for OperateFunctionArg { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if let Some(mode) = &self.mode { - f.write_fmt(format_args!("{0} ", mode))?; - } - if let Some(name) = &self.name { - f.write_fmt(format_args!("{0} ", name))?; - } - f.write_fmt(format_args!("{0}", self.data_type))?; - if let Some(default_expr) = &self.default_expr { - f.write_fmt(format_args!(" = {0}", default_expr))?; - } - Ok(()) - } - } - /// The mode of an argument in CREATE FUNCTION. - pub enum ArgMode { - In, - Out, - InOut, - } - #[automatically_derived] - impl ::core::fmt::Debug for ArgMode { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ArgMode::In => "In", - ArgMode::Out => "Out", - ArgMode::InOut => "InOut", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ArgMode { - #[inline] - fn clone(&self) -> ArgMode { - match self { - ArgMode::In => ArgMode::In, - ArgMode::Out => ArgMode::Out, - ArgMode::InOut => ArgMode::InOut, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ArgMode {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ArgMode { - #[inline] - fn eq(&self, other: &ArgMode) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ArgMode { - #[inline] - fn partial_cmp( - &self, - other: &ArgMode, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ArgMode { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ArgMode { - #[inline] - fn cmp(&self, other: &ArgMode) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ArgMode { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ArgMode { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ArgMode::In => f.write_fmt(format_args!("IN")), - ArgMode::Out => f.write_fmt(format_args!("OUT")), - ArgMode::InOut => f.write_fmt(format_args!("INOUT")), - } - } - } - /// These attributes inform the query optimizer about the behavior of the function. - pub enum FunctionBehavior { - Immutable, - Stable, - Volatile, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionBehavior { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FunctionBehavior::Immutable => "Immutable", - FunctionBehavior::Stable => "Stable", - FunctionBehavior::Volatile => "Volatile", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionBehavior { - #[inline] - fn clone(&self) -> FunctionBehavior { - match self { - FunctionBehavior::Immutable => FunctionBehavior::Immutable, - FunctionBehavior::Stable => FunctionBehavior::Stable, - FunctionBehavior::Volatile => FunctionBehavior::Volatile, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionBehavior {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionBehavior { - #[inline] - fn eq(&self, other: &FunctionBehavior) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionBehavior { - #[inline] - fn partial_cmp( - &self, - other: &FunctionBehavior, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionBehavior { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionBehavior { - #[inline] - fn cmp(&self, other: &FunctionBehavior) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionBehavior { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FunctionBehavior { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FunctionBehavior::Immutable => f.write_fmt(format_args!("IMMUTABLE")), - FunctionBehavior::Stable => f.write_fmt(format_args!("STABLE")), - FunctionBehavior::Volatile => f.write_fmt(format_args!("VOLATILE")), - } - } - } - /// These attributes describe the behavior of the function when called with a null argument. - pub enum FunctionCalledOnNull { - CalledOnNullInput, - ReturnsNullOnNullInput, - Strict, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionCalledOnNull { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FunctionCalledOnNull::CalledOnNullInput => "CalledOnNullInput", - FunctionCalledOnNull::ReturnsNullOnNullInput => { - "ReturnsNullOnNullInput" - } - FunctionCalledOnNull::Strict => "Strict", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionCalledOnNull { - #[inline] - fn clone(&self) -> FunctionCalledOnNull { - match self { - FunctionCalledOnNull::CalledOnNullInput => { - FunctionCalledOnNull::CalledOnNullInput - } - FunctionCalledOnNull::ReturnsNullOnNullInput => { - FunctionCalledOnNull::ReturnsNullOnNullInput - } - FunctionCalledOnNull::Strict => FunctionCalledOnNull::Strict, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionCalledOnNull {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionCalledOnNull { - #[inline] - fn eq(&self, other: &FunctionCalledOnNull) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionCalledOnNull { - #[inline] - fn partial_cmp( - &self, - other: &FunctionCalledOnNull, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionCalledOnNull { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionCalledOnNull { - #[inline] - fn cmp(&self, other: &FunctionCalledOnNull) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionCalledOnNull { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FunctionCalledOnNull { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FunctionCalledOnNull::CalledOnNullInput => { - f.write_fmt(format_args!("CALLED ON NULL INPUT")) - } - FunctionCalledOnNull::ReturnsNullOnNullInput => { - f.write_fmt(format_args!("RETURNS NULL ON NULL INPUT")) - } - FunctionCalledOnNull::Strict => f.write_fmt(format_args!("STRICT")), - } - } - } - /// If it is safe for PostgreSQL to call the function from multiple threads at once - pub enum FunctionParallel { - Unsafe, - Restricted, - Safe, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionParallel { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FunctionParallel::Unsafe => "Unsafe", - FunctionParallel::Restricted => "Restricted", - FunctionParallel::Safe => "Safe", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionParallel { - #[inline] - fn clone(&self) -> FunctionParallel { - match self { - FunctionParallel::Unsafe => FunctionParallel::Unsafe, - FunctionParallel::Restricted => FunctionParallel::Restricted, - FunctionParallel::Safe => FunctionParallel::Safe, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionParallel {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionParallel { - #[inline] - fn eq(&self, other: &FunctionParallel) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionParallel { - #[inline] - fn partial_cmp( - &self, - other: &FunctionParallel, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionParallel { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionParallel { - #[inline] - fn cmp(&self, other: &FunctionParallel) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionParallel { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FunctionParallel { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FunctionParallel::Unsafe => f.write_fmt(format_args!("PARALLEL UNSAFE")), - FunctionParallel::Restricted => { - f.write_fmt(format_args!("PARALLEL RESTRICTED")) - } - FunctionParallel::Safe => f.write_fmt(format_args!("PARALLEL SAFE")), - } - } - } - /// [BigQuery] Determinism specifier used in a UDF definition. - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#syntax_11 - pub enum FunctionDeterminismSpecifier { - Deterministic, - NotDeterministic, - } - #[automatically_derived] - impl ::core::fmt::Debug for FunctionDeterminismSpecifier { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - FunctionDeterminismSpecifier::Deterministic => "Deterministic", - FunctionDeterminismSpecifier::NotDeterministic => "NotDeterministic", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for FunctionDeterminismSpecifier { - #[inline] - fn clone(&self) -> FunctionDeterminismSpecifier { - match self { - FunctionDeterminismSpecifier::Deterministic => { - FunctionDeterminismSpecifier::Deterministic - } - FunctionDeterminismSpecifier::NotDeterministic => { - FunctionDeterminismSpecifier::NotDeterministic - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for FunctionDeterminismSpecifier {} - #[automatically_derived] - impl ::core::cmp::PartialEq for FunctionDeterminismSpecifier { - #[inline] - fn eq(&self, other: &FunctionDeterminismSpecifier) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for FunctionDeterminismSpecifier { - #[inline] - fn partial_cmp( - &self, - other: &FunctionDeterminismSpecifier, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for FunctionDeterminismSpecifier { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for FunctionDeterminismSpecifier { - #[inline] - fn cmp(&self, other: &FunctionDeterminismSpecifier) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for FunctionDeterminismSpecifier { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for FunctionDeterminismSpecifier { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - FunctionDeterminismSpecifier::Deterministic => { - f.write_fmt(format_args!("DETERMINISTIC")) - } - FunctionDeterminismSpecifier::NotDeterministic => { - f.write_fmt(format_args!("NOT DETERMINISTIC")) - } - } - } - } - /// Represent the expression body of a `CREATE FUNCTION` statement as well as - /// where within the statement, the body shows up. - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#syntax_11 - /// [Postgres]: https://www.postgresql.org/docs/15/sql-createfunction.html - pub enum CreateFunctionBody { - /// A function body expression using the 'AS' keyword and shows up - /// before any `OPTIONS` clause. - /// - /// Example: - /// ```sql - /// CREATE FUNCTION myfunc(x FLOAT64, y FLOAT64) RETURNS FLOAT64 - /// AS (x * y) - /// OPTIONS(description="desc"); - /// ``` - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#syntax_11 - AsBeforeOptions(Expr), - /// A function body expression using the 'AS' keyword and shows up - /// after any `OPTIONS` clause. - /// - /// Example: - /// ```sql - /// CREATE FUNCTION myfunc(x FLOAT64, y FLOAT64) RETURNS FLOAT64 - /// OPTIONS(description="desc") - /// AS (x * y); - /// ``` - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#syntax_11 - AsAfterOptions(Expr), - /// Function body expression using the 'RETURN' keyword. - /// - /// Example: - /// ```sql - /// CREATE FUNCTION myfunc(a INTEGER, IN b INTEGER = 1) RETURNS INTEGER - /// LANGUAGE SQL - /// RETURN a + b; - /// ``` - /// - /// [Postgres]: https://www.postgresql.org/docs/current/sql-createfunction.html - Return(Expr), - } - #[automatically_derived] - impl ::core::fmt::Debug for CreateFunctionBody { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CreateFunctionBody::AsBeforeOptions(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "AsBeforeOptions", - &__self_0, - ) - } - CreateFunctionBody::AsAfterOptions(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "AsAfterOptions", - &__self_0, - ) - } - CreateFunctionBody::Return(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Return", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreateFunctionBody { - #[inline] - fn clone(&self) -> CreateFunctionBody { - match self { - CreateFunctionBody::AsBeforeOptions(__self_0) => { - CreateFunctionBody::AsBeforeOptions( - ::core::clone::Clone::clone(__self_0), - ) - } - CreateFunctionBody::AsAfterOptions(__self_0) => { - CreateFunctionBody::AsAfterOptions( - ::core::clone::Clone::clone(__self_0), - ) - } - CreateFunctionBody::Return(__self_0) => { - CreateFunctionBody::Return(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreateFunctionBody {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreateFunctionBody { - #[inline] - fn eq(&self, other: &CreateFunctionBody) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CreateFunctionBody::AsBeforeOptions(__self_0), - CreateFunctionBody::AsBeforeOptions(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CreateFunctionBody::AsAfterOptions(__self_0), - CreateFunctionBody::AsAfterOptions(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CreateFunctionBody::Return(__self_0), - CreateFunctionBody::Return(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreateFunctionBody { - #[inline] - fn partial_cmp( - &self, - other: &CreateFunctionBody, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CreateFunctionBody::AsBeforeOptions(__self_0), - CreateFunctionBody::AsBeforeOptions(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CreateFunctionBody::AsAfterOptions(__self_0), - CreateFunctionBody::AsAfterOptions(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CreateFunctionBody::Return(__self_0), - CreateFunctionBody::Return(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreateFunctionBody { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CreateFunctionBody { - #[inline] - fn cmp(&self, other: &CreateFunctionBody) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CreateFunctionBody::AsBeforeOptions(__self_0), - CreateFunctionBody::AsBeforeOptions(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CreateFunctionBody::AsAfterOptions(__self_0), - CreateFunctionBody::AsAfterOptions(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CreateFunctionBody::Return(__self_0), - CreateFunctionBody::Return(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreateFunctionBody { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CreateFunctionBody::AsBeforeOptions(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CreateFunctionBody::AsAfterOptions(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CreateFunctionBody::Return(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - pub enum CreateFunctionUsing { - Jar(String), - File(String), - Archive(String), - } - #[automatically_derived] - impl ::core::fmt::Debug for CreateFunctionUsing { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CreateFunctionUsing::Jar(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Jar", - &__self_0, - ) - } - CreateFunctionUsing::File(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "File", - &__self_0, - ) - } - CreateFunctionUsing::Archive(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Archive", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreateFunctionUsing { - #[inline] - fn clone(&self) -> CreateFunctionUsing { - match self { - CreateFunctionUsing::Jar(__self_0) => { - CreateFunctionUsing::Jar(::core::clone::Clone::clone(__self_0)) - } - CreateFunctionUsing::File(__self_0) => { - CreateFunctionUsing::File(::core::clone::Clone::clone(__self_0)) - } - CreateFunctionUsing::Archive(__self_0) => { - CreateFunctionUsing::Archive(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreateFunctionUsing {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreateFunctionUsing { - #[inline] - fn eq(&self, other: &CreateFunctionUsing) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - CreateFunctionUsing::Jar(__self_0), - CreateFunctionUsing::Jar(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CreateFunctionUsing::File(__self_0), - CreateFunctionUsing::File(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CreateFunctionUsing::Archive(__self_0), - CreateFunctionUsing::Archive(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreateFunctionUsing { - #[inline] - fn partial_cmp( - &self, - other: &CreateFunctionUsing, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - CreateFunctionUsing::Jar(__self_0), - CreateFunctionUsing::Jar(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CreateFunctionUsing::File(__self_0), - CreateFunctionUsing::File(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - CreateFunctionUsing::Archive(__self_0), - CreateFunctionUsing::Archive(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreateFunctionUsing { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CreateFunctionUsing { - #[inline] - fn cmp(&self, other: &CreateFunctionUsing) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - CreateFunctionUsing::Jar(__self_0), - CreateFunctionUsing::Jar(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CreateFunctionUsing::File(__self_0), - CreateFunctionUsing::File(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CreateFunctionUsing::Archive(__self_0), - CreateFunctionUsing::Archive(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreateFunctionUsing { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CreateFunctionUsing::Jar(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CreateFunctionUsing::File(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CreateFunctionUsing::Archive(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for CreateFunctionUsing { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("USING "))?; - match self { - CreateFunctionUsing::Jar(uri) => { - f.write_fmt(format_args!("JAR \'{0}\'", uri)) - } - CreateFunctionUsing::File(uri) => { - f.write_fmt(format_args!("FILE \'{0}\'", uri)) - } - CreateFunctionUsing::Archive(uri) => { - f.write_fmt(format_args!("ARCHIVE \'{0}\'", uri)) - } - } - } - } - /// `NAME = ` arguments for DuckDB macros - /// - /// See [Create Macro - DuckDB](https://duckdb.org/docs/sql/statements/create_macro) - /// for more details - pub struct MacroArg { - pub name: Ident, - pub default_expr: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for MacroArg { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "MacroArg", - "name", - &self.name, - "default_expr", - &&self.default_expr, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for MacroArg { - #[inline] - fn clone(&self) -> MacroArg { - MacroArg { - name: ::core::clone::Clone::clone(&self.name), - default_expr: ::core::clone::Clone::clone(&self.default_expr), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MacroArg {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MacroArg { - #[inline] - fn eq(&self, other: &MacroArg) -> bool { - self.name == other.name && self.default_expr == other.default_expr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MacroArg { - #[inline] - fn partial_cmp( - &self, - other: &MacroArg, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.default_expr, - &other.default_expr, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MacroArg { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for MacroArg { - #[inline] - fn cmp(&self, other: &MacroArg) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.name, &other.name) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.default_expr, &other.default_expr) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for MacroArg { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.name, state); - ::core::hash::Hash::hash(&self.default_expr, state) - } - } - impl MacroArg { - /// Returns an argument with name. - pub fn new(name: &str) -> Self { - Self { - name: name.into(), - default_expr: None, - } - } - } - impl fmt::Display for MacroArg { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0}", self.name))?; - if let Some(default_expr) = &self.default_expr { - f.write_fmt(format_args!(" := {0}", default_expr))?; - } - Ok(()) - } - } - pub enum MacroDefinition { - Expr(Expr), - Table(Box), - } - #[automatically_derived] - impl ::core::fmt::Debug for MacroDefinition { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - MacroDefinition::Expr(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Expr", - &__self_0, - ) - } - MacroDefinition::Table(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Table", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for MacroDefinition { - #[inline] - fn clone(&self) -> MacroDefinition { - match self { - MacroDefinition::Expr(__self_0) => { - MacroDefinition::Expr(::core::clone::Clone::clone(__self_0)) - } - MacroDefinition::Table(__self_0) => { - MacroDefinition::Table(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for MacroDefinition {} - #[automatically_derived] - impl ::core::cmp::PartialEq for MacroDefinition { - #[inline] - fn eq(&self, other: &MacroDefinition) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - MacroDefinition::Expr(__self_0), - MacroDefinition::Expr(__arg1_0), - ) => __self_0 == __arg1_0, - ( - MacroDefinition::Table(__self_0), - MacroDefinition::Table(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for MacroDefinition { - #[inline] - fn partial_cmp( - &self, - other: &MacroDefinition, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (MacroDefinition::Expr(__self_0), MacroDefinition::Expr(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (MacroDefinition::Table(__self_0), MacroDefinition::Table(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for MacroDefinition { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for MacroDefinition { - #[inline] - fn cmp(&self, other: &MacroDefinition) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - MacroDefinition::Expr(__self_0), - MacroDefinition::Expr(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - MacroDefinition::Table(__self_0), - MacroDefinition::Table(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for MacroDefinition { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - MacroDefinition::Expr(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - MacroDefinition::Table(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for MacroDefinition { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - MacroDefinition::Expr(expr) => f.write_fmt(format_args!("{0}", expr))?, - MacroDefinition::Table(query) => f.write_fmt(format_args!("{0}", query))?, - } - Ok(()) - } - } - /// Schema possible naming variants ([1]). - /// - /// [1]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#schema-definition - pub enum SchemaName { - /// Only schema name specified: ``. - Simple(ObjectName), - /// Only authorization identifier specified: `AUTHORIZATION `. - UnnamedAuthorization(Ident), - /// Both schema name and authorization identifier specified: ` AUTHORIZATION `. - NamedAuthorization(ObjectName, Ident), - } - #[automatically_derived] - impl ::core::fmt::Debug for SchemaName { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - SchemaName::Simple(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Simple", - &__self_0, - ) - } - SchemaName::UnnamedAuthorization(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "UnnamedAuthorization", - &__self_0, - ) - } - SchemaName::NamedAuthorization(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "NamedAuthorization", - __self_0, - &__self_1, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for SchemaName { - #[inline] - fn clone(&self) -> SchemaName { - match self { - SchemaName::Simple(__self_0) => { - SchemaName::Simple(::core::clone::Clone::clone(__self_0)) - } - SchemaName::UnnamedAuthorization(__self_0) => { - SchemaName::UnnamedAuthorization( - ::core::clone::Clone::clone(__self_0), - ) - } - SchemaName::NamedAuthorization(__self_0, __self_1) => { - SchemaName::NamedAuthorization( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SchemaName {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SchemaName { - #[inline] - fn eq(&self, other: &SchemaName) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (SchemaName::Simple(__self_0), SchemaName::Simple(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - SchemaName::UnnamedAuthorization(__self_0), - SchemaName::UnnamedAuthorization(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SchemaName::NamedAuthorization(__self_0, __self_1), - SchemaName::NamedAuthorization(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SchemaName { - #[inline] - fn partial_cmp( - &self, - other: &SchemaName, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (SchemaName::Simple(__self_0), SchemaName::Simple(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - SchemaName::UnnamedAuthorization(__self_0), - SchemaName::UnnamedAuthorization(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SchemaName::NamedAuthorization(__self_0, __self_1), - SchemaName::NamedAuthorization(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SchemaName { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SchemaName { - #[inline] - fn cmp(&self, other: &SchemaName) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (SchemaName::Simple(__self_0), SchemaName::Simple(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - SchemaName::UnnamedAuthorization(__self_0), - SchemaName::UnnamedAuthorization(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SchemaName::NamedAuthorization(__self_0, __self_1), - SchemaName::NamedAuthorization(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SchemaName { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - SchemaName::Simple(__self_0) => ::core::hash::Hash::hash(__self_0, state), - SchemaName::UnnamedAuthorization(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SchemaName::NamedAuthorization(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - } - } - } - impl fmt::Display for SchemaName { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - SchemaName::Simple(name) => f.write_fmt(format_args!("{0}", name)), - SchemaName::UnnamedAuthorization(authorization) => { - f.write_fmt(format_args!("AUTHORIZATION {0}", authorization)) - } - SchemaName::NamedAuthorization(name, authorization) => { - f.write_fmt( - format_args!("{0} AUTHORIZATION {1}", name, authorization), - ) - } - } - } - } - /// Fulltext search modifiers ([1]). - /// - /// [1]: https://dev.mysql.com/doc/refman/8.0/en/fulltext-search.html#function_match - pub enum SearchModifier { - /// `IN NATURAL LANGUAGE MODE`. - InNaturalLanguageMode, - /// `IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION`. - InNaturalLanguageModeWithQueryExpansion, - ///`IN BOOLEAN MODE`. - InBooleanMode, - ///`WITH QUERY EXPANSION`. - WithQueryExpansion, - } - #[automatically_derived] - impl ::core::fmt::Debug for SearchModifier { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - SearchModifier::InNaturalLanguageMode => "InNaturalLanguageMode", - SearchModifier::InNaturalLanguageModeWithQueryExpansion => { - "InNaturalLanguageModeWithQueryExpansion" - } - SearchModifier::InBooleanMode => "InBooleanMode", - SearchModifier::WithQueryExpansion => "WithQueryExpansion", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SearchModifier { - #[inline] - fn clone(&self) -> SearchModifier { - match self { - SearchModifier::InNaturalLanguageMode => { - SearchModifier::InNaturalLanguageMode - } - SearchModifier::InNaturalLanguageModeWithQueryExpansion => { - SearchModifier::InNaturalLanguageModeWithQueryExpansion - } - SearchModifier::InBooleanMode => SearchModifier::InBooleanMode, - SearchModifier::WithQueryExpansion => SearchModifier::WithQueryExpansion, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SearchModifier {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SearchModifier { - #[inline] - fn eq(&self, other: &SearchModifier) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SearchModifier { - #[inline] - fn partial_cmp( - &self, - other: &SearchModifier, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SearchModifier { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for SearchModifier { - #[inline] - fn cmp(&self, other: &SearchModifier) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for SearchModifier { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for SearchModifier { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::InNaturalLanguageMode => { - f.write_fmt(format_args!("IN NATURAL LANGUAGE MODE"))?; - } - Self::InNaturalLanguageModeWithQueryExpansion => { - f.write_fmt( - format_args!("IN NATURAL LANGUAGE MODE WITH QUERY EXPANSION"), - )?; - } - Self::InBooleanMode => { - f.write_fmt(format_args!("IN BOOLEAN MODE"))?; - } - Self::WithQueryExpansion => { - f.write_fmt(format_args!("WITH QUERY EXPANSION"))?; - } - } - Ok(()) - } - } - pub struct LockTable { - pub table: Ident, - pub alias: Option, - pub lock_type: LockTableType, - } - #[automatically_derived] - impl ::core::fmt::Debug for LockTable { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "LockTable", - "table", - &self.table, - "alias", - &self.alias, - "lock_type", - &&self.lock_type, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for LockTable { - #[inline] - fn clone(&self) -> LockTable { - LockTable { - table: ::core::clone::Clone::clone(&self.table), - alias: ::core::clone::Clone::clone(&self.alias), - lock_type: ::core::clone::Clone::clone(&self.lock_type), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for LockTable {} - #[automatically_derived] - impl ::core::cmp::PartialEq for LockTable { - #[inline] - fn eq(&self, other: &LockTable) -> bool { - self.table == other.table && self.alias == other.alias - && self.lock_type == other.lock_type - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for LockTable { - #[inline] - fn partial_cmp( - &self, - other: &LockTable, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.table, &other.table) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.alias, - &other.alias, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.lock_type, - &other.lock_type, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for LockTable { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for LockTable { - #[inline] - fn cmp(&self, other: &LockTable) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.table, &other.table) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.alias, &other.alias) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.lock_type, &other.lock_type) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for LockTable { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.table, state); - ::core::hash::Hash::hash(&self.alias, state); - ::core::hash::Hash::hash(&self.lock_type, state) - } - } - impl fmt::Display for LockTable { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let Self { table: tbl_name, alias, lock_type } = self; - f.write_fmt(format_args!("{0} ", tbl_name))?; - if let Some(alias) = alias { - f.write_fmt(format_args!("AS {0} ", alias))?; - } - f.write_fmt(format_args!("{0}", lock_type))?; - Ok(()) - } - } - pub enum LockTableType { - Read { local: bool }, - Write { low_priority: bool }, - } - #[automatically_derived] - impl ::core::fmt::Debug for LockTableType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - LockTableType::Read { local: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Read", - "local", - &__self_0, - ) - } - LockTableType::Write { low_priority: __self_0 } => { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "Write", - "low_priority", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for LockTableType { - #[inline] - fn clone(&self) -> LockTableType { - match self { - LockTableType::Read { local: __self_0 } => { - LockTableType::Read { - local: ::core::clone::Clone::clone(__self_0), - } - } - LockTableType::Write { low_priority: __self_0 } => { - LockTableType::Write { - low_priority: ::core::clone::Clone::clone(__self_0), - } - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for LockTableType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for LockTableType { - #[inline] - fn eq(&self, other: &LockTableType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - LockTableType::Read { local: __self_0 }, - LockTableType::Read { local: __arg1_0 }, - ) => __self_0 == __arg1_0, - ( - LockTableType::Write { low_priority: __self_0 }, - LockTableType::Write { low_priority: __arg1_0 }, - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for LockTableType { - #[inline] - fn partial_cmp( - &self, - other: &LockTableType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - LockTableType::Read { local: __self_0 }, - LockTableType::Read { local: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - LockTableType::Write { low_priority: __self_0 }, - LockTableType::Write { low_priority: __arg1_0 }, - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for LockTableType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for LockTableType { - #[inline] - fn cmp(&self, other: &LockTableType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - LockTableType::Read { local: __self_0 }, - LockTableType::Read { local: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - LockTableType::Write { low_priority: __self_0 }, - LockTableType::Write { low_priority: __arg1_0 }, - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for LockTableType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - LockTableType::Read { local: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - LockTableType::Write { low_priority: __self_0 } => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for LockTableType { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - Self::Read { local } => { - f.write_fmt(format_args!("READ"))?; - if *local { - f.write_fmt(format_args!(" LOCAL"))?; - } - } - Self::Write { low_priority } => { - if *low_priority { - f.write_fmt(format_args!("LOW_PRIORITY "))?; - } - f.write_fmt(format_args!("WRITE"))?; - } - } - Ok(()) - } - } - pub struct HiveSetLocation { - pub has_set: bool, - pub location: Ident, - } - #[automatically_derived] - impl ::core::fmt::Debug for HiveSetLocation { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "HiveSetLocation", - "has_set", - &self.has_set, - "location", - &&self.location, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for HiveSetLocation { - #[inline] - fn clone(&self) -> HiveSetLocation { - HiveSetLocation { - has_set: ::core::clone::Clone::clone(&self.has_set), - location: ::core::clone::Clone::clone(&self.location), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for HiveSetLocation {} - #[automatically_derived] - impl ::core::cmp::PartialEq for HiveSetLocation { - #[inline] - fn eq(&self, other: &HiveSetLocation) -> bool { - self.has_set == other.has_set && self.location == other.location - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for HiveSetLocation { - #[inline] - fn partial_cmp( - &self, - other: &HiveSetLocation, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.has_set, &other.has_set) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.location, &other.location) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for HiveSetLocation { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for HiveSetLocation { - #[inline] - fn cmp(&self, other: &HiveSetLocation) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.has_set, &other.has_set) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.location, &other.location) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for HiveSetLocation { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.has_set, state); - ::core::hash::Hash::hash(&self.location, state) - } - } - impl fmt::Display for HiveSetLocation { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if self.has_set { - f.write_fmt(format_args!("SET "))?; - } - f.write_fmt(format_args!("LOCATION {0}", self.location)) - } - } - /// MySQL `ALTER TABLE` only [FIRST | AFTER column_name] - #[allow(clippy::large_enum_variant)] - pub enum MySQLColumnPosition { - First, - After(Ident), - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::fmt::Debug for MySQLColumnPosition { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - MySQLColumnPosition::First => { - ::core::fmt::Formatter::write_str(f, "First") - } - MySQLColumnPosition::After(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "After", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::clone::Clone for MySQLColumnPosition { - #[inline] - fn clone(&self) -> MySQLColumnPosition { - match self { - MySQLColumnPosition::First => MySQLColumnPosition::First, - MySQLColumnPosition::After(__self_0) => { - MySQLColumnPosition::After(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::marker::StructuralPartialEq for MySQLColumnPosition {} - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialEq for MySQLColumnPosition { - #[inline] - fn eq(&self, other: &MySQLColumnPosition) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - MySQLColumnPosition::After(__self_0), - MySQLColumnPosition::After(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::PartialOrd for MySQLColumnPosition { - #[inline] - fn partial_cmp( - &self, - other: &MySQLColumnPosition, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - MySQLColumnPosition::After(__self_0), - MySQLColumnPosition::After(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Eq for MySQLColumnPosition { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::cmp::Ord for MySQLColumnPosition { - #[inline] - fn cmp(&self, other: &MySQLColumnPosition) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - MySQLColumnPosition::After(__self_0), - MySQLColumnPosition::After(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - #[allow(clippy::large_enum_variant)] - impl ::core::hash::Hash for MySQLColumnPosition { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - MySQLColumnPosition::After(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl Display for MySQLColumnPosition { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - MySQLColumnPosition::First => f.write_fmt(format_args!("FIRST")), - MySQLColumnPosition::After(ident) => { - let column_name = &ident.value; - f.write_fmt(format_args!("AFTER {0}", column_name)) - } - } - } - } - /// MySQL `CREATE VIEW` algorithm parameter: [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] - pub enum CreateViewAlgorithm { - Undefined, - Merge, - TempTable, - } - #[automatically_derived] - impl ::core::fmt::Debug for CreateViewAlgorithm { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - CreateViewAlgorithm::Undefined => "Undefined", - CreateViewAlgorithm::Merge => "Merge", - CreateViewAlgorithm::TempTable => "TempTable", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreateViewAlgorithm { - #[inline] - fn clone(&self) -> CreateViewAlgorithm { - match self { - CreateViewAlgorithm::Undefined => CreateViewAlgorithm::Undefined, - CreateViewAlgorithm::Merge => CreateViewAlgorithm::Merge, - CreateViewAlgorithm::TempTable => CreateViewAlgorithm::TempTable, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreateViewAlgorithm {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreateViewAlgorithm { - #[inline] - fn eq(&self, other: &CreateViewAlgorithm) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreateViewAlgorithm { - #[inline] - fn partial_cmp( - &self, - other: &CreateViewAlgorithm, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreateViewAlgorithm { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for CreateViewAlgorithm { - #[inline] - fn cmp(&self, other: &CreateViewAlgorithm) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreateViewAlgorithm { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl Display for CreateViewAlgorithm { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CreateViewAlgorithm::Undefined => f.write_fmt(format_args!("UNDEFINED")), - CreateViewAlgorithm::Merge => f.write_fmt(format_args!("MERGE")), - CreateViewAlgorithm::TempTable => f.write_fmt(format_args!("TEMPTABLE")), - } - } - } - /// MySQL `CREATE VIEW` security parameter: [SQL SECURITY { DEFINER | INVOKER }] - pub enum CreateViewSecurity { - Definer, - Invoker, - } - #[automatically_derived] - impl ::core::fmt::Debug for CreateViewSecurity { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - CreateViewSecurity::Definer => "Definer", - CreateViewSecurity::Invoker => "Invoker", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreateViewSecurity { - #[inline] - fn clone(&self) -> CreateViewSecurity { - match self { - CreateViewSecurity::Definer => CreateViewSecurity::Definer, - CreateViewSecurity::Invoker => CreateViewSecurity::Invoker, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreateViewSecurity {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreateViewSecurity { - #[inline] - fn eq(&self, other: &CreateViewSecurity) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreateViewSecurity { - #[inline] - fn partial_cmp( - &self, - other: &CreateViewSecurity, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreateViewSecurity { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for CreateViewSecurity { - #[inline] - fn cmp(&self, other: &CreateViewSecurity) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreateViewSecurity { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl Display for CreateViewSecurity { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - CreateViewSecurity::Definer => f.write_fmt(format_args!("DEFINER")), - CreateViewSecurity::Invoker => f.write_fmt(format_args!("INVOKER")), - } - } - } - /// [MySQL] `CREATE VIEW` additional parameters - /// - /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/create-view.html - pub struct CreateViewParams { - pub algorithm: Option, - pub definer: Option, - pub security: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for CreateViewParams { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "CreateViewParams", - "algorithm", - &self.algorithm, - "definer", - &self.definer, - "security", - &&self.security, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for CreateViewParams { - #[inline] - fn clone(&self) -> CreateViewParams { - CreateViewParams { - algorithm: ::core::clone::Clone::clone(&self.algorithm), - definer: ::core::clone::Clone::clone(&self.definer), - security: ::core::clone::Clone::clone(&self.security), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CreateViewParams {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CreateViewParams { - #[inline] - fn eq(&self, other: &CreateViewParams) -> bool { - self.algorithm == other.algorithm && self.definer == other.definer - && self.security == other.security - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CreateViewParams { - #[inline] - fn partial_cmp( - &self, - other: &CreateViewParams, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp( - &self.algorithm, - &other.algorithm, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.definer, - &other.definer, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.security, - &other.security, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CreateViewParams { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CreateViewParams { - #[inline] - fn cmp(&self, other: &CreateViewParams) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.algorithm, &other.algorithm) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.definer, &other.definer) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.security, &other.security) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CreateViewParams { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.algorithm, state); - ::core::hash::Hash::hash(&self.definer, state); - ::core::hash::Hash::hash(&self.security, state) - } - } - impl Display for CreateViewParams { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let CreateViewParams { algorithm, definer, security } = self; - if let Some(algorithm) = algorithm { - f.write_fmt(format_args!("ALGORITHM = {0} ", algorithm))?; - } - if let Some(definers) = definer { - f.write_fmt(format_args!("DEFINER = {0} ", definers))?; - } - if let Some(security) = security { - f.write_fmt(format_args!("SQL SECURITY {0} ", security))?; - } - Ok(()) - } - } - /// Engine of DB. Some warehouse has parameters of engine, e.g. [clickhouse] - /// - /// [clickhouse]: https://clickhouse.com/docs/en/engines/table-engines - pub struct TableEngine { - pub name: String, - pub parameters: Option>, - } - #[automatically_derived] - impl ::core::fmt::Debug for TableEngine { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "TableEngine", - "name", - &self.name, - "parameters", - &&self.parameters, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableEngine { - #[inline] - fn clone(&self) -> TableEngine { - TableEngine { - name: ::core::clone::Clone::clone(&self.name), - parameters: ::core::clone::Clone::clone(&self.parameters), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableEngine {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableEngine { - #[inline] - fn eq(&self, other: &TableEngine) -> bool { - self.name == other.name && self.parameters == other.parameters - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableEngine { - #[inline] - fn partial_cmp( - &self, - other: &TableEngine, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.parameters, - &other.parameters, - ) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableEngine { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TableEngine { - #[inline] - fn cmp(&self, other: &TableEngine) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.name, &other.name) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.parameters, &other.parameters) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableEngine { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.name, state); - ::core::hash::Hash::hash(&self.parameters, state) - } - } - impl Display for TableEngine { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0}", self.name))?; - if let Some(parameters) = self.parameters.as_ref() { - f.write_fmt(format_args!("({0})", display_comma_separated(parameters)))?; - } - Ok(()) - } - } - /// Snowflake `WITH ROW ACCESS POLICY policy_name ON (identifier, ...)` - /// - /// - /// - pub struct RowAccessPolicy { - pub policy: ObjectName, - pub on: Vec, - } - #[automatically_derived] - impl ::core::fmt::Debug for RowAccessPolicy { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "RowAccessPolicy", - "policy", - &self.policy, - "on", - &&self.on, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for RowAccessPolicy { - #[inline] - fn clone(&self) -> RowAccessPolicy { - RowAccessPolicy { - policy: ::core::clone::Clone::clone(&self.policy), - on: ::core::clone::Clone::clone(&self.on), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for RowAccessPolicy {} - #[automatically_derived] - impl ::core::cmp::PartialEq for RowAccessPolicy { - #[inline] - fn eq(&self, other: &RowAccessPolicy) -> bool { - self.policy == other.policy && self.on == other.on - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for RowAccessPolicy { - #[inline] - fn partial_cmp( - &self, - other: &RowAccessPolicy, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.policy, &other.policy) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.on, &other.on) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for RowAccessPolicy { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for RowAccessPolicy { - #[inline] - fn cmp(&self, other: &RowAccessPolicy) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.policy, &other.policy) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.on, &other.on) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for RowAccessPolicy { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.policy, state); - ::core::hash::Hash::hash(&self.on, state) - } - } - impl RowAccessPolicy { - pub fn new(policy: ObjectName, on: Vec) -> Self { - Self { policy, on } - } - } - impl Display for RowAccessPolicy { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - "WITH ROW ACCESS POLICY {0} ON ({1})", - self.policy, - display_comma_separated(self.on.as_slice()), - ), - ) - } - } - /// Snowflake `WITH TAG ( tag_name = '', ...)` - /// - /// - pub struct Tag { - pub key: Ident, - pub value: String, - } - #[automatically_derived] - impl ::core::fmt::Debug for Tag { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "Tag", - "key", - &self.key, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Tag { - #[inline] - fn clone(&self) -> Tag { - Tag { - key: ::core::clone::Clone::clone(&self.key), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Tag {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Tag { - #[inline] - fn eq(&self, other: &Tag) -> bool { - self.key == other.key && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Tag { - #[inline] - fn partial_cmp( - &self, - other: &Tag, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.key, &other.key) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Tag { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Tag { - #[inline] - fn cmp(&self, other: &Tag) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.key, &other.key) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Tag { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.key, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl Tag { - pub fn new(key: Ident, value: String) -> Self { - Self { key, value } - } - } - impl Display for Tag { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_fmt(format_args!("{0}=\'{1}\'", self.key, self.value)) - } - } - /// Helper to indicate if a comment includes the `=` in the display form - pub enum CommentDef { - /// Includes `=` when printing the comment, as `COMMENT = 'comment'` - /// Does not include `=` when printing the comment, as `COMMENT 'comment'` - WithEq(String), - WithoutEq(String), - AfterColumnDefsWithoutEq(String), - } - #[automatically_derived] - impl ::core::fmt::Debug for CommentDef { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - CommentDef::WithEq(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "WithEq", - &__self_0, - ) - } - CommentDef::WithoutEq(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "WithoutEq", - &__self_0, - ) - } - CommentDef::AfterColumnDefsWithoutEq(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "AfterColumnDefsWithoutEq", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for CommentDef { - #[inline] - fn clone(&self) -> CommentDef { - match self { - CommentDef::WithEq(__self_0) => { - CommentDef::WithEq(::core::clone::Clone::clone(__self_0)) - } - CommentDef::WithoutEq(__self_0) => { - CommentDef::WithoutEq(::core::clone::Clone::clone(__self_0)) - } - CommentDef::AfterColumnDefsWithoutEq(__self_0) => { - CommentDef::AfterColumnDefsWithoutEq( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for CommentDef {} - #[automatically_derived] - impl ::core::cmp::PartialEq for CommentDef { - #[inline] - fn eq(&self, other: &CommentDef) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (CommentDef::WithEq(__self_0), CommentDef::WithEq(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - CommentDef::WithoutEq(__self_0), - CommentDef::WithoutEq(__arg1_0), - ) => __self_0 == __arg1_0, - ( - CommentDef::AfterColumnDefsWithoutEq(__self_0), - CommentDef::AfterColumnDefsWithoutEq(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for CommentDef { - #[inline] - fn partial_cmp( - &self, - other: &CommentDef, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (CommentDef::WithEq(__self_0), CommentDef::WithEq(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (CommentDef::WithoutEq(__self_0), CommentDef::WithoutEq(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - CommentDef::AfterColumnDefsWithoutEq(__self_0), - CommentDef::AfterColumnDefsWithoutEq(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for CommentDef { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for CommentDef { - #[inline] - fn cmp(&self, other: &CommentDef) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (CommentDef::WithEq(__self_0), CommentDef::WithEq(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - CommentDef::WithoutEq(__self_0), - CommentDef::WithoutEq(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - CommentDef::AfterColumnDefsWithoutEq(__self_0), - CommentDef::AfterColumnDefsWithoutEq(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for CommentDef { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - CommentDef::WithEq(__self_0) => ::core::hash::Hash::hash(__self_0, state), - CommentDef::WithoutEq(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - CommentDef::AfterColumnDefsWithoutEq(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl Display for CommentDef { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - CommentDef::WithEq(comment) - | CommentDef::WithoutEq(comment) - | CommentDef::AfterColumnDefsWithoutEq(comment) => { - f.write_fmt(format_args!("{0}", comment)) - } - } - } - } - /// Helper to indicate if a collection should be wrapped by a symbol in the display form - /// - /// [`Display`] is implemented for every [`Vec`] where `T: Display`. - /// The string output is a comma separated list for the vec items - /// - /// # Examples - /// ``` - /// # use sqlparser::ast::WrappedCollection; - /// let items = WrappedCollection::Parentheses(vec!["one", "two", "three"]); - /// assert_eq!("(one, two, three)", items.to_string()); - /// - /// let items = WrappedCollection::NoWrapping(vec!["one", "two", "three"]); - /// assert_eq!("one, two, three", items.to_string()); - /// ``` - pub enum WrappedCollection { - /// Print the collection without wrapping symbols, as `item, item, item` - NoWrapping(T), - /// Wraps the collection in Parentheses, as `(item, item, item)` - Parentheses(T), - } - #[automatically_derived] - impl ::core::fmt::Debug for WrappedCollection { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - WrappedCollection::NoWrapping(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "NoWrapping", - &__self_0, - ) - } - WrappedCollection::Parentheses(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Parentheses", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for WrappedCollection { - #[inline] - fn clone(&self) -> WrappedCollection { - match self { - WrappedCollection::NoWrapping(__self_0) => { - WrappedCollection::NoWrapping(::core::clone::Clone::clone(__self_0)) - } - WrappedCollection::Parentheses(__self_0) => { - WrappedCollection::Parentheses(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for WrappedCollection {} - #[automatically_derived] - impl ::core::cmp::PartialEq for WrappedCollection { - #[inline] - fn eq(&self, other: &WrappedCollection) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - WrappedCollection::NoWrapping(__self_0), - WrappedCollection::NoWrapping(__arg1_0), - ) => __self_0 == __arg1_0, - ( - WrappedCollection::Parentheses(__self_0), - WrappedCollection::Parentheses(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for WrappedCollection { - #[inline] - fn partial_cmp( - &self, - other: &WrappedCollection, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - WrappedCollection::NoWrapping(__self_0), - WrappedCollection::NoWrapping(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - WrappedCollection::Parentheses(__self_0), - WrappedCollection::Parentheses(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for WrappedCollection { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for WrappedCollection { - #[inline] - fn cmp(&self, other: &WrappedCollection) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - WrappedCollection::NoWrapping(__self_0), - WrappedCollection::NoWrapping(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - WrappedCollection::Parentheses(__self_0), - WrappedCollection::Parentheses(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for WrappedCollection { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - WrappedCollection::NoWrapping(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - WrappedCollection::Parentheses(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl Display for WrappedCollection> - where - T: Display, - { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - WrappedCollection::NoWrapping(inner) => { - f.write_fmt( - format_args!("{0}", display_comma_separated(inner.as_slice())), - ) - } - WrappedCollection::Parentheses(inner) => { - f.write_fmt( - format_args!("({0})", display_comma_separated(inner.as_slice())), - ) - } - } - } - } - /// Represents a single PostgreSQL utility option. - /// - /// A utility option is a key-value pair where the key is an identifier (IDENT) and the value - /// can be one of the following: - /// - A number with an optional sign (`+` or `-`). Example: `+10`, `-10.2`, `3` - /// - A non-keyword string. Example: `option1`, `'option2'`, `"option3"` - /// - keyword: `TRUE`, `FALSE`, `ON` (`off` is also accept). - /// - Empty. Example: `ANALYZE` (identifier only) - /// - /// Utility options are used in various PostgreSQL DDL statements, including statements such as - /// `CLUSTER`, `EXPLAIN`, `VACUUM`, and `REINDEX`. These statements format options as `( option [, ...] )`. - /// - /// [CLUSTER](https://www.postgresql.org/docs/current/sql-cluster.html) - /// [EXPLAIN](https://www.postgresql.org/docs/current/sql-explain.html) - /// [VACUUM](https://www.postgresql.org/docs/current/sql-vacuum.html) - /// [REINDEX](https://www.postgresql.org/docs/current/sql-reindex.html) - /// - /// For example, the `EXPLAIN` AND `VACUUM` statements with options might look like this: - /// ```sql - /// EXPLAIN (ANALYZE, VERBOSE TRUE, FORMAT TEXT) SELECT * FROM my_table; - /// - /// VACUUM (VERBOSE, ANALYZE ON, PARALLEL 10) my_table; - /// ``` - pub struct UtilityOption { - pub name: Ident, - pub arg: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for UtilityOption { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "UtilityOption", - "name", - &self.name, - "arg", - &&self.arg, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for UtilityOption { - #[inline] - fn clone(&self) -> UtilityOption { - UtilityOption { - name: ::core::clone::Clone::clone(&self.name), - arg: ::core::clone::Clone::clone(&self.arg), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for UtilityOption {} - #[automatically_derived] - impl ::core::cmp::PartialEq for UtilityOption { - #[inline] - fn eq(&self, other: &UtilityOption) -> bool { - self.name == other.name && self.arg == other.arg - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for UtilityOption { - #[inline] - fn partial_cmp( - &self, - other: &UtilityOption, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.name, &other.name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.arg, &other.arg) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for UtilityOption { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for UtilityOption { - #[inline] - fn cmp(&self, other: &UtilityOption) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.name, &other.name) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.arg, &other.arg) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for UtilityOption { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.name, state); - ::core::hash::Hash::hash(&self.arg, state) - } - } - impl Display for UtilityOption { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - if let Some(ref arg) = self.arg { - f.write_fmt(format_args!("{0} {1}", self.name, arg)) - } else { - f.write_fmt(format_args!("{0}", self.name)) - } - } - } - /// Represents the different options available for `SHOW` - /// statements to filter the results. Example from Snowflake: - /// - pub struct ShowStatementOptions { - pub show_in: Option, - pub starts_with: Option, - pub limit: Option, - pub limit_from: Option, - pub filter_position: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for ShowStatementOptions { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field5_finish( - f, - "ShowStatementOptions", - "show_in", - &self.show_in, - "starts_with", - &self.starts_with, - "limit", - &self.limit, - "limit_from", - &self.limit_from, - "filter_position", - &&self.filter_position, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ShowStatementOptions { - #[inline] - fn clone(&self) -> ShowStatementOptions { - ShowStatementOptions { - show_in: ::core::clone::Clone::clone(&self.show_in), - starts_with: ::core::clone::Clone::clone(&self.starts_with), - limit: ::core::clone::Clone::clone(&self.limit), - limit_from: ::core::clone::Clone::clone(&self.limit_from), - filter_position: ::core::clone::Clone::clone(&self.filter_position), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ShowStatementOptions {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ShowStatementOptions { - #[inline] - fn eq(&self, other: &ShowStatementOptions) -> bool { - self.show_in == other.show_in && self.starts_with == other.starts_with - && self.limit == other.limit && self.limit_from == other.limit_from - && self.filter_position == other.filter_position - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ShowStatementOptions { - #[inline] - fn partial_cmp( - &self, - other: &ShowStatementOptions, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.show_in, &other.show_in) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.starts_with, - &other.starts_with, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.limit, - &other.limit, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.limit_from, - &other.limit_from, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.filter_position, - &other.filter_position, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ShowStatementOptions { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ShowStatementOptions { - #[inline] - fn cmp(&self, other: &ShowStatementOptions) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.show_in, &other.show_in) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.starts_with, &other.starts_with) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.limit, &other.limit) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp( - &self.limit_from, - &other.limit_from, - ) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp( - &self.filter_position, - &other.filter_position, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ShowStatementOptions { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.show_in, state); - ::core::hash::Hash::hash(&self.starts_with, state); - ::core::hash::Hash::hash(&self.limit, state); - ::core::hash::Hash::hash(&self.limit_from, state); - ::core::hash::Hash::hash(&self.filter_position, state) - } - } - impl Display for ShowStatementOptions { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - let (like_in_infix, like_in_suffix) = match &self.filter_position { - Some(ShowStatementFilterPosition::Infix(filter)) => { - ( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format(format_args!(" {0}", filter)); - res - }), - "".to_string(), - ) - } - Some(ShowStatementFilterPosition::Suffix(filter)) => { - ( - "".to_string(), - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format(format_args!(" {0}", filter)); - res - }), - ) - } - None => ("".to_string(), "".to_string()), - }; - f.write_fmt( - format_args!( - "{4}{0}{1}{2}{3}{5}", - match &self.show_in { - Some(i) => { - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format(format_args!(" {0}", i)); - res - }) - } - None => String::new(), - }, - match &self.starts_with { - Some(s) => { - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!(" STARTS WITH {0}", s), - ); - res - }) - } - None => String::new(), - }, - match &self.limit { - Some(l) => { - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!(" LIMIT {0}", l), - ); - res - }) - } - None => String::new(), - }, - match &self.limit_from { - Some(f) => { - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!(" FROM {0}", f), - ); - res - }) - } - None => String::new(), - }, - like_in_infix, - like_in_suffix, - ), - )?; - Ok(()) - } - } - pub enum ShowStatementFilterPosition { - Infix(ShowStatementFilter), - Suffix(ShowStatementFilter), - } - #[automatically_derived] - impl ::core::fmt::Debug for ShowStatementFilterPosition { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - ShowStatementFilterPosition::Infix(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Infix", - &__self_0, - ) - } - ShowStatementFilterPosition::Suffix(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Suffix", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for ShowStatementFilterPosition { - #[inline] - fn clone(&self) -> ShowStatementFilterPosition { - match self { - ShowStatementFilterPosition::Infix(__self_0) => { - ShowStatementFilterPosition::Infix( - ::core::clone::Clone::clone(__self_0), - ) - } - ShowStatementFilterPosition::Suffix(__self_0) => { - ShowStatementFilterPosition::Suffix( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ShowStatementFilterPosition {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ShowStatementFilterPosition { - #[inline] - fn eq(&self, other: &ShowStatementFilterPosition) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - ShowStatementFilterPosition::Infix(__self_0), - ShowStatementFilterPosition::Infix(__arg1_0), - ) => __self_0 == __arg1_0, - ( - ShowStatementFilterPosition::Suffix(__self_0), - ShowStatementFilterPosition::Suffix(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ShowStatementFilterPosition { - #[inline] - fn partial_cmp( - &self, - other: &ShowStatementFilterPosition, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - ShowStatementFilterPosition::Infix(__self_0), - ShowStatementFilterPosition::Infix(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - ShowStatementFilterPosition::Suffix(__self_0), - ShowStatementFilterPosition::Suffix(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ShowStatementFilterPosition { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ShowStatementFilterPosition { - #[inline] - fn cmp(&self, other: &ShowStatementFilterPosition) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - ShowStatementFilterPosition::Infix(__self_0), - ShowStatementFilterPosition::Infix(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - ShowStatementFilterPosition::Suffix(__self_0), - ShowStatementFilterPosition::Suffix(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ShowStatementFilterPosition { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - ShowStatementFilterPosition::Infix(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - ShowStatementFilterPosition::Suffix(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - pub enum ShowStatementInParentType { - Account, - Database, - Schema, - Table, - View, - } - #[automatically_derived] - impl ::core::fmt::Debug for ShowStatementInParentType { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ShowStatementInParentType::Account => "Account", - ShowStatementInParentType::Database => "Database", - ShowStatementInParentType::Schema => "Schema", - ShowStatementInParentType::Table => "Table", - ShowStatementInParentType::View => "View", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ShowStatementInParentType { - #[inline] - fn clone(&self) -> ShowStatementInParentType { - match self { - ShowStatementInParentType::Account => ShowStatementInParentType::Account, - ShowStatementInParentType::Database => { - ShowStatementInParentType::Database - } - ShowStatementInParentType::Schema => ShowStatementInParentType::Schema, - ShowStatementInParentType::Table => ShowStatementInParentType::Table, - ShowStatementInParentType::View => ShowStatementInParentType::View, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ShowStatementInParentType {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ShowStatementInParentType { - #[inline] - fn eq(&self, other: &ShowStatementInParentType) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ShowStatementInParentType { - #[inline] - fn partial_cmp( - &self, - other: &ShowStatementInParentType, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ShowStatementInParentType { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for ShowStatementInParentType { - #[inline] - fn cmp(&self, other: &ShowStatementInParentType) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for ShowStatementInParentType { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for ShowStatementInParentType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - ShowStatementInParentType::Account => { - f.write_fmt(format_args!("ACCOUNT")) - } - ShowStatementInParentType::Database => { - f.write_fmt(format_args!("DATABASE")) - } - ShowStatementInParentType::Schema => f.write_fmt(format_args!("SCHEMA")), - ShowStatementInParentType::Table => f.write_fmt(format_args!("TABLE")), - ShowStatementInParentType::View => f.write_fmt(format_args!("VIEW")), - } - } - } - pub struct ShowStatementIn { - pub clause: ShowStatementInClause, - pub parent_type: Option, - pub parent_name: Option, - } - #[automatically_derived] - impl ::core::fmt::Debug for ShowStatementIn { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "ShowStatementIn", - "clause", - &self.clause, - "parent_type", - &self.parent_type, - "parent_name", - &&self.parent_name, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ShowStatementIn { - #[inline] - fn clone(&self) -> ShowStatementIn { - ShowStatementIn { - clause: ::core::clone::Clone::clone(&self.clause), - parent_type: ::core::clone::Clone::clone(&self.parent_type), - parent_name: ::core::clone::Clone::clone(&self.parent_name), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ShowStatementIn {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ShowStatementIn { - #[inline] - fn eq(&self, other: &ShowStatementIn) -> bool { - self.clause == other.clause && self.parent_type == other.parent_type - && self.parent_name == other.parent_name - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for ShowStatementIn { - #[inline] - fn partial_cmp( - &self, - other: &ShowStatementIn, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.clause, &other.clause) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.parent_type, - &other.parent_type, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.parent_name, - &other.parent_name, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ShowStatementIn { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq>; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for ShowStatementIn { - #[inline] - fn cmp(&self, other: &ShowStatementIn) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.clause, &other.clause) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.parent_type, &other.parent_type) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.parent_name, &other.parent_name) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for ShowStatementIn { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.clause, state); - ::core::hash::Hash::hash(&self.parent_type, state); - ::core::hash::Hash::hash(&self.parent_name, state) - } - } - impl fmt::Display for ShowStatementIn { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0}", self.clause))?; - if let Some(parent_type) = &self.parent_type { - f.write_fmt(format_args!(" {0}", parent_type))?; - } - if let Some(parent_name) = &self.parent_name { - f.write_fmt(format_args!(" {0}", parent_name))?; - } - Ok(()) - } - } - /// MSSQL's json null clause - /// - /// ```plaintext - /// ::= - /// NULL ON NULL - /// | ABSENT ON NULL - /// ``` - /// - /// - pub enum JsonNullClause { - NullOnNull, - AbsentOnNull, - } - #[automatically_derived] - impl ::core::fmt::Debug for JsonNullClause { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - JsonNullClause::NullOnNull => "NullOnNull", - JsonNullClause::AbsentOnNull => "AbsentOnNull", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for JsonNullClause { - #[inline] - fn clone(&self) -> JsonNullClause { - match self { - JsonNullClause::NullOnNull => JsonNullClause::NullOnNull, - JsonNullClause::AbsentOnNull => JsonNullClause::AbsentOnNull, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for JsonNullClause {} - #[automatically_derived] - impl ::core::cmp::PartialEq for JsonNullClause { - #[inline] - fn eq(&self, other: &JsonNullClause) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for JsonNullClause { - #[inline] - fn partial_cmp( - &self, - other: &JsonNullClause, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for JsonNullClause { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for JsonNullClause { - #[inline] - fn cmp(&self, other: &JsonNullClause) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for JsonNullClause { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl Display for JsonNullClause { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - JsonNullClause::NullOnNull => f.write_fmt(format_args!("NULL ON NULL")), - JsonNullClause::AbsentOnNull => { - f.write_fmt(format_args!("ABSENT ON NULL")) - } - } - } - } - /// rename object definition - pub struct RenameTable { - pub old_name: ObjectName, - pub new_name: ObjectName, - } - #[automatically_derived] - impl ::core::fmt::Debug for RenameTable { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "RenameTable", - "old_name", - &self.old_name, - "new_name", - &&self.new_name, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for RenameTable { - #[inline] - fn clone(&self) -> RenameTable { - RenameTable { - old_name: ::core::clone::Clone::clone(&self.old_name), - new_name: ::core::clone::Clone::clone(&self.new_name), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for RenameTable {} - #[automatically_derived] - impl ::core::cmp::PartialEq for RenameTable { - #[inline] - fn eq(&self, other: &RenameTable) -> bool { - self.old_name == other.old_name && self.new_name == other.new_name - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for RenameTable { - #[inline] - fn partial_cmp( - &self, - other: &RenameTable, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.old_name, &other.old_name) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.new_name, &other.new_name) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for RenameTable { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for RenameTable { - #[inline] - fn cmp(&self, other: &RenameTable) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.old_name, &other.old_name) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.new_name, &other.new_name) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for RenameTable { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.old_name, state); - ::core::hash::Hash::hash(&self.new_name, state) - } - } - impl fmt::Display for RenameTable { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("{0} TO {1}", self.old_name, self.new_name))?; - Ok(()) - } - } - /// Represents the referenced table in an `INSERT INTO` statement - pub enum TableObject { - /// Table specified by name. - /// Example: - /// ```sql - /// INSERT INTO my_table - /// ``` - TableName(ObjectName), - /// Table specified as a function. - /// Example: - /// ```sql - /// INSERT INTO TABLE FUNCTION remote('localhost', default.simple_table) - /// ``` - /// [Clickhouse](https://clickhouse.com/docs/en/sql-reference/table-functions) - TableFunction(Function), - } - #[automatically_derived] - impl ::core::fmt::Debug for TableObject { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - TableObject::TableName(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TableName", - &__self_0, - ) - } - TableObject::TableFunction(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TableFunction", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for TableObject { - #[inline] - fn clone(&self) -> TableObject { - match self { - TableObject::TableName(__self_0) => { - TableObject::TableName(::core::clone::Clone::clone(__self_0)) - } - TableObject::TableFunction(__self_0) => { - TableObject::TableFunction(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TableObject {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TableObject { - #[inline] - fn eq(&self, other: &TableObject) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - TableObject::TableName(__self_0), - TableObject::TableName(__arg1_0), - ) => __self_0 == __arg1_0, - ( - TableObject::TableFunction(__self_0), - TableObject::TableFunction(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TableObject { - #[inline] - fn partial_cmp( - &self, - other: &TableObject, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - (TableObject::TableName(__self_0), TableObject::TableName(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - TableObject::TableFunction(__self_0), - TableObject::TableFunction(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TableObject { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TableObject { - #[inline] - fn cmp(&self, other: &TableObject) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - TableObject::TableName(__self_0), - TableObject::TableName(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - TableObject::TableFunction(__self_0), - TableObject::TableFunction(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TableObject { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - TableObject::TableName(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - TableObject::TableFunction(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for TableObject { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Self::TableName(table_name) => { - f.write_fmt(format_args!("{0}", table_name)) - } - Self::TableFunction(func) => { - f.write_fmt(format_args!("FUNCTION {0}", func)) - } - } - } - } - pub enum SetSessionParamKind { - Generic(SetSessionParamGeneric), - IdentityInsert(SetSessionParamIdentityInsert), - Offsets(SetSessionParamOffsets), - Statistics(SetSessionParamStatistics), - } - #[automatically_derived] - impl ::core::fmt::Debug for SetSessionParamKind { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - SetSessionParamKind::Generic(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Generic", - &__self_0, - ) - } - SetSessionParamKind::IdentityInsert(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "IdentityInsert", - &__self_0, - ) - } - SetSessionParamKind::Offsets(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Offsets", - &__self_0, - ) - } - SetSessionParamKind::Statistics(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Statistics", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for SetSessionParamKind { - #[inline] - fn clone(&self) -> SetSessionParamKind { - match self { - SetSessionParamKind::Generic(__self_0) => { - SetSessionParamKind::Generic(::core::clone::Clone::clone(__self_0)) - } - SetSessionParamKind::IdentityInsert(__self_0) => { - SetSessionParamKind::IdentityInsert( - ::core::clone::Clone::clone(__self_0), - ) - } - SetSessionParamKind::Offsets(__self_0) => { - SetSessionParamKind::Offsets(::core::clone::Clone::clone(__self_0)) - } - SetSessionParamKind::Statistics(__self_0) => { - SetSessionParamKind::Statistics( - ::core::clone::Clone::clone(__self_0), - ) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SetSessionParamKind {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SetSessionParamKind { - #[inline] - fn eq(&self, other: &SetSessionParamKind) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - SetSessionParamKind::Generic(__self_0), - SetSessionParamKind::Generic(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SetSessionParamKind::IdentityInsert(__self_0), - SetSessionParamKind::IdentityInsert(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SetSessionParamKind::Offsets(__self_0), - SetSessionParamKind::Offsets(__arg1_0), - ) => __self_0 == __arg1_0, - ( - SetSessionParamKind::Statistics(__self_0), - SetSessionParamKind::Statistics(__arg1_0), - ) => __self_0 == __arg1_0, - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SetSessionParamKind { - #[inline] - fn partial_cmp( - &self, - other: &SetSessionParamKind, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - SetSessionParamKind::Generic(__self_0), - SetSessionParamKind::Generic(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SetSessionParamKind::IdentityInsert(__self_0), - SetSessionParamKind::IdentityInsert(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SetSessionParamKind::Offsets(__self_0), - SetSessionParamKind::Offsets(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - SetSessionParamKind::Statistics(__self_0), - SetSessionParamKind::Statistics(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SetSessionParamKind { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SetSessionParamKind { - #[inline] - fn cmp(&self, other: &SetSessionParamKind) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - SetSessionParamKind::Generic(__self_0), - SetSessionParamKind::Generic(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SetSessionParamKind::IdentityInsert(__self_0), - SetSessionParamKind::IdentityInsert(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SetSessionParamKind::Offsets(__self_0), - SetSessionParamKind::Offsets(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - SetSessionParamKind::Statistics(__self_0), - SetSessionParamKind::Statistics(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => unsafe { ::core::intrinsics::unreachable() } - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SetSessionParamKind { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - SetSessionParamKind::Generic(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SetSessionParamKind::IdentityInsert(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SetSessionParamKind::Offsets(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - SetSessionParamKind::Statistics(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - } - } - } - impl fmt::Display for SetSessionParamKind { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SetSessionParamKind::Generic(x) => f.write_fmt(format_args!("{0}", x)), - SetSessionParamKind::IdentityInsert(x) => { - f.write_fmt(format_args!("{0}", x)) - } - SetSessionParamKind::Offsets(x) => f.write_fmt(format_args!("{0}", x)), - SetSessionParamKind::Statistics(x) => f.write_fmt(format_args!("{0}", x)), - } - } - } - pub struct SetSessionParamGeneric { - pub names: Vec, - pub value: String, - } - #[automatically_derived] - impl ::core::fmt::Debug for SetSessionParamGeneric { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SetSessionParamGeneric", - "names", - &self.names, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SetSessionParamGeneric { - #[inline] - fn clone(&self) -> SetSessionParamGeneric { - SetSessionParamGeneric { - names: ::core::clone::Clone::clone(&self.names), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SetSessionParamGeneric {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SetSessionParamGeneric { - #[inline] - fn eq(&self, other: &SetSessionParamGeneric) -> bool { - self.names == other.names && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SetSessionParamGeneric { - #[inline] - fn partial_cmp( - &self, - other: &SetSessionParamGeneric, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.names, &other.names) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SetSessionParamGeneric { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SetSessionParamGeneric { - #[inline] - fn cmp(&self, other: &SetSessionParamGeneric) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.names, &other.names) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SetSessionParamGeneric { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.names, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl fmt::Display for SetSessionParamGeneric { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!("{0} {1}", display_comma_separated(&self.names), self.value), - ) - } - } - pub struct SetSessionParamIdentityInsert { - pub obj: ObjectName, - pub value: SessionParamValue, - } - #[automatically_derived] - impl ::core::fmt::Debug for SetSessionParamIdentityInsert { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SetSessionParamIdentityInsert", - "obj", - &self.obj, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SetSessionParamIdentityInsert { - #[inline] - fn clone(&self) -> SetSessionParamIdentityInsert { - SetSessionParamIdentityInsert { - obj: ::core::clone::Clone::clone(&self.obj), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SetSessionParamIdentityInsert {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SetSessionParamIdentityInsert { - #[inline] - fn eq(&self, other: &SetSessionParamIdentityInsert) -> bool { - self.obj == other.obj && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SetSessionParamIdentityInsert { - #[inline] - fn partial_cmp( - &self, - other: &SetSessionParamIdentityInsert, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.obj, &other.obj) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SetSessionParamIdentityInsert { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SetSessionParamIdentityInsert { - #[inline] - fn cmp(&self, other: &SetSessionParamIdentityInsert) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.obj, &other.obj) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SetSessionParamIdentityInsert { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.obj, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl fmt::Display for SetSessionParamIdentityInsert { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("IDENTITY_INSERT {0} {1}", self.obj, self.value)) - } - } - pub struct SetSessionParamOffsets { - pub keywords: Vec, - pub value: SessionParamValue, - } - #[automatically_derived] - impl ::core::fmt::Debug for SetSessionParamOffsets { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SetSessionParamOffsets", - "keywords", - &self.keywords, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SetSessionParamOffsets { - #[inline] - fn clone(&self) -> SetSessionParamOffsets { - SetSessionParamOffsets { - keywords: ::core::clone::Clone::clone(&self.keywords), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SetSessionParamOffsets {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SetSessionParamOffsets { - #[inline] - fn eq(&self, other: &SetSessionParamOffsets) -> bool { - self.keywords == other.keywords && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SetSessionParamOffsets { - #[inline] - fn partial_cmp( - &self, - other: &SetSessionParamOffsets, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.keywords, &other.keywords) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SetSessionParamOffsets { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SetSessionParamOffsets { - #[inline] - fn cmp(&self, other: &SetSessionParamOffsets) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.keywords, &other.keywords) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SetSessionParamOffsets { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.keywords, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl fmt::Display for SetSessionParamOffsets { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - "OFFSETS {0} {1}", - display_comma_separated(&self.keywords), - self.value, - ), - ) - } - } - pub struct SetSessionParamStatistics { - pub topic: SessionParamStatsTopic, - pub value: SessionParamValue, - } - #[automatically_derived] - impl ::core::fmt::Debug for SetSessionParamStatistics { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SetSessionParamStatistics", - "topic", - &self.topic, - "value", - &&self.value, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SetSessionParamStatistics { - #[inline] - fn clone(&self) -> SetSessionParamStatistics { - SetSessionParamStatistics { - topic: ::core::clone::Clone::clone(&self.topic), - value: ::core::clone::Clone::clone(&self.value), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SetSessionParamStatistics {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SetSessionParamStatistics { - #[inline] - fn eq(&self, other: &SetSessionParamStatistics) -> bool { - self.topic == other.topic && self.value == other.value - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SetSessionParamStatistics { - #[inline] - fn partial_cmp( - &self, - other: &SetSessionParamStatistics, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.topic, &other.topic) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SetSessionParamStatistics { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for SetSessionParamStatistics { - #[inline] - fn cmp(&self, other: &SetSessionParamStatistics) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.topic, &other.topic) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.value, &other.value) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for SetSessionParamStatistics { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.topic, state); - ::core::hash::Hash::hash(&self.value, state) - } - } - impl fmt::Display for SetSessionParamStatistics { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("STATISTICS {0} {1}", self.topic, self.value)) - } - } - pub enum SessionParamStatsTopic { - IO, - Profile, - Time, - Xml, - } - #[automatically_derived] - impl ::core::fmt::Debug for SessionParamStatsTopic { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - SessionParamStatsTopic::IO => "IO", - SessionParamStatsTopic::Profile => "Profile", - SessionParamStatsTopic::Time => "Time", - SessionParamStatsTopic::Xml => "Xml", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SessionParamStatsTopic { - #[inline] - fn clone(&self) -> SessionParamStatsTopic { - match self { - SessionParamStatsTopic::IO => SessionParamStatsTopic::IO, - SessionParamStatsTopic::Profile => SessionParamStatsTopic::Profile, - SessionParamStatsTopic::Time => SessionParamStatsTopic::Time, - SessionParamStatsTopic::Xml => SessionParamStatsTopic::Xml, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SessionParamStatsTopic {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SessionParamStatsTopic { - #[inline] - fn eq(&self, other: &SessionParamStatsTopic) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SessionParamStatsTopic { - #[inline] - fn partial_cmp( - &self, - other: &SessionParamStatsTopic, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SessionParamStatsTopic { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for SessionParamStatsTopic { - #[inline] - fn cmp(&self, other: &SessionParamStatsTopic) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for SessionParamStatsTopic { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for SessionParamStatsTopic { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SessionParamStatsTopic::IO => f.write_fmt(format_args!("IO")), - SessionParamStatsTopic::Profile => f.write_fmt(format_args!("PROFILE")), - SessionParamStatsTopic::Time => f.write_fmt(format_args!("TIME")), - SessionParamStatsTopic::Xml => f.write_fmt(format_args!("XML")), - } - } - } - pub enum SessionParamValue { - On, - Off, - } - #[automatically_derived] - impl ::core::fmt::Debug for SessionParamValue { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - SessionParamValue::On => "On", - SessionParamValue::Off => "Off", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for SessionParamValue { - #[inline] - fn clone(&self) -> SessionParamValue { - match self { - SessionParamValue::On => SessionParamValue::On, - SessionParamValue::Off => SessionParamValue::Off, - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for SessionParamValue {} - #[automatically_derived] - impl ::core::cmp::PartialEq for SessionParamValue { - #[inline] - fn eq(&self, other: &SessionParamValue) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for SessionParamValue { - #[inline] - fn partial_cmp( - &self, - other: &SessionParamValue, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for SessionParamValue { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for SessionParamValue { - #[inline] - fn cmp(&self, other: &SessionParamValue) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for SessionParamValue { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl fmt::Display for SessionParamValue { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - SessionParamValue::On => f.write_fmt(format_args!("ON")), - SessionParamValue::Off => f.write_fmt(format_args!("OFF")), - } - } - } - /// Snowflake StorageSerializationPolicy for Iceberg Tables - /// ```sql - /// [ STORAGE_SERIALIZATION_POLICY = { COMPATIBLE | OPTIMIZED } ] - /// ``` - /// - /// - pub enum StorageSerializationPolicy { - Compatible, - Optimized, - } - #[automatically_derived] - impl ::core::fmt::Debug for StorageSerializationPolicy { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - StorageSerializationPolicy::Compatible => "Compatible", - StorageSerializationPolicy::Optimized => "Optimized", - }, - ) - } - } - #[automatically_derived] - impl ::core::marker::Copy for StorageSerializationPolicy {} - #[automatically_derived] - impl ::core::clone::Clone for StorageSerializationPolicy { - #[inline] - fn clone(&self) -> StorageSerializationPolicy { - *self - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for StorageSerializationPolicy {} - #[automatically_derived] - impl ::core::cmp::PartialEq for StorageSerializationPolicy { - #[inline] - fn eq(&self, other: &StorageSerializationPolicy) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for StorageSerializationPolicy { - #[inline] - fn partial_cmp( - &self, - other: &StorageSerializationPolicy, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::cmp::Eq for StorageSerializationPolicy { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - impl ::core::cmp::Ord for StorageSerializationPolicy { - #[inline] - fn cmp(&self, other: &StorageSerializationPolicy) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - impl ::core::hash::Hash for StorageSerializationPolicy { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - impl Display for StorageSerializationPolicy { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - match self { - StorageSerializationPolicy::Compatible => { - f.write_fmt(format_args!("COMPATIBLE")) - } - StorageSerializationPolicy::Optimized => { - f.write_fmt(format_args!("OPTIMIZED")) - } - } - } - } -} -#[macro_use] -pub mod dialect { - mod ansi { - use crate::dialect::Dialect; - /// A [`Dialect`] for [ANSI SQL](https://en.wikipedia.org/wiki/SQL:2011). - pub struct AnsiDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for AnsiDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "AnsiDialect") - } - } - impl Dialect for AnsiDialect { - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch.is_ascii_digit() - || ch == '_' - } - fn require_interval_qualifier(&self) -> bool { - true - } - } - } - mod bigquery { - use crate::dialect::Dialect; - use crate::keywords::Keyword; - use crate::parser::Parser; - /// These keywords are disallowed as column identifiers. Such that - /// `SELECT 5 AS FROM T` is rejected by BigQuery. - const RESERVED_FOR_COLUMN_ALIAS: &[Keyword] = &[ - Keyword::WITH, - Keyword::SELECT, - Keyword::WHERE, - Keyword::GROUP, - Keyword::HAVING, - Keyword::ORDER, - Keyword::LATERAL, - Keyword::LIMIT, - Keyword::FETCH, - Keyword::UNION, - Keyword::EXCEPT, - Keyword::INTERSECT, - Keyword::FROM, - Keyword::INTO, - Keyword::END, - ]; - /// A [`Dialect`] for [Google Bigquery](https://cloud.google.com/bigquery/) - pub struct BigQueryDialect; - #[automatically_derived] - impl ::core::fmt::Debug for BigQueryDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "BigQueryDialect") - } - } - #[automatically_derived] - impl ::core::default::Default for BigQueryDialect { - #[inline] - fn default() -> BigQueryDialect { - BigQueryDialect {} - } - } - impl Dialect for BigQueryDialect { - fn is_delimited_identifier_start(&self, ch: char) -> bool { - ch == '`' - } - fn supports_projection_trailing_commas(&self) -> bool { - true - } - /// See - fn supports_column_definition_trailing_commas(&self) -> bool { - true - } - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch == '_' - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch.is_ascii_digit() - || ch == '_' - } - /// See [doc](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - fn supports_triple_quoted_string(&self) -> bool { - true - } - /// See [doc](https://cloud.google.com/bigquery/docs/reference/standard-sql/navigation_functions#first_value) - fn supports_window_function_null_treatment_arg(&self) -> bool { - true - } - fn supports_string_literal_backslash_escape(&self) -> bool { - true - } - /// See [doc](https://cloud.google.com/bigquery/docs/reference/standard-sql/window-function-calls#ref_named_window) - fn supports_window_clause_named_window_reference(&self) -> bool { - true - } - /// See [doc](https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#set) - fn supports_parenthesized_set_variables(&self) -> bool { - true - } - fn supports_select_wildcard_except(&self) -> bool { - true - } - fn require_interval_qualifier(&self) -> bool { - true - } - fn supports_struct_literal(&self) -> bool { - true - } - /// See - fn supports_select_expr_star(&self) -> bool { - true - } - fn supports_timestamp_versioning(&self) -> bool { - true - } - fn is_column_alias(&self, kw: &Keyword, _parser: &mut Parser) -> bool { - !RESERVED_FOR_COLUMN_ALIAS.contains(kw) - } - } - } - mod clickhouse { - use crate::dialect::Dialect; - pub struct ClickHouseDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for ClickHouseDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "ClickHouseDialect") - } - } - impl Dialect for ClickHouseDialect { - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch == '_' - } - fn is_identifier_part(&self, ch: char) -> bool { - self.is_identifier_start(ch) || ch.is_ascii_digit() - } - fn supports_string_literal_backslash_escape(&self) -> bool { - true - } - fn supports_select_wildcard_except(&self) -> bool { - true - } - fn describe_requires_table_keyword(&self) -> bool { - true - } - fn require_interval_qualifier(&self) -> bool { - true - } - fn supports_limit_comma(&self) -> bool { - true - } - fn supports_insert_table_function(&self) -> bool { - true - } - fn supports_insert_format(&self) -> bool { - true - } - fn supports_numeric_literal_underscores(&self) -> bool { - true - } - fn supports_dictionary_syntax(&self) -> bool { - true - } - /// See - fn supports_lambda_functions(&self) -> bool { - true - } - } - } - mod databricks { - use crate::dialect::Dialect; - /// A [`Dialect`] for [Databricks SQL](https://www.databricks.com/) - /// - /// See . - pub struct DatabricksDialect; - #[automatically_derived] - impl ::core::fmt::Debug for DatabricksDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "DatabricksDialect") - } - } - #[automatically_derived] - impl ::core::default::Default for DatabricksDialect { - #[inline] - fn default() -> DatabricksDialect { - DatabricksDialect {} - } - } - impl Dialect for DatabricksDialect { - fn is_delimited_identifier_start(&self, ch: char) -> bool { - match ch { - '`' => true, - _ => false, - } - } - fn is_identifier_start(&self, ch: char) -> bool { - match ch { - 'a'..='z' | 'A'..='Z' | '_' => true, - _ => false, - } - } - fn is_identifier_part(&self, ch: char) -> bool { - match ch { - 'a'..='z' | 'A'..='Z' | '0'..='9' | '_' => true, - _ => false, - } - } - fn supports_filter_during_aggregation(&self) -> bool { - true - } - fn supports_group_by_expr(&self) -> bool { - true - } - fn supports_lambda_functions(&self) -> bool { - true - } - fn supports_select_wildcard_except(&self) -> bool { - true - } - fn require_interval_qualifier(&self) -> bool { - true - } - fn supports_struct_literal(&self) -> bool { - true - } - } - } - mod duckdb { - use crate::dialect::Dialect; - /// A [`Dialect`] for [DuckDB](https://duckdb.org/) - pub struct DuckDbDialect; - #[automatically_derived] - impl ::core::fmt::Debug for DuckDbDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "DuckDbDialect") - } - } - #[automatically_derived] - impl ::core::default::Default for DuckDbDialect { - #[inline] - fn default() -> DuckDbDialect { - DuckDbDialect {} - } - } - impl Dialect for DuckDbDialect { - fn supports_trailing_commas(&self) -> bool { - true - } - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_alphabetic() || ch == '_' - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_alphabetic() || ch.is_ascii_digit() || ch == '$' || ch == '_' - } - fn supports_filter_during_aggregation(&self) -> bool { - true - } - fn supports_group_by_expr(&self) -> bool { - true - } - fn supports_named_fn_args_with_eq_operator(&self) -> bool { - true - } - fn supports_named_fn_args_with_assignment_operator(&self) -> bool { - true - } - fn supports_dictionary_syntax(&self) -> bool { - true - } - fn support_map_literal_syntax(&self) -> bool { - true - } - /// See - fn supports_lambda_functions(&self) -> bool { - true - } - fn supports_explain_with_utility_options(&self) -> bool { - true - } - /// See DuckDB - fn supports_load_extension(&self) -> bool { - true - } - } - } - mod generic { - use crate::dialect::Dialect; - /// A permissive, general purpose [`Dialect`], which parses a wide variety of SQL - /// statements, from many different dialects. - pub struct GenericDialect; - #[automatically_derived] - impl ::core::fmt::Debug for GenericDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "GenericDialect") - } - } - #[automatically_derived] - impl ::core::default::Default for GenericDialect { - #[inline] - fn default() -> GenericDialect { - GenericDialect {} - } - } - impl Dialect for GenericDialect { - fn is_delimited_identifier_start(&self, ch: char) -> bool { - ch == '"' || ch == '`' - } - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_alphabetic() || ch == '_' || ch == '#' || ch == '@' - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_alphabetic() || ch.is_ascii_digit() || ch == '@' || ch == '$' - || ch == '#' || ch == '_' - } - fn supports_unicode_string_literal(&self) -> bool { - true - } - fn supports_group_by_expr(&self) -> bool { - true - } - fn supports_connect_by(&self) -> bool { - true - } - fn supports_match_recognize(&self) -> bool { - true - } - fn supports_start_transaction_modifier(&self) -> bool { - true - } - fn supports_window_function_null_treatment_arg(&self) -> bool { - true - } - fn supports_dictionary_syntax(&self) -> bool { - true - } - fn supports_window_clause_named_window_reference(&self) -> bool { - true - } - fn supports_parenthesized_set_variables(&self) -> bool { - true - } - fn supports_select_wildcard_except(&self) -> bool { - true - } - fn support_map_literal_syntax(&self) -> bool { - true - } - fn allow_extract_custom(&self) -> bool { - true - } - fn allow_extract_single_quotes(&self) -> bool { - true - } - fn supports_create_index_with_clause(&self) -> bool { - true - } - fn supports_explain_with_utility_options(&self) -> bool { - true - } - fn supports_limit_comma(&self) -> bool { - true - } - fn supports_asc_desc_in_column_definition(&self) -> bool { - true - } - fn supports_try_convert(&self) -> bool { - true - } - fn supports_comment_on(&self) -> bool { - true - } - fn supports_load_extension(&self) -> bool { - true - } - fn supports_named_fn_args_with_assignment_operator(&self) -> bool { - true - } - fn supports_struct_literal(&self) -> bool { - true - } - fn supports_empty_projections(&self) -> bool { - true - } - fn supports_nested_comments(&self) -> bool { - true - } - fn supports_user_host_grantee(&self) -> bool { - true - } - fn supports_string_escape_constant(&self) -> bool { - true - } - } - } - mod hive { - use crate::dialect::Dialect; - /// A [`Dialect`] for [Hive](https://hive.apache.org/). - pub struct HiveDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for HiveDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "HiveDialect") - } - } - impl Dialect for HiveDialect { - fn is_delimited_identifier_start(&self, ch: char) -> bool { - (ch == '"') || (ch == '`') - } - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch.is_ascii_digit() - || ch == '$' - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch.is_ascii_digit() - || ch == '_' || ch == '$' || ch == '{' || ch == '}' - } - fn supports_filter_during_aggregation(&self) -> bool { - true - } - fn supports_numeric_prefix(&self) -> bool { - true - } - fn require_interval_qualifier(&self) -> bool { - true - } - /// See Hive - fn supports_bang_not_operator(&self) -> bool { - true - } - /// See Hive - fn supports_load_data(&self) -> bool { - true - } - /// See Hive - fn supports_table_sample_before_alias(&self) -> bool { - true - } - } - } - mod mssql { - use crate::dialect::Dialect; - /// A [`Dialect`] for [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server/) - pub struct MsSqlDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for MsSqlDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "MsSqlDialect") - } - } - impl Dialect for MsSqlDialect { - fn is_delimited_identifier_start(&self, ch: char) -> bool { - ch == '"' || ch == '[' - } - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_alphabetic() || ch == '_' || ch == '#' || ch == '@' - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_alphabetic() || ch.is_ascii_digit() || ch == '@' || ch == '$' - || ch == '#' || ch == '_' - } - /// SQL Server has `CONVERT(type, value)` instead of `CONVERT(value, type)` - /// - fn convert_type_before_value(&self) -> bool { - true - } - fn supports_connect_by(&self) -> bool { - true - } - fn supports_eq_alias_assignment(&self) -> bool { - true - } - fn supports_try_convert(&self) -> bool { - true - } - /// In MSSQL, there is no boolean type, and `true` and `false` are valid column names - fn supports_boolean_literals(&self) -> bool { - false - } - fn supports_methods(&self) -> bool { - true - } - fn supports_named_fn_args_with_colon_operator(&self) -> bool { - true - } - fn supports_named_fn_args_with_expr_name(&self) -> bool { - true - } - fn supports_named_fn_args_with_rarrow_operator(&self) -> bool { - false - } - fn supports_start_transaction_modifier(&self) -> bool { - true - } - fn supports_end_transaction_modifier(&self) -> bool { - true - } - /// See: - fn supports_set_stmt_without_operator(&self) -> bool { - true - } - /// See: - fn supports_timestamp_versioning(&self) -> bool { - true - } - } - } - mod mysql { - use crate::{ - ast::{BinaryOperator, Expr, LockTable, LockTableType, Statement}, - dialect::Dialect, keywords::Keyword, parser::{Parser, ParserError}, - }; - use super::keywords; - const RESERVED_FOR_TABLE_ALIAS_MYSQL: &[Keyword] = &[ - Keyword::USE, - Keyword::IGNORE, - Keyword::FORCE, - ]; - /// A [`Dialect`] for [MySQL](https://www.mysql.com/) - pub struct MySqlDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for MySqlDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "MySqlDialect") - } - } - impl Dialect for MySqlDialect { - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_alphabetic() || ch == '_' || ch == '$' || ch == '@' - || ('\u{0080}'..='\u{ffff}').contains(&ch) - } - fn is_identifier_part(&self, ch: char) -> bool { - self.is_identifier_start(ch) || ch.is_ascii_digit() - } - fn is_delimited_identifier_start(&self, ch: char) -> bool { - ch == '`' - } - fn identifier_quote_style(&self, _identifier: &str) -> Option { - Some('`') - } - fn supports_string_literal_backslash_escape(&self) -> bool { - true - } - fn supports_numeric_prefix(&self) -> bool { - true - } - fn parse_infix( - &self, - parser: &mut crate::parser::Parser, - expr: &crate::ast::Expr, - _precedence: u8, - ) -> Option> { - if parser.parse_keyword(Keyword::DIV) { - Some( - Ok(Expr::BinaryOp { - left: Box::new(expr.clone()), - op: BinaryOperator::MyIntegerDivide, - right: Box::new(parser.parse_expr().unwrap()), - }), - ) - } else { - None - } - } - fn parse_statement( - &self, - parser: &mut Parser, - ) -> Option> { - if parser.parse_keywords(&[Keyword::LOCK, Keyword::TABLES]) { - Some(parse_lock_tables(parser)) - } else if parser.parse_keywords(&[Keyword::UNLOCK, Keyword::TABLES]) { - Some(parse_unlock_tables(parser)) - } else { - None - } - } - fn require_interval_qualifier(&self) -> bool { - true - } - fn supports_limit_comma(&self) -> bool { - true - } - /// See: - fn supports_create_table_select(&self) -> bool { - true - } - /// See: - fn supports_insert_set(&self) -> bool { - true - } - fn supports_user_host_grantee(&self) -> bool { - true - } - fn is_table_factor_alias( - &self, - explicit: bool, - kw: &Keyword, - _parser: &mut Parser, - ) -> bool { - explicit - || (!keywords::RESERVED_FOR_TABLE_ALIAS.contains(kw) - && !RESERVED_FOR_TABLE_ALIAS_MYSQL.contains(kw)) - } - fn supports_table_hints(&self) -> bool { - true - } - } - /// `LOCK TABLES` - /// - fn parse_lock_tables(parser: &mut Parser) -> Result { - let tables = parser.parse_comma_separated(parse_lock_table)?; - Ok(Statement::LockTables { tables }) - } - fn parse_lock_table(parser: &mut Parser) -> Result { - let table = parser.parse_identifier()?; - let alias = parser - .parse_optional_alias( - &[Keyword::READ, Keyword::WRITE, Keyword::LOW_PRIORITY], - )?; - let lock_type = parse_lock_tables_type(parser)?; - Ok(LockTable { - table, - alias, - lock_type, - }) - } - fn parse_lock_tables_type( - parser: &mut Parser, - ) -> Result { - if parser.parse_keyword(Keyword::READ) { - if parser.parse_keyword(Keyword::LOCAL) { - Ok(LockTableType::Read { local: true }) - } else { - Ok(LockTableType::Read { - local: false, - }) - } - } else if parser.parse_keyword(Keyword::WRITE) { - Ok(LockTableType::Write { - low_priority: false, - }) - } else if parser.parse_keywords(&[Keyword::LOW_PRIORITY, Keyword::WRITE]) { - Ok(LockTableType::Write { - low_priority: true, - }) - } else { - parser.expected("an lock type in LOCK TABLES", parser.peek_token()) - } - } - /// UNLOCK TABLES - /// - fn parse_unlock_tables(_parser: &mut Parser) -> Result { - Ok(Statement::UnlockTables) - } - } - mod postgresql { - use log::debug; - use crate::ast::{ObjectName, Statement, UserDefinedTypeRepresentation}; - use crate::dialect::{Dialect, Precedence}; - use crate::keywords::Keyword; - use crate::parser::{Parser, ParserError}; - use crate::tokenizer::Token; - /// A [`Dialect`] for [PostgreSQL](https://www.postgresql.org/) - pub struct PostgreSqlDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for PostgreSqlDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "PostgreSqlDialect") - } - } - const DOUBLE_COLON_PREC: u8 = 140; - const BRACKET_PREC: u8 = 130; - const COLLATE_PREC: u8 = 120; - const AT_TZ_PREC: u8 = 110; - const CARET_PREC: u8 = 100; - const MUL_DIV_MOD_OP_PREC: u8 = 90; - const PLUS_MINUS_PREC: u8 = 80; - const XOR_PREC: u8 = 75; - const PG_OTHER_PREC: u8 = 70; - const BETWEEN_LIKE_PREC: u8 = 60; - const EQ_PREC: u8 = 50; - const IS_PREC: u8 = 40; - const NOT_PREC: u8 = 30; - const AND_PREC: u8 = 20; - const OR_PREC: u8 = 10; - impl Dialect for PostgreSqlDialect { - fn identifier_quote_style(&self, _identifier: &str) -> Option { - Some('"') - } - fn is_delimited_identifier_start(&self, ch: char) -> bool { - ch == '"' - } - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_alphabetic() || ch == '_' - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_alphabetic() || ch.is_ascii_digit() || ch == '$' || ch == '_' - } - fn supports_unicode_string_literal(&self) -> bool { - true - } - /// See - fn is_custom_operator_part(&self, ch: char) -> bool { - match ch { - '+' | '-' | '*' | '/' | '<' | '>' | '=' | '~' | '!' | '@' | '#' | '%' - | '^' | '&' | '|' | '`' | '?' => true, - _ => false, - } - } - fn get_next_precedence( - &self, - parser: &Parser, - ) -> Option> { - let token = parser.peek_token(); - { - let lvl = ::log::Level::Debug; - if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() { - ::log::__private_api::log( - format_args!("get_next_precedence() {0:?}", token), - lvl, - &( - "sqlparser::dialect::postgresql", - "sqlparser::dialect::postgresql", - ::log::__private_api::loc(), - ), - (), - ); - } - }; - match token.token { - Token::Word(w) if w.keyword == Keyword::COLLATE => { - Some(Ok(COLLATE_PREC)) - } - Token::LBracket => Some(Ok(BRACKET_PREC)), - Token::Arrow - | Token::LongArrow - | Token::HashArrow - | Token::HashLongArrow - | Token::AtArrow - | Token::ArrowAt - | Token::HashMinus - | Token::AtQuestion - | Token::AtAt - | Token::Question - | Token::QuestionAnd - | Token::QuestionPipe - | Token::ExclamationMark - | Token::Overlap - | Token::CaretAt - | Token::StringConcat - | Token::Sharp - | Token::ShiftRight - | Token::ShiftLeft - | Token::CustomBinaryOperator(_) => Some(Ok(PG_OTHER_PREC)), - _ => None, - } - } - fn parse_statement( - &self, - parser: &mut Parser, - ) -> Option> { - if parser.parse_keyword(Keyword::CREATE) { - parser.prev_token(); - parse_create(parser) - } else { - None - } - } - fn supports_filter_during_aggregation(&self) -> bool { - true - } - fn supports_group_by_expr(&self) -> bool { - true - } - fn prec_value(&self, prec: Precedence) -> u8 { - match prec { - Precedence::DoubleColon => DOUBLE_COLON_PREC, - Precedence::AtTz => AT_TZ_PREC, - Precedence::MulDivModOp => MUL_DIV_MOD_OP_PREC, - Precedence::PlusMinus => PLUS_MINUS_PREC, - Precedence::Xor => XOR_PREC, - Precedence::Ampersand => PG_OTHER_PREC, - Precedence::Caret => CARET_PREC, - Precedence::Pipe => PG_OTHER_PREC, - Precedence::Between => BETWEEN_LIKE_PREC, - Precedence::Eq => EQ_PREC, - Precedence::Like => BETWEEN_LIKE_PREC, - Precedence::Is => IS_PREC, - Precedence::PgOther => PG_OTHER_PREC, - Precedence::UnaryNot => NOT_PREC, - Precedence::And => AND_PREC, - Precedence::Or => OR_PREC, - } - } - fn allow_extract_custom(&self) -> bool { - true - } - fn allow_extract_single_quotes(&self) -> bool { - true - } - fn supports_create_index_with_clause(&self) -> bool { - true - } - /// see - fn supports_explain_with_utility_options(&self) -> bool { - true - } - /// see - /// see - /// see - fn supports_listen_notify(&self) -> bool { - true - } - /// see - fn supports_factorial_operator(&self) -> bool { - true - } - /// see - fn supports_comment_on(&self) -> bool { - true - } - /// See - fn supports_load_extension(&self) -> bool { - true - } - /// See - /// - /// Required to support the colon in: - /// ```sql - /// SELECT json_object('a': 'b') - /// ``` - fn supports_named_fn_args_with_colon_operator(&self) -> bool { - true - } - /// See - /// - /// Required to support the label in: - /// ```sql - /// SELECT json_object('label': 'value') - /// ``` - fn supports_named_fn_args_with_expr_name(&self) -> bool { - true - } - /// Return true if the dialect supports empty projections in SELECT statements - /// - /// Example - /// ```sql - /// SELECT from table_name - /// ``` - fn supports_empty_projections(&self) -> bool { - true - } - fn supports_nested_comments(&self) -> bool { - true - } - fn supports_string_escape_constant(&self) -> bool { - true - } - fn supports_numeric_literal_underscores(&self) -> bool { - true - } - } - pub fn parse_create( - parser: &mut Parser, - ) -> Option> { - let name = parser - .maybe_parse(|parser| -> Result { - parser.expect_keyword_is(Keyword::CREATE)?; - parser.expect_keyword_is(Keyword::TYPE)?; - let name = parser.parse_object_name(false)?; - parser.expect_keyword_is(Keyword::AS)?; - parser.expect_keyword_is(Keyword::ENUM)?; - Ok(name) - }); - match name { - Ok(name) => name.map(|name| parse_create_type_as_enum(parser, name)), - Err(e) => Some(Err(e)), - } - } - pub fn parse_create_type_as_enum( - parser: &mut Parser, - name: ObjectName, - ) -> Result { - if !parser.consume_token(&Token::LParen) { - return parser - .expected("'(' after CREATE TYPE AS ENUM", parser.peek_token()); - } - let labels = parser - .parse_comma_separated0(|p| p.parse_identifier(), Token::RParen)?; - parser.expect_token(&Token::RParen)?; - Ok(Statement::CreateType { - name, - representation: UserDefinedTypeRepresentation::Enum { - labels, - }, - }) - } - } - mod redshift { - use crate::dialect::Dialect; - use core::iter::Peekable; - use core::str::Chars; - use super::PostgreSqlDialect; - /// A [`Dialect`] for [RedShift](https://aws.amazon.com/redshift/) - pub struct RedshiftSqlDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for RedshiftSqlDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "RedshiftSqlDialect") - } - } - impl Dialect for RedshiftSqlDialect { - /// Determine if a character starts a potential nested quoted identifier. - /// Example: RedShift supports the following quote styles to all mean the same thing: - /// ```sql - /// SELECT 1 AS foo; - /// SELECT 1 AS "foo"; - /// SELECT 1 AS [foo]; - /// SELECT 1 AS ["foo"]; - /// ``` - fn is_nested_delimited_identifier_start(&self, ch: char) -> bool { - ch == '[' - } - /// Only applicable whenever [`Self::is_nested_delimited_identifier_start`] returns true - /// If the next sequence of tokens potentially represent a nested identifier, then this method - /// returns a tuple containing the outer quote style, and if present, the inner (nested) quote style. - /// - /// Example (Redshift): - /// ```text - /// `["foo"]` => Some(`[`, Some(`"`)) - /// `[foo]` => Some(`[`, None) - /// `[0]` => None - /// `"foo"` => None - /// ``` - fn peek_nested_delimited_identifier_quotes( - &self, - mut chars: Peekable>, - ) -> Option<(char, Option)> { - if chars.peek() != Some(&'[') { - return None; - } - chars.next(); - let mut not_white_chars = chars - .skip_while(|ch| ch.is_whitespace()) - .peekable(); - if let Some(&ch) = not_white_chars.peek() { - if ch == '"' { - return Some(('[', Some('"'))); - } - if self.is_identifier_start(ch) { - return Some(('[', None)); - } - } - None - } - fn is_identifier_start(&self, ch: char) -> bool { - PostgreSqlDialect {}.is_identifier_start(ch) || ch == '#' - } - fn is_identifier_part(&self, ch: char) -> bool { - PostgreSqlDialect {}.is_identifier_part(ch) || ch == '#' - } - /// redshift has `CONVERT(type, value)` instead of `CONVERT(value, type)` - /// - fn convert_type_before_value(&self) -> bool { - true - } - fn supports_connect_by(&self) -> bool { - true - } - /// Redshift expects the `TOP` option before the `ALL/DISTINCT` option: - /// - fn supports_top_before_distinct(&self) -> bool { - true - } - /// Redshift supports PartiQL: - fn supports_partiql(&self) -> bool { - true - } - fn supports_string_escape_constant(&self) -> bool { - true - } - } - } - mod snowflake { - use crate::ast::helpers::stmt_create_table::CreateTableBuilder; - use crate::ast::helpers::stmt_data_loading::{ - DataLoadingOption, DataLoadingOptionType, DataLoadingOptions, - FileStagingCommand, StageLoadSelectItem, StageParamsObject, - }; - use crate::ast::{ - ColumnOption, ColumnPolicy, ColumnPolicyProperty, Ident, IdentityParameters, - IdentityProperty, IdentityPropertyFormatKind, IdentityPropertyKind, - IdentityPropertyOrder, ObjectName, RowAccessPolicy, Statement, - TagsColumnOption, WrappedCollection, - }; - use crate::dialect::{Dialect, Precedence}; - use crate::keywords::Keyword; - use crate::parser::{Parser, ParserError}; - use crate::tokenizer::Token; - use sqlparser::ast::StorageSerializationPolicy; - use super::keywords::RESERVED_FOR_IDENTIFIER; - /// A [`Dialect`] for [Snowflake](https://www.snowflake.com/) - pub struct SnowflakeDialect; - #[automatically_derived] - impl ::core::fmt::Debug for SnowflakeDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "SnowflakeDialect") - } - } - #[automatically_derived] - impl ::core::default::Default for SnowflakeDialect { - #[inline] - fn default() -> SnowflakeDialect { - SnowflakeDialect {} - } - } - impl Dialect for SnowflakeDialect { - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch == '_' - } - fn supports_projection_trailing_commas(&self) -> bool { - true - } - fn supports_from_trailing_commas(&self) -> bool { - true - } - fn supports_object_name_double_dot_notation(&self) -> bool { - true - } - fn is_identifier_part(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch.is_ascii_digit() - || ch == '$' || ch == '_' - } - fn supports_string_literal_backslash_escape(&self) -> bool { - true - } - fn supports_within_after_array_aggregation(&self) -> bool { - true - } - fn supports_connect_by(&self) -> bool { - true - } - fn supports_match_recognize(&self) -> bool { - true - } - fn supports_dictionary_syntax(&self) -> bool { - true - } - fn supports_window_function_null_treatment_arg(&self) -> bool { - true - } - /// See [doc](https://docs.snowflake.com/en/sql-reference/sql/set#syntax) - fn supports_parenthesized_set_variables(&self) -> bool { - true - } - /// See [doc](https://docs.snowflake.com/en/sql-reference/sql/comment) - fn supports_comment_on(&self) -> bool { - true - } - fn parse_statement( - &self, - parser: &mut Parser, - ) -> Option> { - if parser.parse_keyword(Keyword::CREATE) { - let or_replace = parser - .parse_keywords(&[Keyword::OR, Keyword::REPLACE]); - let global = match parser - .parse_one_of_keywords(&[Keyword::LOCAL, Keyword::GLOBAL]) - { - Some(Keyword::LOCAL) => Some(false), - Some(Keyword::GLOBAL) => Some(true), - _ => None, - }; - let mut temporary = false; - let mut volatile = false; - let mut transient = false; - let mut iceberg = false; - match parser - .parse_one_of_keywords( - &[ - Keyword::TEMP, - Keyword::TEMPORARY, - Keyword::VOLATILE, - Keyword::TRANSIENT, - Keyword::ICEBERG, - ], - ) - { - Some(Keyword::TEMP | Keyword::TEMPORARY) => temporary = true, - Some(Keyword::VOLATILE) => volatile = true, - Some(Keyword::TRANSIENT) => transient = true, - Some(Keyword::ICEBERG) => iceberg = true, - _ => {} - } - if parser.parse_keyword(Keyword::STAGE) { - return Some(parse_create_stage(or_replace, temporary, parser)); - } else if parser.parse_keyword(Keyword::TABLE) { - return Some( - parse_create_table( - or_replace, - global, - temporary, - volatile, - transient, - iceberg, - parser, - ), - ); - } else { - let mut back = 1; - if or_replace { - back += 2; - } - if temporary { - back += 1; - } - for _i in 0..back { - parser.prev_token(); - } - } - } - if parser.parse_keywords(&[Keyword::COPY, Keyword::INTO]) { - return Some(parse_copy_into(parser)); - } - if let Some(kw) = parser - .parse_one_of_keywords( - &[Keyword::LIST, Keyword::LS, Keyword::REMOVE, Keyword::RM], - ) - { - return Some(parse_file_staging_command(kw, parser)); - } - None - } - fn parse_column_option( - &self, - parser: &mut Parser, - ) -> Result, ParserError>>, ParserError> { - parser - .maybe_parse(|parser| { - let with = parser.parse_keyword(Keyword::WITH); - if parser.parse_keyword(Keyword::IDENTITY) { - Ok( - parse_identity_property(parser) - .map(|p| Some( - ColumnOption::Identity(IdentityPropertyKind::Identity(p)), - )), - ) - } else if parser.parse_keyword(Keyword::AUTOINCREMENT) { - Ok( - parse_identity_property(parser) - .map(|p| { - Some( - ColumnOption::Identity( - IdentityPropertyKind::Autoincrement(p), - ), - ) - }), - ) - } else if parser - .parse_keywords(&[Keyword::MASKING, Keyword::POLICY]) - { - Ok( - parse_column_policy_property(parser, with) - .map(|p| Some( - ColumnOption::Policy(ColumnPolicy::MaskingPolicy(p)), - )), - ) - } else if parser - .parse_keywords(&[Keyword::PROJECTION, Keyword::POLICY]) - { - Ok( - parse_column_policy_property(parser, with) - .map(|p| Some( - ColumnOption::Policy(ColumnPolicy::ProjectionPolicy(p)), - )), - ) - } else if parser.parse_keywords(&[Keyword::TAG]) { - Ok( - parse_column_tags(parser, with) - .map(|p| Some(ColumnOption::Tags(p))), - ) - } else { - Err(ParserError::ParserError("not found match".to_string())) - } - }) - } - fn get_next_precedence( - &self, - parser: &Parser, - ) -> Option> { - let token = parser.peek_token(); - match token.token { - Token::Colon => Some(Ok(self.prec_value(Precedence::DoubleColon))), - _ => None, - } - } - fn describe_requires_table_keyword(&self) -> bool { - true - } - fn allow_extract_custom(&self) -> bool { - true - } - fn allow_extract_single_quotes(&self) -> bool { - true - } - /// Snowflake expects the `LIKE` option before the `IN` option, - /// for example: - fn supports_show_like_before_in(&self) -> bool { - true - } - fn is_reserved_for_identifier(&self, kw: Keyword) -> bool { - if match kw { - Keyword::INTERVAL => true, - _ => false, - } { - false - } else { - RESERVED_FOR_IDENTIFIER.contains(&kw) - } - } - fn supports_partiql(&self) -> bool { - true - } - fn is_select_item_alias( - &self, - explicit: bool, - kw: &Keyword, - parser: &mut Parser, - ) -> bool { - explicit - || match kw { - Keyword::EXCEPT - | Keyword::LIMIT - | Keyword::OFFSET - | Keyword::RETURNING if !match parser.peek_token_ref().token { - Token::Comma | Token::EOF => true, - _ => false, - } => false, - Keyword::FETCH if parser.peek_keyword(Keyword::FIRST) - || parser.peek_keyword(Keyword::NEXT) => false, - Keyword::FROM - | Keyword::GROUP - | Keyword::HAVING - | Keyword::INTERSECT - | Keyword::INTO - | Keyword::MINUS - | Keyword::ORDER - | Keyword::SELECT - | Keyword::UNION - | Keyword::WHERE - | Keyword::WITH => false, - _ => true, - } - } - /// See: - fn supports_timestamp_versioning(&self) -> bool { - true - } - /// See: - fn supports_group_by_expr(&self) -> bool { - true - } - } - fn parse_file_staging_command( - kw: Keyword, - parser: &mut Parser, - ) -> Result { - let stage = parse_snowflake_stage_name(parser)?; - let pattern = if parser.parse_keyword(Keyword::PATTERN) { - parser.expect_token(&Token::Eq)?; - Some(parser.parse_literal_string()?) - } else { - None - }; - match kw { - Keyword::LIST | Keyword::LS => { - Ok( - Statement::List(FileStagingCommand { - stage, - pattern, - }), - ) - } - Keyword::REMOVE | Keyword::RM => { - Ok( - Statement::Remove(FileStagingCommand { - stage, - pattern, - }), - ) - } - _ => { - Err( - ParserError::ParserError( - "unexpected stage command, expecting LIST, LS, REMOVE or RM" - .to_string(), - ), - ) - } - } - } - /// Parse snowflake create table statement. - /// - /// - pub fn parse_create_table( - or_replace: bool, - global: Option, - temporary: bool, - volatile: bool, - transient: bool, - iceberg: bool, - parser: &mut Parser, - ) -> Result { - let if_not_exists = parser - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let table_name = parser.parse_object_name(false)?; - let mut builder = CreateTableBuilder::new(table_name) - .or_replace(or_replace) - .if_not_exists(if_not_exists) - .temporary(temporary) - .transient(transient) - .volatile(volatile) - .iceberg(iceberg) - .global(global) - .hive_formats(Some(Default::default())); - loop { - let next_token = parser.next_token(); - match &next_token.token { - Token::Word(word) => { - match word.keyword { - Keyword::COPY => { - parser.expect_keyword_is(Keyword::GRANTS)?; - builder = builder.copy_grants(true); - } - Keyword::COMMENT => { - parser.prev_token(); - builder = builder - .comment(parser.parse_optional_inline_comment()?); - } - Keyword::AS => { - let query = parser.parse_query()?; - builder = builder.query(Some(query)); - break; - } - Keyword::CLONE => { - let clone = parser.parse_object_name(false).ok(); - builder = builder.clone_clause(clone); - break; - } - Keyword::LIKE => { - let like = parser.parse_object_name(false).ok(); - builder = builder.like(like); - break; - } - Keyword::CLUSTER => { - parser.expect_keyword_is(Keyword::BY)?; - parser.expect_token(&Token::LParen)?; - let cluster_by = Some( - WrappedCollection::Parentheses( - parser.parse_comma_separated(|p| p.parse_identifier())?, - ), - ); - parser.expect_token(&Token::RParen)?; - builder = builder.cluster_by(cluster_by); - } - Keyword::ENABLE_SCHEMA_EVOLUTION => { - parser.expect_token(&Token::Eq)?; - let enable_schema_evolution = match parser - .parse_one_of_keywords(&[Keyword::TRUE, Keyword::FALSE]) - { - Some(Keyword::TRUE) => true, - Some(Keyword::FALSE) => false, - _ => { - return parser.expected("TRUE or FALSE", next_token); - } - }; - builder = builder - .enable_schema_evolution(Some(enable_schema_evolution)); - } - Keyword::CHANGE_TRACKING => { - parser.expect_token(&Token::Eq)?; - let change_tracking = match parser - .parse_one_of_keywords(&[Keyword::TRUE, Keyword::FALSE]) - { - Some(Keyword::TRUE) => true, - Some(Keyword::FALSE) => false, - _ => { - return parser.expected("TRUE or FALSE", next_token); - } - }; - builder = builder.change_tracking(Some(change_tracking)); - } - Keyword::DATA_RETENTION_TIME_IN_DAYS => { - parser.expect_token(&Token::Eq)?; - let data_retention_time_in_days = parser - .parse_literal_uint()?; - builder = builder - .data_retention_time_in_days( - Some(data_retention_time_in_days), - ); - } - Keyword::MAX_DATA_EXTENSION_TIME_IN_DAYS => { - parser.expect_token(&Token::Eq)?; - let max_data_extension_time_in_days = parser - .parse_literal_uint()?; - builder = builder - .max_data_extension_time_in_days( - Some(max_data_extension_time_in_days), - ); - } - Keyword::DEFAULT_DDL_COLLATION => { - parser.expect_token(&Token::Eq)?; - let default_ddl_collation = parser.parse_literal_string()?; - builder = builder - .default_ddl_collation(Some(default_ddl_collation)); - } - Keyword::WITH => { - parser - .expect_one_of_keywords( - &[Keyword::AGGREGATION, Keyword::TAG, Keyword::ROW], - )?; - parser.prev_token(); - } - Keyword::AGGREGATION => { - parser.expect_keyword_is(Keyword::POLICY)?; - let aggregation_policy = parser.parse_object_name(false)?; - builder = builder - .with_aggregation_policy(Some(aggregation_policy)); - } - Keyword::ROW => { - parser - .expect_keywords(&[Keyword::ACCESS, Keyword::POLICY])?; - let policy = parser.parse_object_name(false)?; - parser.expect_keyword_is(Keyword::ON)?; - parser.expect_token(&Token::LParen)?; - let columns = parser - .parse_comma_separated(|p| p.parse_identifier())?; - parser.expect_token(&Token::RParen)?; - builder = builder - .with_row_access_policy( - Some(RowAccessPolicy::new(policy, columns)), - ); - } - Keyword::TAG => { - parser.expect_token(&Token::LParen)?; - let tags = parser.parse_comma_separated(Parser::parse_tag)?; - parser.expect_token(&Token::RParen)?; - builder = builder.with_tags(Some(tags)); - } - Keyword::ON if parser.parse_keyword(Keyword::COMMIT) => { - let on_commit = Some( - parser.parse_create_table_on_commit()?, - ); - builder = builder.on_commit(on_commit); - } - Keyword::EXTERNAL_VOLUME => { - parser.expect_token(&Token::Eq)?; - builder.external_volume = Some( - parser.parse_literal_string()?, - ); - } - Keyword::CATALOG => { - parser.expect_token(&Token::Eq)?; - builder.catalog = Some(parser.parse_literal_string()?); - } - Keyword::BASE_LOCATION => { - parser.expect_token(&Token::Eq)?; - builder.base_location = Some( - parser.parse_literal_string()?, - ); - } - Keyword::CATALOG_SYNC => { - parser.expect_token(&Token::Eq)?; - builder.catalog_sync = Some(parser.parse_literal_string()?); - } - Keyword::STORAGE_SERIALIZATION_POLICY => { - parser.expect_token(&Token::Eq)?; - builder.storage_serialization_policy = Some( - parse_storage_serialization_policy(parser)?, - ); - } - _ => { - return parser.expected("end of statement", next_token); - } - } - } - Token::LParen => { - parser.prev_token(); - let (columns, constraints) = parser.parse_columns()?; - builder = builder.columns(columns).constraints(constraints); - } - Token::EOF => { - if builder.columns.is_empty() { - return Err( - ParserError::ParserError( - "unexpected end of input".to_string(), - ), - ); - } - break; - } - Token::SemiColon => { - if builder.columns.is_empty() { - return Err( - ParserError::ParserError( - "unexpected end of input".to_string(), - ), - ); - } - parser.prev_token(); - break; - } - _ => { - return parser.expected("end of statement", next_token); - } - } - } - if iceberg && builder.base_location.is_none() { - return Err( - ParserError::ParserError( - "BASE_LOCATION is required for ICEBERG tables".to_string(), - ), - ); - } - Ok(builder.build()) - } - pub fn parse_storage_serialization_policy( - parser: &mut Parser, - ) -> Result { - let next_token = parser.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::COMPATIBLE => Ok(StorageSerializationPolicy::Compatible), - Keyword::OPTIMIZED => Ok(StorageSerializationPolicy::Optimized), - _ => parser.expected("storage_serialization_policy", next_token), - } - } - _ => parser.expected("storage_serialization_policy", next_token), - } - } - pub fn parse_create_stage( - or_replace: bool, - temporary: bool, - parser: &mut Parser, - ) -> Result { - let if_not_exists = parser - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let name = parser.parse_object_name(false)?; - let mut directory_table_params = Vec::new(); - let mut file_format = Vec::new(); - let mut copy_options = Vec::new(); - let mut comment = None; - let stage_params = parse_stage_params(parser)?; - if parser.parse_keyword(Keyword::DIRECTORY) { - parser.expect_token(&Token::Eq)?; - directory_table_params = parse_parentheses_options(parser)?; - } - if parser.parse_keyword(Keyword::FILE_FORMAT) { - parser.expect_token(&Token::Eq)?; - file_format = parse_parentheses_options(parser)?; - } - if parser.parse_keyword(Keyword::COPY_OPTIONS) { - parser.expect_token(&Token::Eq)?; - copy_options = parse_parentheses_options(parser)?; - } - if parser.parse_keyword(Keyword::COMMENT) { - parser.expect_token(&Token::Eq)?; - comment = Some( - match parser.next_token().token { - Token::SingleQuotedString(word) => Ok(word), - _ => parser.expected("a comment statement", parser.peek_token()), - }?, - ); - } - Ok(Statement::CreateStage { - or_replace, - temporary, - if_not_exists, - name, - stage_params, - directory_table_params: DataLoadingOptions { - options: directory_table_params, - }, - file_format: DataLoadingOptions { - options: file_format, - }, - copy_options: DataLoadingOptions { - options: copy_options, - }, - comment, - }) - } - pub fn parse_stage_name_identifier( - parser: &mut Parser, - ) -> Result { - let mut ident = String::new(); - while let Some(next_token) = parser.next_token_no_skip() { - match &next_token.token { - Token::Whitespace(_) | Token::SemiColon => break, - Token::Period => { - parser.prev_token(); - break; - } - Token::RParen => { - parser.prev_token(); - break; - } - Token::AtSign => ident.push('@'), - Token::Tilde => ident.push('~'), - Token::Mod => ident.push('%'), - Token::Div => ident.push('/'), - Token::Word(w) => ident.push_str(&w.to_string()), - _ => { - return parser - .expected("stage name identifier", parser.peek_token()); - } - } - } - Ok(Ident::new(ident)) - } - pub fn parse_snowflake_stage_name( - parser: &mut Parser, - ) -> Result { - match parser.next_token().token { - Token::AtSign => { - parser.prev_token(); - let mut idents = ::alloc::vec::Vec::new(); - loop { - idents.push(parse_stage_name_identifier(parser)?); - if !parser.consume_token(&Token::Period) { - break; - } - } - Ok(ObjectName::from(idents)) - } - _ => { - parser.prev_token(); - Ok(parser.parse_object_name(false)?) - } - } - } - pub fn parse_copy_into(parser: &mut Parser) -> Result { - let into: ObjectName = parse_snowflake_stage_name(parser)?; - let mut files: Vec = ::alloc::vec::Vec::new(); - let mut from_transformations: Option> = None; - let from_stage_alias; - let from_stage: ObjectName; - let stage_params: StageParamsObject; - parser.expect_keyword_is(Keyword::FROM)?; - match parser.next_token().token { - Token::LParen => { - parser.expect_keyword_is(Keyword::SELECT)?; - from_transformations = parse_select_items_for_data_load(parser)?; - parser.expect_keyword_is(Keyword::FROM)?; - from_stage = parse_snowflake_stage_name(parser)?; - stage_params = parse_stage_params(parser)?; - from_stage_alias = if parser.parse_keyword(Keyword::AS) { - Some( - match parser.next_token().token { - Token::Word(w) => Ok(Ident::new(w.value)), - _ => parser.expected("stage alias", parser.peek_token()), - }?, - ) - } else { - None - }; - parser.expect_token(&Token::RParen)?; - } - _ => { - parser.prev_token(); - from_stage = parse_snowflake_stage_name(parser)?; - stage_params = parse_stage_params(parser)?; - from_stage_alias = if parser.parse_keyword(Keyword::AS) { - Some( - match parser.next_token().token { - Token::Word(w) => Ok(Ident::new(w.value)), - _ => parser.expected("stage alias", parser.peek_token()), - }?, - ) - } else { - None - }; - } - }; - if parser.parse_keyword(Keyword::FILES) { - parser.expect_token(&Token::Eq)?; - parser.expect_token(&Token::LParen)?; - let mut continue_loop = true; - while continue_loop { - continue_loop = false; - let next_token = parser.next_token(); - match next_token.token { - Token::SingleQuotedString(s) => files.push(s), - _ => parser.expected("file token", next_token)?, - }; - if parser.next_token().token.eq(&Token::Comma) { - continue_loop = true; - } else { - parser.prev_token(); - } - } - parser.expect_token(&Token::RParen)?; - } - let mut pattern = None; - if parser.parse_keyword(Keyword::PATTERN) { - parser.expect_token(&Token::Eq)?; - let next_token = parser.next_token(); - pattern = Some( - match next_token.token { - Token::SingleQuotedString(s) => s, - _ => parser.expected("pattern", next_token)?, - }, - ); - } - let mut file_format = Vec::new(); - if parser.parse_keyword(Keyword::FILE_FORMAT) { - parser.expect_token(&Token::Eq)?; - file_format = parse_parentheses_options(parser)?; - } - let mut copy_options = Vec::new(); - if parser.parse_keyword(Keyword::COPY_OPTIONS) { - parser.expect_token(&Token::Eq)?; - copy_options = parse_parentheses_options(parser)?; - } - let mut validation_mode = None; - if parser.parse_keyword(Keyword::VALIDATION_MODE) { - parser.expect_token(&Token::Eq)?; - validation_mode = Some(parser.next_token().token.to_string()); - } - Ok(Statement::CopyIntoSnowflake { - into, - from_stage, - from_stage_alias, - stage_params, - from_transformations, - files: if files.is_empty() { None } else { Some(files) }, - pattern, - file_format: DataLoadingOptions { - options: file_format, - }, - copy_options: DataLoadingOptions { - options: copy_options, - }, - validation_mode, - }) - } - fn parse_select_items_for_data_load( - parser: &mut Parser, - ) -> Result>, ParserError> { - let mut select_items: Vec = ::alloc::vec::Vec::new(); - loop { - let mut alias: Option = None; - let mut file_col_num: i32 = 0; - let mut element: Option = None; - let mut item_as: Option = None; - let next_token = parser.next_token(); - match next_token.token { - Token::Placeholder(w) => { - file_col_num = w - .to_string() - .split_off(1) - .parse::() - .map_err(|e| { - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Could not parse \'{0}\' as i32: {1}", w, e), - ); - res - }), - ) - })?; - Ok(()) - } - Token::Word(w) => { - alias = Some(Ident::new(w.value)); - Ok(()) - } - _ => parser.expected("alias or file_col_num", next_token), - }?; - if alias.is_some() { - parser.expect_token(&Token::Period)?; - let col_num_token = parser.next_token(); - match col_num_token.token { - Token::Placeholder(w) => { - file_col_num = w - .to_string() - .split_off(1) - .parse::() - .map_err(|e| { - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Could not parse \'{0}\' as i32: {1}", w, e), - ); - res - }), - ) - })?; - Ok(()) - } - _ => parser.expected("file_col_num", col_num_token), - }?; - } - match parser.next_token().token { - Token::Colon => { - element = Some( - Ident::new( - match parser.next_token().token { - Token::Word(w) => Ok(w.value), - _ => parser.expected("file_col_num", parser.peek_token()), - }?, - ), - ); - } - _ => { - parser.prev_token(); - } - } - if parser.parse_keyword(Keyword::AS) { - item_as = Some( - match parser.next_token().token { - Token::Word(w) => Ok(Ident::new(w.value)), - _ => { - parser.expected("column item alias", parser.peek_token()) - } - }?, - ); - } - select_items - .push(StageLoadSelectItem { - alias, - file_col_num, - element, - item_as, - }); - match parser.next_token().token { - Token::Comma => {} - _ => { - parser.prev_token(); - break; - } - } - } - Ok(Some(select_items)) - } - fn parse_stage_params( - parser: &mut Parser, - ) -> Result { - let (mut url, mut storage_integration, mut endpoint) = (None, None, None); - let mut encryption: DataLoadingOptions = DataLoadingOptions { - options: ::alloc::vec::Vec::new(), - }; - let mut credentials: DataLoadingOptions = DataLoadingOptions { - options: ::alloc::vec::Vec::new(), - }; - if parser.parse_keyword(Keyword::URL) { - parser.expect_token(&Token::Eq)?; - url = Some( - match parser.next_token().token { - Token::SingleQuotedString(word) => Ok(word), - _ => parser.expected("a URL statement", parser.peek_token()), - }?, - ); - } - if parser.parse_keyword(Keyword::STORAGE_INTEGRATION) { - parser.expect_token(&Token::Eq)?; - storage_integration = Some(parser.next_token().token.to_string()); - } - if parser.parse_keyword(Keyword::ENDPOINT) { - parser.expect_token(&Token::Eq)?; - endpoint = Some( - match parser.next_token().token { - Token::SingleQuotedString(word) => Ok(word), - _ => { - parser.expected("an endpoint statement", parser.peek_token()) - } - }?, - ); - } - if parser.parse_keyword(Keyword::CREDENTIALS) { - parser.expect_token(&Token::Eq)?; - credentials = DataLoadingOptions { - options: parse_parentheses_options(parser)?, - }; - } - if parser.parse_keyword(Keyword::ENCRYPTION) { - parser.expect_token(&Token::Eq)?; - encryption = DataLoadingOptions { - options: parse_parentheses_options(parser)?, - }; - } - Ok(StageParamsObject { - url, - encryption, - endpoint, - storage_integration, - credentials, - }) - } - /// Parses options provided within parentheses like: - /// ( ENABLE = { TRUE | FALSE } - /// [ AUTO_REFRESH = { TRUE | FALSE } ] - /// [ REFRESH_ON_CREATE = { TRUE | FALSE } ] - /// [ NOTIFICATION_INTEGRATION = '' ] ) - /// - fn parse_parentheses_options( - parser: &mut Parser, - ) -> Result, ParserError> { - let mut options: Vec = Vec::new(); - parser.expect_token(&Token::LParen)?; - loop { - match parser.next_token().token { - Token::RParen => break, - Token::Word(key) => { - parser.expect_token(&Token::Eq)?; - if parser.parse_keyword(Keyword::TRUE) { - options - .push(DataLoadingOption { - option_name: key.value, - option_type: DataLoadingOptionType::BOOLEAN, - value: "TRUE".to_string(), - }); - Ok(()) - } else if parser.parse_keyword(Keyword::FALSE) { - options - .push(DataLoadingOption { - option_name: key.value, - option_type: DataLoadingOptionType::BOOLEAN, - value: "FALSE".to_string(), - }); - Ok(()) - } else { - match parser.next_token().token { - Token::SingleQuotedString(value) => { - options - .push(DataLoadingOption { - option_name: key.value, - option_type: DataLoadingOptionType::STRING, - value, - }); - Ok(()) - } - Token::Word(word) => { - options - .push(DataLoadingOption { - option_name: key.value, - option_type: DataLoadingOptionType::ENUM, - value: word.value, - }); - Ok(()) - } - _ => { - parser - .expected("expected option value", parser.peek_token()) - } - } - } - } - _ => parser.expected("another option or ')'", parser.peek_token()), - }?; - } - Ok(options) - } - /// Parsing a property of identity or autoincrement column option - /// Syntax: - /// ```sql - /// [ (seed , increment) | START num INCREMENT num ] [ ORDER | NOORDER ] - /// ``` - /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table - fn parse_identity_property( - parser: &mut Parser, - ) -> Result { - let parameters = if parser.consume_token(&Token::LParen) { - let seed = parser.parse_number()?; - parser.expect_token(&Token::Comma)?; - let increment = parser.parse_number()?; - parser.expect_token(&Token::RParen)?; - Some( - IdentityPropertyFormatKind::FunctionCall(IdentityParameters { - seed, - increment, - }), - ) - } else if parser.parse_keyword(Keyword::START) { - let seed = parser.parse_number()?; - parser.expect_keyword_is(Keyword::INCREMENT)?; - let increment = parser.parse_number()?; - Some( - IdentityPropertyFormatKind::StartAndIncrement(IdentityParameters { - seed, - increment, - }), - ) - } else { - None - }; - let order = match parser - .parse_one_of_keywords(&[Keyword::ORDER, Keyword::NOORDER]) - { - Some(Keyword::ORDER) => Some(IdentityPropertyOrder::Order), - Some(Keyword::NOORDER) => Some(IdentityPropertyOrder::NoOrder), - _ => None, - }; - Ok(IdentityProperty { - parameters, - order, - }) - } - /// Parsing a policy property of column option - /// Syntax: - /// ```sql - /// [ USING ( , , ... ) - /// ``` - /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table - fn parse_column_policy_property( - parser: &mut Parser, - with: bool, - ) -> Result { - let policy_name = parser.parse_identifier()?; - let using_columns = if parser.parse_keyword(Keyword::USING) { - parser.expect_token(&Token::LParen)?; - let columns = parser.parse_comma_separated(|p| p.parse_identifier())?; - parser.expect_token(&Token::RParen)?; - Some(columns) - } else { - None - }; - Ok(ColumnPolicyProperty { - with, - policy_name, - using_columns, - }) - } - /// Parsing tags list of column - /// Syntax: - /// ```sql - /// ( = '' [ , = '' , ... ] ) - /// ``` - /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table - fn parse_column_tags( - parser: &mut Parser, - with: bool, - ) -> Result { - parser.expect_token(&Token::LParen)?; - let tags = parser.parse_comma_separated(Parser::parse_tag)?; - parser.expect_token(&Token::RParen)?; - Ok(TagsColumnOption { with, tags }) - } - } - mod sqlite { - use crate::ast::Statement; - use crate::dialect::Dialect; - use crate::keywords::Keyword; - use crate::parser::{Parser, ParserError}; - /// A [`Dialect`] for [SQLite](https://www.sqlite.org) - /// - /// This dialect allows columns in a - /// [`CREATE TABLE`](https://sqlite.org/lang_createtable.html) statement with no - /// type specified, as in `CREATE TABLE t1 (a)`. In the AST, these columns will - /// have the data type [`Unspecified`](crate::ast::DataType::Unspecified). - pub struct SQLiteDialect {} - #[automatically_derived] - impl ::core::fmt::Debug for SQLiteDialect { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str(f, "SQLiteDialect") - } - } - impl Dialect for SQLiteDialect { - fn is_delimited_identifier_start(&self, ch: char) -> bool { - ch == '`' || ch == '"' || ch == '[' - } - fn identifier_quote_style(&self, _identifier: &str) -> Option { - Some('`') - } - fn is_identifier_start(&self, ch: char) -> bool { - ch.is_ascii_lowercase() || ch.is_ascii_uppercase() || ch == '_' - || ('\u{007f}'..='\u{ffff}').contains(&ch) - } - fn supports_filter_during_aggregation(&self) -> bool { - true - } - fn supports_start_transaction_modifier(&self) -> bool { - true - } - fn is_identifier_part(&self, ch: char) -> bool { - self.is_identifier_start(ch) || ch.is_ascii_digit() - } - fn parse_statement( - &self, - parser: &mut Parser, - ) -> Option> { - if parser.parse_keyword(Keyword::REPLACE) { - parser.prev_token(); - Some(parser.parse_insert()) - } else { - None - } - } - fn supports_in_empty_list(&self) -> bool { - true - } - fn supports_limit_comma(&self) -> bool { - true - } - fn supports_asc_desc_in_column_definition(&self) -> bool { - true - } - fn supports_dollar_placeholder(&self) -> bool { - true - } - } - } - use core::any::{Any, TypeId}; - use core::fmt::Debug; - use core::iter::Peekable; - use core::str::Chars; - use log::debug; - pub use self::ansi::AnsiDialect; - pub use self::bigquery::BigQueryDialect; - pub use self::clickhouse::ClickHouseDialect; - pub use self::databricks::DatabricksDialect; - pub use self::duckdb::DuckDbDialect; - pub use self::generic::GenericDialect; - pub use self::hive::HiveDialect; - pub use self::mssql::MsSqlDialect; - pub use self::mysql::MySqlDialect; - pub use self::postgresql::PostgreSqlDialect; - pub use self::redshift::RedshiftSqlDialect; - pub use self::snowflake::SnowflakeDialect; - pub use self::sqlite::SQLiteDialect; - use crate::ast::{ColumnOption, Expr, Statement}; - pub use crate::keywords; - use crate::keywords::Keyword; - use crate::parser::{Parser, ParserError}; - use crate::tokenizer::Token; - /// Encapsulates the differences between SQL implementations. - /// - /// # SQL Dialects - /// - /// SQL implementations deviate from one another, either due to - /// custom extensions or various historical reasons. This trait - /// encapsulates the parsing differences between dialects. - /// - /// [`GenericDialect`] is the most permissive dialect, and parses the union of - /// all the other dialects, when there is no ambiguity. However, it does not - /// currently allow `CREATE TABLE` statements without types specified for all - /// columns; use [`SQLiteDialect`] if you require that. - /// - /// # Examples - /// Most users create a [`Dialect`] directly, as shown on the [module - /// level documentation]: - /// - /// ``` - /// # use sqlparser::dialect::AnsiDialect; - /// let dialect = AnsiDialect {}; - /// ``` - /// - /// It is also possible to dynamically create a [`Dialect`] from its - /// name. For example: - /// - /// ``` - /// # use sqlparser::dialect::{AnsiDialect, dialect_from_str}; - /// let dialect = dialect_from_str("ansi").unwrap(); - /// - /// // Parsed dialect is an instance of `AnsiDialect`: - /// assert!(dialect.is::()); - /// ``` - /// - /// [module level documentation]: crate - pub trait Dialect: Debug + Any { - /// Determine the [`TypeId`] of this dialect. - /// - /// By default, return the same [`TypeId`] as [`Any::type_id`]. Can be overridden - /// by dialects that behave like other dialects - /// (for example when wrapping a dialect). - fn dialect(&self) -> TypeId { - self.type_id() - } - /// Determine if a character starts a quoted identifier. The default - /// implementation, accepting "double quoted" ids is both ANSI-compliant - /// and appropriate for most dialects (with the notable exception of - /// MySQL, MS SQL, and sqlite). You can accept one of characters listed - /// in `Word::matching_end_quote` here - fn is_delimited_identifier_start(&self, ch: char) -> bool { - ch == '"' || ch == '`' - } - /// Determine if a character starts a potential nested quoted identifier. - /// Example: RedShift supports the following quote styles to all mean the same thing: - /// ```sql - /// SELECT 1 AS foo; - /// SELECT 1 AS "foo"; - /// SELECT 1 AS [foo]; - /// SELECT 1 AS ["foo"]; - /// ``` - fn is_nested_delimited_identifier_start(&self, _ch: char) -> bool { - false - } - /// Only applicable whenever [`Self::is_nested_delimited_identifier_start`] returns true - /// If the next sequence of tokens potentially represent a nested identifier, then this method - /// returns a tuple containing the outer quote style, and if present, the inner (nested) quote style. - /// - /// Example (Redshift): - /// ```text - /// `["foo"]` => Some(`[`, Some(`"`)) - /// `[foo]` => Some(`[`, None) - /// `[0]` => None - /// `"foo"` => None - /// ``` - fn peek_nested_delimited_identifier_quotes( - &self, - mut _chars: Peekable>, - ) -> Option<(char, Option)> { - None - } - /// Return the character used to quote identifiers. - fn identifier_quote_style(&self, _identifier: &str) -> Option { - None - } - /// Determine if a character is a valid start character for an unquoted identifier - fn is_identifier_start(&self, ch: char) -> bool; - /// Determine if a character is a valid unquoted identifier character - fn is_identifier_part(&self, ch: char) -> bool; - /// Most dialects do not have custom operators. Override this method to provide custom operators. - fn is_custom_operator_part(&self, _ch: char) -> bool { - false - } - /// Determine if the dialect supports escaping characters via '\' in string literals. - /// - /// Some dialects like BigQuery and Snowflake support this while others like - /// Postgres do not. Such that the following is accepted by the former but - /// rejected by the latter. - /// ```sql - /// SELECT 'ab\'cd'; - /// ``` - /// - /// Conversely, such dialects reject the following statement which - /// otherwise would be valid in the other dialects. - /// ```sql - /// SELECT '\'; - /// ``` - fn supports_string_literal_backslash_escape(&self) -> bool { - false - } - /// Determine if the dialect supports string literals with `U&` prefix. - /// This is used to specify Unicode code points in string literals. - /// For example, in PostgreSQL, the following is a valid string literal: - /// ```sql - /// SELECT U&'\0061\0062\0063'; - /// ``` - /// This is equivalent to the string literal `'abc'`. - /// See - /// - [Postgres docs](https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-UESCAPE) - /// - [H2 docs](http://www.h2database.com/html/grammar.html#string) - fn supports_unicode_string_literal(&self) -> bool { - false - } - /// Does the dialect support `FILTER (WHERE expr)` for aggregate queries? - fn supports_filter_during_aggregation(&self) -> bool { - false - } - /// Returns true if the dialect supports referencing another named window - /// within a window clause declaration. - /// - /// Example - /// ```sql - /// SELECT * FROM mytable - /// WINDOW mynamed_window AS another_named_window - /// ``` - fn supports_window_clause_named_window_reference(&self) -> bool { - false - } - /// Returns true if the dialect supports `ARRAY_AGG() [WITHIN GROUP (ORDER BY)]` expressions. - /// Otherwise, the dialect should expect an `ORDER BY` without the `WITHIN GROUP` clause, e.g. [`ANSI`] - /// - /// [`ANSI`]: https://jakewheat.github.io/sql-overview/sql-2016-foundation-grammar.html#array-aggregate-function - fn supports_within_after_array_aggregation(&self) -> bool { - false - } - /// Returns true if the dialects supports `group sets, roll up, or cube` expressions. - fn supports_group_by_expr(&self) -> bool { - false - } - /// Returns true if the dialect supports CONNECT BY. - fn supports_connect_by(&self) -> bool { - false - } - /// Returns true if the dialect supports the MATCH_RECOGNIZE operation. - fn supports_match_recognize(&self) -> bool { - false - } - /// Returns true if the dialect supports `(NOT) IN ()` expressions - fn supports_in_empty_list(&self) -> bool { - false - } - /// Returns true if the dialect supports `BEGIN {DEFERRED | IMMEDIATE | EXCLUSIVE | TRY | CATCH} [TRANSACTION]` statements - fn supports_start_transaction_modifier(&self) -> bool { - false - } - /// Returns true if the dialect supports `END {TRY | CATCH}` statements - fn supports_end_transaction_modifier(&self) -> bool { - false - } - /// Returns true if the dialect supports named arguments of the form `FUN(a = '1', b = '2')`. - fn supports_named_fn_args_with_eq_operator(&self) -> bool { - false - } - /// Returns true if the dialect supports named arguments of the form `FUN(a : '1', b : '2')`. - fn supports_named_fn_args_with_colon_operator(&self) -> bool { - false - } - /// Returns true if the dialect supports named arguments of the form `FUN(a := '1', b := '2')`. - fn supports_named_fn_args_with_assignment_operator(&self) -> bool { - false - } - /// Returns true if the dialect supports named arguments of the form `FUN(a => '1', b => '2')`. - fn supports_named_fn_args_with_rarrow_operator(&self) -> bool { - true - } - /// Returns true if dialect supports argument name as arbitrary expression. - /// e.g. `FUN(LOWER('a'):'1', b:'2')` - /// Such function arguments are represented in the AST by the `FunctionArg::ExprNamed` variant, - /// otherwise use the `FunctionArg::Named` variant (compatible reason). - fn supports_named_fn_args_with_expr_name(&self) -> bool { - false - } - /// Returns true if the dialect supports identifiers starting with a numeric - /// prefix such as tables named `59901_user_login` - fn supports_numeric_prefix(&self) -> bool { - false - } - /// Returns true if the dialect supports numbers containing underscores, e.g. `10_000_000` - fn supports_numeric_literal_underscores(&self) -> bool { - false - } - /// Returns true if the dialects supports specifying null treatment - /// as part of a window function's parameter list as opposed - /// to after the parameter list. - /// - /// i.e The following syntax returns true - /// ```sql - /// FIRST_VALUE(a IGNORE NULLS) OVER () - /// ``` - /// while the following syntax returns false - /// ```sql - /// FIRST_VALUE(a) IGNORE NULLS OVER () - /// ``` - fn supports_window_function_null_treatment_arg(&self) -> bool { - false - } - /// Returns true if the dialect supports defining structs or objects using a - /// syntax like `{'x': 1, 'y': 2, 'z': 3}`. - fn supports_dictionary_syntax(&self) -> bool { - false - } - /// Returns true if the dialect supports defining object using the - /// syntax like `Map {1: 10, 2: 20}`. - fn support_map_literal_syntax(&self) -> bool { - false - } - /// Returns true if the dialect supports lambda functions, for example: - /// - /// ```sql - /// SELECT transform(array(1, 2, 3), x -> x + 1); -- returns [2,3,4] - /// ``` - fn supports_lambda_functions(&self) -> bool { - false - } - /// Returns true if the dialect supports method calls, for example: - /// - /// ```sql - /// SELECT (SELECT ',' + name FROM sys.objects FOR XML PATH(''), TYPE).value('.','NVARCHAR(MAX)') - /// ``` - fn supports_methods(&self) -> bool { - false - } - /// Returns true if the dialect supports multiple variable assignment - /// using parentheses in a `SET` variable declaration. - /// - /// ```sql - /// SET (variable[, ...]) = (expression[, ...]); - /// ``` - fn supports_parenthesized_set_variables(&self) -> bool { - false - } - /// Returns true if the dialect supports an `EXCEPT` clause following a - /// wildcard in a select list. - /// - /// For example - /// ```sql - /// SELECT * EXCEPT order_id FROM orders; - /// ``` - fn supports_select_wildcard_except(&self) -> bool { - false - } - /// Returns true if the dialect has a CONVERT function which accepts a type first - /// and an expression second, e.g. `CONVERT(varchar, 1)` - fn convert_type_before_value(&self) -> bool { - false - } - /// Returns true if the dialect supports triple quoted string - /// e.g. `"""abc"""` - fn supports_triple_quoted_string(&self) -> bool { - false - } - /// Dialect-specific prefix parser override - fn parse_prefix( - &self, - _parser: &mut Parser, - ) -> Option> { - None - } - /// Does the dialect support trailing commas around the query? - fn supports_trailing_commas(&self) -> bool { - false - } - /// Does the dialect support parsing `LIMIT 1, 2` as `LIMIT 2 OFFSET 1`? - fn supports_limit_comma(&self) -> bool { - false - } - /// Does the dialect support trailing commas in the projection list? - fn supports_projection_trailing_commas(&self) -> bool { - self.supports_trailing_commas() - } - /// Returns true if the dialect supports trailing commas in the `FROM` clause of a `SELECT` statement. - /// Example: `SELECT 1 FROM T, U, LIMIT 1` - fn supports_from_trailing_commas(&self) -> bool { - false - } - /// Returns true if the dialect supports trailing commas in the - /// column definitions list of a `CREATE` statement. - /// Example: `CREATE TABLE T (x INT, y TEXT,)` - fn supports_column_definition_trailing_commas(&self) -> bool { - false - } - /// Returns true if the dialect supports double dot notation for object names - /// - /// Example - /// ```sql - /// SELECT * FROM db_name..table_name - /// ``` - fn supports_object_name_double_dot_notation(&self) -> bool { - false - } - /// Return true if the dialect supports the STRUCT literal - /// - /// Example - /// ```sql - /// SELECT STRUCT(1 as one, 'foo' as foo, false) - /// ``` - fn supports_struct_literal(&self) -> bool { - false - } - /// Return true if the dialect supports empty projections in SELECT statements - /// - /// Example - /// ```sql - /// SELECT from table_name - /// ``` - fn supports_empty_projections(&self) -> bool { - false - } - /// Return true if the dialect supports wildcard expansion on - /// arbitrary expressions in projections. - /// - /// Example: - /// ```sql - /// SELECT STRUCT('foo').* FROM T - /// ``` - fn supports_select_expr_star(&self) -> bool { - false - } - /// Does the dialect support MySQL-style `'user'@'host'` grantee syntax? - fn supports_user_host_grantee(&self) -> bool { - false - } - /// Dialect-specific infix parser override - /// - /// This method is called to parse the next infix expression. - /// - /// If `None` is returned, falls back to the default behavior. - fn parse_infix( - &self, - _parser: &mut Parser, - _expr: &Expr, - _precedence: u8, - ) -> Option> { - None - } - /// Dialect-specific precedence override - /// - /// This method is called to get the precedence of the next token. - /// - /// If `None` is returned, falls back to the default behavior. - fn get_next_precedence( - &self, - _parser: &Parser, - ) -> Option> { - None - } - /// Get the precedence of the next token, looking at the full token stream. - /// - /// A higher number => higher precedence - /// - /// See [`Self::get_next_precedence`] to override the behavior for just the - /// next token. - /// - /// The default implementation is used for many dialects, but can be - /// overridden to provide dialect-specific behavior. - fn get_next_precedence_default( - &self, - parser: &Parser, - ) -> Result { - if let Some(precedence) = self.get_next_precedence(parser) { - return precedence; - } - let token = parser.peek_token(); - { - let lvl = ::log::Level::Debug; - if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() { - ::log::__private_api::log( - format_args!("get_next_precedence_full() {0:?}", token), - lvl, - &( - "sqlparser::dialect", - "sqlparser::dialect", - ::log::__private_api::loc(), - ), - (), - ); - } - }; - match token.token { - Token::Word(w) if w.keyword == Keyword::OR => { - Ok(self.prec_value(Precedence::Or)) - } - Token::Word(w) if w.keyword == Keyword::AND => { - Ok(self.prec_value(Precedence::And)) - } - Token::Word(w) if w.keyword == Keyword::XOR => { - Ok(self.prec_value(Precedence::Xor)) - } - Token::Word(w) if w.keyword == Keyword::AT => { - match ( - parser.peek_nth_token(1).token, - parser.peek_nth_token(2).token, - ) { - ( - Token::Word(w), - Token::Word(w2), - ) if w.keyword == Keyword::TIME - && w2.keyword == Keyword::ZONE => { - Ok(self.prec_value(Precedence::AtTz)) - } - _ => Ok(self.prec_unknown()), - } - } - Token::Word(w) if w.keyword == Keyword::NOT => { - match parser.peek_nth_token(1).token { - Token::Word(w) if w.keyword == Keyword::IN => { - Ok(self.prec_value(Precedence::Between)) - } - Token::Word(w) if w.keyword == Keyword::BETWEEN => { - Ok(self.prec_value(Precedence::Between)) - } - Token::Word(w) if w.keyword == Keyword::LIKE => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::ILIKE => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::RLIKE => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::REGEXP => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::SIMILAR => { - Ok(self.prec_value(Precedence::Like)) - } - _ => Ok(self.prec_unknown()), - } - } - Token::Word(w) if w.keyword == Keyword::IS => { - Ok(self.prec_value(Precedence::Is)) - } - Token::Word(w) if w.keyword == Keyword::IN => { - Ok(self.prec_value(Precedence::Between)) - } - Token::Word(w) if w.keyword == Keyword::BETWEEN => { - Ok(self.prec_value(Precedence::Between)) - } - Token::Word(w) if w.keyword == Keyword::OVERLAPS => { - Ok(self.prec_value(Precedence::Between)) - } - Token::Word(w) if w.keyword == Keyword::LIKE => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::ILIKE => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::RLIKE => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::REGEXP => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::SIMILAR => { - Ok(self.prec_value(Precedence::Like)) - } - Token::Word(w) if w.keyword == Keyword::OPERATOR => { - Ok(self.prec_value(Precedence::Between)) - } - Token::Word(w) if w.keyword == Keyword::DIV => { - Ok(self.prec_value(Precedence::MulDivModOp)) - } - Token::Eq - | Token::Lt - | Token::LtEq - | Token::Neq - | Token::Gt - | Token::GtEq - | Token::DoubleEq - | Token::Tilde - | Token::TildeAsterisk - | Token::ExclamationMarkTilde - | Token::ExclamationMarkTildeAsterisk - | Token::DoubleTilde - | Token::DoubleTildeAsterisk - | Token::ExclamationMarkDoubleTilde - | Token::ExclamationMarkDoubleTildeAsterisk - | Token::Spaceship => Ok(self.prec_value(Precedence::Eq)), - Token::Pipe => Ok(self.prec_value(Precedence::Pipe)), - Token::Caret | Token::Sharp | Token::ShiftRight | Token::ShiftLeft => { - Ok(self.prec_value(Precedence::Caret)) - } - Token::Ampersand => Ok(self.prec_value(Precedence::Ampersand)), - Token::Plus | Token::Minus => Ok(self.prec_value(Precedence::PlusMinus)), - Token::Mul - | Token::Div - | Token::DuckIntDiv - | Token::Mod - | Token::StringConcat => Ok(self.prec_value(Precedence::MulDivModOp)), - Token::DoubleColon - | Token::ExclamationMark - | Token::LBracket - | Token::Overlap - | Token::CaretAt => Ok(self.prec_value(Precedence::DoubleColon)), - Token::Arrow - | Token::LongArrow - | Token::HashArrow - | Token::HashLongArrow - | Token::AtArrow - | Token::ArrowAt - | Token::HashMinus - | Token::AtQuestion - | Token::AtAt - | Token::Question - | Token::QuestionAnd - | Token::QuestionPipe - | Token::CustomBinaryOperator(_) => { - Ok(self.prec_value(Precedence::PgOther)) - } - _ => Ok(self.prec_unknown()), - } - } - /// Dialect-specific statement parser override - /// - /// This method is called to parse the next statement. - /// - /// If `None` is returned, falls back to the default behavior. - fn parse_statement( - &self, - _parser: &mut Parser, - ) -> Option> { - None - } - /// Dialect-specific column option parser override - /// - /// This method is called to parse the next column option. - /// - /// If `None` is returned, falls back to the default behavior. - fn parse_column_option( - &self, - _parser: &mut Parser, - ) -> Result, ParserError>>, ParserError> { - Ok(None) - } - /// Decide the lexical Precedence of operators. - /// - /// Uses (APPROXIMATELY) as a reference - fn prec_value(&self, prec: Precedence) -> u8 { - match prec { - Precedence::DoubleColon => 50, - Precedence::AtTz => 41, - Precedence::MulDivModOp => 40, - Precedence::PlusMinus => 30, - Precedence::Xor => 24, - Precedence::Ampersand => 23, - Precedence::Caret => 22, - Precedence::Pipe => 21, - Precedence::Between => 20, - Precedence::Eq => 20, - Precedence::Like => 19, - Precedence::Is => 17, - Precedence::PgOther => 16, - Precedence::UnaryNot => 15, - Precedence::And => 10, - Precedence::Or => 5, - } - } - /// Returns the precedence when the precedence is otherwise unknown - fn prec_unknown(&self) -> u8 { - 0 - } - /// Returns true if this dialect requires the `TABLE` keyword after `DESCRIBE` - /// - /// Defaults to false. - /// - /// If true, the following statement is valid: `DESCRIBE TABLE my_table` - /// If false, the following statements are valid: `DESCRIBE my_table` and `DESCRIBE table` - fn describe_requires_table_keyword(&self) -> bool { - false - } - /// Returns true if this dialect allows the `EXTRACT` function to words other than [`Keyword`]. - fn allow_extract_custom(&self) -> bool { - false - } - /// Returns true if this dialect allows the `EXTRACT` function to use single quotes in the part being extracted. - fn allow_extract_single_quotes(&self) -> bool { - false - } - /// Returns true if this dialect allows dollar placeholders - /// e.g. `SELECT $var` (SQLite) - fn supports_dollar_placeholder(&self) -> bool { - false - } - /// Does the dialect support with clause in create index statement? - /// e.g. `CREATE INDEX idx ON t WITH (key = value, key2)` - fn supports_create_index_with_clause(&self) -> bool { - false - } - /// Whether `INTERVAL` expressions require units (called "qualifiers" in the ANSI SQL spec) to be specified, - /// e.g. `INTERVAL 1 DAY` vs `INTERVAL 1`. - /// - /// Expressions within intervals (e.g. `INTERVAL '1' + '1' DAY`) are only allowed when units are required. - /// - /// See for more information. - /// - /// When `true`: - /// * `INTERVAL '1' DAY` is VALID - /// * `INTERVAL 1 + 1 DAY` is VALID - /// * `INTERVAL '1' + '1' DAY` is VALID - /// * `INTERVAL '1'` is INVALID - /// - /// When `false`: - /// * `INTERVAL '1'` is VALID - /// * `INTERVAL '1' DAY` is VALID — unit is not required, but still allowed - /// * `INTERVAL 1 + 1 DAY` is INVALID - fn require_interval_qualifier(&self) -> bool { - false - } - fn supports_explain_with_utility_options(&self) -> bool { - false - } - fn supports_asc_desc_in_column_definition(&self) -> bool { - false - } - /// Returns true if the dialect supports `a!` expressions - fn supports_factorial_operator(&self) -> bool { - false - } - /// Returns true if the dialect supports nested comments - /// e.g. `/* /* nested */ */` - fn supports_nested_comments(&self) -> bool { - false - } - /// Returns true if this dialect supports treating the equals operator `=` within a `SelectItem` - /// as an alias assignment operator, rather than a boolean expression. - /// For example: the following statements are equivalent for such a dialect: - /// ```sql - /// SELECT col_alias = col FROM tbl; - /// SELECT col_alias AS col FROM tbl; - /// ``` - fn supports_eq_alias_assignment(&self) -> bool { - false - } - /// Returns true if this dialect supports the `TRY_CONVERT` function - fn supports_try_convert(&self) -> bool { - false - } - /// Returns true if the dialect supports `!a` syntax for boolean `NOT` expressions. - fn supports_bang_not_operator(&self) -> bool { - false - } - /// Returns true if the dialect supports the `LISTEN`, `UNLISTEN` and `NOTIFY` statements - fn supports_listen_notify(&self) -> bool { - false - } - /// Returns true if the dialect supports the `LOAD DATA` statement - fn supports_load_data(&self) -> bool { - false - } - /// Returns true if the dialect supports the `LOAD extension` statement - fn supports_load_extension(&self) -> bool { - false - } - /// Returns true if this dialect expects the `TOP` option - /// before the `ALL`/`DISTINCT` options in a `SELECT` statement. - fn supports_top_before_distinct(&self) -> bool { - false - } - /// Returns true if the dialect supports boolean literals (`true` and `false`). - /// For example, in MSSQL these are treated as identifiers rather than boolean literals. - fn supports_boolean_literals(&self) -> bool { - true - } - /// Returns true if this dialect supports the `LIKE 'pattern'` option in - /// a `SHOW` statement before the `IN` option - fn supports_show_like_before_in(&self) -> bool { - false - } - /// Returns true if this dialect supports the `COMMENT` statement - fn supports_comment_on(&self) -> bool { - false - } - /// Returns true if the dialect supports the `CREATE TABLE SELECT` statement - fn supports_create_table_select(&self) -> bool { - false - } - /// Returns true if the dialect supports PartiQL for querying semi-structured data - /// - fn supports_partiql(&self) -> bool { - false - } - /// Returns true if the specified keyword is reserved and cannot be - /// used as an identifier without special handling like quoting. - fn is_reserved_for_identifier(&self, kw: Keyword) -> bool { - keywords::RESERVED_FOR_IDENTIFIER.contains(&kw) - } - /// Returns reserved keywords when looking to parse a `TableFactor`. - /// See [Self::supports_from_trailing_commas] - fn get_reserved_keywords_for_table_factor(&self) -> &[Keyword] { - keywords::RESERVED_FOR_TABLE_FACTOR - } - /// Returns true if this dialect supports the `TABLESAMPLE` option - /// before the table alias option. For example: - /// - /// Table sample before alias: `SELECT * FROM tbl AS t TABLESAMPLE (10)` - /// Table sample after alias: `SELECT * FROM tbl TABLESAMPLE (10) AS t` - /// - /// - fn supports_table_sample_before_alias(&self) -> bool { - false - } - /// Returns true if this dialect supports the `INSERT INTO ... SET col1 = 1, ...` syntax. - /// - /// MySQL: - fn supports_insert_set(&self) -> bool { - false - } - /// Does the dialect support table function in insertion? - fn supports_insert_table_function(&self) -> bool { - false - } - /// Does the dialect support insert formats, e.g. `INSERT INTO ... FORMAT ` - fn supports_insert_format(&self) -> bool { - false - } - /// Returns true if this dialect supports `SET` statements without an explicit - /// assignment operator such as `=`. For example: `SET SHOWPLAN_XML ON`. - fn supports_set_stmt_without_operator(&self) -> bool { - false - } - /// Returns true if the specified keyword should be parsed as a column identifier. - /// See [keywords::RESERVED_FOR_COLUMN_ALIAS] - fn is_column_alias(&self, kw: &Keyword, _parser: &mut Parser) -> bool { - !keywords::RESERVED_FOR_COLUMN_ALIAS.contains(kw) - } - /// Returns true if the specified keyword should be parsed as a select item alias. - /// When explicit is true, the keyword is preceded by an `AS` word. Parser is provided - /// to enable looking ahead if needed. - fn is_select_item_alias( - &self, - explicit: bool, - kw: &Keyword, - parser: &mut Parser, - ) -> bool { - explicit || self.is_column_alias(kw, parser) - } - /// Returns true if the specified keyword should be parsed as a table factor alias. - /// When explicit is true, the keyword is preceded by an `AS` word. Parser is provided - /// to enable looking ahead if needed. - fn is_table_factor_alias( - &self, - explicit: bool, - kw: &Keyword, - _parser: &mut Parser, - ) -> bool { - explicit || !keywords::RESERVED_FOR_TABLE_ALIAS.contains(kw) - } - /// Returns true if this dialect supports querying historical table data - /// by specifying which version of the data to query. - fn supports_timestamp_versioning(&self) -> bool { - false - } - /// Returns true if this dialect supports the E'...' syntax for string literals - /// - /// Postgres: - fn supports_string_escape_constant(&self) -> bool { - false - } - /// Returns true if the dialect supports the table hints in the `FROM` clause. - fn supports_table_hints(&self) -> bool { - false - } - } - /// This represents the operators for which precedence must be defined - /// - /// higher number -> higher precedence - pub enum Precedence { - DoubleColon, - AtTz, - MulDivModOp, - PlusMinus, - Xor, - Ampersand, - Caret, - Pipe, - Between, - Eq, - Like, - Is, - PgOther, - UnaryNot, - And, - Or, - } - #[automatically_derived] - impl ::core::fmt::Debug for Precedence { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - Precedence::DoubleColon => "DoubleColon", - Precedence::AtTz => "AtTz", - Precedence::MulDivModOp => "MulDivModOp", - Precedence::PlusMinus => "PlusMinus", - Precedence::Xor => "Xor", - Precedence::Ampersand => "Ampersand", - Precedence::Caret => "Caret", - Precedence::Pipe => "Pipe", - Precedence::Between => "Between", - Precedence::Eq => "Eq", - Precedence::Like => "Like", - Precedence::Is => "Is", - Precedence::PgOther => "PgOther", - Precedence::UnaryNot => "UnaryNot", - Precedence::And => "And", - Precedence::Or => "Or", - }, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Precedence { - #[inline] - fn clone(&self) -> Precedence { - *self - } - } - #[automatically_derived] - impl ::core::marker::Copy for Precedence {} - impl dyn Dialect { - #[inline] - pub fn is(&self) -> bool { - TypeId::of::() == self.dialect() - } - } - /// Returns the built in [`Dialect`] corresponding to `dialect_name`. - /// - /// See [`Dialect`] documentation for an example. - pub fn dialect_from_str(dialect_name: impl AsRef) -> Option> { - let dialect_name = dialect_name.as_ref(); - match dialect_name.to_lowercase().as_str() { - "generic" => Some(Box::new(GenericDialect)), - "mysql" => Some(Box::new(MySqlDialect {})), - "postgresql" | "postgres" => Some(Box::new(PostgreSqlDialect {})), - "hive" => Some(Box::new(HiveDialect {})), - "sqlite" => Some(Box::new(SQLiteDialect {})), - "snowflake" => Some(Box::new(SnowflakeDialect)), - "redshift" => Some(Box::new(RedshiftSqlDialect {})), - "mssql" => Some(Box::new(MsSqlDialect {})), - "clickhouse" => Some(Box::new(ClickHouseDialect {})), - "bigquery" => Some(Box::new(BigQueryDialect)), - "ansi" => Some(Box::new(AnsiDialect {})), - "duckdb" => Some(Box::new(DuckDbDialect {})), - "databricks" => Some(Box::new(DatabricksDialect {})), - _ => None, - } - } -} -pub mod keywords { - //! This module defines - //! 1) a list of constants for every keyword - //! 2) an `ALL_KEYWORDS` array with every keyword in it - //! This is not a list of *reserved* keywords: some of these can be - //! parsed as identifiers if the parser decides so. This means that - //! new keywords can be added here without affecting the parse result. - //! - //! As a matter of fact, most of these keywords are not used at all - //! and could be removed. - //! 3) a `RESERVED_FOR_TABLE_ALIAS` array with keywords reserved in a - //! "table alias" context. - #[allow(non_camel_case_types)] - pub enum Keyword { - NoKeyword, - ABORT, - ABS, - ABSENT, - ABSOLUTE, - ACCESS, - ACCOUNT, - ACTION, - ADD, - ADMIN, - AFTER, - AGAINST, - AGGREGATION, - ALERT, - ALGORITHM, - ALIAS, - ALL, - ALLOCATE, - ALTER, - ALWAYS, - ANALYZE, - AND, - ANTI, - ANY, - APPLICATION, - APPLY, - APPLYBUDGET, - ARCHIVE, - ARE, - ARRAY, - ARRAY_MAX_CARDINALITY, - AS, - ASC, - ASENSITIVE, - ASOF, - ASSERT, - ASYMMETRIC, - AT, - ATOMIC, - ATTACH, - AUDIT, - AUTHENTICATION, - AUTHORIZATION, - AUTO, - AUTOINCREMENT, - AUTO_INCREMENT, - AVG, - AVRO, - BACKWARD, - BASE64, - BASE_LOCATION, - BEFORE, - BEGIN, - BEGIN_FRAME, - BEGIN_PARTITION, - BERNOULLI, - BETWEEN, - BIGDECIMAL, - BIGINT, - BIGNUMERIC, - BINARY, - BIND, - BINDING, - BIT, - BIT_OPS, - BLOB, - BLOCK, - BLOOM, - BLOOMFILTER, - BOOL, - BOOLEAN, - BOOL_OPS, - BOTH, - BPCHAR_OPS, - BRIN, - BROWSE, - BTREE, - BTREE_CUBE_OPS, - BTREE_HSTORE_OPS, - BUCKET, - BUCKETS, - BY, - BYPASSRLS, - BYTEA, - BYTEA_OPS, - BYTES, - CACHE, - CALL, - CALLED, - CARDINALITY, - CASCADE, - CASCADED, - CASE, - CASES, - CAST, - CATALOG, - CATALOG_SYNC, - CATCH, - CEIL, - CEILING, - CENTURY, - CHAIN, - CHANGE, - CHANGE_TRACKING, - CHANNEL, - CHAR, - CHARACTER, - CHARACTERS, - CHARACTER_LENGTH, - CHARSET, - CHAR_LENGTH, - CHAR_OPS, - CHECK, - CIDR_OPS, - CITEXT_OPS, - CLEAR, - CLOB, - CLONE, - CLOSE, - CLUSTER, - CLUSTERED, - CLUSTERING, - COALESCE, - COLLATE, - COLLATION, - COLLECT, - COLLECTION, - COLUMN, - COLUMNS, - COLUMNSTORE, - COMMENT, - COMMIT, - COMMITTED, - COMPATIBLE, - COMPRESSION, - COMPUTE, - CONCURRENTLY, - CONDITION, - CONFLICT, - CONNECT, - CONNECTION, - CONNECTOR, - CONSTRAINT, - CONTAINS, - CONTINUE, - CONVERT, - COPY, - COPY_OPTIONS, - CORR, - CORRESPONDING, - COUNT, - COVAR_POP, - COVAR_SAMP, - CREATE, - CREATEDB, - CREATEROLE, - CREDENTIALS, - CROSS, - CSV, - CUBE, - CUME_DIST, - CURRENT, - CURRENT_CATALOG, - CURRENT_DATE, - CURRENT_DEFAULT_TRANSFORM_GROUP, - CURRENT_PATH, - CURRENT_ROLE, - CURRENT_ROW, - CURRENT_SCHEMA, - CURRENT_TIME, - CURRENT_TIMESTAMP, - CURRENT_TRANSFORM_GROUP_FOR_TYPE, - CURRENT_USER, - CURSOR, - CYCLE, - DATA, - DATABASE, - DATABASES, - DATA_RETENTION_TIME_IN_DAYS, - DATE, - DATE32, - DATETIME, - DATETIME64, - DATE_OPS, - DAY, - DAYOFWEEK, - DAYOFYEAR, - DAYS, - DCPROPERTIES, - DEALLOCATE, - DEC, - DECADE, - DECIMAL, - DECLARE, - DEDUPLICATE, - DEFAULT, - DEFAULT_DDL_COLLATION, - DEFERRABLE, - DEFERRED, - DEFINE, - DEFINED, - DEFINER, - DELAYED, - DELETE, - DELIMITED, - DELIMITER, - DELTA, - DENSE_RANK, - DEREF, - DESC, - DESCRIBE, - DETACH, - DETAIL, - DETERMINISTIC, - DIRECTORY, - DISABLE, - DISCARD, - DISCONNECT, - DISTINCT, - DISTRIBUTE, - DIV, - DO, - DOUBLE, - DOW, - DOY, - DROP, - DRY, - DUPLICATE, - DYNAMIC, - EACH, - EAN13_OPS, - ELEMENT, - ELEMENTS, - ELSE, - EMPTY, - ENABLE, - ENABLE_SCHEMA_EVOLUTION, - ENCODING, - ENCRYPTION, - END, - END_EXEC, - ENDPOINT, - END_FRAME, - END_PARTITION, - ENFORCED, - ENGINE, - ENUM, - ENUM16, - ENUM8, - ENUM_OPS, - EPHEMERAL, - EPOCH, - EQUALS, - ERROR, - ESCAPE, - ESCAPED, - ESTIMATE, - EVENT, - EVERY, - EVOLVE, - EXCEPT, - EXCEPTION, - EXCHANGE, - EXCLUDE, - EXCLUSIVE, - EXEC, - EXECUTE, - EXECUTION, - EXISTS, - EXP, - EXPANSION, - EXPLAIN, - EXPLICIT, - EXPORT, - EXTENDED, - EXTENSION, - EXTERNAL, - EXTERNAL_VOLUME, - EXTRACT, - FAIL, - FAILOVER, - FALSE, - FETCH, - FIELDS, - FILE, - FILES, - FILE_FORMAT, - FILL, - FILTER, - FINAL, - FIRST, - FIRST_VALUE, - FIXEDSTRING, - FLOAT, - FLOAT32, - FLOAT4, - FLOAT4_OPS, - FLOAT64, - FLOAT8, - FLOAT8_OPS, - FLOOR, - FLUSH, - FN, - FOLLOWING, - FOR, - FORCE, - FORCE_NOT_NULL, - FORCE_NULL, - FORCE_QUOTE, - FOREIGN, - FORMAT, - FORMATTED, - FORWARD, - FRAME_ROW, - FREE, - FREEZE, - FROM, - FSCK, - FULFILLMENT, - FULL, - FULLTEXT, - FUNCTION, - FUNCTIONS, - FUSION, - GENERAL, - GENERATE, - GENERATED, - GEOGRAPHY, - GET, - GIN, - GIN_HSTORE_OPS, - GIN_TRGM_OPS, - GIST, - GIST_BIT_OPS, - GIST_BOOL_OPS, - GIST_BPCHAR_OPS, - GIST_BYTEA_OPS, - GIST_CASH_OPS, - GIST_CIDR_OPS, - GIST_CUBE_OPS, - GIST_DATE_OPS, - GIST_ENUM_OPS, - GIST_FLOAT4_OPS, - GIST_FLOAT8_OPS, - GIST_HSTORE_OPS, - GIST_INET_OPS, - GIST_INT2_OPS, - GIST_INT4_OPS, - GIST_INT8_OPS, - GIST_INTERVAL_OPS, - GIST_LTREE_OPS, - GIST_MACADDR8_OPS, - GIST_MACADDR_OPS, - GIST_NUMERIC_OPS, - GIST_OID_OPS, - GIST_SEG_OPS, - GIST_TEXT_OPS, - GIST_TIMESTAMP_OPS, - GIST_TIMESTAMPTZ_OPS, - GIST_TIME_OPS, - GIST_TIMETZ_OPS, - GIST_TRGM_OPS, - GIST_UUID_OPS, - GIST_VBIT_OPS, - GLOBAL, - GRANT, - GRANTED, - GRANTS, - GRAPHVIZ, - GROUP, - GROUPING, - GROUPS, - HASH, - HASH_HSTORE_OPS, - HASH_LTREE_OPS, - HAVING, - HEADER, - HEAP, - HIGH_PRIORITY, - HISTORY, - HIVEVAR, - HOLD, - HOSTS, - HOUR, - HOURS, - ICEBERG, - ID, - IDENTITY, - IDENTITY_INSERT, - IF, - IGNORE, - ILIKE, - IMMEDIATE, - IMMUTABLE, - IMPORT, - IMPORTED, - IN, - INCLUDE, - INCLUDE_NULL_VALUES, - INCREMENT, - INDEX, - INDICATOR, - INET_OPS, - INHERIT, - INITIALLY, - INNER, - INOUT, - INPATH, - INPUT, - INPUTFORMAT, - INSENSITIVE, - INSERT, - INSTALL, - INSTEAD, - INT, - INT128, - INT16, - INT2, - INT256, - INT2_OPS, - INT32, - INT4, - INT4_OPS, - INT64, - INT8, - INT8_OPS, - INTEGER, - INTEGRATION, - INTERPOLATE, - INTERSECT, - INTERSECTION, - INTERVAL, - INTERVAL_OPS, - INTO, - INVOKER, - IO, - IS, - ISBN13_OPS, - ISBN_OPS, - ISMN13_OPS, - ISMN_OPS, - ISODOW, - ISOLATION, - ISOWEEK, - ISOYEAR, - ISSN13_OPS, - ISSN_OPS, - ITEMS, - JAR, - JOIN, - JSON, - JSONB, - JSONFILE, - JSON_TABLE, - JULIAN, - KEY, - KEYS, - KILL, - LAG, - LANGUAGE, - LARGE, - LAST, - LAST_VALUE, - LATERAL, - LEAD, - LEADING, - LEFT, - LEVEL, - LIKE, - LIKE_REGEX, - LIMIT, - LINES, - LIST, - LISTEN, - LISTING, - LN, - LOAD, - LOCAL, - LOCALTIME, - LOCALTIMESTAMP, - LOCATION, - LOCK, - LOCKED, - LOG, - LOGIN, - LOGS, - LONGBLOB, - LONGTEXT, - LOWCARDINALITY, - LOWER, - LOW_PRIORITY, - LS, - LTREE_OPS, - MACADDR8_OPS, - MACADDR_OPS, - MACRO, - MANAGE, - MANAGED, - MANAGEDLOCATION, - MAP, - MASKING, - MATCH, - MATCHED, - MATCHES, - MATCH_CONDITION, - MATCH_RECOGNIZE, - MATERIALIZE, - MATERIALIZED, - MAX, - MAXVALUE, - MAX_DATA_EXTENSION_TIME_IN_DAYS, - MEASURES, - MEDIUMBLOB, - MEDIUMINT, - MEDIUMTEXT, - MEMBER, - MERGE, - METADATA, - METHOD, - METRIC, - MICROSECOND, - MICROSECONDS, - MILLENIUM, - MILLENNIUM, - MILLISECOND, - MILLISECONDS, - MIN, - MINUS, - MINUTE, - MINUTES, - MINVALUE, - MOD, - MODE, - MODIFIES, - MODIFY, - MODULE, - MONEY_OPS, - MONITOR, - MONTH, - MONTHS, - MSCK, - MULTISET, - MUTATION, - NAME, - NAME_OPS, - NANOSECOND, - NANOSECONDS, - NATIONAL, - NATURAL, - NCHAR, - NCLOB, - NESTED, - NETWORK, - NEW, - NEXT, - NFC, - NFD, - NFKC, - NFKD, - NO, - NOBYPASSRLS, - NOCREATEDB, - NOCREATEROLE, - NOINHERIT, - NOLOGIN, - NONE, - NOORDER, - NOREPLICATION, - NORMALIZE, - NORMALIZED, - NOSCAN, - NOSUPERUSER, - NOT, - NOTHING, - NOTIFY, - NOWAIT, - NO_WRITE_TO_BINLOG, - NTH_VALUE, - NTILE, - NULL, - NULLABLE, - NULLIF, - NULLS, - NUMERIC, - NUMERIC_OPS, - NVARCHAR, - OBJECT, - OCCURRENCES_REGEX, - OCTETS, - OCTET_LENGTH, - OF, - OFF, - OFFSET, - OFFSETS, - OID_OPS, - OLD, - OMIT, - ON, - ONE, - ONLY, - OPEN, - OPENJSON, - OPERATE, - OPERATOR, - OPTIMIZATION, - OPTIMIZE, - OPTIMIZED, - OPTIMIZER_COSTS, - OPTION, - OPTIONS, - OR, - ORC, - ORDER, - ORDINALITY, - ORGANIZATION, - OUT, - OUTER, - OUTPUTFORMAT, - OVER, - OVERFLOW, - OVERLAPS, - OVERLAY, - OVERRIDE, - OVERWRITE, - OWNED, - OWNER, - OWNERSHIP, - PACKAGE, - PACKAGES, - PARALLEL, - PARAMETER, - PARQUET, - PART, - PARTITION, - PARTITIONED, - PARTITIONS, - PASSWORD, - PAST, - PATH, - PATTERN, - PER, - PERCENT, - PERCENTILE_CONT, - PERCENTILE_DISC, - PERCENT_RANK, - PERIOD, - PERMISSIVE, - PERSISTENT, - PIVOT, - PLACING, - PLAN, - PLANS, - POLICY, - POOL, - PORTION, - POSITION, - POSITION_REGEX, - POWER, - PRAGMA, - PRECEDES, - PRECEDING, - PRECISION, - PREPARE, - PRESERVE, - PREWHERE, - PRIMARY, - PRIOR, - PRIVILEGES, - PROCEDURE, - PROFILE, - PROGRAM, - PROJECTION, - PUBLIC, - PURCHASE, - PURGE, - QUALIFY, - QUARTER, - QUERY, - QUOTE, - RAISERROR, - RANGE, - RANK, - RAW, - RCFILE, - READ, - READS, - READ_ONLY, - REAL, - RECLUSTER, - RECURSIVE, - REF, - REFERENCES, - REFERENCING, - REGCLASS, - REGEXP, - REGR_AVGX, - REGR_AVGY, - REGR_COUNT, - REGR_INTERCEPT, - REGR_R2, - REGR_SLOPE, - REGR_SXX, - REGR_SXY, - REGR_SYY, - RELATIVE, - RELAY, - RELEASE, - RELEASES, - REMOTE, - REMOVE, - RENAME, - REORG, - REPAIR, - REPEATABLE, - REPLACE, - REPLICA, - REPLICATE, - REPLICATION, - RESET, - RESOLVE, - RESPECT, - RESTART, - RESTRICT, - RESTRICTED, - RESTRICTIONS, - RESTRICTIVE, - RESULT, - RESULTSET, - RESUME, - RETAIN, - RETURN, - RETURNING, - RETURNS, - REVOKE, - RIGHT, - RLIKE, - RM, - ROLE, - ROLES, - ROLLBACK, - ROLLUP, - ROOT, - ROW, - ROWID, - ROWS, - ROW_NUMBER, - RULE, - RUN, - SAFE, - SAFE_CAST, - SAMPLE, - SAVEPOINT, - SCHEMA, - SCHEMAS, - SCOPE, - SCROLL, - SEARCH, - SECOND, - SECONDARY, - SECONDS, - SECRET, - SECURITY, - SEED, - SEG_OPS, - SELECT, - SEMI, - SENSITIVE, - SEPARATOR, - SEQUENCE, - SEQUENCEFILE, - SEQUENCES, - SERDE, - SERDEPROPERTIES, - SERIALIZABLE, - SERVICE, - SESSION, - SESSION_USER, - SET, - SETERROR, - SETS, - SETTINGS, - SHARE, - SHARING, - SHOW, - SIMILAR, - SKIP, - SLOW, - SMALLINT, - SNAPSHOT, - SOME, - SORT, - SORTED, - SOURCE, - SPATIAL, - SPECIFIC, - SPECIFICTYPE, - SPGIST, - SQL, - SQLEXCEPTION, - SQLSTATE, - SQLWARNING, - SQRT, - STABLE, - STAGE, - START, - STARTS, - STATEMENT, - STATIC, - STATISTICS, - STATUS, - STDDEV_POP, - STDDEV_SAMP, - STDIN, - STDOUT, - STEP, - STORAGE_INTEGRATION, - STORAGE_SERIALIZATION_POLICY, - STORED, - STRICT, - STRING, - STRUCT, - SUBMULTISET, - SUBSTRING, - SUBSTRING_REGEX, - SUCCEEDS, - SUM, - SUPER, - SUPERUSER, - SUPPORT, - SUSPEND, - SWAP, - SYMMETRIC, - SYNC, - SYSTEM, - SYSTEM_TIME, - SYSTEM_USER, - TABLE, - TABLES, - TABLESAMPLE, - TAG, - TARGET, - TASK, - TBLPROPERTIES, - TEMP, - TEMPORARY, - TEMPTABLE, - TERMINATED, - TERSE, - TEXT, - TEXTFILE, - TEXT_OPS, - THEN, - TIES, - TIME, - TIMESTAMP, - TIMESTAMPTZ, - TIMESTAMPTZ_OPS, - TIMESTAMP_OPS, - TIMETZ, - TIMETZ_OPS, - TIMEZONE, - TIMEZONE_ABBR, - TIMEZONE_HOUR, - TIMEZONE_MINUTE, - TIMEZONE_REGION, - TIME_OPS, - TINYBLOB, - TINYINT, - TINYTEXT, - TO, - TOP, - TOTALS, - TRACE, - TRAILING, - TRANSACTION, - TRANSIENT, - TRANSLATE, - TRANSLATE_REGEX, - TRANSLATION, - TREAT, - TRIGGER, - TRIM, - TRIM_ARRAY, - TRUE, - TRUNCATE, - TRY, - TRY_CAST, - TRY_CONVERT, - TUPLE, - TYPE, - UESCAPE, - UINT128, - UINT16, - UINT256, - UINT32, - UINT64, - UINT8, - UNBOUNDED, - UNCACHE, - UNCOMMITTED, - UNDEFINED, - UNFREEZE, - UNION, - UNIQUE, - UNKNOWN, - UNLISTEN, - UNLOAD, - UNLOCK, - UNLOGGED, - UNMATCHED, - UNNEST, - UNPIVOT, - UNSAFE, - UNSIGNED, - UNTIL, - UPC_OPS, - UPDATE, - UPPER, - URL, - USAGE, - USE, - USER, - USER_RESOURCES, - USING, - UUID, - UUID_OPS, - VACUUM, - VALID, - VALIDATION_MODE, - VALUE, - VALUES, - VALUE_OF, - VARBINARY, - VARBIT_OPS, - VARCHAR, - VARCHAR_OPS, - VARIABLES, - VARYING, - VAR_POP, - VAR_SAMP, - VERBOSE, - VERSION, - VERSIONING, - VERSIONS, - VIEW, - VIEWS, - VIRTUAL, - VOLATILE, - VOLUME, - WAREHOUSE, - WAREHOUSES, - WEEK, - WEEKS, - WHEN, - WHENEVER, - WHERE, - WIDTH_BUCKET, - WINDOW, - WITH, - WITHIN, - WITHOUT, - WITHOUT_ARRAY_WRAPPER, - WORK, - WRITE, - XML, - XOR, - YEAR, - YEARS, - ZONE, - ZORDER, - } - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::fmt::Debug for Keyword { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - Keyword::NoKeyword => "NoKeyword", - Keyword::ABORT => "ABORT", - Keyword::ABS => "ABS", - Keyword::ABSENT => "ABSENT", - Keyword::ABSOLUTE => "ABSOLUTE", - Keyword::ACCESS => "ACCESS", - Keyword::ACCOUNT => "ACCOUNT", - Keyword::ACTION => "ACTION", - Keyword::ADD => "ADD", - Keyword::ADMIN => "ADMIN", - Keyword::AFTER => "AFTER", - Keyword::AGAINST => "AGAINST", - Keyword::AGGREGATION => "AGGREGATION", - Keyword::ALERT => "ALERT", - Keyword::ALGORITHM => "ALGORITHM", - Keyword::ALIAS => "ALIAS", - Keyword::ALL => "ALL", - Keyword::ALLOCATE => "ALLOCATE", - Keyword::ALTER => "ALTER", - Keyword::ALWAYS => "ALWAYS", - Keyword::ANALYZE => "ANALYZE", - Keyword::AND => "AND", - Keyword::ANTI => "ANTI", - Keyword::ANY => "ANY", - Keyword::APPLICATION => "APPLICATION", - Keyword::APPLY => "APPLY", - Keyword::APPLYBUDGET => "APPLYBUDGET", - Keyword::ARCHIVE => "ARCHIVE", - Keyword::ARE => "ARE", - Keyword::ARRAY => "ARRAY", - Keyword::ARRAY_MAX_CARDINALITY => "ARRAY_MAX_CARDINALITY", - Keyword::AS => "AS", - Keyword::ASC => "ASC", - Keyword::ASENSITIVE => "ASENSITIVE", - Keyword::ASOF => "ASOF", - Keyword::ASSERT => "ASSERT", - Keyword::ASYMMETRIC => "ASYMMETRIC", - Keyword::AT => "AT", - Keyword::ATOMIC => "ATOMIC", - Keyword::ATTACH => "ATTACH", - Keyword::AUDIT => "AUDIT", - Keyword::AUTHENTICATION => "AUTHENTICATION", - Keyword::AUTHORIZATION => "AUTHORIZATION", - Keyword::AUTO => "AUTO", - Keyword::AUTOINCREMENT => "AUTOINCREMENT", - Keyword::AUTO_INCREMENT => "AUTO_INCREMENT", - Keyword::AVG => "AVG", - Keyword::AVRO => "AVRO", - Keyword::BACKWARD => "BACKWARD", - Keyword::BASE64 => "BASE64", - Keyword::BASE_LOCATION => "BASE_LOCATION", - Keyword::BEFORE => "BEFORE", - Keyword::BEGIN => "BEGIN", - Keyword::BEGIN_FRAME => "BEGIN_FRAME", - Keyword::BEGIN_PARTITION => "BEGIN_PARTITION", - Keyword::BERNOULLI => "BERNOULLI", - Keyword::BETWEEN => "BETWEEN", - Keyword::BIGDECIMAL => "BIGDECIMAL", - Keyword::BIGINT => "BIGINT", - Keyword::BIGNUMERIC => "BIGNUMERIC", - Keyword::BINARY => "BINARY", - Keyword::BIND => "BIND", - Keyword::BINDING => "BINDING", - Keyword::BIT => "BIT", - Keyword::BIT_OPS => "BIT_OPS", - Keyword::BLOB => "BLOB", - Keyword::BLOCK => "BLOCK", - Keyword::BLOOM => "BLOOM", - Keyword::BLOOMFILTER => "BLOOMFILTER", - Keyword::BOOL => "BOOL", - Keyword::BOOLEAN => "BOOLEAN", - Keyword::BOOL_OPS => "BOOL_OPS", - Keyword::BOTH => "BOTH", - Keyword::BPCHAR_OPS => "BPCHAR_OPS", - Keyword::BRIN => "BRIN", - Keyword::BROWSE => "BROWSE", - Keyword::BTREE => "BTREE", - Keyword::BTREE_CUBE_OPS => "BTREE_CUBE_OPS", - Keyword::BTREE_HSTORE_OPS => "BTREE_HSTORE_OPS", - Keyword::BUCKET => "BUCKET", - Keyword::BUCKETS => "BUCKETS", - Keyword::BY => "BY", - Keyword::BYPASSRLS => "BYPASSRLS", - Keyword::BYTEA => "BYTEA", - Keyword::BYTEA_OPS => "BYTEA_OPS", - Keyword::BYTES => "BYTES", - Keyword::CACHE => "CACHE", - Keyword::CALL => "CALL", - Keyword::CALLED => "CALLED", - Keyword::CARDINALITY => "CARDINALITY", - Keyword::CASCADE => "CASCADE", - Keyword::CASCADED => "CASCADED", - Keyword::CASE => "CASE", - Keyword::CASES => "CASES", - Keyword::CAST => "CAST", - Keyword::CATALOG => "CATALOG", - Keyword::CATALOG_SYNC => "CATALOG_SYNC", - Keyword::CATCH => "CATCH", - Keyword::CEIL => "CEIL", - Keyword::CEILING => "CEILING", - Keyword::CENTURY => "CENTURY", - Keyword::CHAIN => "CHAIN", - Keyword::CHANGE => "CHANGE", - Keyword::CHANGE_TRACKING => "CHANGE_TRACKING", - Keyword::CHANNEL => "CHANNEL", - Keyword::CHAR => "CHAR", - Keyword::CHARACTER => "CHARACTER", - Keyword::CHARACTERS => "CHARACTERS", - Keyword::CHARACTER_LENGTH => "CHARACTER_LENGTH", - Keyword::CHARSET => "CHARSET", - Keyword::CHAR_LENGTH => "CHAR_LENGTH", - Keyword::CHAR_OPS => "CHAR_OPS", - Keyword::CHECK => "CHECK", - Keyword::CIDR_OPS => "CIDR_OPS", - Keyword::CITEXT_OPS => "CITEXT_OPS", - Keyword::CLEAR => "CLEAR", - Keyword::CLOB => "CLOB", - Keyword::CLONE => "CLONE", - Keyword::CLOSE => "CLOSE", - Keyword::CLUSTER => "CLUSTER", - Keyword::CLUSTERED => "CLUSTERED", - Keyword::CLUSTERING => "CLUSTERING", - Keyword::COALESCE => "COALESCE", - Keyword::COLLATE => "COLLATE", - Keyword::COLLATION => "COLLATION", - Keyword::COLLECT => "COLLECT", - Keyword::COLLECTION => "COLLECTION", - Keyword::COLUMN => "COLUMN", - Keyword::COLUMNS => "COLUMNS", - Keyword::COLUMNSTORE => "COLUMNSTORE", - Keyword::COMMENT => "COMMENT", - Keyword::COMMIT => "COMMIT", - Keyword::COMMITTED => "COMMITTED", - Keyword::COMPATIBLE => "COMPATIBLE", - Keyword::COMPRESSION => "COMPRESSION", - Keyword::COMPUTE => "COMPUTE", - Keyword::CONCURRENTLY => "CONCURRENTLY", - Keyword::CONDITION => "CONDITION", - Keyword::CONFLICT => "CONFLICT", - Keyword::CONNECT => "CONNECT", - Keyword::CONNECTION => "CONNECTION", - Keyword::CONNECTOR => "CONNECTOR", - Keyword::CONSTRAINT => "CONSTRAINT", - Keyword::CONTAINS => "CONTAINS", - Keyword::CONTINUE => "CONTINUE", - Keyword::CONVERT => "CONVERT", - Keyword::COPY => "COPY", - Keyword::COPY_OPTIONS => "COPY_OPTIONS", - Keyword::CORR => "CORR", - Keyword::CORRESPONDING => "CORRESPONDING", - Keyword::COUNT => "COUNT", - Keyword::COVAR_POP => "COVAR_POP", - Keyword::COVAR_SAMP => "COVAR_SAMP", - Keyword::CREATE => "CREATE", - Keyword::CREATEDB => "CREATEDB", - Keyword::CREATEROLE => "CREATEROLE", - Keyword::CREDENTIALS => "CREDENTIALS", - Keyword::CROSS => "CROSS", - Keyword::CSV => "CSV", - Keyword::CUBE => "CUBE", - Keyword::CUME_DIST => "CUME_DIST", - Keyword::CURRENT => "CURRENT", - Keyword::CURRENT_CATALOG => "CURRENT_CATALOG", - Keyword::CURRENT_DATE => "CURRENT_DATE", - Keyword::CURRENT_DEFAULT_TRANSFORM_GROUP => { - "CURRENT_DEFAULT_TRANSFORM_GROUP" - } - Keyword::CURRENT_PATH => "CURRENT_PATH", - Keyword::CURRENT_ROLE => "CURRENT_ROLE", - Keyword::CURRENT_ROW => "CURRENT_ROW", - Keyword::CURRENT_SCHEMA => "CURRENT_SCHEMA", - Keyword::CURRENT_TIME => "CURRENT_TIME", - Keyword::CURRENT_TIMESTAMP => "CURRENT_TIMESTAMP", - Keyword::CURRENT_TRANSFORM_GROUP_FOR_TYPE => { - "CURRENT_TRANSFORM_GROUP_FOR_TYPE" - } - Keyword::CURRENT_USER => "CURRENT_USER", - Keyword::CURSOR => "CURSOR", - Keyword::CYCLE => "CYCLE", - Keyword::DATA => "DATA", - Keyword::DATABASE => "DATABASE", - Keyword::DATABASES => "DATABASES", - Keyword::DATA_RETENTION_TIME_IN_DAYS => "DATA_RETENTION_TIME_IN_DAYS", - Keyword::DATE => "DATE", - Keyword::DATE32 => "DATE32", - Keyword::DATETIME => "DATETIME", - Keyword::DATETIME64 => "DATETIME64", - Keyword::DATE_OPS => "DATE_OPS", - Keyword::DAY => "DAY", - Keyword::DAYOFWEEK => "DAYOFWEEK", - Keyword::DAYOFYEAR => "DAYOFYEAR", - Keyword::DAYS => "DAYS", - Keyword::DCPROPERTIES => "DCPROPERTIES", - Keyword::DEALLOCATE => "DEALLOCATE", - Keyword::DEC => "DEC", - Keyword::DECADE => "DECADE", - Keyword::DECIMAL => "DECIMAL", - Keyword::DECLARE => "DECLARE", - Keyword::DEDUPLICATE => "DEDUPLICATE", - Keyword::DEFAULT => "DEFAULT", - Keyword::DEFAULT_DDL_COLLATION => "DEFAULT_DDL_COLLATION", - Keyword::DEFERRABLE => "DEFERRABLE", - Keyword::DEFERRED => "DEFERRED", - Keyword::DEFINE => "DEFINE", - Keyword::DEFINED => "DEFINED", - Keyword::DEFINER => "DEFINER", - Keyword::DELAYED => "DELAYED", - Keyword::DELETE => "DELETE", - Keyword::DELIMITED => "DELIMITED", - Keyword::DELIMITER => "DELIMITER", - Keyword::DELTA => "DELTA", - Keyword::DENSE_RANK => "DENSE_RANK", - Keyword::DEREF => "DEREF", - Keyword::DESC => "DESC", - Keyword::DESCRIBE => "DESCRIBE", - Keyword::DETACH => "DETACH", - Keyword::DETAIL => "DETAIL", - Keyword::DETERMINISTIC => "DETERMINISTIC", - Keyword::DIRECTORY => "DIRECTORY", - Keyword::DISABLE => "DISABLE", - Keyword::DISCARD => "DISCARD", - Keyword::DISCONNECT => "DISCONNECT", - Keyword::DISTINCT => "DISTINCT", - Keyword::DISTRIBUTE => "DISTRIBUTE", - Keyword::DIV => "DIV", - Keyword::DO => "DO", - Keyword::DOUBLE => "DOUBLE", - Keyword::DOW => "DOW", - Keyword::DOY => "DOY", - Keyword::DROP => "DROP", - Keyword::DRY => "DRY", - Keyword::DUPLICATE => "DUPLICATE", - Keyword::DYNAMIC => "DYNAMIC", - Keyword::EACH => "EACH", - Keyword::EAN13_OPS => "EAN13_OPS", - Keyword::ELEMENT => "ELEMENT", - Keyword::ELEMENTS => "ELEMENTS", - Keyword::ELSE => "ELSE", - Keyword::EMPTY => "EMPTY", - Keyword::ENABLE => "ENABLE", - Keyword::ENABLE_SCHEMA_EVOLUTION => "ENABLE_SCHEMA_EVOLUTION", - Keyword::ENCODING => "ENCODING", - Keyword::ENCRYPTION => "ENCRYPTION", - Keyword::END => "END", - Keyword::END_EXEC => "END_EXEC", - Keyword::ENDPOINT => "ENDPOINT", - Keyword::END_FRAME => "END_FRAME", - Keyword::END_PARTITION => "END_PARTITION", - Keyword::ENFORCED => "ENFORCED", - Keyword::ENGINE => "ENGINE", - Keyword::ENUM => "ENUM", - Keyword::ENUM16 => "ENUM16", - Keyword::ENUM8 => "ENUM8", - Keyword::ENUM_OPS => "ENUM_OPS", - Keyword::EPHEMERAL => "EPHEMERAL", - Keyword::EPOCH => "EPOCH", - Keyword::EQUALS => "EQUALS", - Keyword::ERROR => "ERROR", - Keyword::ESCAPE => "ESCAPE", - Keyword::ESCAPED => "ESCAPED", - Keyword::ESTIMATE => "ESTIMATE", - Keyword::EVENT => "EVENT", - Keyword::EVERY => "EVERY", - Keyword::EVOLVE => "EVOLVE", - Keyword::EXCEPT => "EXCEPT", - Keyword::EXCEPTION => "EXCEPTION", - Keyword::EXCHANGE => "EXCHANGE", - Keyword::EXCLUDE => "EXCLUDE", - Keyword::EXCLUSIVE => "EXCLUSIVE", - Keyword::EXEC => "EXEC", - Keyword::EXECUTE => "EXECUTE", - Keyword::EXECUTION => "EXECUTION", - Keyword::EXISTS => "EXISTS", - Keyword::EXP => "EXP", - Keyword::EXPANSION => "EXPANSION", - Keyword::EXPLAIN => "EXPLAIN", - Keyword::EXPLICIT => "EXPLICIT", - Keyword::EXPORT => "EXPORT", - Keyword::EXTENDED => "EXTENDED", - Keyword::EXTENSION => "EXTENSION", - Keyword::EXTERNAL => "EXTERNAL", - Keyword::EXTERNAL_VOLUME => "EXTERNAL_VOLUME", - Keyword::EXTRACT => "EXTRACT", - Keyword::FAIL => "FAIL", - Keyword::FAILOVER => "FAILOVER", - Keyword::FALSE => "FALSE", - Keyword::FETCH => "FETCH", - Keyword::FIELDS => "FIELDS", - Keyword::FILE => "FILE", - Keyword::FILES => "FILES", - Keyword::FILE_FORMAT => "FILE_FORMAT", - Keyword::FILL => "FILL", - Keyword::FILTER => "FILTER", - Keyword::FINAL => "FINAL", - Keyword::FIRST => "FIRST", - Keyword::FIRST_VALUE => "FIRST_VALUE", - Keyword::FIXEDSTRING => "FIXEDSTRING", - Keyword::FLOAT => "FLOAT", - Keyword::FLOAT32 => "FLOAT32", - Keyword::FLOAT4 => "FLOAT4", - Keyword::FLOAT4_OPS => "FLOAT4_OPS", - Keyword::FLOAT64 => "FLOAT64", - Keyword::FLOAT8 => "FLOAT8", - Keyword::FLOAT8_OPS => "FLOAT8_OPS", - Keyword::FLOOR => "FLOOR", - Keyword::FLUSH => "FLUSH", - Keyword::FN => "FN", - Keyword::FOLLOWING => "FOLLOWING", - Keyword::FOR => "FOR", - Keyword::FORCE => "FORCE", - Keyword::FORCE_NOT_NULL => "FORCE_NOT_NULL", - Keyword::FORCE_NULL => "FORCE_NULL", - Keyword::FORCE_QUOTE => "FORCE_QUOTE", - Keyword::FOREIGN => "FOREIGN", - Keyword::FORMAT => "FORMAT", - Keyword::FORMATTED => "FORMATTED", - Keyword::FORWARD => "FORWARD", - Keyword::FRAME_ROW => "FRAME_ROW", - Keyword::FREE => "FREE", - Keyword::FREEZE => "FREEZE", - Keyword::FROM => "FROM", - Keyword::FSCK => "FSCK", - Keyword::FULFILLMENT => "FULFILLMENT", - Keyword::FULL => "FULL", - Keyword::FULLTEXT => "FULLTEXT", - Keyword::FUNCTION => "FUNCTION", - Keyword::FUNCTIONS => "FUNCTIONS", - Keyword::FUSION => "FUSION", - Keyword::GENERAL => "GENERAL", - Keyword::GENERATE => "GENERATE", - Keyword::GENERATED => "GENERATED", - Keyword::GEOGRAPHY => "GEOGRAPHY", - Keyword::GET => "GET", - Keyword::GIN => "GIN", - Keyword::GIN_HSTORE_OPS => "GIN_HSTORE_OPS", - Keyword::GIN_TRGM_OPS => "GIN_TRGM_OPS", - Keyword::GIST => "GIST", - Keyword::GIST_BIT_OPS => "GIST_BIT_OPS", - Keyword::GIST_BOOL_OPS => "GIST_BOOL_OPS", - Keyword::GIST_BPCHAR_OPS => "GIST_BPCHAR_OPS", - Keyword::GIST_BYTEA_OPS => "GIST_BYTEA_OPS", - Keyword::GIST_CASH_OPS => "GIST_CASH_OPS", - Keyword::GIST_CIDR_OPS => "GIST_CIDR_OPS", - Keyword::GIST_CUBE_OPS => "GIST_CUBE_OPS", - Keyword::GIST_DATE_OPS => "GIST_DATE_OPS", - Keyword::GIST_ENUM_OPS => "GIST_ENUM_OPS", - Keyword::GIST_FLOAT4_OPS => "GIST_FLOAT4_OPS", - Keyword::GIST_FLOAT8_OPS => "GIST_FLOAT8_OPS", - Keyword::GIST_HSTORE_OPS => "GIST_HSTORE_OPS", - Keyword::GIST_INET_OPS => "GIST_INET_OPS", - Keyword::GIST_INT2_OPS => "GIST_INT2_OPS", - Keyword::GIST_INT4_OPS => "GIST_INT4_OPS", - Keyword::GIST_INT8_OPS => "GIST_INT8_OPS", - Keyword::GIST_INTERVAL_OPS => "GIST_INTERVAL_OPS", - Keyword::GIST_LTREE_OPS => "GIST_LTREE_OPS", - Keyword::GIST_MACADDR8_OPS => "GIST_MACADDR8_OPS", - Keyword::GIST_MACADDR_OPS => "GIST_MACADDR_OPS", - Keyword::GIST_NUMERIC_OPS => "GIST_NUMERIC_OPS", - Keyword::GIST_OID_OPS => "GIST_OID_OPS", - Keyword::GIST_SEG_OPS => "GIST_SEG_OPS", - Keyword::GIST_TEXT_OPS => "GIST_TEXT_OPS", - Keyword::GIST_TIMESTAMP_OPS => "GIST_TIMESTAMP_OPS", - Keyword::GIST_TIMESTAMPTZ_OPS => "GIST_TIMESTAMPTZ_OPS", - Keyword::GIST_TIME_OPS => "GIST_TIME_OPS", - Keyword::GIST_TIMETZ_OPS => "GIST_TIMETZ_OPS", - Keyword::GIST_TRGM_OPS => "GIST_TRGM_OPS", - Keyword::GIST_UUID_OPS => "GIST_UUID_OPS", - Keyword::GIST_VBIT_OPS => "GIST_VBIT_OPS", - Keyword::GLOBAL => "GLOBAL", - Keyword::GRANT => "GRANT", - Keyword::GRANTED => "GRANTED", - Keyword::GRANTS => "GRANTS", - Keyword::GRAPHVIZ => "GRAPHVIZ", - Keyword::GROUP => "GROUP", - Keyword::GROUPING => "GROUPING", - Keyword::GROUPS => "GROUPS", - Keyword::HASH => "HASH", - Keyword::HASH_HSTORE_OPS => "HASH_HSTORE_OPS", - Keyword::HASH_LTREE_OPS => "HASH_LTREE_OPS", - Keyword::HAVING => "HAVING", - Keyword::HEADER => "HEADER", - Keyword::HEAP => "HEAP", - Keyword::HIGH_PRIORITY => "HIGH_PRIORITY", - Keyword::HISTORY => "HISTORY", - Keyword::HIVEVAR => "HIVEVAR", - Keyword::HOLD => "HOLD", - Keyword::HOSTS => "HOSTS", - Keyword::HOUR => "HOUR", - Keyword::HOURS => "HOURS", - Keyword::ICEBERG => "ICEBERG", - Keyword::ID => "ID", - Keyword::IDENTITY => "IDENTITY", - Keyword::IDENTITY_INSERT => "IDENTITY_INSERT", - Keyword::IF => "IF", - Keyword::IGNORE => "IGNORE", - Keyword::ILIKE => "ILIKE", - Keyword::IMMEDIATE => "IMMEDIATE", - Keyword::IMMUTABLE => "IMMUTABLE", - Keyword::IMPORT => "IMPORT", - Keyword::IMPORTED => "IMPORTED", - Keyword::IN => "IN", - Keyword::INCLUDE => "INCLUDE", - Keyword::INCLUDE_NULL_VALUES => "INCLUDE_NULL_VALUES", - Keyword::INCREMENT => "INCREMENT", - Keyword::INDEX => "INDEX", - Keyword::INDICATOR => "INDICATOR", - Keyword::INET_OPS => "INET_OPS", - Keyword::INHERIT => "INHERIT", - Keyword::INITIALLY => "INITIALLY", - Keyword::INNER => "INNER", - Keyword::INOUT => "INOUT", - Keyword::INPATH => "INPATH", - Keyword::INPUT => "INPUT", - Keyword::INPUTFORMAT => "INPUTFORMAT", - Keyword::INSENSITIVE => "INSENSITIVE", - Keyword::INSERT => "INSERT", - Keyword::INSTALL => "INSTALL", - Keyword::INSTEAD => "INSTEAD", - Keyword::INT => "INT", - Keyword::INT128 => "INT128", - Keyword::INT16 => "INT16", - Keyword::INT2 => "INT2", - Keyword::INT256 => "INT256", - Keyword::INT2_OPS => "INT2_OPS", - Keyword::INT32 => "INT32", - Keyword::INT4 => "INT4", - Keyword::INT4_OPS => "INT4_OPS", - Keyword::INT64 => "INT64", - Keyword::INT8 => "INT8", - Keyword::INT8_OPS => "INT8_OPS", - Keyword::INTEGER => "INTEGER", - Keyword::INTEGRATION => "INTEGRATION", - Keyword::INTERPOLATE => "INTERPOLATE", - Keyword::INTERSECT => "INTERSECT", - Keyword::INTERSECTION => "INTERSECTION", - Keyword::INTERVAL => "INTERVAL", - Keyword::INTERVAL_OPS => "INTERVAL_OPS", - Keyword::INTO => "INTO", - Keyword::INVOKER => "INVOKER", - Keyword::IO => "IO", - Keyword::IS => "IS", - Keyword::ISBN13_OPS => "ISBN13_OPS", - Keyword::ISBN_OPS => "ISBN_OPS", - Keyword::ISMN13_OPS => "ISMN13_OPS", - Keyword::ISMN_OPS => "ISMN_OPS", - Keyword::ISODOW => "ISODOW", - Keyword::ISOLATION => "ISOLATION", - Keyword::ISOWEEK => "ISOWEEK", - Keyword::ISOYEAR => "ISOYEAR", - Keyword::ISSN13_OPS => "ISSN13_OPS", - Keyword::ISSN_OPS => "ISSN_OPS", - Keyword::ITEMS => "ITEMS", - Keyword::JAR => "JAR", - Keyword::JOIN => "JOIN", - Keyword::JSON => "JSON", - Keyword::JSONB => "JSONB", - Keyword::JSONFILE => "JSONFILE", - Keyword::JSON_TABLE => "JSON_TABLE", - Keyword::JULIAN => "JULIAN", - Keyword::KEY => "KEY", - Keyword::KEYS => "KEYS", - Keyword::KILL => "KILL", - Keyword::LAG => "LAG", - Keyword::LANGUAGE => "LANGUAGE", - Keyword::LARGE => "LARGE", - Keyword::LAST => "LAST", - Keyword::LAST_VALUE => "LAST_VALUE", - Keyword::LATERAL => "LATERAL", - Keyword::LEAD => "LEAD", - Keyword::LEADING => "LEADING", - Keyword::LEFT => "LEFT", - Keyword::LEVEL => "LEVEL", - Keyword::LIKE => "LIKE", - Keyword::LIKE_REGEX => "LIKE_REGEX", - Keyword::LIMIT => "LIMIT", - Keyword::LINES => "LINES", - Keyword::LIST => "LIST", - Keyword::LISTEN => "LISTEN", - Keyword::LISTING => "LISTING", - Keyword::LN => "LN", - Keyword::LOAD => "LOAD", - Keyword::LOCAL => "LOCAL", - Keyword::LOCALTIME => "LOCALTIME", - Keyword::LOCALTIMESTAMP => "LOCALTIMESTAMP", - Keyword::LOCATION => "LOCATION", - Keyword::LOCK => "LOCK", - Keyword::LOCKED => "LOCKED", - Keyword::LOG => "LOG", - Keyword::LOGIN => "LOGIN", - Keyword::LOGS => "LOGS", - Keyword::LONGBLOB => "LONGBLOB", - Keyword::LONGTEXT => "LONGTEXT", - Keyword::LOWCARDINALITY => "LOWCARDINALITY", - Keyword::LOWER => "LOWER", - Keyword::LOW_PRIORITY => "LOW_PRIORITY", - Keyword::LS => "LS", - Keyword::LTREE_OPS => "LTREE_OPS", - Keyword::MACADDR8_OPS => "MACADDR8_OPS", - Keyword::MACADDR_OPS => "MACADDR_OPS", - Keyword::MACRO => "MACRO", - Keyword::MANAGE => "MANAGE", - Keyword::MANAGED => "MANAGED", - Keyword::MANAGEDLOCATION => "MANAGEDLOCATION", - Keyword::MAP => "MAP", - Keyword::MASKING => "MASKING", - Keyword::MATCH => "MATCH", - Keyword::MATCHED => "MATCHED", - Keyword::MATCHES => "MATCHES", - Keyword::MATCH_CONDITION => "MATCH_CONDITION", - Keyword::MATCH_RECOGNIZE => "MATCH_RECOGNIZE", - Keyword::MATERIALIZE => "MATERIALIZE", - Keyword::MATERIALIZED => "MATERIALIZED", - Keyword::MAX => "MAX", - Keyword::MAXVALUE => "MAXVALUE", - Keyword::MAX_DATA_EXTENSION_TIME_IN_DAYS => { - "MAX_DATA_EXTENSION_TIME_IN_DAYS" - } - Keyword::MEASURES => "MEASURES", - Keyword::MEDIUMBLOB => "MEDIUMBLOB", - Keyword::MEDIUMINT => "MEDIUMINT", - Keyword::MEDIUMTEXT => "MEDIUMTEXT", - Keyword::MEMBER => "MEMBER", - Keyword::MERGE => "MERGE", - Keyword::METADATA => "METADATA", - Keyword::METHOD => "METHOD", - Keyword::METRIC => "METRIC", - Keyword::MICROSECOND => "MICROSECOND", - Keyword::MICROSECONDS => "MICROSECONDS", - Keyword::MILLENIUM => "MILLENIUM", - Keyword::MILLENNIUM => "MILLENNIUM", - Keyword::MILLISECOND => "MILLISECOND", - Keyword::MILLISECONDS => "MILLISECONDS", - Keyword::MIN => "MIN", - Keyword::MINUS => "MINUS", - Keyword::MINUTE => "MINUTE", - Keyword::MINUTES => "MINUTES", - Keyword::MINVALUE => "MINVALUE", - Keyword::MOD => "MOD", - Keyword::MODE => "MODE", - Keyword::MODIFIES => "MODIFIES", - Keyword::MODIFY => "MODIFY", - Keyword::MODULE => "MODULE", - Keyword::MONEY_OPS => "MONEY_OPS", - Keyword::MONITOR => "MONITOR", - Keyword::MONTH => "MONTH", - Keyword::MONTHS => "MONTHS", - Keyword::MSCK => "MSCK", - Keyword::MULTISET => "MULTISET", - Keyword::MUTATION => "MUTATION", - Keyword::NAME => "NAME", - Keyword::NAME_OPS => "NAME_OPS", - Keyword::NANOSECOND => "NANOSECOND", - Keyword::NANOSECONDS => "NANOSECONDS", - Keyword::NATIONAL => "NATIONAL", - Keyword::NATURAL => "NATURAL", - Keyword::NCHAR => "NCHAR", - Keyword::NCLOB => "NCLOB", - Keyword::NESTED => "NESTED", - Keyword::NETWORK => "NETWORK", - Keyword::NEW => "NEW", - Keyword::NEXT => "NEXT", - Keyword::NFC => "NFC", - Keyword::NFD => "NFD", - Keyword::NFKC => "NFKC", - Keyword::NFKD => "NFKD", - Keyword::NO => "NO", - Keyword::NOBYPASSRLS => "NOBYPASSRLS", - Keyword::NOCREATEDB => "NOCREATEDB", - Keyword::NOCREATEROLE => "NOCREATEROLE", - Keyword::NOINHERIT => "NOINHERIT", - Keyword::NOLOGIN => "NOLOGIN", - Keyword::NONE => "NONE", - Keyword::NOORDER => "NOORDER", - Keyword::NOREPLICATION => "NOREPLICATION", - Keyword::NORMALIZE => "NORMALIZE", - Keyword::NORMALIZED => "NORMALIZED", - Keyword::NOSCAN => "NOSCAN", - Keyword::NOSUPERUSER => "NOSUPERUSER", - Keyword::NOT => "NOT", - Keyword::NOTHING => "NOTHING", - Keyword::NOTIFY => "NOTIFY", - Keyword::NOWAIT => "NOWAIT", - Keyword::NO_WRITE_TO_BINLOG => "NO_WRITE_TO_BINLOG", - Keyword::NTH_VALUE => "NTH_VALUE", - Keyword::NTILE => "NTILE", - Keyword::NULL => "NULL", - Keyword::NULLABLE => "NULLABLE", - Keyword::NULLIF => "NULLIF", - Keyword::NULLS => "NULLS", - Keyword::NUMERIC => "NUMERIC", - Keyword::NUMERIC_OPS => "NUMERIC_OPS", - Keyword::NVARCHAR => "NVARCHAR", - Keyword::OBJECT => "OBJECT", - Keyword::OCCURRENCES_REGEX => "OCCURRENCES_REGEX", - Keyword::OCTETS => "OCTETS", - Keyword::OCTET_LENGTH => "OCTET_LENGTH", - Keyword::OF => "OF", - Keyword::OFF => "OFF", - Keyword::OFFSET => "OFFSET", - Keyword::OFFSETS => "OFFSETS", - Keyword::OID_OPS => "OID_OPS", - Keyword::OLD => "OLD", - Keyword::OMIT => "OMIT", - Keyword::ON => "ON", - Keyword::ONE => "ONE", - Keyword::ONLY => "ONLY", - Keyword::OPEN => "OPEN", - Keyword::OPENJSON => "OPENJSON", - Keyword::OPERATE => "OPERATE", - Keyword::OPERATOR => "OPERATOR", - Keyword::OPTIMIZATION => "OPTIMIZATION", - Keyword::OPTIMIZE => "OPTIMIZE", - Keyword::OPTIMIZED => "OPTIMIZED", - Keyword::OPTIMIZER_COSTS => "OPTIMIZER_COSTS", - Keyword::OPTION => "OPTION", - Keyword::OPTIONS => "OPTIONS", - Keyword::OR => "OR", - Keyword::ORC => "ORC", - Keyword::ORDER => "ORDER", - Keyword::ORDINALITY => "ORDINALITY", - Keyword::ORGANIZATION => "ORGANIZATION", - Keyword::OUT => "OUT", - Keyword::OUTER => "OUTER", - Keyword::OUTPUTFORMAT => "OUTPUTFORMAT", - Keyword::OVER => "OVER", - Keyword::OVERFLOW => "OVERFLOW", - Keyword::OVERLAPS => "OVERLAPS", - Keyword::OVERLAY => "OVERLAY", - Keyword::OVERRIDE => "OVERRIDE", - Keyword::OVERWRITE => "OVERWRITE", - Keyword::OWNED => "OWNED", - Keyword::OWNER => "OWNER", - Keyword::OWNERSHIP => "OWNERSHIP", - Keyword::PACKAGE => "PACKAGE", - Keyword::PACKAGES => "PACKAGES", - Keyword::PARALLEL => "PARALLEL", - Keyword::PARAMETER => "PARAMETER", - Keyword::PARQUET => "PARQUET", - Keyword::PART => "PART", - Keyword::PARTITION => "PARTITION", - Keyword::PARTITIONED => "PARTITIONED", - Keyword::PARTITIONS => "PARTITIONS", - Keyword::PASSWORD => "PASSWORD", - Keyword::PAST => "PAST", - Keyword::PATH => "PATH", - Keyword::PATTERN => "PATTERN", - Keyword::PER => "PER", - Keyword::PERCENT => "PERCENT", - Keyword::PERCENTILE_CONT => "PERCENTILE_CONT", - Keyword::PERCENTILE_DISC => "PERCENTILE_DISC", - Keyword::PERCENT_RANK => "PERCENT_RANK", - Keyword::PERIOD => "PERIOD", - Keyword::PERMISSIVE => "PERMISSIVE", - Keyword::PERSISTENT => "PERSISTENT", - Keyword::PIVOT => "PIVOT", - Keyword::PLACING => "PLACING", - Keyword::PLAN => "PLAN", - Keyword::PLANS => "PLANS", - Keyword::POLICY => "POLICY", - Keyword::POOL => "POOL", - Keyword::PORTION => "PORTION", - Keyword::POSITION => "POSITION", - Keyword::POSITION_REGEX => "POSITION_REGEX", - Keyword::POWER => "POWER", - Keyword::PRAGMA => "PRAGMA", - Keyword::PRECEDES => "PRECEDES", - Keyword::PRECEDING => "PRECEDING", - Keyword::PRECISION => "PRECISION", - Keyword::PREPARE => "PREPARE", - Keyword::PRESERVE => "PRESERVE", - Keyword::PREWHERE => "PREWHERE", - Keyword::PRIMARY => "PRIMARY", - Keyword::PRIOR => "PRIOR", - Keyword::PRIVILEGES => "PRIVILEGES", - Keyword::PROCEDURE => "PROCEDURE", - Keyword::PROFILE => "PROFILE", - Keyword::PROGRAM => "PROGRAM", - Keyword::PROJECTION => "PROJECTION", - Keyword::PUBLIC => "PUBLIC", - Keyword::PURCHASE => "PURCHASE", - Keyword::PURGE => "PURGE", - Keyword::QUALIFY => "QUALIFY", - Keyword::QUARTER => "QUARTER", - Keyword::QUERY => "QUERY", - Keyword::QUOTE => "QUOTE", - Keyword::RAISERROR => "RAISERROR", - Keyword::RANGE => "RANGE", - Keyword::RANK => "RANK", - Keyword::RAW => "RAW", - Keyword::RCFILE => "RCFILE", - Keyword::READ => "READ", - Keyword::READS => "READS", - Keyword::READ_ONLY => "READ_ONLY", - Keyword::REAL => "REAL", - Keyword::RECLUSTER => "RECLUSTER", - Keyword::RECURSIVE => "RECURSIVE", - Keyword::REF => "REF", - Keyword::REFERENCES => "REFERENCES", - Keyword::REFERENCING => "REFERENCING", - Keyword::REGCLASS => "REGCLASS", - Keyword::REGEXP => "REGEXP", - Keyword::REGR_AVGX => "REGR_AVGX", - Keyword::REGR_AVGY => "REGR_AVGY", - Keyword::REGR_COUNT => "REGR_COUNT", - Keyword::REGR_INTERCEPT => "REGR_INTERCEPT", - Keyword::REGR_R2 => "REGR_R2", - Keyword::REGR_SLOPE => "REGR_SLOPE", - Keyword::REGR_SXX => "REGR_SXX", - Keyword::REGR_SXY => "REGR_SXY", - Keyword::REGR_SYY => "REGR_SYY", - Keyword::RELATIVE => "RELATIVE", - Keyword::RELAY => "RELAY", - Keyword::RELEASE => "RELEASE", - Keyword::RELEASES => "RELEASES", - Keyword::REMOTE => "REMOTE", - Keyword::REMOVE => "REMOVE", - Keyword::RENAME => "RENAME", - Keyword::REORG => "REORG", - Keyword::REPAIR => "REPAIR", - Keyword::REPEATABLE => "REPEATABLE", - Keyword::REPLACE => "REPLACE", - Keyword::REPLICA => "REPLICA", - Keyword::REPLICATE => "REPLICATE", - Keyword::REPLICATION => "REPLICATION", - Keyword::RESET => "RESET", - Keyword::RESOLVE => "RESOLVE", - Keyword::RESPECT => "RESPECT", - Keyword::RESTART => "RESTART", - Keyword::RESTRICT => "RESTRICT", - Keyword::RESTRICTED => "RESTRICTED", - Keyword::RESTRICTIONS => "RESTRICTIONS", - Keyword::RESTRICTIVE => "RESTRICTIVE", - Keyword::RESULT => "RESULT", - Keyword::RESULTSET => "RESULTSET", - Keyword::RESUME => "RESUME", - Keyword::RETAIN => "RETAIN", - Keyword::RETURN => "RETURN", - Keyword::RETURNING => "RETURNING", - Keyword::RETURNS => "RETURNS", - Keyword::REVOKE => "REVOKE", - Keyword::RIGHT => "RIGHT", - Keyword::RLIKE => "RLIKE", - Keyword::RM => "RM", - Keyword::ROLE => "ROLE", - Keyword::ROLES => "ROLES", - Keyword::ROLLBACK => "ROLLBACK", - Keyword::ROLLUP => "ROLLUP", - Keyword::ROOT => "ROOT", - Keyword::ROW => "ROW", - Keyword::ROWID => "ROWID", - Keyword::ROWS => "ROWS", - Keyword::ROW_NUMBER => "ROW_NUMBER", - Keyword::RULE => "RULE", - Keyword::RUN => "RUN", - Keyword::SAFE => "SAFE", - Keyword::SAFE_CAST => "SAFE_CAST", - Keyword::SAMPLE => "SAMPLE", - Keyword::SAVEPOINT => "SAVEPOINT", - Keyword::SCHEMA => "SCHEMA", - Keyword::SCHEMAS => "SCHEMAS", - Keyword::SCOPE => "SCOPE", - Keyword::SCROLL => "SCROLL", - Keyword::SEARCH => "SEARCH", - Keyword::SECOND => "SECOND", - Keyword::SECONDARY => "SECONDARY", - Keyword::SECONDS => "SECONDS", - Keyword::SECRET => "SECRET", - Keyword::SECURITY => "SECURITY", - Keyword::SEED => "SEED", - Keyword::SEG_OPS => "SEG_OPS", - Keyword::SELECT => "SELECT", - Keyword::SEMI => "SEMI", - Keyword::SENSITIVE => "SENSITIVE", - Keyword::SEPARATOR => "SEPARATOR", - Keyword::SEQUENCE => "SEQUENCE", - Keyword::SEQUENCEFILE => "SEQUENCEFILE", - Keyword::SEQUENCES => "SEQUENCES", - Keyword::SERDE => "SERDE", - Keyword::SERDEPROPERTIES => "SERDEPROPERTIES", - Keyword::SERIALIZABLE => "SERIALIZABLE", - Keyword::SERVICE => "SERVICE", - Keyword::SESSION => "SESSION", - Keyword::SESSION_USER => "SESSION_USER", - Keyword::SET => "SET", - Keyword::SETERROR => "SETERROR", - Keyword::SETS => "SETS", - Keyword::SETTINGS => "SETTINGS", - Keyword::SHARE => "SHARE", - Keyword::SHARING => "SHARING", - Keyword::SHOW => "SHOW", - Keyword::SIMILAR => "SIMILAR", - Keyword::SKIP => "SKIP", - Keyword::SLOW => "SLOW", - Keyword::SMALLINT => "SMALLINT", - Keyword::SNAPSHOT => "SNAPSHOT", - Keyword::SOME => "SOME", - Keyword::SORT => "SORT", - Keyword::SORTED => "SORTED", - Keyword::SOURCE => "SOURCE", - Keyword::SPATIAL => "SPATIAL", - Keyword::SPECIFIC => "SPECIFIC", - Keyword::SPECIFICTYPE => "SPECIFICTYPE", - Keyword::SPGIST => "SPGIST", - Keyword::SQL => "SQL", - Keyword::SQLEXCEPTION => "SQLEXCEPTION", - Keyword::SQLSTATE => "SQLSTATE", - Keyword::SQLWARNING => "SQLWARNING", - Keyword::SQRT => "SQRT", - Keyword::STABLE => "STABLE", - Keyword::STAGE => "STAGE", - Keyword::START => "START", - Keyword::STARTS => "STARTS", - Keyword::STATEMENT => "STATEMENT", - Keyword::STATIC => "STATIC", - Keyword::STATISTICS => "STATISTICS", - Keyword::STATUS => "STATUS", - Keyword::STDDEV_POP => "STDDEV_POP", - Keyword::STDDEV_SAMP => "STDDEV_SAMP", - Keyword::STDIN => "STDIN", - Keyword::STDOUT => "STDOUT", - Keyword::STEP => "STEP", - Keyword::STORAGE_INTEGRATION => "STORAGE_INTEGRATION", - Keyword::STORAGE_SERIALIZATION_POLICY => { - "STORAGE_SERIALIZATION_POLICY" - } - Keyword::STORED => "STORED", - Keyword::STRICT => "STRICT", - Keyword::STRING => "STRING", - Keyword::STRUCT => "STRUCT", - Keyword::SUBMULTISET => "SUBMULTISET", - Keyword::SUBSTRING => "SUBSTRING", - Keyword::SUBSTRING_REGEX => "SUBSTRING_REGEX", - Keyword::SUCCEEDS => "SUCCEEDS", - Keyword::SUM => "SUM", - Keyword::SUPER => "SUPER", - Keyword::SUPERUSER => "SUPERUSER", - Keyword::SUPPORT => "SUPPORT", - Keyword::SUSPEND => "SUSPEND", - Keyword::SWAP => "SWAP", - Keyword::SYMMETRIC => "SYMMETRIC", - Keyword::SYNC => "SYNC", - Keyword::SYSTEM => "SYSTEM", - Keyword::SYSTEM_TIME => "SYSTEM_TIME", - Keyword::SYSTEM_USER => "SYSTEM_USER", - Keyword::TABLE => "TABLE", - Keyword::TABLES => "TABLES", - Keyword::TABLESAMPLE => "TABLESAMPLE", - Keyword::TAG => "TAG", - Keyword::TARGET => "TARGET", - Keyword::TASK => "TASK", - Keyword::TBLPROPERTIES => "TBLPROPERTIES", - Keyword::TEMP => "TEMP", - Keyword::TEMPORARY => "TEMPORARY", - Keyword::TEMPTABLE => "TEMPTABLE", - Keyword::TERMINATED => "TERMINATED", - Keyword::TERSE => "TERSE", - Keyword::TEXT => "TEXT", - Keyword::TEXTFILE => "TEXTFILE", - Keyword::TEXT_OPS => "TEXT_OPS", - Keyword::THEN => "THEN", - Keyword::TIES => "TIES", - Keyword::TIME => "TIME", - Keyword::TIMESTAMP => "TIMESTAMP", - Keyword::TIMESTAMPTZ => "TIMESTAMPTZ", - Keyword::TIMESTAMPTZ_OPS => "TIMESTAMPTZ_OPS", - Keyword::TIMESTAMP_OPS => "TIMESTAMP_OPS", - Keyword::TIMETZ => "TIMETZ", - Keyword::TIMETZ_OPS => "TIMETZ_OPS", - Keyword::TIMEZONE => "TIMEZONE", - Keyword::TIMEZONE_ABBR => "TIMEZONE_ABBR", - Keyword::TIMEZONE_HOUR => "TIMEZONE_HOUR", - Keyword::TIMEZONE_MINUTE => "TIMEZONE_MINUTE", - Keyword::TIMEZONE_REGION => "TIMEZONE_REGION", - Keyword::TIME_OPS => "TIME_OPS", - Keyword::TINYBLOB => "TINYBLOB", - Keyword::TINYINT => "TINYINT", - Keyword::TINYTEXT => "TINYTEXT", - Keyword::TO => "TO", - Keyword::TOP => "TOP", - Keyword::TOTALS => "TOTALS", - Keyword::TRACE => "TRACE", - Keyword::TRAILING => "TRAILING", - Keyword::TRANSACTION => "TRANSACTION", - Keyword::TRANSIENT => "TRANSIENT", - Keyword::TRANSLATE => "TRANSLATE", - Keyword::TRANSLATE_REGEX => "TRANSLATE_REGEX", - Keyword::TRANSLATION => "TRANSLATION", - Keyword::TREAT => "TREAT", - Keyword::TRIGGER => "TRIGGER", - Keyword::TRIM => "TRIM", - Keyword::TRIM_ARRAY => "TRIM_ARRAY", - Keyword::TRUE => "TRUE", - Keyword::TRUNCATE => "TRUNCATE", - Keyword::TRY => "TRY", - Keyword::TRY_CAST => "TRY_CAST", - Keyword::TRY_CONVERT => "TRY_CONVERT", - Keyword::TUPLE => "TUPLE", - Keyword::TYPE => "TYPE", - Keyword::UESCAPE => "UESCAPE", - Keyword::UINT128 => "UINT128", - Keyword::UINT16 => "UINT16", - Keyword::UINT256 => "UINT256", - Keyword::UINT32 => "UINT32", - Keyword::UINT64 => "UINT64", - Keyword::UINT8 => "UINT8", - Keyword::UNBOUNDED => "UNBOUNDED", - Keyword::UNCACHE => "UNCACHE", - Keyword::UNCOMMITTED => "UNCOMMITTED", - Keyword::UNDEFINED => "UNDEFINED", - Keyword::UNFREEZE => "UNFREEZE", - Keyword::UNION => "UNION", - Keyword::UNIQUE => "UNIQUE", - Keyword::UNKNOWN => "UNKNOWN", - Keyword::UNLISTEN => "UNLISTEN", - Keyword::UNLOAD => "UNLOAD", - Keyword::UNLOCK => "UNLOCK", - Keyword::UNLOGGED => "UNLOGGED", - Keyword::UNMATCHED => "UNMATCHED", - Keyword::UNNEST => "UNNEST", - Keyword::UNPIVOT => "UNPIVOT", - Keyword::UNSAFE => "UNSAFE", - Keyword::UNSIGNED => "UNSIGNED", - Keyword::UNTIL => "UNTIL", - Keyword::UPC_OPS => "UPC_OPS", - Keyword::UPDATE => "UPDATE", - Keyword::UPPER => "UPPER", - Keyword::URL => "URL", - Keyword::USAGE => "USAGE", - Keyword::USE => "USE", - Keyword::USER => "USER", - Keyword::USER_RESOURCES => "USER_RESOURCES", - Keyword::USING => "USING", - Keyword::UUID => "UUID", - Keyword::UUID_OPS => "UUID_OPS", - Keyword::VACUUM => "VACUUM", - Keyword::VALID => "VALID", - Keyword::VALIDATION_MODE => "VALIDATION_MODE", - Keyword::VALUE => "VALUE", - Keyword::VALUES => "VALUES", - Keyword::VALUE_OF => "VALUE_OF", - Keyword::VARBINARY => "VARBINARY", - Keyword::VARBIT_OPS => "VARBIT_OPS", - Keyword::VARCHAR => "VARCHAR", - Keyword::VARCHAR_OPS => "VARCHAR_OPS", - Keyword::VARIABLES => "VARIABLES", - Keyword::VARYING => "VARYING", - Keyword::VAR_POP => "VAR_POP", - Keyword::VAR_SAMP => "VAR_SAMP", - Keyword::VERBOSE => "VERBOSE", - Keyword::VERSION => "VERSION", - Keyword::VERSIONING => "VERSIONING", - Keyword::VERSIONS => "VERSIONS", - Keyword::VIEW => "VIEW", - Keyword::VIEWS => "VIEWS", - Keyword::VIRTUAL => "VIRTUAL", - Keyword::VOLATILE => "VOLATILE", - Keyword::VOLUME => "VOLUME", - Keyword::WAREHOUSE => "WAREHOUSE", - Keyword::WAREHOUSES => "WAREHOUSES", - Keyword::WEEK => "WEEK", - Keyword::WEEKS => "WEEKS", - Keyword::WHEN => "WHEN", - Keyword::WHENEVER => "WHENEVER", - Keyword::WHERE => "WHERE", - Keyword::WIDTH_BUCKET => "WIDTH_BUCKET", - Keyword::WINDOW => "WINDOW", - Keyword::WITH => "WITH", - Keyword::WITHIN => "WITHIN", - Keyword::WITHOUT => "WITHOUT", - Keyword::WITHOUT_ARRAY_WRAPPER => "WITHOUT_ARRAY_WRAPPER", - Keyword::WORK => "WORK", - Keyword::WRITE => "WRITE", - Keyword::XML => "XML", - Keyword::XOR => "XOR", - Keyword::YEAR => "YEAR", - Keyword::YEARS => "YEARS", - Keyword::ZONE => "ZONE", - Keyword::ZORDER => "ZORDER", - }, - ) - } - } - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::clone::Clone for Keyword { - #[inline] - fn clone(&self) -> Keyword { - *self - } - } - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::marker::Copy for Keyword {} - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::marker::StructuralPartialEq for Keyword {} - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::cmp::PartialEq for Keyword { - #[inline] - fn eq(&self, other: &Keyword) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::cmp::PartialOrd for Keyword { - #[inline] - fn partial_cmp( - &self, - other: &Keyword, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::cmp::Eq for Keyword { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::cmp::Ord for Keyword { - #[inline] - fn cmp(&self, other: &Keyword) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) - } - } - #[automatically_derived] - #[allow(non_camel_case_types)] - impl ::core::hash::Hash for Keyword { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state) - } - } - pub const ALL_KEYWORDS_INDEX: &[Keyword] = &[ - Keyword::ABORT, - Keyword::ABS, - Keyword::ABSENT, - Keyword::ABSOLUTE, - Keyword::ACCESS, - Keyword::ACCOUNT, - Keyword::ACTION, - Keyword::ADD, - Keyword::ADMIN, - Keyword::AFTER, - Keyword::AGAINST, - Keyword::AGGREGATION, - Keyword::ALERT, - Keyword::ALGORITHM, - Keyword::ALIAS, - Keyword::ALL, - Keyword::ALLOCATE, - Keyword::ALTER, - Keyword::ALWAYS, - Keyword::ANALYZE, - Keyword::AND, - Keyword::ANTI, - Keyword::ANY, - Keyword::APPLICATION, - Keyword::APPLY, - Keyword::APPLYBUDGET, - Keyword::ARCHIVE, - Keyword::ARE, - Keyword::ARRAY, - Keyword::ARRAY_MAX_CARDINALITY, - Keyword::AS, - Keyword::ASC, - Keyword::ASENSITIVE, - Keyword::ASOF, - Keyword::ASSERT, - Keyword::ASYMMETRIC, - Keyword::AT, - Keyword::ATOMIC, - Keyword::ATTACH, - Keyword::AUDIT, - Keyword::AUTHENTICATION, - Keyword::AUTHORIZATION, - Keyword::AUTO, - Keyword::AUTOINCREMENT, - Keyword::AUTO_INCREMENT, - Keyword::AVG, - Keyword::AVRO, - Keyword::BACKWARD, - Keyword::BASE64, - Keyword::BASE_LOCATION, - Keyword::BEFORE, - Keyword::BEGIN, - Keyword::BEGIN_FRAME, - Keyword::BEGIN_PARTITION, - Keyword::BERNOULLI, - Keyword::BETWEEN, - Keyword::BIGDECIMAL, - Keyword::BIGINT, - Keyword::BIGNUMERIC, - Keyword::BINARY, - Keyword::BIND, - Keyword::BINDING, - Keyword::BIT, - Keyword::BIT_OPS, - Keyword::BLOB, - Keyword::BLOCK, - Keyword::BLOOM, - Keyword::BLOOMFILTER, - Keyword::BOOL, - Keyword::BOOLEAN, - Keyword::BOOL_OPS, - Keyword::BOTH, - Keyword::BPCHAR_OPS, - Keyword::BRIN, - Keyword::BROWSE, - Keyword::BTREE, - Keyword::BTREE_CUBE_OPS, - Keyword::BTREE_HSTORE_OPS, - Keyword::BUCKET, - Keyword::BUCKETS, - Keyword::BY, - Keyword::BYPASSRLS, - Keyword::BYTEA, - Keyword::BYTEA_OPS, - Keyword::BYTES, - Keyword::CACHE, - Keyword::CALL, - Keyword::CALLED, - Keyword::CARDINALITY, - Keyword::CASCADE, - Keyword::CASCADED, - Keyword::CASE, - Keyword::CASES, - Keyword::CAST, - Keyword::CATALOG, - Keyword::CATALOG_SYNC, - Keyword::CATCH, - Keyword::CEIL, - Keyword::CEILING, - Keyword::CENTURY, - Keyword::CHAIN, - Keyword::CHANGE, - Keyword::CHANGE_TRACKING, - Keyword::CHANNEL, - Keyword::CHAR, - Keyword::CHARACTER, - Keyword::CHARACTERS, - Keyword::CHARACTER_LENGTH, - Keyword::CHARSET, - Keyword::CHAR_LENGTH, - Keyword::CHAR_OPS, - Keyword::CHECK, - Keyword::CIDR_OPS, - Keyword::CITEXT_OPS, - Keyword::CLEAR, - Keyword::CLOB, - Keyword::CLONE, - Keyword::CLOSE, - Keyword::CLUSTER, - Keyword::CLUSTERED, - Keyword::CLUSTERING, - Keyword::COALESCE, - Keyword::COLLATE, - Keyword::COLLATION, - Keyword::COLLECT, - Keyword::COLLECTION, - Keyword::COLUMN, - Keyword::COLUMNS, - Keyword::COLUMNSTORE, - Keyword::COMMENT, - Keyword::COMMIT, - Keyword::COMMITTED, - Keyword::COMPATIBLE, - Keyword::COMPRESSION, - Keyword::COMPUTE, - Keyword::CONCURRENTLY, - Keyword::CONDITION, - Keyword::CONFLICT, - Keyword::CONNECT, - Keyword::CONNECTION, - Keyword::CONNECTOR, - Keyword::CONSTRAINT, - Keyword::CONTAINS, - Keyword::CONTINUE, - Keyword::CONVERT, - Keyword::COPY, - Keyword::COPY_OPTIONS, - Keyword::CORR, - Keyword::CORRESPONDING, - Keyword::COUNT, - Keyword::COVAR_POP, - Keyword::COVAR_SAMP, - Keyword::CREATE, - Keyword::CREATEDB, - Keyword::CREATEROLE, - Keyword::CREDENTIALS, - Keyword::CROSS, - Keyword::CSV, - Keyword::CUBE, - Keyword::CUME_DIST, - Keyword::CURRENT, - Keyword::CURRENT_CATALOG, - Keyword::CURRENT_DATE, - Keyword::CURRENT_DEFAULT_TRANSFORM_GROUP, - Keyword::CURRENT_PATH, - Keyword::CURRENT_ROLE, - Keyword::CURRENT_ROW, - Keyword::CURRENT_SCHEMA, - Keyword::CURRENT_TIME, - Keyword::CURRENT_TIMESTAMP, - Keyword::CURRENT_TRANSFORM_GROUP_FOR_TYPE, - Keyword::CURRENT_USER, - Keyword::CURSOR, - Keyword::CYCLE, - Keyword::DATA, - Keyword::DATABASE, - Keyword::DATABASES, - Keyword::DATA_RETENTION_TIME_IN_DAYS, - Keyword::DATE, - Keyword::DATE32, - Keyword::DATETIME, - Keyword::DATETIME64, - Keyword::DATE_OPS, - Keyword::DAY, - Keyword::DAYOFWEEK, - Keyword::DAYOFYEAR, - Keyword::DAYS, - Keyword::DCPROPERTIES, - Keyword::DEALLOCATE, - Keyword::DEC, - Keyword::DECADE, - Keyword::DECIMAL, - Keyword::DECLARE, - Keyword::DEDUPLICATE, - Keyword::DEFAULT, - Keyword::DEFAULT_DDL_COLLATION, - Keyword::DEFERRABLE, - Keyword::DEFERRED, - Keyword::DEFINE, - Keyword::DEFINED, - Keyword::DEFINER, - Keyword::DELAYED, - Keyword::DELETE, - Keyword::DELIMITED, - Keyword::DELIMITER, - Keyword::DELTA, - Keyword::DENSE_RANK, - Keyword::DEREF, - Keyword::DESC, - Keyword::DESCRIBE, - Keyword::DETACH, - Keyword::DETAIL, - Keyword::DETERMINISTIC, - Keyword::DIRECTORY, - Keyword::DISABLE, - Keyword::DISCARD, - Keyword::DISCONNECT, - Keyword::DISTINCT, - Keyword::DISTRIBUTE, - Keyword::DIV, - Keyword::DO, - Keyword::DOUBLE, - Keyword::DOW, - Keyword::DOY, - Keyword::DROP, - Keyword::DRY, - Keyword::DUPLICATE, - Keyword::DYNAMIC, - Keyword::EACH, - Keyword::EAN13_OPS, - Keyword::ELEMENT, - Keyword::ELEMENTS, - Keyword::ELSE, - Keyword::EMPTY, - Keyword::ENABLE, - Keyword::ENABLE_SCHEMA_EVOLUTION, - Keyword::ENCODING, - Keyword::ENCRYPTION, - Keyword::END, - Keyword::END_EXEC, - Keyword::ENDPOINT, - Keyword::END_FRAME, - Keyword::END_PARTITION, - Keyword::ENFORCED, - Keyword::ENGINE, - Keyword::ENUM, - Keyword::ENUM16, - Keyword::ENUM8, - Keyword::ENUM_OPS, - Keyword::EPHEMERAL, - Keyword::EPOCH, - Keyword::EQUALS, - Keyword::ERROR, - Keyword::ESCAPE, - Keyword::ESCAPED, - Keyword::ESTIMATE, - Keyword::EVENT, - Keyword::EVERY, - Keyword::EVOLVE, - Keyword::EXCEPT, - Keyword::EXCEPTION, - Keyword::EXCHANGE, - Keyword::EXCLUDE, - Keyword::EXCLUSIVE, - Keyword::EXEC, - Keyword::EXECUTE, - Keyword::EXECUTION, - Keyword::EXISTS, - Keyword::EXP, - Keyword::EXPANSION, - Keyword::EXPLAIN, - Keyword::EXPLICIT, - Keyword::EXPORT, - Keyword::EXTENDED, - Keyword::EXTENSION, - Keyword::EXTERNAL, - Keyword::EXTERNAL_VOLUME, - Keyword::EXTRACT, - Keyword::FAIL, - Keyword::FAILOVER, - Keyword::FALSE, - Keyword::FETCH, - Keyword::FIELDS, - Keyword::FILE, - Keyword::FILES, - Keyword::FILE_FORMAT, - Keyword::FILL, - Keyword::FILTER, - Keyword::FINAL, - Keyword::FIRST, - Keyword::FIRST_VALUE, - Keyword::FIXEDSTRING, - Keyword::FLOAT, - Keyword::FLOAT32, - Keyword::FLOAT4, - Keyword::FLOAT4_OPS, - Keyword::FLOAT64, - Keyword::FLOAT8, - Keyword::FLOAT8_OPS, - Keyword::FLOOR, - Keyword::FLUSH, - Keyword::FN, - Keyword::FOLLOWING, - Keyword::FOR, - Keyword::FORCE, - Keyword::FORCE_NOT_NULL, - Keyword::FORCE_NULL, - Keyword::FORCE_QUOTE, - Keyword::FOREIGN, - Keyword::FORMAT, - Keyword::FORMATTED, - Keyword::FORWARD, - Keyword::FRAME_ROW, - Keyword::FREE, - Keyword::FREEZE, - Keyword::FROM, - Keyword::FSCK, - Keyword::FULFILLMENT, - Keyword::FULL, - Keyword::FULLTEXT, - Keyword::FUNCTION, - Keyword::FUNCTIONS, - Keyword::FUSION, - Keyword::GENERAL, - Keyword::GENERATE, - Keyword::GENERATED, - Keyword::GEOGRAPHY, - Keyword::GET, - Keyword::GIN, - Keyword::GIN_HSTORE_OPS, - Keyword::GIN_TRGM_OPS, - Keyword::GIST, - Keyword::GIST_BIT_OPS, - Keyword::GIST_BOOL_OPS, - Keyword::GIST_BPCHAR_OPS, - Keyword::GIST_BYTEA_OPS, - Keyword::GIST_CASH_OPS, - Keyword::GIST_CIDR_OPS, - Keyword::GIST_CUBE_OPS, - Keyword::GIST_DATE_OPS, - Keyword::GIST_ENUM_OPS, - Keyword::GIST_FLOAT4_OPS, - Keyword::GIST_FLOAT8_OPS, - Keyword::GIST_HSTORE_OPS, - Keyword::GIST_INET_OPS, - Keyword::GIST_INT2_OPS, - Keyword::GIST_INT4_OPS, - Keyword::GIST_INT8_OPS, - Keyword::GIST_INTERVAL_OPS, - Keyword::GIST_LTREE_OPS, - Keyword::GIST_MACADDR8_OPS, - Keyword::GIST_MACADDR_OPS, - Keyword::GIST_NUMERIC_OPS, - Keyword::GIST_OID_OPS, - Keyword::GIST_SEG_OPS, - Keyword::GIST_TEXT_OPS, - Keyword::GIST_TIMESTAMP_OPS, - Keyword::GIST_TIMESTAMPTZ_OPS, - Keyword::GIST_TIME_OPS, - Keyword::GIST_TIMETZ_OPS, - Keyword::GIST_TRGM_OPS, - Keyword::GIST_UUID_OPS, - Keyword::GIST_VBIT_OPS, - Keyword::GLOBAL, - Keyword::GRANT, - Keyword::GRANTED, - Keyword::GRANTS, - Keyword::GRAPHVIZ, - Keyword::GROUP, - Keyword::GROUPING, - Keyword::GROUPS, - Keyword::HASH, - Keyword::HASH_HSTORE_OPS, - Keyword::HASH_LTREE_OPS, - Keyword::HAVING, - Keyword::HEADER, - Keyword::HEAP, - Keyword::HIGH_PRIORITY, - Keyword::HISTORY, - Keyword::HIVEVAR, - Keyword::HOLD, - Keyword::HOSTS, - Keyword::HOUR, - Keyword::HOURS, - Keyword::ICEBERG, - Keyword::ID, - Keyword::IDENTITY, - Keyword::IDENTITY_INSERT, - Keyword::IF, - Keyword::IGNORE, - Keyword::ILIKE, - Keyword::IMMEDIATE, - Keyword::IMMUTABLE, - Keyword::IMPORT, - Keyword::IMPORTED, - Keyword::IN, - Keyword::INCLUDE, - Keyword::INCLUDE_NULL_VALUES, - Keyword::INCREMENT, - Keyword::INDEX, - Keyword::INDICATOR, - Keyword::INET_OPS, - Keyword::INHERIT, - Keyword::INITIALLY, - Keyword::INNER, - Keyword::INOUT, - Keyword::INPATH, - Keyword::INPUT, - Keyword::INPUTFORMAT, - Keyword::INSENSITIVE, - Keyword::INSERT, - Keyword::INSTALL, - Keyword::INSTEAD, - Keyword::INT, - Keyword::INT128, - Keyword::INT16, - Keyword::INT2, - Keyword::INT256, - Keyword::INT2_OPS, - Keyword::INT32, - Keyword::INT4, - Keyword::INT4_OPS, - Keyword::INT64, - Keyword::INT8, - Keyword::INT8_OPS, - Keyword::INTEGER, - Keyword::INTEGRATION, - Keyword::INTERPOLATE, - Keyword::INTERSECT, - Keyword::INTERSECTION, - Keyword::INTERVAL, - Keyword::INTERVAL_OPS, - Keyword::INTO, - Keyword::INVOKER, - Keyword::IO, - Keyword::IS, - Keyword::ISBN13_OPS, - Keyword::ISBN_OPS, - Keyword::ISMN13_OPS, - Keyword::ISMN_OPS, - Keyword::ISODOW, - Keyword::ISOLATION, - Keyword::ISOWEEK, - Keyword::ISOYEAR, - Keyword::ISSN13_OPS, - Keyword::ISSN_OPS, - Keyword::ITEMS, - Keyword::JAR, - Keyword::JOIN, - Keyword::JSON, - Keyword::JSONB, - Keyword::JSONFILE, - Keyword::JSON_TABLE, - Keyword::JULIAN, - Keyword::KEY, - Keyword::KEYS, - Keyword::KILL, - Keyword::LAG, - Keyword::LANGUAGE, - Keyword::LARGE, - Keyword::LAST, - Keyword::LAST_VALUE, - Keyword::LATERAL, - Keyword::LEAD, - Keyword::LEADING, - Keyword::LEFT, - Keyword::LEVEL, - Keyword::LIKE, - Keyword::LIKE_REGEX, - Keyword::LIMIT, - Keyword::LINES, - Keyword::LIST, - Keyword::LISTEN, - Keyword::LISTING, - Keyword::LN, - Keyword::LOAD, - Keyword::LOCAL, - Keyword::LOCALTIME, - Keyword::LOCALTIMESTAMP, - Keyword::LOCATION, - Keyword::LOCK, - Keyword::LOCKED, - Keyword::LOG, - Keyword::LOGIN, - Keyword::LOGS, - Keyword::LONGBLOB, - Keyword::LONGTEXT, - Keyword::LOWCARDINALITY, - Keyword::LOWER, - Keyword::LOW_PRIORITY, - Keyword::LS, - Keyword::LTREE_OPS, - Keyword::MACADDR8_OPS, - Keyword::MACADDR_OPS, - Keyword::MACRO, - Keyword::MANAGE, - Keyword::MANAGED, - Keyword::MANAGEDLOCATION, - Keyword::MAP, - Keyword::MASKING, - Keyword::MATCH, - Keyword::MATCHED, - Keyword::MATCHES, - Keyword::MATCH_CONDITION, - Keyword::MATCH_RECOGNIZE, - Keyword::MATERIALIZE, - Keyword::MATERIALIZED, - Keyword::MAX, - Keyword::MAXVALUE, - Keyword::MAX_DATA_EXTENSION_TIME_IN_DAYS, - Keyword::MEASURES, - Keyword::MEDIUMBLOB, - Keyword::MEDIUMINT, - Keyword::MEDIUMTEXT, - Keyword::MEMBER, - Keyword::MERGE, - Keyword::METADATA, - Keyword::METHOD, - Keyword::METRIC, - Keyword::MICROSECOND, - Keyword::MICROSECONDS, - Keyword::MILLENIUM, - Keyword::MILLENNIUM, - Keyword::MILLISECOND, - Keyword::MILLISECONDS, - Keyword::MIN, - Keyword::MINUS, - Keyword::MINUTE, - Keyword::MINUTES, - Keyword::MINVALUE, - Keyword::MOD, - Keyword::MODE, - Keyword::MODIFIES, - Keyword::MODIFY, - Keyword::MODULE, - Keyword::MONEY_OPS, - Keyword::MONITOR, - Keyword::MONTH, - Keyword::MONTHS, - Keyword::MSCK, - Keyword::MULTISET, - Keyword::MUTATION, - Keyword::NAME, - Keyword::NAME_OPS, - Keyword::NANOSECOND, - Keyword::NANOSECONDS, - Keyword::NATIONAL, - Keyword::NATURAL, - Keyword::NCHAR, - Keyword::NCLOB, - Keyword::NESTED, - Keyword::NETWORK, - Keyword::NEW, - Keyword::NEXT, - Keyword::NFC, - Keyword::NFD, - Keyword::NFKC, - Keyword::NFKD, - Keyword::NO, - Keyword::NOBYPASSRLS, - Keyword::NOCREATEDB, - Keyword::NOCREATEROLE, - Keyword::NOINHERIT, - Keyword::NOLOGIN, - Keyword::NONE, - Keyword::NOORDER, - Keyword::NOREPLICATION, - Keyword::NORMALIZE, - Keyword::NORMALIZED, - Keyword::NOSCAN, - Keyword::NOSUPERUSER, - Keyword::NOT, - Keyword::NOTHING, - Keyword::NOTIFY, - Keyword::NOWAIT, - Keyword::NO_WRITE_TO_BINLOG, - Keyword::NTH_VALUE, - Keyword::NTILE, - Keyword::NULL, - Keyword::NULLABLE, - Keyword::NULLIF, - Keyword::NULLS, - Keyword::NUMERIC, - Keyword::NUMERIC_OPS, - Keyword::NVARCHAR, - Keyword::OBJECT, - Keyword::OCCURRENCES_REGEX, - Keyword::OCTETS, - Keyword::OCTET_LENGTH, - Keyword::OF, - Keyword::OFF, - Keyword::OFFSET, - Keyword::OFFSETS, - Keyword::OID_OPS, - Keyword::OLD, - Keyword::OMIT, - Keyword::ON, - Keyword::ONE, - Keyword::ONLY, - Keyword::OPEN, - Keyword::OPENJSON, - Keyword::OPERATE, - Keyword::OPERATOR, - Keyword::OPTIMIZATION, - Keyword::OPTIMIZE, - Keyword::OPTIMIZED, - Keyword::OPTIMIZER_COSTS, - Keyword::OPTION, - Keyword::OPTIONS, - Keyword::OR, - Keyword::ORC, - Keyword::ORDER, - Keyword::ORDINALITY, - Keyword::ORGANIZATION, - Keyword::OUT, - Keyword::OUTER, - Keyword::OUTPUTFORMAT, - Keyword::OVER, - Keyword::OVERFLOW, - Keyword::OVERLAPS, - Keyword::OVERLAY, - Keyword::OVERRIDE, - Keyword::OVERWRITE, - Keyword::OWNED, - Keyword::OWNER, - Keyword::OWNERSHIP, - Keyword::PACKAGE, - Keyword::PACKAGES, - Keyword::PARALLEL, - Keyword::PARAMETER, - Keyword::PARQUET, - Keyword::PART, - Keyword::PARTITION, - Keyword::PARTITIONED, - Keyword::PARTITIONS, - Keyword::PASSWORD, - Keyword::PAST, - Keyword::PATH, - Keyword::PATTERN, - Keyword::PER, - Keyword::PERCENT, - Keyword::PERCENTILE_CONT, - Keyword::PERCENTILE_DISC, - Keyword::PERCENT_RANK, - Keyword::PERIOD, - Keyword::PERMISSIVE, - Keyword::PERSISTENT, - Keyword::PIVOT, - Keyword::PLACING, - Keyword::PLAN, - Keyword::PLANS, - Keyword::POLICY, - Keyword::POOL, - Keyword::PORTION, - Keyword::POSITION, - Keyword::POSITION_REGEX, - Keyword::POWER, - Keyword::PRAGMA, - Keyword::PRECEDES, - Keyword::PRECEDING, - Keyword::PRECISION, - Keyword::PREPARE, - Keyword::PRESERVE, - Keyword::PREWHERE, - Keyword::PRIMARY, - Keyword::PRIOR, - Keyword::PRIVILEGES, - Keyword::PROCEDURE, - Keyword::PROFILE, - Keyword::PROGRAM, - Keyword::PROJECTION, - Keyword::PUBLIC, - Keyword::PURCHASE, - Keyword::PURGE, - Keyword::QUALIFY, - Keyword::QUARTER, - Keyword::QUERY, - Keyword::QUOTE, - Keyword::RAISERROR, - Keyword::RANGE, - Keyword::RANK, - Keyword::RAW, - Keyword::RCFILE, - Keyword::READ, - Keyword::READS, - Keyword::READ_ONLY, - Keyword::REAL, - Keyword::RECLUSTER, - Keyword::RECURSIVE, - Keyword::REF, - Keyword::REFERENCES, - Keyword::REFERENCING, - Keyword::REGCLASS, - Keyword::REGEXP, - Keyword::REGR_AVGX, - Keyword::REGR_AVGY, - Keyword::REGR_COUNT, - Keyword::REGR_INTERCEPT, - Keyword::REGR_R2, - Keyword::REGR_SLOPE, - Keyword::REGR_SXX, - Keyword::REGR_SXY, - Keyword::REGR_SYY, - Keyword::RELATIVE, - Keyword::RELAY, - Keyword::RELEASE, - Keyword::RELEASES, - Keyword::REMOTE, - Keyword::REMOVE, - Keyword::RENAME, - Keyword::REORG, - Keyword::REPAIR, - Keyword::REPEATABLE, - Keyword::REPLACE, - Keyword::REPLICA, - Keyword::REPLICATE, - Keyword::REPLICATION, - Keyword::RESET, - Keyword::RESOLVE, - Keyword::RESPECT, - Keyword::RESTART, - Keyword::RESTRICT, - Keyword::RESTRICTED, - Keyword::RESTRICTIONS, - Keyword::RESTRICTIVE, - Keyword::RESULT, - Keyword::RESULTSET, - Keyword::RESUME, - Keyword::RETAIN, - Keyword::RETURN, - Keyword::RETURNING, - Keyword::RETURNS, - Keyword::REVOKE, - Keyword::RIGHT, - Keyword::RLIKE, - Keyword::RM, - Keyword::ROLE, - Keyword::ROLES, - Keyword::ROLLBACK, - Keyword::ROLLUP, - Keyword::ROOT, - Keyword::ROW, - Keyword::ROWID, - Keyword::ROWS, - Keyword::ROW_NUMBER, - Keyword::RULE, - Keyword::RUN, - Keyword::SAFE, - Keyword::SAFE_CAST, - Keyword::SAMPLE, - Keyword::SAVEPOINT, - Keyword::SCHEMA, - Keyword::SCHEMAS, - Keyword::SCOPE, - Keyword::SCROLL, - Keyword::SEARCH, - Keyword::SECOND, - Keyword::SECONDARY, - Keyword::SECONDS, - Keyword::SECRET, - Keyword::SECURITY, - Keyword::SEED, - Keyword::SEG_OPS, - Keyword::SELECT, - Keyword::SEMI, - Keyword::SENSITIVE, - Keyword::SEPARATOR, - Keyword::SEQUENCE, - Keyword::SEQUENCEFILE, - Keyword::SEQUENCES, - Keyword::SERDE, - Keyword::SERDEPROPERTIES, - Keyword::SERIALIZABLE, - Keyword::SERVICE, - Keyword::SESSION, - Keyword::SESSION_USER, - Keyword::SET, - Keyword::SETERROR, - Keyword::SETS, - Keyword::SETTINGS, - Keyword::SHARE, - Keyword::SHARING, - Keyword::SHOW, - Keyword::SIMILAR, - Keyword::SKIP, - Keyword::SLOW, - Keyword::SMALLINT, - Keyword::SNAPSHOT, - Keyword::SOME, - Keyword::SORT, - Keyword::SORTED, - Keyword::SOURCE, - Keyword::SPATIAL, - Keyword::SPECIFIC, - Keyword::SPECIFICTYPE, - Keyword::SPGIST, - Keyword::SQL, - Keyword::SQLEXCEPTION, - Keyword::SQLSTATE, - Keyword::SQLWARNING, - Keyword::SQRT, - Keyword::STABLE, - Keyword::STAGE, - Keyword::START, - Keyword::STARTS, - Keyword::STATEMENT, - Keyword::STATIC, - Keyword::STATISTICS, - Keyword::STATUS, - Keyword::STDDEV_POP, - Keyword::STDDEV_SAMP, - Keyword::STDIN, - Keyword::STDOUT, - Keyword::STEP, - Keyword::STORAGE_INTEGRATION, - Keyword::STORAGE_SERIALIZATION_POLICY, - Keyword::STORED, - Keyword::STRICT, - Keyword::STRING, - Keyword::STRUCT, - Keyword::SUBMULTISET, - Keyword::SUBSTRING, - Keyword::SUBSTRING_REGEX, - Keyword::SUCCEEDS, - Keyword::SUM, - Keyword::SUPER, - Keyword::SUPERUSER, - Keyword::SUPPORT, - Keyword::SUSPEND, - Keyword::SWAP, - Keyword::SYMMETRIC, - Keyword::SYNC, - Keyword::SYSTEM, - Keyword::SYSTEM_TIME, - Keyword::SYSTEM_USER, - Keyword::TABLE, - Keyword::TABLES, - Keyword::TABLESAMPLE, - Keyword::TAG, - Keyword::TARGET, - Keyword::TASK, - Keyword::TBLPROPERTIES, - Keyword::TEMP, - Keyword::TEMPORARY, - Keyword::TEMPTABLE, - Keyword::TERMINATED, - Keyword::TERSE, - Keyword::TEXT, - Keyword::TEXTFILE, - Keyword::TEXT_OPS, - Keyword::THEN, - Keyword::TIES, - Keyword::TIME, - Keyword::TIMESTAMP, - Keyword::TIMESTAMPTZ, - Keyword::TIMESTAMPTZ_OPS, - Keyword::TIMESTAMP_OPS, - Keyword::TIMETZ, - Keyword::TIMETZ_OPS, - Keyword::TIMEZONE, - Keyword::TIMEZONE_ABBR, - Keyword::TIMEZONE_HOUR, - Keyword::TIMEZONE_MINUTE, - Keyword::TIMEZONE_REGION, - Keyword::TIME_OPS, - Keyword::TINYBLOB, - Keyword::TINYINT, - Keyword::TINYTEXT, - Keyword::TO, - Keyword::TOP, - Keyword::TOTALS, - Keyword::TRACE, - Keyword::TRAILING, - Keyword::TRANSACTION, - Keyword::TRANSIENT, - Keyword::TRANSLATE, - Keyword::TRANSLATE_REGEX, - Keyword::TRANSLATION, - Keyword::TREAT, - Keyword::TRIGGER, - Keyword::TRIM, - Keyword::TRIM_ARRAY, - Keyword::TRUE, - Keyword::TRUNCATE, - Keyword::TRY, - Keyword::TRY_CAST, - Keyword::TRY_CONVERT, - Keyword::TUPLE, - Keyword::TYPE, - Keyword::UESCAPE, - Keyword::UINT128, - Keyword::UINT16, - Keyword::UINT256, - Keyword::UINT32, - Keyword::UINT64, - Keyword::UINT8, - Keyword::UNBOUNDED, - Keyword::UNCACHE, - Keyword::UNCOMMITTED, - Keyword::UNDEFINED, - Keyword::UNFREEZE, - Keyword::UNION, - Keyword::UNIQUE, - Keyword::UNKNOWN, - Keyword::UNLISTEN, - Keyword::UNLOAD, - Keyword::UNLOCK, - Keyword::UNLOGGED, - Keyword::UNMATCHED, - Keyword::UNNEST, - Keyword::UNPIVOT, - Keyword::UNSAFE, - Keyword::UNSIGNED, - Keyword::UNTIL, - Keyword::UPC_OPS, - Keyword::UPDATE, - Keyword::UPPER, - Keyword::URL, - Keyword::USAGE, - Keyword::USE, - Keyword::USER, - Keyword::USER_RESOURCES, - Keyword::USING, - Keyword::UUID, - Keyword::UUID_OPS, - Keyword::VACUUM, - Keyword::VALID, - Keyword::VALIDATION_MODE, - Keyword::VALUE, - Keyword::VALUES, - Keyword::VALUE_OF, - Keyword::VARBINARY, - Keyword::VARBIT_OPS, - Keyword::VARCHAR, - Keyword::VARCHAR_OPS, - Keyword::VARIABLES, - Keyword::VARYING, - Keyword::VAR_POP, - Keyword::VAR_SAMP, - Keyword::VERBOSE, - Keyword::VERSION, - Keyword::VERSIONING, - Keyword::VERSIONS, - Keyword::VIEW, - Keyword::VIEWS, - Keyword::VIRTUAL, - Keyword::VOLATILE, - Keyword::VOLUME, - Keyword::WAREHOUSE, - Keyword::WAREHOUSES, - Keyword::WEEK, - Keyword::WEEKS, - Keyword::WHEN, - Keyword::WHENEVER, - Keyword::WHERE, - Keyword::WIDTH_BUCKET, - Keyword::WINDOW, - Keyword::WITH, - Keyword::WITHIN, - Keyword::WITHOUT, - Keyword::WITHOUT_ARRAY_WRAPPER, - Keyword::WORK, - Keyword::WRITE, - Keyword::XML, - Keyword::XOR, - Keyword::YEAR, - Keyword::YEARS, - Keyword::ZONE, - Keyword::ZORDER, - ]; - pub const ABORT: &'static str = "ABORT"; - pub const ABS: &'static str = "ABS"; - pub const ABSENT: &'static str = "ABSENT"; - pub const ABSOLUTE: &'static str = "ABSOLUTE"; - pub const ACCESS: &'static str = "ACCESS"; - pub const ACCOUNT: &'static str = "ACCOUNT"; - pub const ACTION: &'static str = "ACTION"; - pub const ADD: &'static str = "ADD"; - pub const ADMIN: &'static str = "ADMIN"; - pub const AFTER: &'static str = "AFTER"; - pub const AGAINST: &'static str = "AGAINST"; - pub const AGGREGATION: &'static str = "AGGREGATION"; - pub const ALERT: &'static str = "ALERT"; - pub const ALGORITHM: &'static str = "ALGORITHM"; - pub const ALIAS: &'static str = "ALIAS"; - pub const ALL: &'static str = "ALL"; - pub const ALLOCATE: &'static str = "ALLOCATE"; - pub const ALTER: &'static str = "ALTER"; - pub const ALWAYS: &'static str = "ALWAYS"; - pub const ANALYZE: &'static str = "ANALYZE"; - pub const AND: &'static str = "AND"; - pub const ANTI: &'static str = "ANTI"; - pub const ANY: &'static str = "ANY"; - pub const APPLICATION: &'static str = "APPLICATION"; - pub const APPLY: &'static str = "APPLY"; - pub const APPLYBUDGET: &'static str = "APPLYBUDGET"; - pub const ARCHIVE: &'static str = "ARCHIVE"; - pub const ARE: &'static str = "ARE"; - pub const ARRAY: &'static str = "ARRAY"; - pub const ARRAY_MAX_CARDINALITY: &'static str = "ARRAY_MAX_CARDINALITY"; - pub const AS: &'static str = "AS"; - pub const ASC: &'static str = "ASC"; - pub const ASENSITIVE: &'static str = "ASENSITIVE"; - pub const ASOF: &'static str = "ASOF"; - pub const ASSERT: &'static str = "ASSERT"; - pub const ASYMMETRIC: &'static str = "ASYMMETRIC"; - pub const AT: &'static str = "AT"; - pub const ATOMIC: &'static str = "ATOMIC"; - pub const ATTACH: &'static str = "ATTACH"; - pub const AUDIT: &'static str = "AUDIT"; - pub const AUTHENTICATION: &'static str = "AUTHENTICATION"; - pub const AUTHORIZATION: &'static str = "AUTHORIZATION"; - pub const AUTO: &'static str = "AUTO"; - pub const AUTOINCREMENT: &'static str = "AUTOINCREMENT"; - pub const AUTO_INCREMENT: &'static str = "AUTO_INCREMENT"; - pub const AVG: &'static str = "AVG"; - pub const AVRO: &'static str = "AVRO"; - pub const BACKWARD: &'static str = "BACKWARD"; - pub const BASE64: &'static str = "BASE64"; - pub const BASE_LOCATION: &'static str = "BASE_LOCATION"; - pub const BEFORE: &'static str = "BEFORE"; - pub const BEGIN: &'static str = "BEGIN"; - pub const BEGIN_FRAME: &'static str = "BEGIN_FRAME"; - pub const BEGIN_PARTITION: &'static str = "BEGIN_PARTITION"; - pub const BERNOULLI: &'static str = "BERNOULLI"; - pub const BETWEEN: &'static str = "BETWEEN"; - pub const BIGDECIMAL: &'static str = "BIGDECIMAL"; - pub const BIGINT: &'static str = "BIGINT"; - pub const BIGNUMERIC: &'static str = "BIGNUMERIC"; - pub const BINARY: &'static str = "BINARY"; - pub const BIND: &'static str = "BIND"; - pub const BINDING: &'static str = "BINDING"; - pub const BIT: &'static str = "BIT"; - pub const BIT_OPS: &'static str = "bit_ops"; - pub const BLOB: &'static str = "BLOB"; - pub const BLOCK: &'static str = "BLOCK"; - pub const BLOOM: &'static str = "BLOOM"; - pub const BLOOMFILTER: &'static str = "BLOOMFILTER"; - pub const BOOL: &'static str = "BOOL"; - pub const BOOLEAN: &'static str = "BOOLEAN"; - pub const BOOL_OPS: &'static str = "bool_ops"; - pub const BOTH: &'static str = "BOTH"; - pub const BPCHAR_OPS: &'static str = "bpchar_ops"; - pub const BRIN: &'static str = "BRIN"; - pub const BROWSE: &'static str = "BROWSE"; - pub const BTREE: &'static str = "BTREE"; - pub const BTREE_CUBE_OPS: &'static str = "btree_cube_ops"; - pub const BTREE_HSTORE_OPS: &'static str = "btree_hstore_ops"; - pub const BUCKET: &'static str = "BUCKET"; - pub const BUCKETS: &'static str = "BUCKETS"; - pub const BY: &'static str = "BY"; - pub const BYPASSRLS: &'static str = "BYPASSRLS"; - pub const BYTEA: &'static str = "BYTEA"; - pub const BYTEA_OPS: &'static str = "bytea_ops"; - pub const BYTES: &'static str = "BYTES"; - pub const CACHE: &'static str = "CACHE"; - pub const CALL: &'static str = "CALL"; - pub const CALLED: &'static str = "CALLED"; - pub const CARDINALITY: &'static str = "CARDINALITY"; - pub const CASCADE: &'static str = "CASCADE"; - pub const CASCADED: &'static str = "CASCADED"; - pub const CASE: &'static str = "CASE"; - pub const CASES: &'static str = "CASES"; - pub const CAST: &'static str = "CAST"; - pub const CATALOG: &'static str = "CATALOG"; - pub const CATALOG_SYNC: &'static str = "CATALOG_SYNC"; - pub const CATCH: &'static str = "CATCH"; - pub const CEIL: &'static str = "CEIL"; - pub const CEILING: &'static str = "CEILING"; - pub const CENTURY: &'static str = "CENTURY"; - pub const CHAIN: &'static str = "CHAIN"; - pub const CHANGE: &'static str = "CHANGE"; - pub const CHANGE_TRACKING: &'static str = "CHANGE_TRACKING"; - pub const CHANNEL: &'static str = "CHANNEL"; - pub const CHAR: &'static str = "CHAR"; - pub const CHARACTER: &'static str = "CHARACTER"; - pub const CHARACTERS: &'static str = "CHARACTERS"; - pub const CHARACTER_LENGTH: &'static str = "CHARACTER_LENGTH"; - pub const CHARSET: &'static str = "CHARSET"; - pub const CHAR_LENGTH: &'static str = "CHAR_LENGTH"; - pub const CHAR_OPS: &'static str = "char_ops"; - pub const CHECK: &'static str = "CHECK"; - pub const CIDR_OPS: &'static str = "cidr_ops"; - pub const CITEXT_OPS: &'static str = "citext_ops"; - pub const CLEAR: &'static str = "CLEAR"; - pub const CLOB: &'static str = "CLOB"; - pub const CLONE: &'static str = "CLONE"; - pub const CLOSE: &'static str = "CLOSE"; - pub const CLUSTER: &'static str = "CLUSTER"; - pub const CLUSTERED: &'static str = "CLUSTERED"; - pub const CLUSTERING: &'static str = "CLUSTERING"; - pub const COALESCE: &'static str = "COALESCE"; - pub const COLLATE: &'static str = "COLLATE"; - pub const COLLATION: &'static str = "COLLATION"; - pub const COLLECT: &'static str = "COLLECT"; - pub const COLLECTION: &'static str = "COLLECTION"; - pub const COLUMN: &'static str = "COLUMN"; - pub const COLUMNS: &'static str = "COLUMNS"; - pub const COLUMNSTORE: &'static str = "COLUMNSTORE"; - pub const COMMENT: &'static str = "COMMENT"; - pub const COMMIT: &'static str = "COMMIT"; - pub const COMMITTED: &'static str = "COMMITTED"; - pub const COMPATIBLE: &'static str = "COMPATIBLE"; - pub const COMPRESSION: &'static str = "COMPRESSION"; - pub const COMPUTE: &'static str = "COMPUTE"; - pub const CONCURRENTLY: &'static str = "CONCURRENTLY"; - pub const CONDITION: &'static str = "CONDITION"; - pub const CONFLICT: &'static str = "CONFLICT"; - pub const CONNECT: &'static str = "CONNECT"; - pub const CONNECTION: &'static str = "CONNECTION"; - pub const CONNECTOR: &'static str = "CONNECTOR"; - pub const CONSTRAINT: &'static str = "CONSTRAINT"; - pub const CONTAINS: &'static str = "CONTAINS"; - pub const CONTINUE: &'static str = "CONTINUE"; - pub const CONVERT: &'static str = "CONVERT"; - pub const COPY: &'static str = "COPY"; - pub const COPY_OPTIONS: &'static str = "COPY_OPTIONS"; - pub const CORR: &'static str = "CORR"; - pub const CORRESPONDING: &'static str = "CORRESPONDING"; - pub const COUNT: &'static str = "COUNT"; - pub const COVAR_POP: &'static str = "COVAR_POP"; - pub const COVAR_SAMP: &'static str = "COVAR_SAMP"; - pub const CREATE: &'static str = "CREATE"; - pub const CREATEDB: &'static str = "CREATEDB"; - pub const CREATEROLE: &'static str = "CREATEROLE"; - pub const CREDENTIALS: &'static str = "CREDENTIALS"; - pub const CROSS: &'static str = "CROSS"; - pub const CSV: &'static str = "CSV"; - pub const CUBE: &'static str = "CUBE"; - pub const CUME_DIST: &'static str = "CUME_DIST"; - pub const CURRENT: &'static str = "CURRENT"; - pub const CURRENT_CATALOG: &'static str = "CURRENT_CATALOG"; - pub const CURRENT_DATE: &'static str = "CURRENT_DATE"; - pub const CURRENT_DEFAULT_TRANSFORM_GROUP: &'static str = "CURRENT_DEFAULT_TRANSFORM_GROUP"; - pub const CURRENT_PATH: &'static str = "CURRENT_PATH"; - pub const CURRENT_ROLE: &'static str = "CURRENT_ROLE"; - pub const CURRENT_ROW: &'static str = "CURRENT_ROW"; - pub const CURRENT_SCHEMA: &'static str = "CURRENT_SCHEMA"; - pub const CURRENT_TIME: &'static str = "CURRENT_TIME"; - pub const CURRENT_TIMESTAMP: &'static str = "CURRENT_TIMESTAMP"; - pub const CURRENT_TRANSFORM_GROUP_FOR_TYPE: &'static str = "CURRENT_TRANSFORM_GROUP_FOR_TYPE"; - pub const CURRENT_USER: &'static str = "CURRENT_USER"; - pub const CURSOR: &'static str = "CURSOR"; - pub const CYCLE: &'static str = "CYCLE"; - pub const DATA: &'static str = "DATA"; - pub const DATABASE: &'static str = "DATABASE"; - pub const DATABASES: &'static str = "DATABASES"; - pub const DATA_RETENTION_TIME_IN_DAYS: &'static str = "DATA_RETENTION_TIME_IN_DAYS"; - pub const DATE: &'static str = "DATE"; - pub const DATE32: &'static str = "DATE32"; - pub const DATETIME: &'static str = "DATETIME"; - pub const DATETIME64: &'static str = "DATETIME64"; - pub const DATE_OPS: &'static str = "date_ops"; - pub const DAY: &'static str = "DAY"; - pub const DAYOFWEEK: &'static str = "DAYOFWEEK"; - pub const DAYOFYEAR: &'static str = "DAYOFYEAR"; - pub const DAYS: &'static str = "DAYS"; - pub const DCPROPERTIES: &'static str = "DCPROPERTIES"; - pub const DEALLOCATE: &'static str = "DEALLOCATE"; - pub const DEC: &'static str = "DEC"; - pub const DECADE: &'static str = "DECADE"; - pub const DECIMAL: &'static str = "DECIMAL"; - pub const DECLARE: &'static str = "DECLARE"; - pub const DEDUPLICATE: &'static str = "DEDUPLICATE"; - pub const DEFAULT: &'static str = "DEFAULT"; - pub const DEFAULT_DDL_COLLATION: &'static str = "DEFAULT_DDL_COLLATION"; - pub const DEFERRABLE: &'static str = "DEFERRABLE"; - pub const DEFERRED: &'static str = "DEFERRED"; - pub const DEFINE: &'static str = "DEFINE"; - pub const DEFINED: &'static str = "DEFINED"; - pub const DEFINER: &'static str = "DEFINER"; - pub const DELAYED: &'static str = "DELAYED"; - pub const DELETE: &'static str = "DELETE"; - pub const DELIMITED: &'static str = "DELIMITED"; - pub const DELIMITER: &'static str = "DELIMITER"; - pub const DELTA: &'static str = "DELTA"; - pub const DENSE_RANK: &'static str = "DENSE_RANK"; - pub const DEREF: &'static str = "DEREF"; - pub const DESC: &'static str = "DESC"; - pub const DESCRIBE: &'static str = "DESCRIBE"; - pub const DETACH: &'static str = "DETACH"; - pub const DETAIL: &'static str = "DETAIL"; - pub const DETERMINISTIC: &'static str = "DETERMINISTIC"; - pub const DIRECTORY: &'static str = "DIRECTORY"; - pub const DISABLE: &'static str = "DISABLE"; - pub const DISCARD: &'static str = "DISCARD"; - pub const DISCONNECT: &'static str = "DISCONNECT"; - pub const DISTINCT: &'static str = "DISTINCT"; - pub const DISTRIBUTE: &'static str = "DISTRIBUTE"; - pub const DIV: &'static str = "DIV"; - pub const DO: &'static str = "DO"; - pub const DOUBLE: &'static str = "DOUBLE"; - pub const DOW: &'static str = "DOW"; - pub const DOY: &'static str = "DOY"; - pub const DROP: &'static str = "DROP"; - pub const DRY: &'static str = "DRY"; - pub const DUPLICATE: &'static str = "DUPLICATE"; - pub const DYNAMIC: &'static str = "DYNAMIC"; - pub const EACH: &'static str = "EACH"; - pub const EAN13_OPS: &'static str = "ean13_ops"; - pub const ELEMENT: &'static str = "ELEMENT"; - pub const ELEMENTS: &'static str = "ELEMENTS"; - pub const ELSE: &'static str = "ELSE"; - pub const EMPTY: &'static str = "EMPTY"; - pub const ENABLE: &'static str = "ENABLE"; - pub const ENABLE_SCHEMA_EVOLUTION: &'static str = "ENABLE_SCHEMA_EVOLUTION"; - pub const ENCODING: &'static str = "ENCODING"; - pub const ENCRYPTION: &'static str = "ENCRYPTION"; - pub const END: &'static str = "END"; - pub const END_EXEC: &'static str = "END-EXEC"; - pub const ENDPOINT: &'static str = "ENDPOINT"; - pub const END_FRAME: &'static str = "END_FRAME"; - pub const END_PARTITION: &'static str = "END_PARTITION"; - pub const ENFORCED: &'static str = "ENFORCED"; - pub const ENGINE: &'static str = "ENGINE"; - pub const ENUM: &'static str = "ENUM"; - pub const ENUM16: &'static str = "ENUM16"; - pub const ENUM8: &'static str = "ENUM8"; - pub const ENUM_OPS: &'static str = "enum_ops"; - pub const EPHEMERAL: &'static str = "EPHEMERAL"; - pub const EPOCH: &'static str = "EPOCH"; - pub const EQUALS: &'static str = "EQUALS"; - pub const ERROR: &'static str = "ERROR"; - pub const ESCAPE: &'static str = "ESCAPE"; - pub const ESCAPED: &'static str = "ESCAPED"; - pub const ESTIMATE: &'static str = "ESTIMATE"; - pub const EVENT: &'static str = "EVENT"; - pub const EVERY: &'static str = "EVERY"; - pub const EVOLVE: &'static str = "EVOLVE"; - pub const EXCEPT: &'static str = "EXCEPT"; - pub const EXCEPTION: &'static str = "EXCEPTION"; - pub const EXCHANGE: &'static str = "EXCHANGE"; - pub const EXCLUDE: &'static str = "EXCLUDE"; - pub const EXCLUSIVE: &'static str = "EXCLUSIVE"; - pub const EXEC: &'static str = "EXEC"; - pub const EXECUTE: &'static str = "EXECUTE"; - pub const EXECUTION: &'static str = "EXECUTION"; - pub const EXISTS: &'static str = "EXISTS"; - pub const EXP: &'static str = "EXP"; - pub const EXPANSION: &'static str = "EXPANSION"; - pub const EXPLAIN: &'static str = "EXPLAIN"; - pub const EXPLICIT: &'static str = "EXPLICIT"; - pub const EXPORT: &'static str = "EXPORT"; - pub const EXTENDED: &'static str = "EXTENDED"; - pub const EXTENSION: &'static str = "EXTENSION"; - pub const EXTERNAL: &'static str = "EXTERNAL"; - pub const EXTERNAL_VOLUME: &'static str = "EXTERNAL_VOLUME"; - pub const EXTRACT: &'static str = "EXTRACT"; - pub const FAIL: &'static str = "FAIL"; - pub const FAILOVER: &'static str = "FAILOVER"; - pub const FALSE: &'static str = "FALSE"; - pub const FETCH: &'static str = "FETCH"; - pub const FIELDS: &'static str = "FIELDS"; - pub const FILE: &'static str = "FILE"; - pub const FILES: &'static str = "FILES"; - pub const FILE_FORMAT: &'static str = "FILE_FORMAT"; - pub const FILL: &'static str = "FILL"; - pub const FILTER: &'static str = "FILTER"; - pub const FINAL: &'static str = "FINAL"; - pub const FIRST: &'static str = "FIRST"; - pub const FIRST_VALUE: &'static str = "FIRST_VALUE"; - pub const FIXEDSTRING: &'static str = "FIXEDSTRING"; - pub const FLOAT: &'static str = "FLOAT"; - pub const FLOAT32: &'static str = "FLOAT32"; - pub const FLOAT4: &'static str = "FLOAT4"; - pub const FLOAT4_OPS: &'static str = "float4_ops"; - pub const FLOAT64: &'static str = "FLOAT64"; - pub const FLOAT8: &'static str = "FLOAT8"; - pub const FLOAT8_OPS: &'static str = "float8_ops"; - pub const FLOOR: &'static str = "FLOOR"; - pub const FLUSH: &'static str = "FLUSH"; - pub const FN: &'static str = "FN"; - pub const FOLLOWING: &'static str = "FOLLOWING"; - pub const FOR: &'static str = "FOR"; - pub const FORCE: &'static str = "FORCE"; - pub const FORCE_NOT_NULL: &'static str = "FORCE_NOT_NULL"; - pub const FORCE_NULL: &'static str = "FORCE_NULL"; - pub const FORCE_QUOTE: &'static str = "FORCE_QUOTE"; - pub const FOREIGN: &'static str = "FOREIGN"; - pub const FORMAT: &'static str = "FORMAT"; - pub const FORMATTED: &'static str = "FORMATTED"; - pub const FORWARD: &'static str = "FORWARD"; - pub const FRAME_ROW: &'static str = "FRAME_ROW"; - pub const FREE: &'static str = "FREE"; - pub const FREEZE: &'static str = "FREEZE"; - pub const FROM: &'static str = "FROM"; - pub const FSCK: &'static str = "FSCK"; - pub const FULFILLMENT: &'static str = "FULFILLMENT"; - pub const FULL: &'static str = "FULL"; - pub const FULLTEXT: &'static str = "FULLTEXT"; - pub const FUNCTION: &'static str = "FUNCTION"; - pub const FUNCTIONS: &'static str = "FUNCTIONS"; - pub const FUSION: &'static str = "FUSION"; - pub const GENERAL: &'static str = "GENERAL"; - pub const GENERATE: &'static str = "GENERATE"; - pub const GENERATED: &'static str = "GENERATED"; - pub const GEOGRAPHY: &'static str = "GEOGRAPHY"; - pub const GET: &'static str = "GET"; - pub const GIN: &'static str = "GIN"; - pub const GIN_HSTORE_OPS: &'static str = "gin_hstore_ops"; - pub const GIN_TRGM_OPS: &'static str = "gin_trgm_ops"; - pub const GIST: &'static str = "GIST"; - pub const GIST_BIT_OPS: &'static str = "gist_bit_ops"; - pub const GIST_BOOL_OPS: &'static str = "gist_bool_ops"; - pub const GIST_BPCHAR_OPS: &'static str = "gist_bpchar_ops"; - pub const GIST_BYTEA_OPS: &'static str = "gist_bytea_ops"; - pub const GIST_CASH_OPS: &'static str = "gist_cash_ops"; - pub const GIST_CIDR_OPS: &'static str = "gist_cidr_ops"; - pub const GIST_CUBE_OPS: &'static str = "gist_cube_ops"; - pub const GIST_DATE_OPS: &'static str = "gist_date_ops"; - pub const GIST_ENUM_OPS: &'static str = "gist_enum_ops"; - pub const GIST_FLOAT4_OPS: &'static str = "gist_float4_ops"; - pub const GIST_FLOAT8_OPS: &'static str = "gist_float8_ops"; - pub const GIST_HSTORE_OPS: &'static str = "gist_hstore_ops"; - pub const GIST_INET_OPS: &'static str = "gist_inet_ops"; - pub const GIST_INT2_OPS: &'static str = "gist_int2_ops"; - pub const GIST_INT4_OPS: &'static str = "gist_int4_ops"; - pub const GIST_INT8_OPS: &'static str = "gist_int8_ops"; - pub const GIST_INTERVAL_OPS: &'static str = "gist_interval_ops"; - pub const GIST_LTREE_OPS: &'static str = "gist_ltree_ops"; - pub const GIST_MACADDR8_OPS: &'static str = "gist_macaddr8_ops"; - pub const GIST_MACADDR_OPS: &'static str = "gist_macaddr_ops"; - pub const GIST_NUMERIC_OPS: &'static str = "gist_numeric_ops"; - pub const GIST_OID_OPS: &'static str = "gist_oid_ops"; - pub const GIST_SEG_OPS: &'static str = "gist_seg_ops"; - pub const GIST_TEXT_OPS: &'static str = "gist_text_ops"; - pub const GIST_TIMESTAMP_OPS: &'static str = "gist_timestamp_ops"; - pub const GIST_TIMESTAMPTZ_OPS: &'static str = "gist_timestamptz_ops"; - pub const GIST_TIME_OPS: &'static str = "gist_time_ops"; - pub const GIST_TIMETZ_OPS: &'static str = "gist_timetz_ops"; - pub const GIST_TRGM_OPS: &'static str = "gist_trgm_ops"; - pub const GIST_UUID_OPS: &'static str = "gist_uuid_ops"; - pub const GIST_VBIT_OPS: &'static str = "gist_vbit_ops"; - pub const GLOBAL: &'static str = "GLOBAL"; - pub const GRANT: &'static str = "GRANT"; - pub const GRANTED: &'static str = "GRANTED"; - pub const GRANTS: &'static str = "GRANTS"; - pub const GRAPHVIZ: &'static str = "GRAPHVIZ"; - pub const GROUP: &'static str = "GROUP"; - pub const GROUPING: &'static str = "GROUPING"; - pub const GROUPS: &'static str = "GROUPS"; - pub const HASH: &'static str = "HASH"; - pub const HASH_HSTORE_OPS: &'static str = "hash_hstore_ops"; - pub const HASH_LTREE_OPS: &'static str = "hash_ltree_ops"; - pub const HAVING: &'static str = "HAVING"; - pub const HEADER: &'static str = "HEADER"; - pub const HEAP: &'static str = "HEAP"; - pub const HIGH_PRIORITY: &'static str = "HIGH_PRIORITY"; - pub const HISTORY: &'static str = "HISTORY"; - pub const HIVEVAR: &'static str = "HIVEVAR"; - pub const HOLD: &'static str = "HOLD"; - pub const HOSTS: &'static str = "HOSTS"; - pub const HOUR: &'static str = "HOUR"; - pub const HOURS: &'static str = "HOURS"; - pub const ICEBERG: &'static str = "ICEBERG"; - pub const ID: &'static str = "ID"; - pub const IDENTITY: &'static str = "IDENTITY"; - pub const IDENTITY_INSERT: &'static str = "IDENTITY_INSERT"; - pub const IF: &'static str = "IF"; - pub const IGNORE: &'static str = "IGNORE"; - pub const ILIKE: &'static str = "ILIKE"; - pub const IMMEDIATE: &'static str = "IMMEDIATE"; - pub const IMMUTABLE: &'static str = "IMMUTABLE"; - pub const IMPORT: &'static str = "IMPORT"; - pub const IMPORTED: &'static str = "IMPORTED"; - pub const IN: &'static str = "IN"; - pub const INCLUDE: &'static str = "INCLUDE"; - pub const INCLUDE_NULL_VALUES: &'static str = "INCLUDE_NULL_VALUES"; - pub const INCREMENT: &'static str = "INCREMENT"; - pub const INDEX: &'static str = "INDEX"; - pub const INDICATOR: &'static str = "INDICATOR"; - pub const INET_OPS: &'static str = "inet_ops"; - pub const INHERIT: &'static str = "INHERIT"; - pub const INITIALLY: &'static str = "INITIALLY"; - pub const INNER: &'static str = "INNER"; - pub const INOUT: &'static str = "INOUT"; - pub const INPATH: &'static str = "INPATH"; - pub const INPUT: &'static str = "INPUT"; - pub const INPUTFORMAT: &'static str = "INPUTFORMAT"; - pub const INSENSITIVE: &'static str = "INSENSITIVE"; - pub const INSERT: &'static str = "INSERT"; - pub const INSTALL: &'static str = "INSTALL"; - pub const INSTEAD: &'static str = "INSTEAD"; - pub const INT: &'static str = "INT"; - pub const INT128: &'static str = "INT128"; - pub const INT16: &'static str = "INT16"; - pub const INT2: &'static str = "INT2"; - pub const INT256: &'static str = "INT256"; - pub const INT2_OPS: &'static str = "int2_ops"; - pub const INT32: &'static str = "INT32"; - pub const INT4: &'static str = "INT4"; - pub const INT4_OPS: &'static str = "int4_ops"; - pub const INT64: &'static str = "INT64"; - pub const INT8: &'static str = "INT8"; - pub const INT8_OPS: &'static str = "int8_ops"; - pub const INTEGER: &'static str = "INTEGER"; - pub const INTEGRATION: &'static str = "INTEGRATION"; - pub const INTERPOLATE: &'static str = "INTERPOLATE"; - pub const INTERSECT: &'static str = "INTERSECT"; - pub const INTERSECTION: &'static str = "INTERSECTION"; - pub const INTERVAL: &'static str = "INTERVAL"; - pub const INTERVAL_OPS: &'static str = "interval_ops"; - pub const INTO: &'static str = "INTO"; - pub const INVOKER: &'static str = "INVOKER"; - pub const IO: &'static str = "IO"; - pub const IS: &'static str = "IS"; - pub const ISBN13_OPS: &'static str = "isbn13_ops"; - pub const ISBN_OPS: &'static str = "isbn_ops"; - pub const ISMN13_OPS: &'static str = "ismn13_ops"; - pub const ISMN_OPS: &'static str = "ismn_ops"; - pub const ISODOW: &'static str = "ISODOW"; - pub const ISOLATION: &'static str = "ISOLATION"; - pub const ISOWEEK: &'static str = "ISOWEEK"; - pub const ISOYEAR: &'static str = "ISOYEAR"; - pub const ISSN13_OPS: &'static str = "issn13_ops"; - pub const ISSN_OPS: &'static str = "issn_ops"; - pub const ITEMS: &'static str = "ITEMS"; - pub const JAR: &'static str = "JAR"; - pub const JOIN: &'static str = "JOIN"; - pub const JSON: &'static str = "JSON"; - pub const JSONB: &'static str = "JSONB"; - pub const JSONFILE: &'static str = "JSONFILE"; - pub const JSON_TABLE: &'static str = "JSON_TABLE"; - pub const JULIAN: &'static str = "JULIAN"; - pub const KEY: &'static str = "KEY"; - pub const KEYS: &'static str = "KEYS"; - pub const KILL: &'static str = "KILL"; - pub const LAG: &'static str = "LAG"; - pub const LANGUAGE: &'static str = "LANGUAGE"; - pub const LARGE: &'static str = "LARGE"; - pub const LAST: &'static str = "LAST"; - pub const LAST_VALUE: &'static str = "LAST_VALUE"; - pub const LATERAL: &'static str = "LATERAL"; - pub const LEAD: &'static str = "LEAD"; - pub const LEADING: &'static str = "LEADING"; - pub const LEFT: &'static str = "LEFT"; - pub const LEVEL: &'static str = "LEVEL"; - pub const LIKE: &'static str = "LIKE"; - pub const LIKE_REGEX: &'static str = "LIKE_REGEX"; - pub const LIMIT: &'static str = "LIMIT"; - pub const LINES: &'static str = "LINES"; - pub const LIST: &'static str = "LIST"; - pub const LISTEN: &'static str = "LISTEN"; - pub const LISTING: &'static str = "LISTING"; - pub const LN: &'static str = "LN"; - pub const LOAD: &'static str = "LOAD"; - pub const LOCAL: &'static str = "LOCAL"; - pub const LOCALTIME: &'static str = "LOCALTIME"; - pub const LOCALTIMESTAMP: &'static str = "LOCALTIMESTAMP"; - pub const LOCATION: &'static str = "LOCATION"; - pub const LOCK: &'static str = "LOCK"; - pub const LOCKED: &'static str = "LOCKED"; - pub const LOG: &'static str = "LOG"; - pub const LOGIN: &'static str = "LOGIN"; - pub const LOGS: &'static str = "LOGS"; - pub const LONGBLOB: &'static str = "LONGBLOB"; - pub const LONGTEXT: &'static str = "LONGTEXT"; - pub const LOWCARDINALITY: &'static str = "LOWCARDINALITY"; - pub const LOWER: &'static str = "LOWER"; - pub const LOW_PRIORITY: &'static str = "LOW_PRIORITY"; - pub const LS: &'static str = "LS"; - pub const LTREE_OPS: &'static str = "ltree_ops"; - pub const MACADDR8_OPS: &'static str = "macaddr8_ops"; - pub const MACADDR_OPS: &'static str = "macaddr_ops"; - pub const MACRO: &'static str = "MACRO"; - pub const MANAGE: &'static str = "MANAGE"; - pub const MANAGED: &'static str = "MANAGED"; - pub const MANAGEDLOCATION: &'static str = "MANAGEDLOCATION"; - pub const MAP: &'static str = "MAP"; - pub const MASKING: &'static str = "MASKING"; - pub const MATCH: &'static str = "MATCH"; - pub const MATCHED: &'static str = "MATCHED"; - pub const MATCHES: &'static str = "MATCHES"; - pub const MATCH_CONDITION: &'static str = "MATCH_CONDITION"; - pub const MATCH_RECOGNIZE: &'static str = "MATCH_RECOGNIZE"; - pub const MATERIALIZE: &'static str = "MATERIALIZE"; - pub const MATERIALIZED: &'static str = "MATERIALIZED"; - pub const MAX: &'static str = "MAX"; - pub const MAXVALUE: &'static str = "MAXVALUE"; - pub const MAX_DATA_EXTENSION_TIME_IN_DAYS: &'static str = "MAX_DATA_EXTENSION_TIME_IN_DAYS"; - pub const MEASURES: &'static str = "MEASURES"; - pub const MEDIUMBLOB: &'static str = "MEDIUMBLOB"; - pub const MEDIUMINT: &'static str = "MEDIUMINT"; - pub const MEDIUMTEXT: &'static str = "MEDIUMTEXT"; - pub const MEMBER: &'static str = "MEMBER"; - pub const MERGE: &'static str = "MERGE"; - pub const METADATA: &'static str = "METADATA"; - pub const METHOD: &'static str = "METHOD"; - pub const METRIC: &'static str = "METRIC"; - pub const MICROSECOND: &'static str = "MICROSECOND"; - pub const MICROSECONDS: &'static str = "MICROSECONDS"; - pub const MILLENIUM: &'static str = "MILLENIUM"; - pub const MILLENNIUM: &'static str = "MILLENNIUM"; - pub const MILLISECOND: &'static str = "MILLISECOND"; - pub const MILLISECONDS: &'static str = "MILLISECONDS"; - pub const MIN: &'static str = "MIN"; - pub const MINUS: &'static str = "MINUS"; - pub const MINUTE: &'static str = "MINUTE"; - pub const MINUTES: &'static str = "MINUTES"; - pub const MINVALUE: &'static str = "MINVALUE"; - pub const MOD: &'static str = "MOD"; - pub const MODE: &'static str = "MODE"; - pub const MODIFIES: &'static str = "MODIFIES"; - pub const MODIFY: &'static str = "MODIFY"; - pub const MODULE: &'static str = "MODULE"; - pub const MONEY_OPS: &'static str = "money_ops"; - pub const MONITOR: &'static str = "MONITOR"; - pub const MONTH: &'static str = "MONTH"; - pub const MONTHS: &'static str = "MONTHS"; - pub const MSCK: &'static str = "MSCK"; - pub const MULTISET: &'static str = "MULTISET"; - pub const MUTATION: &'static str = "MUTATION"; - pub const NAME: &'static str = "NAME"; - pub const NAME_OPS: &'static str = "name_ops"; - pub const NANOSECOND: &'static str = "NANOSECOND"; - pub const NANOSECONDS: &'static str = "NANOSECONDS"; - pub const NATIONAL: &'static str = "NATIONAL"; - pub const NATURAL: &'static str = "NATURAL"; - pub const NCHAR: &'static str = "NCHAR"; - pub const NCLOB: &'static str = "NCLOB"; - pub const NESTED: &'static str = "NESTED"; - pub const NETWORK: &'static str = "NETWORK"; - pub const NEW: &'static str = "NEW"; - pub const NEXT: &'static str = "NEXT"; - pub const NFC: &'static str = "NFC"; - pub const NFD: &'static str = "NFD"; - pub const NFKC: &'static str = "NFKC"; - pub const NFKD: &'static str = "NFKD"; - pub const NO: &'static str = "NO"; - pub const NOBYPASSRLS: &'static str = "NOBYPASSRLS"; - pub const NOCREATEDB: &'static str = "NOCREATEDB"; - pub const NOCREATEROLE: &'static str = "NOCREATEROLE"; - pub const NOINHERIT: &'static str = "NOINHERIT"; - pub const NOLOGIN: &'static str = "NOLOGIN"; - pub const NONE: &'static str = "NONE"; - pub const NOORDER: &'static str = "NOORDER"; - pub const NOREPLICATION: &'static str = "NOREPLICATION"; - pub const NORMALIZE: &'static str = "NORMALIZE"; - pub const NORMALIZED: &'static str = "NORMALIZED"; - pub const NOSCAN: &'static str = "NOSCAN"; - pub const NOSUPERUSER: &'static str = "NOSUPERUSER"; - pub const NOT: &'static str = "NOT"; - pub const NOTHING: &'static str = "NOTHING"; - pub const NOTIFY: &'static str = "NOTIFY"; - pub const NOWAIT: &'static str = "NOWAIT"; - pub const NO_WRITE_TO_BINLOG: &'static str = "NO_WRITE_TO_BINLOG"; - pub const NTH_VALUE: &'static str = "NTH_VALUE"; - pub const NTILE: &'static str = "NTILE"; - pub const NULL: &'static str = "NULL"; - pub const NULLABLE: &'static str = "NULLABLE"; - pub const NULLIF: &'static str = "NULLIF"; - pub const NULLS: &'static str = "NULLS"; - pub const NUMERIC: &'static str = "NUMERIC"; - pub const NUMERIC_OPS: &'static str = "numeric_ops"; - pub const NVARCHAR: &'static str = "NVARCHAR"; - pub const OBJECT: &'static str = "OBJECT"; - pub const OCCURRENCES_REGEX: &'static str = "OCCURRENCES_REGEX"; - pub const OCTETS: &'static str = "OCTETS"; - pub const OCTET_LENGTH: &'static str = "OCTET_LENGTH"; - pub const OF: &'static str = "OF"; - pub const OFF: &'static str = "OFF"; - pub const OFFSET: &'static str = "OFFSET"; - pub const OFFSETS: &'static str = "OFFSETS"; - pub const OID_OPS: &'static str = "oid_ops"; - pub const OLD: &'static str = "OLD"; - pub const OMIT: &'static str = "OMIT"; - pub const ON: &'static str = "ON"; - pub const ONE: &'static str = "ONE"; - pub const ONLY: &'static str = "ONLY"; - pub const OPEN: &'static str = "OPEN"; - pub const OPENJSON: &'static str = "OPENJSON"; - pub const OPERATE: &'static str = "OPERATE"; - pub const OPERATOR: &'static str = "OPERATOR"; - pub const OPTIMIZATION: &'static str = "OPTIMIZATION"; - pub const OPTIMIZE: &'static str = "OPTIMIZE"; - pub const OPTIMIZED: &'static str = "OPTIMIZED"; - pub const OPTIMIZER_COSTS: &'static str = "OPTIMIZER_COSTS"; - pub const OPTION: &'static str = "OPTION"; - pub const OPTIONS: &'static str = "OPTIONS"; - pub const OR: &'static str = "OR"; - pub const ORC: &'static str = "ORC"; - pub const ORDER: &'static str = "ORDER"; - pub const ORDINALITY: &'static str = "ORDINALITY"; - pub const ORGANIZATION: &'static str = "ORGANIZATION"; - pub const OUT: &'static str = "OUT"; - pub const OUTER: &'static str = "OUTER"; - pub const OUTPUTFORMAT: &'static str = "OUTPUTFORMAT"; - pub const OVER: &'static str = "OVER"; - pub const OVERFLOW: &'static str = "OVERFLOW"; - pub const OVERLAPS: &'static str = "OVERLAPS"; - pub const OVERLAY: &'static str = "OVERLAY"; - pub const OVERRIDE: &'static str = "OVERRIDE"; - pub const OVERWRITE: &'static str = "OVERWRITE"; - pub const OWNED: &'static str = "OWNED"; - pub const OWNER: &'static str = "OWNER"; - pub const OWNERSHIP: &'static str = "OWNERSHIP"; - pub const PACKAGE: &'static str = "PACKAGE"; - pub const PACKAGES: &'static str = "PACKAGES"; - pub const PARALLEL: &'static str = "PARALLEL"; - pub const PARAMETER: &'static str = "PARAMETER"; - pub const PARQUET: &'static str = "PARQUET"; - pub const PART: &'static str = "PART"; - pub const PARTITION: &'static str = "PARTITION"; - pub const PARTITIONED: &'static str = "PARTITIONED"; - pub const PARTITIONS: &'static str = "PARTITIONS"; - pub const PASSWORD: &'static str = "PASSWORD"; - pub const PAST: &'static str = "PAST"; - pub const PATH: &'static str = "PATH"; - pub const PATTERN: &'static str = "PATTERN"; - pub const PER: &'static str = "PER"; - pub const PERCENT: &'static str = "PERCENT"; - pub const PERCENTILE_CONT: &'static str = "PERCENTILE_CONT"; - pub const PERCENTILE_DISC: &'static str = "PERCENTILE_DISC"; - pub const PERCENT_RANK: &'static str = "PERCENT_RANK"; - pub const PERIOD: &'static str = "PERIOD"; - pub const PERMISSIVE: &'static str = "PERMISSIVE"; - pub const PERSISTENT: &'static str = "PERSISTENT"; - pub const PIVOT: &'static str = "PIVOT"; - pub const PLACING: &'static str = "PLACING"; - pub const PLAN: &'static str = "PLAN"; - pub const PLANS: &'static str = "PLANS"; - pub const POLICY: &'static str = "POLICY"; - pub const POOL: &'static str = "POOL"; - pub const PORTION: &'static str = "PORTION"; - pub const POSITION: &'static str = "POSITION"; - pub const POSITION_REGEX: &'static str = "POSITION_REGEX"; - pub const POWER: &'static str = "POWER"; - pub const PRAGMA: &'static str = "PRAGMA"; - pub const PRECEDES: &'static str = "PRECEDES"; - pub const PRECEDING: &'static str = "PRECEDING"; - pub const PRECISION: &'static str = "PRECISION"; - pub const PREPARE: &'static str = "PREPARE"; - pub const PRESERVE: &'static str = "PRESERVE"; - pub const PREWHERE: &'static str = "PREWHERE"; - pub const PRIMARY: &'static str = "PRIMARY"; - pub const PRIOR: &'static str = "PRIOR"; - pub const PRIVILEGES: &'static str = "PRIVILEGES"; - pub const PROCEDURE: &'static str = "PROCEDURE"; - pub const PROFILE: &'static str = "PROFILE"; - pub const PROGRAM: &'static str = "PROGRAM"; - pub const PROJECTION: &'static str = "PROJECTION"; - pub const PUBLIC: &'static str = "PUBLIC"; - pub const PURCHASE: &'static str = "PURCHASE"; - pub const PURGE: &'static str = "PURGE"; - pub const QUALIFY: &'static str = "QUALIFY"; - pub const QUARTER: &'static str = "QUARTER"; - pub const QUERY: &'static str = "QUERY"; - pub const QUOTE: &'static str = "QUOTE"; - pub const RAISERROR: &'static str = "RAISERROR"; - pub const RANGE: &'static str = "RANGE"; - pub const RANK: &'static str = "RANK"; - pub const RAW: &'static str = "RAW"; - pub const RCFILE: &'static str = "RCFILE"; - pub const READ: &'static str = "READ"; - pub const READS: &'static str = "READS"; - pub const READ_ONLY: &'static str = "READ_ONLY"; - pub const REAL: &'static str = "REAL"; - pub const RECLUSTER: &'static str = "RECLUSTER"; - pub const RECURSIVE: &'static str = "RECURSIVE"; - pub const REF: &'static str = "REF"; - pub const REFERENCES: &'static str = "REFERENCES"; - pub const REFERENCING: &'static str = "REFERENCING"; - pub const REGCLASS: &'static str = "REGCLASS"; - pub const REGEXP: &'static str = "REGEXP"; - pub const REGR_AVGX: &'static str = "REGR_AVGX"; - pub const REGR_AVGY: &'static str = "REGR_AVGY"; - pub const REGR_COUNT: &'static str = "REGR_COUNT"; - pub const REGR_INTERCEPT: &'static str = "REGR_INTERCEPT"; - pub const REGR_R2: &'static str = "REGR_R2"; - pub const REGR_SLOPE: &'static str = "REGR_SLOPE"; - pub const REGR_SXX: &'static str = "REGR_SXX"; - pub const REGR_SXY: &'static str = "REGR_SXY"; - pub const REGR_SYY: &'static str = "REGR_SYY"; - pub const RELATIVE: &'static str = "RELATIVE"; - pub const RELAY: &'static str = "RELAY"; - pub const RELEASE: &'static str = "RELEASE"; - pub const RELEASES: &'static str = "RELEASES"; - pub const REMOTE: &'static str = "REMOTE"; - pub const REMOVE: &'static str = "REMOVE"; - pub const RENAME: &'static str = "RENAME"; - pub const REORG: &'static str = "REORG"; - pub const REPAIR: &'static str = "REPAIR"; - pub const REPEATABLE: &'static str = "REPEATABLE"; - pub const REPLACE: &'static str = "REPLACE"; - pub const REPLICA: &'static str = "REPLICA"; - pub const REPLICATE: &'static str = "REPLICATE"; - pub const REPLICATION: &'static str = "REPLICATION"; - pub const RESET: &'static str = "RESET"; - pub const RESOLVE: &'static str = "RESOLVE"; - pub const RESPECT: &'static str = "RESPECT"; - pub const RESTART: &'static str = "RESTART"; - pub const RESTRICT: &'static str = "RESTRICT"; - pub const RESTRICTED: &'static str = "RESTRICTED"; - pub const RESTRICTIONS: &'static str = "RESTRICTIONS"; - pub const RESTRICTIVE: &'static str = "RESTRICTIVE"; - pub const RESULT: &'static str = "RESULT"; - pub const RESULTSET: &'static str = "RESULTSET"; - pub const RESUME: &'static str = "RESUME"; - pub const RETAIN: &'static str = "RETAIN"; - pub const RETURN: &'static str = "RETURN"; - pub const RETURNING: &'static str = "RETURNING"; - pub const RETURNS: &'static str = "RETURNS"; - pub const REVOKE: &'static str = "REVOKE"; - pub const RIGHT: &'static str = "RIGHT"; - pub const RLIKE: &'static str = "RLIKE"; - pub const RM: &'static str = "RM"; - pub const ROLE: &'static str = "ROLE"; - pub const ROLES: &'static str = "ROLES"; - pub const ROLLBACK: &'static str = "ROLLBACK"; - pub const ROLLUP: &'static str = "ROLLUP"; - pub const ROOT: &'static str = "ROOT"; - pub const ROW: &'static str = "ROW"; - pub const ROWID: &'static str = "ROWID"; - pub const ROWS: &'static str = "ROWS"; - pub const ROW_NUMBER: &'static str = "ROW_NUMBER"; - pub const RULE: &'static str = "RULE"; - pub const RUN: &'static str = "RUN"; - pub const SAFE: &'static str = "SAFE"; - pub const SAFE_CAST: &'static str = "SAFE_CAST"; - pub const SAMPLE: &'static str = "SAMPLE"; - pub const SAVEPOINT: &'static str = "SAVEPOINT"; - pub const SCHEMA: &'static str = "SCHEMA"; - pub const SCHEMAS: &'static str = "SCHEMAS"; - pub const SCOPE: &'static str = "SCOPE"; - pub const SCROLL: &'static str = "SCROLL"; - pub const SEARCH: &'static str = "SEARCH"; - pub const SECOND: &'static str = "SECOND"; - pub const SECONDARY: &'static str = "SECONDARY"; - pub const SECONDS: &'static str = "SECONDS"; - pub const SECRET: &'static str = "SECRET"; - pub const SECURITY: &'static str = "SECURITY"; - pub const SEED: &'static str = "SEED"; - pub const SEG_OPS: &'static str = "seg_ops"; - pub const SELECT: &'static str = "SELECT"; - pub const SEMI: &'static str = "SEMI"; - pub const SENSITIVE: &'static str = "SENSITIVE"; - pub const SEPARATOR: &'static str = "SEPARATOR"; - pub const SEQUENCE: &'static str = "SEQUENCE"; - pub const SEQUENCEFILE: &'static str = "SEQUENCEFILE"; - pub const SEQUENCES: &'static str = "SEQUENCES"; - pub const SERDE: &'static str = "SERDE"; - pub const SERDEPROPERTIES: &'static str = "SERDEPROPERTIES"; - pub const SERIALIZABLE: &'static str = "SERIALIZABLE"; - pub const SERVICE: &'static str = "SERVICE"; - pub const SESSION: &'static str = "SESSION"; - pub const SESSION_USER: &'static str = "SESSION_USER"; - pub const SET: &'static str = "SET"; - pub const SETERROR: &'static str = "SETERROR"; - pub const SETS: &'static str = "SETS"; - pub const SETTINGS: &'static str = "SETTINGS"; - pub const SHARE: &'static str = "SHARE"; - pub const SHARING: &'static str = "SHARING"; - pub const SHOW: &'static str = "SHOW"; - pub const SIMILAR: &'static str = "SIMILAR"; - pub const SKIP: &'static str = "SKIP"; - pub const SLOW: &'static str = "SLOW"; - pub const SMALLINT: &'static str = "SMALLINT"; - pub const SNAPSHOT: &'static str = "SNAPSHOT"; - pub const SOME: &'static str = "SOME"; - pub const SORT: &'static str = "SORT"; - pub const SORTED: &'static str = "SORTED"; - pub const SOURCE: &'static str = "SOURCE"; - pub const SPATIAL: &'static str = "SPATIAL"; - pub const SPECIFIC: &'static str = "SPECIFIC"; - pub const SPECIFICTYPE: &'static str = "SPECIFICTYPE"; - pub const SPGIST: &'static str = "SPGIST"; - pub const SQL: &'static str = "SQL"; - pub const SQLEXCEPTION: &'static str = "SQLEXCEPTION"; - pub const SQLSTATE: &'static str = "SQLSTATE"; - pub const SQLWARNING: &'static str = "SQLWARNING"; - pub const SQRT: &'static str = "SQRT"; - pub const STABLE: &'static str = "STABLE"; - pub const STAGE: &'static str = "STAGE"; - pub const START: &'static str = "START"; - pub const STARTS: &'static str = "STARTS"; - pub const STATEMENT: &'static str = "STATEMENT"; - pub const STATIC: &'static str = "STATIC"; - pub const STATISTICS: &'static str = "STATISTICS"; - pub const STATUS: &'static str = "STATUS"; - pub const STDDEV_POP: &'static str = "STDDEV_POP"; - pub const STDDEV_SAMP: &'static str = "STDDEV_SAMP"; - pub const STDIN: &'static str = "STDIN"; - pub const STDOUT: &'static str = "STDOUT"; - pub const STEP: &'static str = "STEP"; - pub const STORAGE_INTEGRATION: &'static str = "STORAGE_INTEGRATION"; - pub const STORAGE_SERIALIZATION_POLICY: &'static str = "STORAGE_SERIALIZATION_POLICY"; - pub const STORED: &'static str = "STORED"; - pub const STRICT: &'static str = "STRICT"; - pub const STRING: &'static str = "STRING"; - pub const STRUCT: &'static str = "STRUCT"; - pub const SUBMULTISET: &'static str = "SUBMULTISET"; - pub const SUBSTRING: &'static str = "SUBSTRING"; - pub const SUBSTRING_REGEX: &'static str = "SUBSTRING_REGEX"; - pub const SUCCEEDS: &'static str = "SUCCEEDS"; - pub const SUM: &'static str = "SUM"; - pub const SUPER: &'static str = "SUPER"; - pub const SUPERUSER: &'static str = "SUPERUSER"; - pub const SUPPORT: &'static str = "SUPPORT"; - pub const SUSPEND: &'static str = "SUSPEND"; - pub const SWAP: &'static str = "SWAP"; - pub const SYMMETRIC: &'static str = "SYMMETRIC"; - pub const SYNC: &'static str = "SYNC"; - pub const SYSTEM: &'static str = "SYSTEM"; - pub const SYSTEM_TIME: &'static str = "SYSTEM_TIME"; - pub const SYSTEM_USER: &'static str = "SYSTEM_USER"; - pub const TABLE: &'static str = "TABLE"; - pub const TABLES: &'static str = "TABLES"; - pub const TABLESAMPLE: &'static str = "TABLESAMPLE"; - pub const TAG: &'static str = "TAG"; - pub const TARGET: &'static str = "TARGET"; - pub const TASK: &'static str = "TASK"; - pub const TBLPROPERTIES: &'static str = "TBLPROPERTIES"; - pub const TEMP: &'static str = "TEMP"; - pub const TEMPORARY: &'static str = "TEMPORARY"; - pub const TEMPTABLE: &'static str = "TEMPTABLE"; - pub const TERMINATED: &'static str = "TERMINATED"; - pub const TERSE: &'static str = "TERSE"; - pub const TEXT: &'static str = "TEXT"; - pub const TEXTFILE: &'static str = "TEXTFILE"; - pub const TEXT_OPS: &'static str = "text_ops"; - pub const THEN: &'static str = "THEN"; - pub const TIES: &'static str = "TIES"; - pub const TIME: &'static str = "TIME"; - pub const TIMESTAMP: &'static str = "TIMESTAMP"; - pub const TIMESTAMPTZ: &'static str = "TIMESTAMPTZ"; - pub const TIMESTAMPTZ_OPS: &'static str = "timestamptz_ops"; - pub const TIMESTAMP_OPS: &'static str = "timestamp_ops"; - pub const TIMETZ: &'static str = "TIMETZ"; - pub const TIMETZ_OPS: &'static str = "timetz_ops"; - pub const TIMEZONE: &'static str = "TIMEZONE"; - pub const TIMEZONE_ABBR: &'static str = "TIMEZONE_ABBR"; - pub const TIMEZONE_HOUR: &'static str = "TIMEZONE_HOUR"; - pub const TIMEZONE_MINUTE: &'static str = "TIMEZONE_MINUTE"; - pub const TIMEZONE_REGION: &'static str = "TIMEZONE_REGION"; - pub const TIME_OPS: &'static str = "time_ops"; - pub const TINYBLOB: &'static str = "TINYBLOB"; - pub const TINYINT: &'static str = "TINYINT"; - pub const TINYTEXT: &'static str = "TINYTEXT"; - pub const TO: &'static str = "TO"; - pub const TOP: &'static str = "TOP"; - pub const TOTALS: &'static str = "TOTALS"; - pub const TRACE: &'static str = "TRACE"; - pub const TRAILING: &'static str = "TRAILING"; - pub const TRANSACTION: &'static str = "TRANSACTION"; - pub const TRANSIENT: &'static str = "TRANSIENT"; - pub const TRANSLATE: &'static str = "TRANSLATE"; - pub const TRANSLATE_REGEX: &'static str = "TRANSLATE_REGEX"; - pub const TRANSLATION: &'static str = "TRANSLATION"; - pub const TREAT: &'static str = "TREAT"; - pub const TRIGGER: &'static str = "TRIGGER"; - pub const TRIM: &'static str = "TRIM"; - pub const TRIM_ARRAY: &'static str = "TRIM_ARRAY"; - pub const TRUE: &'static str = "TRUE"; - pub const TRUNCATE: &'static str = "TRUNCATE"; - pub const TRY: &'static str = "TRY"; - pub const TRY_CAST: &'static str = "TRY_CAST"; - pub const TRY_CONVERT: &'static str = "TRY_CONVERT"; - pub const TUPLE: &'static str = "TUPLE"; - pub const TYPE: &'static str = "TYPE"; - pub const UESCAPE: &'static str = "UESCAPE"; - pub const UINT128: &'static str = "UINT128"; - pub const UINT16: &'static str = "UINT16"; - pub const UINT256: &'static str = "UINT256"; - pub const UINT32: &'static str = "UINT32"; - pub const UINT64: &'static str = "UINT64"; - pub const UINT8: &'static str = "UINT8"; - pub const UNBOUNDED: &'static str = "UNBOUNDED"; - pub const UNCACHE: &'static str = "UNCACHE"; - pub const UNCOMMITTED: &'static str = "UNCOMMITTED"; - pub const UNDEFINED: &'static str = "UNDEFINED"; - pub const UNFREEZE: &'static str = "UNFREEZE"; - pub const UNION: &'static str = "UNION"; - pub const UNIQUE: &'static str = "UNIQUE"; - pub const UNKNOWN: &'static str = "UNKNOWN"; - pub const UNLISTEN: &'static str = "UNLISTEN"; - pub const UNLOAD: &'static str = "UNLOAD"; - pub const UNLOCK: &'static str = "UNLOCK"; - pub const UNLOGGED: &'static str = "UNLOGGED"; - pub const UNMATCHED: &'static str = "UNMATCHED"; - pub const UNNEST: &'static str = "UNNEST"; - pub const UNPIVOT: &'static str = "UNPIVOT"; - pub const UNSAFE: &'static str = "UNSAFE"; - pub const UNSIGNED: &'static str = "UNSIGNED"; - pub const UNTIL: &'static str = "UNTIL"; - pub const UPC_OPS: &'static str = "upc_ops"; - pub const UPDATE: &'static str = "UPDATE"; - pub const UPPER: &'static str = "UPPER"; - pub const URL: &'static str = "URL"; - pub const USAGE: &'static str = "USAGE"; - pub const USE: &'static str = "USE"; - pub const USER: &'static str = "USER"; - pub const USER_RESOURCES: &'static str = "USER_RESOURCES"; - pub const USING: &'static str = "USING"; - pub const UUID: &'static str = "UUID"; - pub const UUID_OPS: &'static str = "uuid_ops"; - pub const VACUUM: &'static str = "VACUUM"; - pub const VALID: &'static str = "VALID"; - pub const VALIDATION_MODE: &'static str = "VALIDATION_MODE"; - pub const VALUE: &'static str = "VALUE"; - pub const VALUES: &'static str = "VALUES"; - pub const VALUE_OF: &'static str = "VALUE_OF"; - pub const VARBINARY: &'static str = "VARBINARY"; - pub const VARBIT_OPS: &'static str = "varbit_ops"; - pub const VARCHAR: &'static str = "VARCHAR"; - pub const VARCHAR_OPS: &'static str = "varchar_ops"; - pub const VARIABLES: &'static str = "VARIABLES"; - pub const VARYING: &'static str = "VARYING"; - pub const VAR_POP: &'static str = "VAR_POP"; - pub const VAR_SAMP: &'static str = "VAR_SAMP"; - pub const VERBOSE: &'static str = "VERBOSE"; - pub const VERSION: &'static str = "VERSION"; - pub const VERSIONING: &'static str = "VERSIONING"; - pub const VERSIONS: &'static str = "VERSIONS"; - pub const VIEW: &'static str = "VIEW"; - pub const VIEWS: &'static str = "VIEWS"; - pub const VIRTUAL: &'static str = "VIRTUAL"; - pub const VOLATILE: &'static str = "VOLATILE"; - pub const VOLUME: &'static str = "VOLUME"; - pub const WAREHOUSE: &'static str = "WAREHOUSE"; - pub const WAREHOUSES: &'static str = "WAREHOUSES"; - pub const WEEK: &'static str = "WEEK"; - pub const WEEKS: &'static str = "WEEKS"; - pub const WHEN: &'static str = "WHEN"; - pub const WHENEVER: &'static str = "WHENEVER"; - pub const WHERE: &'static str = "WHERE"; - pub const WIDTH_BUCKET: &'static str = "WIDTH_BUCKET"; - pub const WINDOW: &'static str = "WINDOW"; - pub const WITH: &'static str = "WITH"; - pub const WITHIN: &'static str = "WITHIN"; - pub const WITHOUT: &'static str = "WITHOUT"; - pub const WITHOUT_ARRAY_WRAPPER: &'static str = "WITHOUT_ARRAY_WRAPPER"; - pub const WORK: &'static str = "WORK"; - pub const WRITE: &'static str = "WRITE"; - pub const XML: &'static str = "XML"; - pub const XOR: &'static str = "XOR"; - pub const YEAR: &'static str = "YEAR"; - pub const YEARS: &'static str = "YEARS"; - pub const ZONE: &'static str = "ZONE"; - pub const ZORDER: &'static str = "ZORDER"; - pub const ALL_KEYWORDS: &[&str] = &[ - ABORT, - ABS, - ABSENT, - ABSOLUTE, - ACCESS, - ACCOUNT, - ACTION, - ADD, - ADMIN, - AFTER, - AGAINST, - AGGREGATION, - ALERT, - ALGORITHM, - ALIAS, - ALL, - ALLOCATE, - ALTER, - ALWAYS, - ANALYZE, - AND, - ANTI, - ANY, - APPLICATION, - APPLY, - APPLYBUDGET, - ARCHIVE, - ARE, - ARRAY, - ARRAY_MAX_CARDINALITY, - AS, - ASC, - ASENSITIVE, - ASOF, - ASSERT, - ASYMMETRIC, - AT, - ATOMIC, - ATTACH, - AUDIT, - AUTHENTICATION, - AUTHORIZATION, - AUTO, - AUTOINCREMENT, - AUTO_INCREMENT, - AVG, - AVRO, - BACKWARD, - BASE64, - BASE_LOCATION, - BEFORE, - BEGIN, - BEGIN_FRAME, - BEGIN_PARTITION, - BERNOULLI, - BETWEEN, - BIGDECIMAL, - BIGINT, - BIGNUMERIC, - BINARY, - BIND, - BINDING, - BIT, - BIT_OPS, - BLOB, - BLOCK, - BLOOM, - BLOOMFILTER, - BOOL, - BOOLEAN, - BOOL_OPS, - BOTH, - BPCHAR_OPS, - BRIN, - BROWSE, - BTREE, - BTREE_CUBE_OPS, - BTREE_HSTORE_OPS, - BUCKET, - BUCKETS, - BY, - BYPASSRLS, - BYTEA, - BYTEA_OPS, - BYTES, - CACHE, - CALL, - CALLED, - CARDINALITY, - CASCADE, - CASCADED, - CASE, - CASES, - CAST, - CATALOG, - CATALOG_SYNC, - CATCH, - CEIL, - CEILING, - CENTURY, - CHAIN, - CHANGE, - CHANGE_TRACKING, - CHANNEL, - CHAR, - CHARACTER, - CHARACTERS, - CHARACTER_LENGTH, - CHARSET, - CHAR_LENGTH, - CHAR_OPS, - CHECK, - CIDR_OPS, - CITEXT_OPS, - CLEAR, - CLOB, - CLONE, - CLOSE, - CLUSTER, - CLUSTERED, - CLUSTERING, - COALESCE, - COLLATE, - COLLATION, - COLLECT, - COLLECTION, - COLUMN, - COLUMNS, - COLUMNSTORE, - COMMENT, - COMMIT, - COMMITTED, - COMPATIBLE, - COMPRESSION, - COMPUTE, - CONCURRENTLY, - CONDITION, - CONFLICT, - CONNECT, - CONNECTION, - CONNECTOR, - CONSTRAINT, - CONTAINS, - CONTINUE, - CONVERT, - COPY, - COPY_OPTIONS, - CORR, - CORRESPONDING, - COUNT, - COVAR_POP, - COVAR_SAMP, - CREATE, - CREATEDB, - CREATEROLE, - CREDENTIALS, - CROSS, - CSV, - CUBE, - CUME_DIST, - CURRENT, - CURRENT_CATALOG, - CURRENT_DATE, - CURRENT_DEFAULT_TRANSFORM_GROUP, - CURRENT_PATH, - CURRENT_ROLE, - CURRENT_ROW, - CURRENT_SCHEMA, - CURRENT_TIME, - CURRENT_TIMESTAMP, - CURRENT_TRANSFORM_GROUP_FOR_TYPE, - CURRENT_USER, - CURSOR, - CYCLE, - DATA, - DATABASE, - DATABASES, - DATA_RETENTION_TIME_IN_DAYS, - DATE, - DATE32, - DATETIME, - DATETIME64, - DATE_OPS, - DAY, - DAYOFWEEK, - DAYOFYEAR, - DAYS, - DCPROPERTIES, - DEALLOCATE, - DEC, - DECADE, - DECIMAL, - DECLARE, - DEDUPLICATE, - DEFAULT, - DEFAULT_DDL_COLLATION, - DEFERRABLE, - DEFERRED, - DEFINE, - DEFINED, - DEFINER, - DELAYED, - DELETE, - DELIMITED, - DELIMITER, - DELTA, - DENSE_RANK, - DEREF, - DESC, - DESCRIBE, - DETACH, - DETAIL, - DETERMINISTIC, - DIRECTORY, - DISABLE, - DISCARD, - DISCONNECT, - DISTINCT, - DISTRIBUTE, - DIV, - DO, - DOUBLE, - DOW, - DOY, - DROP, - DRY, - DUPLICATE, - DYNAMIC, - EACH, - EAN13_OPS, - ELEMENT, - ELEMENTS, - ELSE, - EMPTY, - ENABLE, - ENABLE_SCHEMA_EVOLUTION, - ENCODING, - ENCRYPTION, - END, - END_EXEC, - ENDPOINT, - END_FRAME, - END_PARTITION, - ENFORCED, - ENGINE, - ENUM, - ENUM16, - ENUM8, - ENUM_OPS, - EPHEMERAL, - EPOCH, - EQUALS, - ERROR, - ESCAPE, - ESCAPED, - ESTIMATE, - EVENT, - EVERY, - EVOLVE, - EXCEPT, - EXCEPTION, - EXCHANGE, - EXCLUDE, - EXCLUSIVE, - EXEC, - EXECUTE, - EXECUTION, - EXISTS, - EXP, - EXPANSION, - EXPLAIN, - EXPLICIT, - EXPORT, - EXTENDED, - EXTENSION, - EXTERNAL, - EXTERNAL_VOLUME, - EXTRACT, - FAIL, - FAILOVER, - FALSE, - FETCH, - FIELDS, - FILE, - FILES, - FILE_FORMAT, - FILL, - FILTER, - FINAL, - FIRST, - FIRST_VALUE, - FIXEDSTRING, - FLOAT, - FLOAT32, - FLOAT4, - FLOAT4_OPS, - FLOAT64, - FLOAT8, - FLOAT8_OPS, - FLOOR, - FLUSH, - FN, - FOLLOWING, - FOR, - FORCE, - FORCE_NOT_NULL, - FORCE_NULL, - FORCE_QUOTE, - FOREIGN, - FORMAT, - FORMATTED, - FORWARD, - FRAME_ROW, - FREE, - FREEZE, - FROM, - FSCK, - FULFILLMENT, - FULL, - FULLTEXT, - FUNCTION, - FUNCTIONS, - FUSION, - GENERAL, - GENERATE, - GENERATED, - GEOGRAPHY, - GET, - GIN, - GIN_HSTORE_OPS, - GIN_TRGM_OPS, - GIST, - GIST_BIT_OPS, - GIST_BOOL_OPS, - GIST_BPCHAR_OPS, - GIST_BYTEA_OPS, - GIST_CASH_OPS, - GIST_CIDR_OPS, - GIST_CUBE_OPS, - GIST_DATE_OPS, - GIST_ENUM_OPS, - GIST_FLOAT4_OPS, - GIST_FLOAT8_OPS, - GIST_HSTORE_OPS, - GIST_INET_OPS, - GIST_INT2_OPS, - GIST_INT4_OPS, - GIST_INT8_OPS, - GIST_INTERVAL_OPS, - GIST_LTREE_OPS, - GIST_MACADDR8_OPS, - GIST_MACADDR_OPS, - GIST_NUMERIC_OPS, - GIST_OID_OPS, - GIST_SEG_OPS, - GIST_TEXT_OPS, - GIST_TIMESTAMP_OPS, - GIST_TIMESTAMPTZ_OPS, - GIST_TIME_OPS, - GIST_TIMETZ_OPS, - GIST_TRGM_OPS, - GIST_UUID_OPS, - GIST_VBIT_OPS, - GLOBAL, - GRANT, - GRANTED, - GRANTS, - GRAPHVIZ, - GROUP, - GROUPING, - GROUPS, - HASH, - HASH_HSTORE_OPS, - HASH_LTREE_OPS, - HAVING, - HEADER, - HEAP, - HIGH_PRIORITY, - HISTORY, - HIVEVAR, - HOLD, - HOSTS, - HOUR, - HOURS, - ICEBERG, - ID, - IDENTITY, - IDENTITY_INSERT, - IF, - IGNORE, - ILIKE, - IMMEDIATE, - IMMUTABLE, - IMPORT, - IMPORTED, - IN, - INCLUDE, - INCLUDE_NULL_VALUES, - INCREMENT, - INDEX, - INDICATOR, - INET_OPS, - INHERIT, - INITIALLY, - INNER, - INOUT, - INPATH, - INPUT, - INPUTFORMAT, - INSENSITIVE, - INSERT, - INSTALL, - INSTEAD, - INT, - INT128, - INT16, - INT2, - INT256, - INT2_OPS, - INT32, - INT4, - INT4_OPS, - INT64, - INT8, - INT8_OPS, - INTEGER, - INTEGRATION, - INTERPOLATE, - INTERSECT, - INTERSECTION, - INTERVAL, - INTERVAL_OPS, - INTO, - INVOKER, - IO, - IS, - ISBN13_OPS, - ISBN_OPS, - ISMN13_OPS, - ISMN_OPS, - ISODOW, - ISOLATION, - ISOWEEK, - ISOYEAR, - ISSN13_OPS, - ISSN_OPS, - ITEMS, - JAR, - JOIN, - JSON, - JSONB, - JSONFILE, - JSON_TABLE, - JULIAN, - KEY, - KEYS, - KILL, - LAG, - LANGUAGE, - LARGE, - LAST, - LAST_VALUE, - LATERAL, - LEAD, - LEADING, - LEFT, - LEVEL, - LIKE, - LIKE_REGEX, - LIMIT, - LINES, - LIST, - LISTEN, - LISTING, - LN, - LOAD, - LOCAL, - LOCALTIME, - LOCALTIMESTAMP, - LOCATION, - LOCK, - LOCKED, - LOG, - LOGIN, - LOGS, - LONGBLOB, - LONGTEXT, - LOWCARDINALITY, - LOWER, - LOW_PRIORITY, - LS, - LTREE_OPS, - MACADDR8_OPS, - MACADDR_OPS, - MACRO, - MANAGE, - MANAGED, - MANAGEDLOCATION, - MAP, - MASKING, - MATCH, - MATCHED, - MATCHES, - MATCH_CONDITION, - MATCH_RECOGNIZE, - MATERIALIZE, - MATERIALIZED, - MAX, - MAXVALUE, - MAX_DATA_EXTENSION_TIME_IN_DAYS, - MEASURES, - MEDIUMBLOB, - MEDIUMINT, - MEDIUMTEXT, - MEMBER, - MERGE, - METADATA, - METHOD, - METRIC, - MICROSECOND, - MICROSECONDS, - MILLENIUM, - MILLENNIUM, - MILLISECOND, - MILLISECONDS, - MIN, - MINUS, - MINUTE, - MINUTES, - MINVALUE, - MOD, - MODE, - MODIFIES, - MODIFY, - MODULE, - MONEY_OPS, - MONITOR, - MONTH, - MONTHS, - MSCK, - MULTISET, - MUTATION, - NAME, - NAME_OPS, - NANOSECOND, - NANOSECONDS, - NATIONAL, - NATURAL, - NCHAR, - NCLOB, - NESTED, - NETWORK, - NEW, - NEXT, - NFC, - NFD, - NFKC, - NFKD, - NO, - NOBYPASSRLS, - NOCREATEDB, - NOCREATEROLE, - NOINHERIT, - NOLOGIN, - NONE, - NOORDER, - NOREPLICATION, - NORMALIZE, - NORMALIZED, - NOSCAN, - NOSUPERUSER, - NOT, - NOTHING, - NOTIFY, - NOWAIT, - NO_WRITE_TO_BINLOG, - NTH_VALUE, - NTILE, - NULL, - NULLABLE, - NULLIF, - NULLS, - NUMERIC, - NUMERIC_OPS, - NVARCHAR, - OBJECT, - OCCURRENCES_REGEX, - OCTETS, - OCTET_LENGTH, - OF, - OFF, - OFFSET, - OFFSETS, - OID_OPS, - OLD, - OMIT, - ON, - ONE, - ONLY, - OPEN, - OPENJSON, - OPERATE, - OPERATOR, - OPTIMIZATION, - OPTIMIZE, - OPTIMIZED, - OPTIMIZER_COSTS, - OPTION, - OPTIONS, - OR, - ORC, - ORDER, - ORDINALITY, - ORGANIZATION, - OUT, - OUTER, - OUTPUTFORMAT, - OVER, - OVERFLOW, - OVERLAPS, - OVERLAY, - OVERRIDE, - OVERWRITE, - OWNED, - OWNER, - OWNERSHIP, - PACKAGE, - PACKAGES, - PARALLEL, - PARAMETER, - PARQUET, - PART, - PARTITION, - PARTITIONED, - PARTITIONS, - PASSWORD, - PAST, - PATH, - PATTERN, - PER, - PERCENT, - PERCENTILE_CONT, - PERCENTILE_DISC, - PERCENT_RANK, - PERIOD, - PERMISSIVE, - PERSISTENT, - PIVOT, - PLACING, - PLAN, - PLANS, - POLICY, - POOL, - PORTION, - POSITION, - POSITION_REGEX, - POWER, - PRAGMA, - PRECEDES, - PRECEDING, - PRECISION, - PREPARE, - PRESERVE, - PREWHERE, - PRIMARY, - PRIOR, - PRIVILEGES, - PROCEDURE, - PROFILE, - PROGRAM, - PROJECTION, - PUBLIC, - PURCHASE, - PURGE, - QUALIFY, - QUARTER, - QUERY, - QUOTE, - RAISERROR, - RANGE, - RANK, - RAW, - RCFILE, - READ, - READS, - READ_ONLY, - REAL, - RECLUSTER, - RECURSIVE, - REF, - REFERENCES, - REFERENCING, - REGCLASS, - REGEXP, - REGR_AVGX, - REGR_AVGY, - REGR_COUNT, - REGR_INTERCEPT, - REGR_R2, - REGR_SLOPE, - REGR_SXX, - REGR_SXY, - REGR_SYY, - RELATIVE, - RELAY, - RELEASE, - RELEASES, - REMOTE, - REMOVE, - RENAME, - REORG, - REPAIR, - REPEATABLE, - REPLACE, - REPLICA, - REPLICATE, - REPLICATION, - RESET, - RESOLVE, - RESPECT, - RESTART, - RESTRICT, - RESTRICTED, - RESTRICTIONS, - RESTRICTIVE, - RESULT, - RESULTSET, - RESUME, - RETAIN, - RETURN, - RETURNING, - RETURNS, - REVOKE, - RIGHT, - RLIKE, - RM, - ROLE, - ROLES, - ROLLBACK, - ROLLUP, - ROOT, - ROW, - ROWID, - ROWS, - ROW_NUMBER, - RULE, - RUN, - SAFE, - SAFE_CAST, - SAMPLE, - SAVEPOINT, - SCHEMA, - SCHEMAS, - SCOPE, - SCROLL, - SEARCH, - SECOND, - SECONDARY, - SECONDS, - SECRET, - SECURITY, - SEED, - SEG_OPS, - SELECT, - SEMI, - SENSITIVE, - SEPARATOR, - SEQUENCE, - SEQUENCEFILE, - SEQUENCES, - SERDE, - SERDEPROPERTIES, - SERIALIZABLE, - SERVICE, - SESSION, - SESSION_USER, - SET, - SETERROR, - SETS, - SETTINGS, - SHARE, - SHARING, - SHOW, - SIMILAR, - SKIP, - SLOW, - SMALLINT, - SNAPSHOT, - SOME, - SORT, - SORTED, - SOURCE, - SPATIAL, - SPECIFIC, - SPECIFICTYPE, - SPGIST, - SQL, - SQLEXCEPTION, - SQLSTATE, - SQLWARNING, - SQRT, - STABLE, - STAGE, - START, - STARTS, - STATEMENT, - STATIC, - STATISTICS, - STATUS, - STDDEV_POP, - STDDEV_SAMP, - STDIN, - STDOUT, - STEP, - STORAGE_INTEGRATION, - STORAGE_SERIALIZATION_POLICY, - STORED, - STRICT, - STRING, - STRUCT, - SUBMULTISET, - SUBSTRING, - SUBSTRING_REGEX, - SUCCEEDS, - SUM, - SUPER, - SUPERUSER, - SUPPORT, - SUSPEND, - SWAP, - SYMMETRIC, - SYNC, - SYSTEM, - SYSTEM_TIME, - SYSTEM_USER, - TABLE, - TABLES, - TABLESAMPLE, - TAG, - TARGET, - TASK, - TBLPROPERTIES, - TEMP, - TEMPORARY, - TEMPTABLE, - TERMINATED, - TERSE, - TEXT, - TEXTFILE, - TEXT_OPS, - THEN, - TIES, - TIME, - TIMESTAMP, - TIMESTAMPTZ, - TIMESTAMPTZ_OPS, - TIMESTAMP_OPS, - TIMETZ, - TIMETZ_OPS, - TIMEZONE, - TIMEZONE_ABBR, - TIMEZONE_HOUR, - TIMEZONE_MINUTE, - TIMEZONE_REGION, - TIME_OPS, - TINYBLOB, - TINYINT, - TINYTEXT, - TO, - TOP, - TOTALS, - TRACE, - TRAILING, - TRANSACTION, - TRANSIENT, - TRANSLATE, - TRANSLATE_REGEX, - TRANSLATION, - TREAT, - TRIGGER, - TRIM, - TRIM_ARRAY, - TRUE, - TRUNCATE, - TRY, - TRY_CAST, - TRY_CONVERT, - TUPLE, - TYPE, - UESCAPE, - UINT128, - UINT16, - UINT256, - UINT32, - UINT64, - UINT8, - UNBOUNDED, - UNCACHE, - UNCOMMITTED, - UNDEFINED, - UNFREEZE, - UNION, - UNIQUE, - UNKNOWN, - UNLISTEN, - UNLOAD, - UNLOCK, - UNLOGGED, - UNMATCHED, - UNNEST, - UNPIVOT, - UNSAFE, - UNSIGNED, - UNTIL, - UPC_OPS, - UPDATE, - UPPER, - URL, - USAGE, - USE, - USER, - USER_RESOURCES, - USING, - UUID, - UUID_OPS, - VACUUM, - VALID, - VALIDATION_MODE, - VALUE, - VALUES, - VALUE_OF, - VARBINARY, - VARBIT_OPS, - VARCHAR, - VARCHAR_OPS, - VARIABLES, - VARYING, - VAR_POP, - VAR_SAMP, - VERBOSE, - VERSION, - VERSIONING, - VERSIONS, - VIEW, - VIEWS, - VIRTUAL, - VOLATILE, - VOLUME, - WAREHOUSE, - WAREHOUSES, - WEEK, - WEEKS, - WHEN, - WHENEVER, - WHERE, - WIDTH_BUCKET, - WINDOW, - WITH, - WITHIN, - WITHOUT, - WITHOUT_ARRAY_WRAPPER, - WORK, - WRITE, - XML, - XOR, - YEAR, - YEARS, - ZONE, - ZORDER, - ]; - /// These keywords can't be used as a table alias, so that `FROM table_name alias` - /// can be parsed unambiguously without looking ahead. - pub const RESERVED_FOR_TABLE_ALIAS: &[Keyword] = &[ - Keyword::WITH, - Keyword::EXPLAIN, - Keyword::ANALYZE, - Keyword::SELECT, - Keyword::WHERE, - Keyword::GROUP, - Keyword::SORT, - Keyword::HAVING, - Keyword::ORDER, - Keyword::PIVOT, - Keyword::UNPIVOT, - Keyword::TOP, - Keyword::LATERAL, - Keyword::VIEW, - Keyword::LIMIT, - Keyword::OFFSET, - Keyword::FETCH, - Keyword::UNION, - Keyword::EXCEPT, - Keyword::INTERSECT, - Keyword::MINUS, - Keyword::ON, - Keyword::JOIN, - Keyword::INNER, - Keyword::CROSS, - Keyword::FULL, - Keyword::LEFT, - Keyword::RIGHT, - Keyword::NATURAL, - Keyword::USING, - Keyword::CLUSTER, - Keyword::DISTRIBUTE, - Keyword::GLOBAL, - Keyword::ANTI, - Keyword::SEMI, - Keyword::RETURNING, - Keyword::ASOF, - Keyword::MATCH_CONDITION, - Keyword::OUTER, - Keyword::SET, - Keyword::QUALIFY, - Keyword::WINDOW, - Keyword::END, - Keyword::FOR, - Keyword::PARTITION, - Keyword::PREWHERE, - Keyword::SETTINGS, - Keyword::FORMAT, - Keyword::START, - Keyword::CONNECT, - Keyword::MATCH_RECOGNIZE, - Keyword::SAMPLE, - Keyword::TABLESAMPLE, - Keyword::FROM, - ]; - /// Can't be used as a column alias, so that `SELECT alias` - /// can be parsed unambiguously without looking ahead. - pub const RESERVED_FOR_COLUMN_ALIAS: &[Keyword] = &[ - Keyword::WITH, - Keyword::EXPLAIN, - Keyword::ANALYZE, - Keyword::SELECT, - Keyword::WHERE, - Keyword::GROUP, - Keyword::SORT, - Keyword::HAVING, - Keyword::ORDER, - Keyword::TOP, - Keyword::LATERAL, - Keyword::VIEW, - Keyword::LIMIT, - Keyword::OFFSET, - Keyword::FETCH, - Keyword::UNION, - Keyword::EXCEPT, - Keyword::INTERSECT, - Keyword::MINUS, - Keyword::CLUSTER, - Keyword::DISTRIBUTE, - Keyword::RETURNING, - Keyword::FROM, - Keyword::INTO, - Keyword::END, - ]; - pub const RESERVED_FOR_TABLE_FACTOR: &[Keyword] = &[ - Keyword::INTO, - Keyword::LIMIT, - Keyword::HAVING, - Keyword::WHERE, - ]; - /// Global list of reserved keywords that cannot be parsed as identifiers - /// without special handling like quoting. Parser should call `Dialect::is_reserved_for_identifier` - /// to allow for each dialect to customize the list. - pub const RESERVED_FOR_IDENTIFIER: &[Keyword] = &[ - Keyword::EXISTS, - Keyword::INTERVAL, - Keyword::STRUCT, - Keyword::TRIM, - ]; -} -pub mod parser { - //! SQL Parser - use core::{ - fmt::{self, Display}, - str::FromStr, - }; - use helpers::attached_token::AttachedToken; - use log::debug; - use recursion::RecursionCounter; - use IsLateral::*; - use IsOptional::*; - use crate::ast::helpers::stmt_create_table::{ - CreateTableBuilder, CreateTableConfiguration, - }; - use crate::ast::Statement::CreatePolicy; - use crate::ast::*; - use crate::dialect::*; - use crate::keywords::{Keyword, ALL_KEYWORDS}; - use crate::tokenizer::*; - mod alter { - //! SQL Parser for ALTER - use super::{Parser, ParserError}; - use crate::{ - ast::{ - AlterConnectorOwner, AlterPolicyOperation, AlterRoleOperation, Expr, - Password, ResetConfig, RoleOption, SetConfigValue, Statement, - }, - dialect::{MsSqlDialect, PostgreSqlDialect}, - keywords::Keyword, tokenizer::Token, - }; - impl Parser<'_> { - pub fn parse_alter_role(&mut self) -> Result { - if (self.dialect.is::()) { - return self.parse_pg_alter_role(); - } else if (self.dialect.is::()) { - return self.parse_mssql_alter_role(); - } - Err( - ParserError::ParserError( - "ALTER ROLE is only support for PostgreSqlDialect, MsSqlDialect" - .into(), - ), - ) - } - /// Parse ALTER POLICY statement - /// ```sql - /// ALTER POLICY policy_name ON table_name [ RENAME TO new_name ] - /// or - /// ALTER POLICY policy_name ON table_name - /// [ TO { role_name | PUBLIC | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...] ] - /// [ USING ( using_expression ) ] - /// [ WITH CHECK ( check_expression ) ] - /// ``` - /// - /// [PostgreSQL](https://www.postgresql.org/docs/current/sql-alterpolicy.html) - pub fn parse_alter_policy(&mut self) -> Result { - let name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::ON)?; - let table_name = self.parse_object_name(false)?; - if self.parse_keyword(Keyword::RENAME) { - self.expect_keyword_is(Keyword::TO)?; - let new_name = self.parse_identifier()?; - Ok(Statement::AlterPolicy { - name, - table_name, - operation: AlterPolicyOperation::Rename { - new_name, - }, - }) - } else { - let to = if self.parse_keyword(Keyword::TO) { - Some(self.parse_comma_separated(|p| p.parse_owner())?) - } else { - None - }; - let using = if self.parse_keyword(Keyword::USING) { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Some(expr) - } else { - None - }; - let with_check = if self - .parse_keywords(&[Keyword::WITH, Keyword::CHECK]) - { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Some(expr) - } else { - None - }; - Ok(Statement::AlterPolicy { - name, - table_name, - operation: AlterPolicyOperation::Apply { - to, - using, - with_check, - }, - }) - } - } - /// Parse an `ALTER CONNECTOR` statement - /// ```sql - /// ALTER CONNECTOR connector_name SET DCPROPERTIES(property_name=property_value, ...); - /// - /// ALTER CONNECTOR connector_name SET URL new_url; - /// - /// ALTER CONNECTOR connector_name SET OWNER [USER|ROLE] user_or_role; - /// ``` - pub fn parse_alter_connector(&mut self) -> Result { - let name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::SET)?; - let properties = match self - .parse_options_with_keywords(&[Keyword::DCPROPERTIES])? - { - properties if !properties.is_empty() => Some(properties), - _ => None, - }; - let url = if self.parse_keyword(Keyword::URL) { - Some(self.parse_literal_string()?) - } else { - None - }; - let owner = if self.parse_keywords(&[Keyword::OWNER, Keyword::USER]) { - let owner = self.parse_identifier()?; - Some(AlterConnectorOwner::User(owner)) - } else if self.parse_keywords(&[Keyword::OWNER, Keyword::ROLE]) { - let owner = self.parse_identifier()?; - Some(AlterConnectorOwner::Role(owner)) - } else { - None - }; - Ok(Statement::AlterConnector { - name, - properties, - url, - owner, - }) - } - fn parse_mssql_alter_role(&mut self) -> Result { - let role_name = self.parse_identifier()?; - let operation = if self.parse_keywords(&[Keyword::ADD, Keyword::MEMBER]) - { - let member_name = self.parse_identifier()?; - AlterRoleOperation::AddMember { - member_name, - } - } else if self.parse_keywords(&[Keyword::DROP, Keyword::MEMBER]) { - let member_name = self.parse_identifier()?; - AlterRoleOperation::DropMember { - member_name, - } - } else if self.parse_keywords(&[Keyword::WITH, Keyword::NAME]) { - if self.consume_token(&Token::Eq) { - let role_name = self.parse_identifier()?; - AlterRoleOperation::RenameRole { - role_name, - } - } else { - return self.expected("= after WITH NAME ", self.peek_token()); - } - } else { - return self - .expected("'ADD' or 'DROP' or 'WITH NAME'", self.peek_token()); - }; - Ok(Statement::AlterRole { - name: role_name, - operation, - }) - } - fn parse_pg_alter_role(&mut self) -> Result { - let role_name = self.parse_identifier()?; - let in_database = if self - .parse_keywords(&[Keyword::IN, Keyword::DATABASE]) - { - self.parse_object_name(false).ok() - } else { - None - }; - let operation = if self.parse_keyword(Keyword::RENAME) { - if self.parse_keyword(Keyword::TO) { - let role_name = self.parse_identifier()?; - AlterRoleOperation::RenameRole { - role_name, - } - } else { - return self.expected("TO after RENAME", self.peek_token()); - } - } else if self.parse_keyword(Keyword::SET) { - let config_name = self.parse_object_name(false)?; - if self.parse_keywords(&[Keyword::FROM, Keyword::CURRENT]) { - AlterRoleOperation::Set { - config_name, - config_value: SetConfigValue::FromCurrent, - in_database, - } - } else if self.consume_token(&Token::Eq) - || self.parse_keyword(Keyword::TO) - { - if self.parse_keyword(Keyword::DEFAULT) { - AlterRoleOperation::Set { - config_name, - config_value: SetConfigValue::Default, - in_database, - } - } else if let Ok(expr) = self.parse_expr() { - AlterRoleOperation::Set { - config_name, - config_value: SetConfigValue::Value(expr), - in_database, - } - } else { - self.expected("config value", self.peek_token())? - } - } else { - self.expected( - "'TO' or '=' or 'FROM CURRENT'", - self.peek_token(), - )? - } - } else if self.parse_keyword(Keyword::RESET) { - if self.parse_keyword(Keyword::ALL) { - AlterRoleOperation::Reset { - config_name: ResetConfig::ALL, - in_database, - } - } else { - let config_name = self.parse_object_name(false)?; - AlterRoleOperation::Reset { - config_name: ResetConfig::ConfigName(config_name), - in_database, - } - } - } else { - let _ = self.parse_keyword(Keyword::WITH); - let mut options = ::alloc::vec::Vec::new(); - while let Some(opt) = self - .maybe_parse(|parser| parser.parse_pg_role_option())? - { - options.push(opt); - } - if options.is_empty() { - return self.expected("option", self.peek_token())?; - } - AlterRoleOperation::WithOptions { - options, - } - }; - Ok(Statement::AlterRole { - name: role_name, - operation, - }) - } - fn parse_pg_role_option(&mut self) -> Result { - let option = match self - .parse_one_of_keywords( - &[ - Keyword::BYPASSRLS, - Keyword::NOBYPASSRLS, - Keyword::CONNECTION, - Keyword::CREATEDB, - Keyword::NOCREATEDB, - Keyword::CREATEROLE, - Keyword::NOCREATEROLE, - Keyword::INHERIT, - Keyword::NOINHERIT, - Keyword::LOGIN, - Keyword::NOLOGIN, - Keyword::PASSWORD, - Keyword::REPLICATION, - Keyword::NOREPLICATION, - Keyword::SUPERUSER, - Keyword::NOSUPERUSER, - Keyword::VALID, - ], - ) - { - Some(Keyword::BYPASSRLS) => RoleOption::BypassRLS(true), - Some(Keyword::NOBYPASSRLS) => RoleOption::BypassRLS(false), - Some(Keyword::CONNECTION) => { - self.expect_keyword_is(Keyword::LIMIT)?; - RoleOption::ConnectionLimit( - Expr::Value(self.parse_number_value()?), - ) - } - Some(Keyword::CREATEDB) => RoleOption::CreateDB(true), - Some(Keyword::NOCREATEDB) => RoleOption::CreateDB(false), - Some(Keyword::CREATEROLE) => RoleOption::CreateRole(true), - Some(Keyword::NOCREATEROLE) => RoleOption::CreateRole(false), - Some(Keyword::INHERIT) => RoleOption::Inherit(true), - Some(Keyword::NOINHERIT) => RoleOption::Inherit(false), - Some(Keyword::LOGIN) => RoleOption::Login(true), - Some(Keyword::NOLOGIN) => RoleOption::Login(false), - Some(Keyword::PASSWORD) => { - let password = if self.parse_keyword(Keyword::NULL) { - Password::NullPassword - } else { - Password::Password(Expr::Value(self.parse_value()?)) - }; - RoleOption::Password(password) - } - Some(Keyword::REPLICATION) => RoleOption::Replication(true), - Some(Keyword::NOREPLICATION) => RoleOption::Replication(false), - Some(Keyword::SUPERUSER) => RoleOption::SuperUser(true), - Some(Keyword::NOSUPERUSER) => RoleOption::SuperUser(false), - Some(Keyword::VALID) => { - self.expect_keyword_is(Keyword::UNTIL)?; - RoleOption::ValidUntil(Expr::Value(self.parse_value()?)) - } - _ => self.expected("option", self.peek_token())?, - }; - Ok(option) - } - } - } - pub enum ParserError { - TokenizerError(String), - ParserError(String), - RecursionLimitExceeded, - } - #[automatically_derived] - impl ::core::fmt::Debug for ParserError { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - ParserError::TokenizerError(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TokenizerError", - &__self_0, - ) - } - ParserError::ParserError(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "ParserError", - &__self_0, - ) - } - ParserError::RecursionLimitExceeded => { - ::core::fmt::Formatter::write_str(f, "RecursionLimitExceeded") - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for ParserError { - #[inline] - fn clone(&self) -> ParserError { - match self { - ParserError::TokenizerError(__self_0) => { - ParserError::TokenizerError(::core::clone::Clone::clone(__self_0)) - } - ParserError::ParserError(__self_0) => { - ParserError::ParserError(::core::clone::Clone::clone(__self_0)) - } - ParserError::RecursionLimitExceeded => { - ParserError::RecursionLimitExceeded - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ParserError {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ParserError { - #[inline] - fn eq(&self, other: &ParserError) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - ParserError::TokenizerError(__self_0), - ParserError::TokenizerError(__arg1_0), - ) => __self_0 == __arg1_0, - ( - ParserError::ParserError(__self_0), - ParserError::ParserError(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ParserError { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[cfg(feature = "std")] - /// Implementation [`RecursionCounter`] if std is available - mod recursion { - use std::cell::Cell; - use std::rc::Rc; - use super::ParserError; - /// Tracks remaining recursion depth. This value is decremented on - /// each call to [`RecursionCounter::try_decrease()`], when it reaches 0 an error will - /// be returned. - /// - /// Note: Uses an [`std::rc::Rc`] and [`std::cell::Cell`] in order to satisfy the Rust - /// borrow checker so the automatic [`DepthGuard`] decrement a - /// reference to the counter. - /// - /// Note: when "recursive-protection" feature is enabled, this crate uses additional stack overflow protection - /// for some of its recursive methods. See [`recursive::recursive`] for more information. - pub(crate) struct RecursionCounter { - remaining_depth: Rc>, - } - #[automatically_derived] - impl ::core::fmt::Debug for RecursionCounter { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field1_finish( - f, - "RecursionCounter", - "remaining_depth", - &&self.remaining_depth, - ) - } - } - impl RecursionCounter { - /// Creates a [`RecursionCounter`] with the specified maximum - /// depth - pub fn new(remaining_depth: usize) -> Self { - Self { - remaining_depth: Rc::new(remaining_depth.into()), - } - } - /// Decreases the remaining depth by 1. - /// - /// Returns [`Err`] if the remaining depth falls to 0. - /// - /// Returns a [`DepthGuard`] which will adds 1 to the - /// remaining depth upon drop; - pub fn try_decrease(&self) -> Result { - let old_value = self.remaining_depth.get(); - if old_value == 0 { - Err(ParserError::RecursionLimitExceeded) - } else { - self.remaining_depth.set(old_value - 1); - Ok(DepthGuard::new(Rc::clone(&self.remaining_depth))) - } - } - } - /// Guard that increases the remaining depth by 1 on drop - pub struct DepthGuard { - remaining_depth: Rc>, - } - impl DepthGuard { - fn new(remaining_depth: Rc>) -> Self { - Self { remaining_depth } - } - } - impl Drop for DepthGuard { - fn drop(&mut self) { - let old_value = self.remaining_depth.get(); - self.remaining_depth.set(old_value + 1); - } - } - } - pub enum IsOptional { - Optional, - Mandatory, - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for IsOptional {} - #[automatically_derived] - impl ::core::cmp::PartialEq for IsOptional { - #[inline] - fn eq(&self, other: &IsOptional) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - } - } - #[automatically_derived] - impl ::core::cmp::Eq for IsOptional { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () {} - } - pub enum IsLateral { - Lateral, - NotLateral, - } - pub enum WildcardExpr { - Expr(Expr), - QualifiedWildcard(ObjectName), - Wildcard, - } - impl From for ParserError { - fn from(e: TokenizerError) -> Self { - ParserError::TokenizerError(e.to_string()) - } - } - impl fmt::Display for ParserError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt( - format_args!( - "sql parser error: {0}", - match self { - ParserError::TokenizerError(s) => s, - ParserError::ParserError(s) => s, - ParserError::RecursionLimitExceeded => "recursion limit exceeded", - }, - ), - ) - } - } - #[cfg(feature = "std")] - impl std::error::Error for ParserError {} - const DEFAULT_REMAINING_DEPTH: usize = 50; - const EOF_TOKEN: TokenWithSpan = TokenWithSpan { - token: Token::EOF, - span: Span { - start: Location { line: 0, column: 0 }, - end: Location { line: 0, column: 0 }, - }, - }; - /// Composite types declarations using angle brackets syntax can be arbitrary - /// nested such that the following declaration is possible: - /// `ARRAY>` - /// But the tokenizer recognizes the `>>` as a ShiftRight token. - /// We work around that limitation when parsing a data type by accepting - /// either a `>` or `>>` token in such cases, remembering which variant we - /// matched. - /// In the latter case having matched a `>>`, the parent type will not look to - /// match its closing `>` as a result since that will have taken place at the - /// child type. - /// - /// See [Parser::parse_data_type] for details - struct MatchedTrailingBracket(bool); - impl From for MatchedTrailingBracket { - fn from(value: bool) -> Self { - Self(value) - } - } - /// Options that control how the [`Parser`] parses SQL text - pub struct ParserOptions { - pub trailing_commas: bool, - /// Controls how literal values are unescaped. See - /// [`Tokenizer::with_unescape`] for more details. - pub unescape: bool, - } - #[automatically_derived] - impl ::core::fmt::Debug for ParserOptions { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "ParserOptions", - "trailing_commas", - &self.trailing_commas, - "unescape", - &&self.unescape, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for ParserOptions { - #[inline] - fn clone(&self) -> ParserOptions { - ParserOptions { - trailing_commas: ::core::clone::Clone::clone(&self.trailing_commas), - unescape: ::core::clone::Clone::clone(&self.unescape), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for ParserOptions {} - #[automatically_derived] - impl ::core::cmp::PartialEq for ParserOptions { - #[inline] - fn eq(&self, other: &ParserOptions) -> bool { - self.trailing_commas == other.trailing_commas - && self.unescape == other.unescape - } - } - #[automatically_derived] - impl ::core::cmp::Eq for ParserOptions { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - impl Default for ParserOptions { - fn default() -> Self { - Self { - trailing_commas: false, - unescape: true, - } - } - } - impl ParserOptions { - /// Create a new [`ParserOptions`] - pub fn new() -> Self { - Default::default() - } - /// Set if trailing commas are allowed. - /// - /// If this option is `false` (the default), the following SQL will - /// not parse. If the option is `true`, the SQL will parse. - /// - /// ```sql - /// SELECT - /// foo, - /// bar, - /// FROM baz - /// ``` - pub fn with_trailing_commas(mut self, trailing_commas: bool) -> Self { - self.trailing_commas = trailing_commas; - self - } - /// Set if literal values are unescaped. Defaults to true. See - /// [`Tokenizer::with_unescape`] for more details. - pub fn with_unescape(mut self, unescape: bool) -> Self { - self.unescape = unescape; - self - } - } - enum ParserState { - /// The default state of the parser. - Normal, - /// The state when parsing a CONNECT BY expression. This allows parsing - /// PRIOR expressions while still allowing prior as an identifier name - /// in other contexts. - ConnectBy, - } - #[automatically_derived] - impl ::core::marker::Copy for ParserState {} - #[automatically_derived] - impl ::core::clone::Clone for ParserState { - #[inline] - fn clone(&self) -> ParserState { - *self - } - } - #[automatically_derived] - impl ::core::fmt::Debug for ParserState { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::write_str( - f, - match self { - ParserState::Normal => "Normal", - ParserState::ConnectBy => "ConnectBy", - }, - ) - } - } - /// A SQL Parser - /// - /// This struct is the main entry point for parsing SQL queries. - /// - /// # Functionality: - /// * Parsing SQL: see examples on [`Parser::new`] and [`Parser::parse_sql`] - /// * Controlling recursion: See [`Parser::with_recursion_limit`] - /// * Controlling parser options: See [`Parser::with_options`] - /// * Providing your own tokens: See [`Parser::with_tokens`] - /// - /// # Internals - /// - /// The parser uses a [`Tokenizer`] to tokenize the input SQL string into a - /// `Vec` of [`TokenWithSpan`]s and maintains an `index` to the current token - /// being processed. The token vec may contain multiple SQL statements. - /// - /// * The "current" token is the token at `index - 1` - /// * The "next" token is the token at `index` - /// * The "previous" token is the token at `index - 2` - /// - /// If `index` is equal to the length of the token stream, the 'next' token is - /// [`Token::EOF`]. - /// - /// For example, the SQL string "SELECT * FROM foo" will be tokenized into - /// following tokens: - /// ```text - /// [ - /// "SELECT", // token index 0 - /// " ", // whitespace - /// "*", - /// " ", - /// "FROM", - /// " ", - /// "foo" - /// ] - /// ``` - /// - /// - pub struct Parser<'a> { - /// The tokens - tokens: Vec, - /// The index of the first unprocessed token in [`Parser::tokens`]. - index: usize, - /// The current state of the parser. - state: ParserState, - /// The SQL dialect to use. - dialect: &'a dyn Dialect, - /// Additional options that allow you to mix & match behavior - /// otherwise constrained to certain dialects (e.g. trailing - /// commas) and/or format of parse (e.g. unescaping). - options: ParserOptions, - /// Ensures the stack does not overflow by limiting recursion depth. - recursion_counter: RecursionCounter, - } - #[automatically_derived] - impl<'a> ::core::fmt::Debug for Parser<'a> { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - let names: &'static _ = &[ - "tokens", - "index", - "state", - "dialect", - "options", - "recursion_counter", - ]; - let values: &[&dyn ::core::fmt::Debug] = &[ - &self.tokens, - &self.index, - &self.state, - &self.dialect, - &self.options, - &&self.recursion_counter, - ]; - ::core::fmt::Formatter::debug_struct_fields_finish( - f, - "Parser", - names, - values, - ) - } - } - impl<'a> Parser<'a> { - /// Create a parser for a [`Dialect`] - /// - /// See also [`Parser::parse_sql`] - /// - /// Example: - /// ``` - /// # use sqlparser::{parser::{Parser, ParserError}, dialect::GenericDialect}; - /// # fn main() -> Result<(), ParserError> { - /// let dialect = GenericDialect{}; - /// let statements = Parser::new(&dialect) - /// .try_with_sql("SELECT * FROM foo")? - /// .parse_statements()?; - /// # Ok(()) - /// # } - /// ``` - pub fn new(dialect: &'a dyn Dialect) -> Self { - Self { - tokens: ::alloc::vec::Vec::new(), - index: 0, - state: ParserState::Normal, - dialect, - recursion_counter: RecursionCounter::new(DEFAULT_REMAINING_DEPTH), - options: ParserOptions::new() - .with_trailing_commas(dialect.supports_trailing_commas()), - } - } - /// 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: - /// ``` - /// # use sqlparser::{parser::{Parser, ParserError}, dialect::GenericDialect}; - /// # fn main() -> Result<(), ParserError> { - /// 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)); - /// # Ok(()) - /// # } - /// ``` - /// - /// Note: when "recursive-protection" feature is enabled, this crate uses additional stack overflow protection - pub fn with_recursion_limit(mut self, recursion_limit: usize) -> Self { - self.recursion_counter = RecursionCounter::new(recursion_limit); - self - } - /// 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: - /// ``` - /// # use sqlparser::{parser::{Parser, ParserError, ParserOptions}, dialect::GenericDialect}; - /// # fn main() -> Result<(), ParserError> { - /// 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(_))); - /// # Ok(()) - /// # } - /// ``` - pub fn with_options(mut self, options: ParserOptions) -> Self { - self.options = options; - self - } - /// Reset this parser to parse the specified token stream - pub fn with_tokens_with_locations(mut self, tokens: Vec) -> Self { - self.tokens = tokens; - self.index = 0; - self - } - /// Reset this parser state to parse the specified tokens - pub fn with_tokens(self, tokens: Vec) -> Self { - let tokens_with_locations: Vec = tokens - .into_iter() - .map(|token| TokenWithSpan { - token, - span: Span::empty(), - }) - .collect(); - self.with_tokens_with_locations(tokens_with_locations) - } - /// 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 - pub fn try_with_sql(self, sql: &str) -> Result { - { - let lvl = ::log::Level::Debug; - if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() { - ::log::__private_api::log( - format_args!("Parsing sql \'{0}\'...", sql), - lvl, - &( - "sqlparser::parser", - "sqlparser::parser", - ::log::__private_api::loc(), - ), - (), - ); - } - }; - let tokens = Tokenizer::new(self.dialect, sql) - .with_unescape(self.options.unescape) - .tokenize_with_location()?; - Ok(self.with_tokens_with_locations(tokens)) - } - /// Parse potentially multiple statements - /// - /// Example - /// ``` - /// # use sqlparser::{parser::{Parser, ParserError}, dialect::GenericDialect}; - /// # fn main() -> Result<(), ParserError> { - /// 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); - /// # Ok(()) - /// # } - /// ``` - pub fn parse_statements(&mut self) -> Result, ParserError> { - let mut stmts = Vec::new(); - let mut expecting_statement_delimiter = false; - loop { - while self.consume_token(&Token::SemiColon) { - expecting_statement_delimiter = false; - } - match self.peek_token().token { - Token::EOF => break, - Token::Word(word) => { - if expecting_statement_delimiter && word.keyword == Keyword::END - { - break; - } - } - _ => {} - } - if expecting_statement_delimiter { - return self.expected("end of statement", self.peek_token()); - } - let statement = self.parse_statement()?; - stmts.push(statement); - expecting_statement_delimiter = true; - } - Ok(stmts) - } - /// Convenience method to parse a string with one or more SQL - /// statements into produce an Abstract Syntax Tree (AST). - /// - /// Example - /// ``` - /// # use sqlparser::{parser::{Parser, ParserError}, dialect::GenericDialect}; - /// # fn main() -> Result<(), ParserError> { - /// let dialect = GenericDialect{}; - /// let statements = Parser::parse_sql( - /// &dialect, "SELECT * FROM foo" - /// )?; - /// assert_eq!(statements.len(), 1); - /// # Ok(()) - /// # } - /// ``` - pub fn parse_sql( - dialect: &dyn Dialect, - sql: &str, - ) -> Result, ParserError> { - Parser::new(dialect).try_with_sql(sql)?.parse_statements() - } - /// Parse a single top-level statement (such as SELECT, INSERT, CREATE, etc.), - /// stopping before the statement separator, if any. - pub fn parse_statement(&mut self) -> Result { - let _guard = self.recursion_counter.try_decrease()?; - if let Some(statement) = self.dialect.parse_statement(self) { - return statement; - } - let next_token = self.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::KILL => self.parse_kill(), - Keyword::FLUSH => self.parse_flush(), - Keyword::DESC => self.parse_explain(DescribeAlias::Desc), - Keyword::DESCRIBE => self.parse_explain(DescribeAlias::Describe), - Keyword::EXPLAIN => self.parse_explain(DescribeAlias::Explain), - Keyword::ANALYZE => self.parse_analyze(), - Keyword::SELECT | Keyword::WITH | Keyword::VALUES => { - self.prev_token(); - self.parse_query().map(Statement::Query) - } - Keyword::TRUNCATE => self.parse_truncate(), - Keyword::ATTACH => { - if (self.dialect.is::()) { - self.parse_attach_duckdb_database() - } else { - self.parse_attach_database() - } - } - Keyword::DETACH if (self.dialect.is::() - || self.dialect.is::()) => { - self.parse_detach_duckdb_database() - } - Keyword::MSCK => self.parse_msck(), - Keyword::CREATE => self.parse_create(), - Keyword::CACHE => self.parse_cache_table(), - Keyword::DROP => self.parse_drop(), - Keyword::DISCARD => self.parse_discard(), - Keyword::DECLARE => self.parse_declare(), - Keyword::FETCH => self.parse_fetch_statement(), - Keyword::DELETE => self.parse_delete(), - Keyword::INSERT => self.parse_insert(), - Keyword::REPLACE => self.parse_replace(), - Keyword::UNCACHE => self.parse_uncache_table(), - Keyword::UPDATE => self.parse_update(), - Keyword::ALTER => self.parse_alter(), - Keyword::CALL => self.parse_call(), - Keyword::COPY => self.parse_copy(), - Keyword::CLOSE => self.parse_close(), - Keyword::SET => self.parse_set(), - Keyword::SHOW => self.parse_show(), - Keyword::USE => self.parse_use(), - Keyword::GRANT => self.parse_grant(), - Keyword::REVOKE => self.parse_revoke(), - Keyword::START => self.parse_start_transaction(), - Keyword::BEGIN => self.parse_begin(), - Keyword::END => self.parse_end(), - Keyword::SAVEPOINT => self.parse_savepoint(), - Keyword::RELEASE => self.parse_release(), - Keyword::COMMIT => self.parse_commit(), - Keyword::RAISERROR => Ok(self.parse_raiserror()?), - Keyword::ROLLBACK => self.parse_rollback(), - Keyword::ASSERT => self.parse_assert(), - Keyword::DEALLOCATE => self.parse_deallocate(), - Keyword::EXECUTE | Keyword::EXEC => self.parse_execute(), - Keyword::PREPARE => self.parse_prepare(), - Keyword::MERGE => self.parse_merge(), - Keyword::LISTEN if self.dialect.supports_listen_notify() => { - self.parse_listen() - } - Keyword::UNLISTEN if self.dialect.supports_listen_notify() => { - self.parse_unlisten() - } - Keyword::NOTIFY if self.dialect.supports_listen_notify() => { - self.parse_notify() - } - Keyword::PRAGMA => self.parse_pragma(), - Keyword::UNLOAD => self.parse_unload(), - Keyword::RENAME => self.parse_rename(), - Keyword::INSTALL if (self.dialect.is::() - || self.dialect.is::()) => { - self.parse_install() - } - Keyword::LOAD => self.parse_load(), - Keyword::OPTIMIZE if (self.dialect.is::() - || self.dialect.is::()) => { - self.parse_optimize_table() - } - Keyword::COMMENT if self.dialect.supports_comment_on() => { - self.parse_comment() - } - _ => self.expected("an SQL statement", next_token), - } - } - Token::LParen => { - self.prev_token(); - self.parse_query().map(Statement::Query) - } - _ => self.expected("an SQL statement", next_token), - } - } - pub fn parse_comment(&mut self) -> Result { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - self.expect_keyword_is(Keyword::ON)?; - let token = self.next_token(); - let (object_type, object_name) = match token.token { - Token::Word(w) if w.keyword == Keyword::COLUMN => { - (CommentObject::Column, self.parse_object_name(false)?) - } - Token::Word(w) if w.keyword == Keyword::TABLE => { - (CommentObject::Table, self.parse_object_name(false)?) - } - Token::Word(w) if w.keyword == Keyword::EXTENSION => { - (CommentObject::Extension, self.parse_object_name(false)?) - } - Token::Word(w) if w.keyword == Keyword::SCHEMA => { - (CommentObject::Schema, self.parse_object_name(false)?) - } - Token::Word(w) if w.keyword == Keyword::DATABASE => { - (CommentObject::Database, self.parse_object_name(false)?) - } - Token::Word(w) if w.keyword == Keyword::USER => { - (CommentObject::User, self.parse_object_name(false)?) - } - Token::Word(w) if w.keyword == Keyword::ROLE => { - (CommentObject::Role, self.parse_object_name(false)?) - } - _ => self.expected("comment object_type", token)?, - }; - self.expect_keyword_is(Keyword::IS)?; - let comment = if self.parse_keyword(Keyword::NULL) { - None - } else { - Some(self.parse_literal_string()?) - }; - Ok(Statement::Comment { - object_type, - object_name, - comment, - if_exists, - }) - } - pub fn parse_flush(&mut self) -> Result { - let mut channel = None; - let mut tables: Vec = ::alloc::vec::Vec::new(); - let mut read_lock = false; - let mut export = false; - if !(self.dialect.is::() - || self.dialect.is::()) - { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Unsupported statement FLUSH", - self.peek_token().span.start, - ), - ); - res - }), - ), - ); - } - let location = if self.parse_keyword(Keyword::NO_WRITE_TO_BINLOG) { - Some(FlushLocation::NoWriteToBinlog) - } else if self.parse_keyword(Keyword::LOCAL) { - Some(FlushLocation::Local) - } else { - None - }; - let object_type = if self.parse_keywords(&[Keyword::BINARY, Keyword::LOGS]) { - FlushType::BinaryLogs - } else if self.parse_keywords(&[Keyword::ENGINE, Keyword::LOGS]) { - FlushType::EngineLogs - } else if self.parse_keywords(&[Keyword::ERROR, Keyword::LOGS]) { - FlushType::ErrorLogs - } else if self.parse_keywords(&[Keyword::GENERAL, Keyword::LOGS]) { - FlushType::GeneralLogs - } else if self.parse_keywords(&[Keyword::HOSTS]) { - FlushType::Hosts - } else if self.parse_keyword(Keyword::PRIVILEGES) { - FlushType::Privileges - } else if self.parse_keyword(Keyword::OPTIMIZER_COSTS) { - FlushType::OptimizerCosts - } else if self.parse_keywords(&[Keyword::RELAY, Keyword::LOGS]) { - if self.parse_keywords(&[Keyword::FOR, Keyword::CHANNEL]) { - channel = Some(self.parse_object_name(false).unwrap().to_string()); - } - FlushType::RelayLogs - } else if self.parse_keywords(&[Keyword::SLOW, Keyword::LOGS]) { - FlushType::SlowLogs - } else if self.parse_keyword(Keyword::STATUS) { - FlushType::Status - } else if self.parse_keyword(Keyword::USER_RESOURCES) { - FlushType::UserResources - } else if self.parse_keywords(&[Keyword::LOGS]) { - FlushType::Logs - } else if self.parse_keywords(&[Keyword::TABLES]) { - loop { - let next_token = self.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::WITH => { - read_lock = self - .parse_keywords(&[Keyword::READ, Keyword::LOCK]); - } - Keyword::FOR => { - export = self.parse_keyword(Keyword::EXPORT); - } - Keyword::NoKeyword => { - self.prev_token(); - tables = self - .parse_comma_separated(|p| p.parse_object_name(false))?; - } - _ => {} - } - } - _ => { - break; - } - } - } - FlushType::Tables - } else { - return self - .expected( - "BINARY LOGS, ENGINE LOGS, ERROR LOGS, GENERAL LOGS, HOSTS, LOGS, PRIVILEGES, OPTIMIZER_COSTS,\ - RELAY LOGS [FOR CHANNEL channel], SLOW LOGS, STATUS, USER_RESOURCES", - self.peek_token(), - ); - }; - Ok(Statement::Flush { - object_type, - location, - channel, - read_lock, - export, - tables, - }) - } - pub fn parse_msck(&mut self) -> Result { - let repair = self.parse_keyword(Keyword::REPAIR); - self.expect_keyword_is(Keyword::TABLE)?; - let table_name = self.parse_object_name(false)?; - let partition_action = self - .maybe_parse(|parser| { - let pa = match parser - .parse_one_of_keywords( - &[Keyword::ADD, Keyword::DROP, Keyword::SYNC], - ) - { - Some(Keyword::ADD) => Some(AddDropSync::ADD), - Some(Keyword::DROP) => Some(AddDropSync::DROP), - Some(Keyword::SYNC) => Some(AddDropSync::SYNC), - _ => None, - }; - parser.expect_keyword_is(Keyword::PARTITIONS)?; - Ok(pa) - })? - .unwrap_or_default(); - Ok(Statement::Msck { - repair, - table_name, - partition_action, - }) - } - pub fn parse_truncate(&mut self) -> Result { - let table = self.parse_keyword(Keyword::TABLE); - let only = self.parse_keyword(Keyword::ONLY); - let table_names = self - .parse_comma_separated(|p| p.parse_object_name(false))? - .into_iter() - .map(|n| TruncateTableTarget { name: n }) - .collect(); - let mut partitions = None; - if self.parse_keyword(Keyword::PARTITION) { - self.expect_token(&Token::LParen)?; - partitions = Some(self.parse_comma_separated(Parser::parse_expr)?); - self.expect_token(&Token::RParen)?; - } - let mut identity = None; - let mut cascade = None; - if (self.dialect.is::() - || self.dialect.is::()) - { - identity = if self.parse_keywords(&[Keyword::RESTART, Keyword::IDENTITY]) - { - Some(TruncateIdentityOption::Restart) - } else if self.parse_keywords(&[Keyword::CONTINUE, Keyword::IDENTITY]) { - Some(TruncateIdentityOption::Continue) - } else { - None - }; - cascade = self.parse_cascade_option(); - } - let on_cluster = self.parse_optional_on_cluster()?; - Ok(Statement::Truncate { - table_names, - partitions, - table, - only, - identity, - cascade, - on_cluster, - }) - } - fn parse_cascade_option(&mut self) -> Option { - if self.parse_keyword(Keyword::CASCADE) { - Some(CascadeOption::Cascade) - } else if self.parse_keyword(Keyword::RESTRICT) { - Some(CascadeOption::Restrict) - } else { - None - } - } - pub fn parse_attach_duckdb_database_options( - &mut self, - ) -> Result, ParserError> { - if !self.consume_token(&Token::LParen) { - return Ok(::alloc::vec::Vec::new()); - } - let mut options = ::alloc::vec::Vec::new(); - loop { - if self.parse_keyword(Keyword::READ_ONLY) { - let boolean = if self.parse_keyword(Keyword::TRUE) { - Some(true) - } else if self.parse_keyword(Keyword::FALSE) { - Some(false) - } else { - None - }; - options.push(AttachDuckDBDatabaseOption::ReadOnly(boolean)); - } else if self.parse_keyword(Keyword::TYPE) { - let ident = self.parse_identifier()?; - options.push(AttachDuckDBDatabaseOption::Type(ident)); - } else { - return self - .expected( - "expected one of: ), READ_ONLY, TYPE", - self.peek_token(), - ); - }; - if self.consume_token(&Token::RParen) { - return Ok(options); - } else if self.consume_token(&Token::Comma) { - continue; - } else { - return self.expected("expected one of: ')', ','", self.peek_token()); - } - } - } - pub fn parse_attach_duckdb_database( - &mut self, - ) -> Result { - let database = self.parse_keyword(Keyword::DATABASE); - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let database_path = self.parse_identifier()?; - let database_alias = if self.parse_keyword(Keyword::AS) { - Some(self.parse_identifier()?) - } else { - None - }; - let attach_options = self.parse_attach_duckdb_database_options()?; - Ok(Statement::AttachDuckDBDatabase { - if_not_exists, - database, - database_path, - database_alias, - attach_options, - }) - } - pub fn parse_detach_duckdb_database( - &mut self, - ) -> Result { - let database = self.parse_keyword(Keyword::DATABASE); - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let database_alias = self.parse_identifier()?; - Ok(Statement::DetachDuckDBDatabase { - if_exists, - database, - database_alias, - }) - } - pub fn parse_attach_database(&mut self) -> Result { - let database = self.parse_keyword(Keyword::DATABASE); - let database_file_name = self.parse_expr()?; - self.expect_keyword_is(Keyword::AS)?; - let schema_name = self.parse_identifier()?; - Ok(Statement::AttachDatabase { - database, - schema_name, - database_file_name, - }) - } - pub fn parse_analyze(&mut self) -> Result { - let has_table_keyword = self.parse_keyword(Keyword::TABLE); - let table_name = self.parse_object_name(false)?; - let mut for_columns = false; - let mut cache_metadata = false; - let mut noscan = false; - let mut partitions = None; - let mut compute_statistics = false; - let mut columns = ::alloc::vec::Vec::new(); - loop { - match self - .parse_one_of_keywords( - &[ - Keyword::PARTITION, - Keyword::FOR, - Keyword::CACHE, - Keyword::NOSCAN, - Keyword::COMPUTE, - ], - ) - { - Some(Keyword::PARTITION) => { - self.expect_token(&Token::LParen)?; - partitions = Some( - self.parse_comma_separated(Parser::parse_expr)?, - ); - self.expect_token(&Token::RParen)?; - } - Some(Keyword::NOSCAN) => noscan = true, - Some(Keyword::FOR) => { - self.expect_keyword_is(Keyword::COLUMNS)?; - columns = self - .maybe_parse(|parser| { - parser.parse_comma_separated(|p| p.parse_identifier()) - })? - .unwrap_or_default(); - for_columns = true; - } - Some(Keyword::CACHE) => { - self.expect_keyword_is(Keyword::METADATA)?; - cache_metadata = true; - } - Some(Keyword::COMPUTE) => { - self.expect_keyword_is(Keyword::STATISTICS)?; - compute_statistics = true; - } - _ => break, - } - } - Ok(Statement::Analyze { - has_table_keyword, - table_name, - for_columns, - columns, - partitions, - cache_metadata, - noscan, - compute_statistics, - }) - } - /// Parse a new expression including wildcard & qualified wildcard. - pub fn parse_wildcard_expr(&mut self) -> Result { - let index = self.index; - let next_token = self.next_token(); - match next_token.token { - t @ (Token::Word(_) | Token::SingleQuotedString(_)) => { - if self.peek_token().token == Token::Period { - let mut id_parts: Vec = <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - match t { - Token::Word(w) => w.into_ident(next_token.span), - Token::SingleQuotedString(s) => Ident::with_quote('\'', s), - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }, - ]), - ); - while self.consume_token(&Token::Period) { - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => { - id_parts.push(w.into_ident(next_token.span)) - } - Token::SingleQuotedString(s) => { - id_parts.push(Ident::with_quote('\'', s)) - } - Token::Mul => { - return Ok( - Expr::QualifiedWildcard( - ObjectName::from(id_parts), - AttachedToken(next_token), - ), - ); - } - _ => { - return self - .expected("an identifier or a '*' after '.'", next_token); - } - } - } - } - } - Token::Mul => { - return Ok(Expr::Wildcard(AttachedToken(next_token))); - } - _ => {} - }; - self.index = index; - self.parse_expr() - } - /// Parse a new expression. - pub fn parse_expr(&mut self) -> Result { - self.parse_subexpr(self.dialect.prec_unknown()) - } - /// Parse tokens until the precedence changes. - pub fn parse_subexpr(&mut self, precedence: u8) -> Result { - let _guard = self.recursion_counter.try_decrease()?; - { - let lvl = ::log::Level::Debug; - if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() { - ::log::__private_api::log( - format_args!("parsing expr"), - lvl, - &( - "sqlparser::parser", - "sqlparser::parser", - ::log::__private_api::loc(), - ), - (), - ); - } - }; - let mut expr = self.parse_prefix()?; - { - let lvl = ::log::Level::Debug; - if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() { - ::log::__private_api::log( - format_args!("prefix: {0:?}", expr), - lvl, - &( - "sqlparser::parser", - "sqlparser::parser", - ::log::__private_api::loc(), - ), - (), - ); - } - }; - loop { - let next_precedence = self.get_next_precedence()?; - { - let lvl = ::log::Level::Debug; - if lvl <= ::log::STATIC_MAX_LEVEL && lvl <= ::log::max_level() { - ::log::__private_api::log( - format_args!("next precedence: {0:?}", next_precedence), - lvl, - &( - "sqlparser::parser", - "sqlparser::parser", - ::log::__private_api::loc(), - ), - (), - ); - } - }; - if precedence >= next_precedence { - break; - } - expr = self.parse_infix(expr, next_precedence)?; - } - Ok(expr) - } - pub fn parse_assert(&mut self) -> Result { - let condition = self.parse_expr()?; - let message = if self.parse_keyword(Keyword::AS) { - Some(self.parse_expr()?) - } else { - None - }; - Ok(Statement::Assert { - condition, - message, - }) - } - pub fn parse_savepoint(&mut self) -> Result { - let name = self.parse_identifier()?; - Ok(Statement::Savepoint { name }) - } - pub fn parse_release(&mut self) -> Result { - let _ = self.parse_keyword(Keyword::SAVEPOINT); - let name = self.parse_identifier()?; - Ok(Statement::ReleaseSavepoint { - name, - }) - } - pub fn parse_listen(&mut self) -> Result { - let channel = self.parse_identifier()?; - Ok(Statement::LISTEN { channel }) - } - pub fn parse_unlisten(&mut self) -> Result { - let channel = if self.consume_token(&Token::Mul) { - Ident::new(Expr::Wildcard(AttachedToken::empty()).to_string()) - } else { - match self.parse_identifier() { - Ok(expr) => expr, - _ => { - self.prev_token(); - return self - .expected("wildcard or identifier", self.peek_token()); - } - } - }; - Ok(Statement::UNLISTEN { channel }) - } - pub fn parse_notify(&mut self) -> Result { - let channel = self.parse_identifier()?; - let payload = if self.consume_token(&Token::Comma) { - Some(self.parse_literal_string()?) - } else { - None - }; - Ok(Statement::NOTIFY { - channel, - payload, - }) - } - /// Parses a `RENAME TABLE` statement. See [Statement::RenameTable] - pub fn parse_rename(&mut self) -> Result { - if self.peek_keyword(Keyword::TABLE) { - self.expect_keyword(Keyword::TABLE)?; - let rename_tables = self - .parse_comma_separated(|parser| { - let old_name = parser.parse_object_name(false)?; - parser.expect_keyword(Keyword::TO)?; - let new_name = parser.parse_object_name(false)?; - Ok(RenameTable { old_name, new_name }) - })?; - Ok(Statement::RenameTable(rename_tables)) - } else { - self.expected("KEYWORD `TABLE` after RENAME", self.peek_token()) - } - } - fn parse_expr_prefix_by_reserved_word( - &mut self, - w: &Word, - w_span: Span, - ) -> Result, ParserError> { - match w.keyword { - Keyword::TRUE - | Keyword::FALSE if self.dialect.supports_boolean_literals() => { - self.prev_token(); - Ok(Some(Expr::Value(self.parse_value()?))) - } - Keyword::NULL => { - self.prev_token(); - Ok(Some(Expr::Value(self.parse_value()?))) - } - Keyword::CURRENT_CATALOG - | Keyword::CURRENT_USER - | Keyword::SESSION_USER - | Keyword::USER if (self.dialect.is::() - || self.dialect.is::()) => { - Ok( - Some( - Expr::Function(Function { - name: ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([w.clone().into_ident(w_span)]), - ), - ), - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args: FunctionArguments::None, - null_treatment: None, - filter: None, - over: None, - within_group: ::alloc::vec::Vec::new(), - }), - ), - ) - } - Keyword::CURRENT_TIMESTAMP - | Keyword::CURRENT_TIME - | Keyword::CURRENT_DATE - | Keyword::LOCALTIME - | Keyword::LOCALTIMESTAMP => { - Ok( - Some( - self - .parse_time_functions( - ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([w.clone().into_ident(w_span)]), - ), - ), - )?, - ), - ) - } - Keyword::CASE => Ok(Some(self.parse_case_expr()?)), - Keyword::CONVERT => Ok(Some(self.parse_convert_expr(false)?)), - Keyword::TRY_CONVERT if self.dialect.supports_try_convert() => { - Ok(Some(self.parse_convert_expr(true)?)) - } - Keyword::CAST => Ok(Some(self.parse_cast_expr(CastKind::Cast)?)), - Keyword::TRY_CAST => Ok(Some(self.parse_cast_expr(CastKind::TryCast)?)), - Keyword::SAFE_CAST => Ok(Some(self.parse_cast_expr(CastKind::SafeCast)?)), - Keyword::EXISTS if !(self.dialect.is::()) - || match self.peek_nth_token_ref(1).token { - Token::Word( - Word { keyword: Keyword::SELECT | Keyword::WITH, .. }, - ) => true, - _ => false, - } => Ok(Some(self.parse_exists_expr(false)?)), - Keyword::EXTRACT => Ok(Some(self.parse_extract_expr()?)), - Keyword::CEIL => Ok(Some(self.parse_ceil_floor_expr(true)?)), - Keyword::FLOOR => Ok(Some(self.parse_ceil_floor_expr(false)?)), - Keyword::POSITION if self.peek_token_ref().token == Token::LParen => { - Ok(Some(self.parse_position_expr(w.clone().into_ident(w_span))?)) - } - Keyword::SUBSTRING => Ok(Some(self.parse_substring_expr()?)), - Keyword::OVERLAY => Ok(Some(self.parse_overlay_expr()?)), - Keyword::TRIM => Ok(Some(self.parse_trim_expr()?)), - Keyword::INTERVAL => Ok(Some(self.parse_interval()?)), - Keyword::ARRAY if *self.peek_token_ref() == Token::LBracket => { - self.expect_token(&Token::LBracket)?; - Ok(Some(self.parse_array_expr(true)?)) - } - Keyword::ARRAY if self.peek_token() == Token::LParen - && !(self.dialect.is::() - || self.dialect.is::()) => { - self.expect_token(&Token::LParen)?; - let query = self.parse_query()?; - self.expect_token(&Token::RParen)?; - Ok( - Some( - Expr::Function(Function { - name: ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([w.clone().into_ident(w_span)]), - ), - ), - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args: FunctionArguments::Subquery(query), - filter: None, - null_treatment: None, - over: None, - within_group: ::alloc::vec::Vec::new(), - }), - ), - ) - } - Keyword::NOT => Ok(Some(self.parse_not()?)), - Keyword::MATCH if (self.dialect.is::() - || self.dialect.is::()) => { - Ok(Some(self.parse_match_against()?)) - } - Keyword::STRUCT if self.dialect.supports_struct_literal() => { - let struct_expr = self.parse_struct_literal()?; - Ok( - Some( - self - .parse_compound_field_access( - struct_expr, - ::alloc::vec::Vec::new(), - )?, - ), - ) - } - Keyword::PRIOR if match self.state { - ParserState::ConnectBy => true, - _ => false, - } => { - let expr = self - .parse_subexpr(self.dialect.prec_value(Precedence::PlusMinus))?; - Ok(Some(Expr::Prior(Box::new(expr)))) - } - Keyword::MAP if *self.peek_token_ref() == Token::LBrace - && self.dialect.support_map_literal_syntax() => { - Ok(Some(self.parse_duckdb_map_literal()?)) - } - _ => Ok(None), - } - } - fn parse_expr_prefix_by_unreserved_word( - &mut self, - w: &Word, - w_span: Span, - ) -> Result { - match self.peek_token().token { - Token::Period => { - self.parse_compound_field_access( - Expr::Identifier(w.clone().into_ident(w_span)), - ::alloc::vec::Vec::new(), - ) - } - Token::LParen => { - let id_parts = <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([w.clone().into_ident(w_span)]), - ); - if let Some(expr) = self.parse_outer_join_expr(&id_parts) { - Ok(expr) - } else { - let mut expr = self.parse_function(ObjectName::from(id_parts))?; - expr = self.try_parse_method(expr)?; - let fields = ::alloc::vec::Vec::new(); - self.parse_compound_field_access(expr, fields) - } - } - Token::LBracket if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) => { - let ident = Expr::Identifier(w.clone().into_ident(w_span)); - let mut fields = ::alloc::vec::Vec::new(); - self.parse_multi_dim_subscript(&mut fields)?; - self.parse_compound_field_access(ident, fields) - } - Token::SingleQuotedString(_) - | Token::DoubleQuotedString(_) - | Token::HexStringLiteral(_) if w.value.starts_with('_') => { - Ok(Expr::IntroducedString { - introducer: w.value.clone(), - value: self.parse_introduced_string_value()?, - }) - } - Token::SingleQuotedString(_) - | Token::DoubleQuotedString(_) - | Token::HexStringLiteral(_) if w.value.starts_with('_') => { - Ok(Expr::IntroducedString { - introducer: w.value.clone(), - value: self.parse_introduced_string_value()?, - }) - } - Token::Arrow if self.dialect.supports_lambda_functions() => { - self.expect_token(&Token::Arrow)?; - Ok( - Expr::Lambda(LambdaFunction { - params: OneOrManyWithParens::One( - w.clone().into_ident(w_span), - ), - body: Box::new(self.parse_expr()?), - }), - ) - } - _ => Ok(Expr::Identifier(w.clone().into_ident(w_span))), - } - } - /// Parse an expression prefix. - pub fn parse_prefix(&mut self) -> Result { - if let Some(prefix) = self.dialect.parse_prefix(self) { - return prefix; - } - let loc = self.peek_token_ref().span.start; - let opt_expr = self - .maybe_parse(|parser| { - match parser.parse_data_type()? { - DataType::Interval => parser.parse_interval(), - DataType::Custom(..) => { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "dummy", loc), - ); - res - }), - ), - ) - } - data_type => { - Ok(Expr::TypedString { - data_type, - value: parser.parse_value()?, - }) - } - } - })?; - if let Some(expr) = opt_expr { - return Ok(expr); - } - let dialect = self.dialect; - self.advance_token(); - let next_token_index = self.get_current_index(); - let next_token = self.get_current_token(); - let span = next_token.span; - let expr = match &next_token.token { - Token::Word(w) => { - let w = w.clone(); - match self - .try_parse(|parser| { - parser.parse_expr_prefix_by_reserved_word(&w, span) - }) - { - Ok(Some(expr)) => Ok(expr), - Ok(None) => { - Ok(self.parse_expr_prefix_by_unreserved_word(&w, span)?) - } - Err(e) => { - if !self.dialect.is_reserved_for_identifier(w.keyword) { - if let Ok(Some(expr)) = self - .maybe_parse(|parser| { - parser.parse_expr_prefix_by_unreserved_word(&w, span) - }) - { - return Ok(expr); - } - } - return Err(e); - } - } - } - Token::LBracket => self.parse_array_expr(false), - tok @ Token::Minus | tok @ Token::Plus => { - let op = if *tok == Token::Plus { - UnaryOperator::Plus - } else { - UnaryOperator::Minus - }; - Ok(Expr::UnaryOp { - op, - expr: Box::new( - self - .parse_subexpr( - self.dialect.prec_value(Precedence::MulDivModOp), - )?, - ), - }) - } - Token::ExclamationMark if dialect.supports_bang_not_operator() => { - Ok(Expr::UnaryOp { - op: UnaryOperator::BangNot, - expr: Box::new( - self - .parse_subexpr( - self.dialect.prec_value(Precedence::UnaryNot), - )?, - ), - }) - } - tok @ Token::DoubleExclamationMark - | tok @ Token::PGSquareRoot - | tok @ Token::PGCubeRoot - | tok @ Token::AtSign - | tok @ Token::Tilde if (dialect.is::()) => { - let op = match tok { - Token::DoubleExclamationMark => UnaryOperator::PGPrefixFactorial, - Token::PGSquareRoot => UnaryOperator::PGSquareRoot, - Token::PGCubeRoot => UnaryOperator::PGCubeRoot, - Token::AtSign => UnaryOperator::PGAbs, - Token::Tilde => UnaryOperator::PGBitwiseNot, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }; - Ok(Expr::UnaryOp { - op, - expr: Box::new( - self - .parse_subexpr( - self.dialect.prec_value(Precedence::PlusMinus), - )?, - ), - }) - } - Token::EscapedStringLiteral( - _, - ) if (dialect.is::() - || dialect.is::()) => { - self.prev_token(); - Ok(Expr::Value(self.parse_value()?)) - } - Token::UnicodeStringLiteral(_) => { - self.prev_token(); - Ok(Expr::Value(self.parse_value()?)) - } - Token::Number(_, _) - | Token::SingleQuotedString(_) - | Token::DoubleQuotedString(_) - | Token::TripleSingleQuotedString(_) - | Token::TripleDoubleQuotedString(_) - | Token::DollarQuotedString(_) - | Token::SingleQuotedByteStringLiteral(_) - | Token::DoubleQuotedByteStringLiteral(_) - | Token::TripleSingleQuotedByteStringLiteral(_) - | Token::TripleDoubleQuotedByteStringLiteral(_) - | Token::SingleQuotedRawStringLiteral(_) - | Token::DoubleQuotedRawStringLiteral(_) - | Token::TripleSingleQuotedRawStringLiteral(_) - | Token::TripleDoubleQuotedRawStringLiteral(_) - | Token::NationalStringLiteral(_) - | Token::HexStringLiteral(_) => { - self.prev_token(); - Ok(Expr::Value(self.parse_value()?)) - } - Token::LParen => { - let expr = if let Some(expr) = self.try_parse_expr_sub_query()? { - expr - } else if let Some(lambda) = self.try_parse_lambda()? { - return Ok(lambda); - } else { - let exprs = self.parse_comma_separated(Parser::parse_expr)?; - match exprs.len() { - 0 => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - 1 => { - Expr::Nested(Box::new(exprs.into_iter().next().unwrap())) - } - _ => Expr::Tuple(exprs), - } - }; - self.expect_token(&Token::RParen)?; - let expr = self.try_parse_method(expr)?; - if !self.consume_token(&Token::Period) { - Ok(expr) - } else { - let tok = self.next_token(); - let key = match tok.token { - Token::Word(word) => word.into_ident(tok.span), - _ => { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expected identifier, found: {0}", tok), - ); - res - }), - tok.span.start, - ), - ); - res - }), - ), - ); - } - }; - Ok(Expr::CompositeAccess { - expr: Box::new(expr), - key, - }) - } - } - Token::Placeholder(_) | Token::Colon | Token::AtSign => { - self.prev_token(); - Ok(Expr::Value(self.parse_value()?)) - } - Token::LBrace => { - self.prev_token(); - self.parse_lbrace_expr() - } - _ => self.expected_at("an expression", next_token_index), - }?; - let expr = self.try_parse_method(expr)?; - if self.parse_keyword(Keyword::COLLATE) { - Ok(Expr::Collate { - expr: Box::new(expr), - collation: self.parse_object_name(false)?, - }) - } else { - Ok(expr) - } - } - /// Try to parse an [Expr::CompoundFieldAccess] like `a.b.c` or `a.b[1].c`. - /// If all the fields are `Expr::Identifier`s, return an [Expr::CompoundIdentifier] instead. - /// If only the root exists, return the root. - /// If self supports [Dialect::supports_partiql], it will fall back when occurs [Token::LBracket] for JsonAccess parsing. - pub fn parse_compound_field_access( - &mut self, - root: Expr, - mut chain: Vec, - ) -> Result { - let mut ending_wildcard: Option = None; - let mut ending_lbracket = false; - while self.consume_token(&Token::Period) { - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => { - let expr = Expr::Identifier(w.into_ident(next_token.span)); - chain.push(AccessExpr::Dot(expr)); - if self.peek_token().token == Token::LBracket { - if self.dialect.supports_partiql() { - self.next_token(); - ending_lbracket = true; - break; - } else { - self.parse_multi_dim_subscript(&mut chain)? - } - } - } - Token::Mul => { - if (self.dialect.is::()) { - ending_wildcard = Some(next_token); - } else { - self.prev_token(); - self.prev_token(); - } - break; - } - Token::SingleQuotedString(s) => { - let expr = Expr::Identifier(Ident::with_quote('\'', s)); - chain.push(AccessExpr::Dot(expr)); - } - _ => { - return self - .expected("an identifier or a '*' after '.'", next_token); - } - } - } - if self.dialect.supports_partiql() && ending_lbracket { - self.prev_token(); - } - if let Some(wildcard_token) = ending_wildcard { - if !Self::is_all_ident(&root, &chain) { - return self - .expected("an identifier or a '*' after '.'", self.peek_token()); - } - Ok( - Expr::QualifiedWildcard( - ObjectName::from(Self::exprs_to_idents(root, chain)?), - AttachedToken(wildcard_token), - ), - ) - } else if self.peek_token().token == Token::LParen { - if !Self::is_all_ident(&root, &chain) { - self.next_token(); - return self - .expected("an identifier or a '*' after '.'", self.peek_token()); - } - let id_parts = Self::exprs_to_idents(root, chain)?; - if let Some(expr) = self.parse_outer_join_expr(&id_parts) { - Ok(expr) - } else { - self.parse_function(ObjectName::from(id_parts)) - } - } else if chain.is_empty() { - Ok(root) - } else { - if Self::is_all_ident(&root, &chain) { - return Ok( - Expr::CompoundIdentifier(Self::exprs_to_idents(root, chain)?), - ); - } - Ok(Expr::CompoundFieldAccess { - root: Box::new(root), - access_chain: chain, - }) - } - } - /// Check if the root is an identifier and all fields are identifiers. - fn is_all_ident(root: &Expr, fields: &[AccessExpr]) -> bool { - if !match root { - Expr::Identifier(_) => true, - _ => false, - } { - return false; - } - fields - .iter() - .all(|x| match x { - AccessExpr::Dot(Expr::Identifier(_)) => true, - _ => false, - }) - } - /// Convert a root and a list of fields to a list of identifiers. - fn exprs_to_idents( - root: Expr, - fields: Vec, - ) -> Result, ParserError> { - let mut idents = ::alloc::vec::Vec::new(); - if let Expr::Identifier(root) = root { - idents.push(root); - for x in fields { - if let AccessExpr::Dot(Expr::Identifier(ident)) = x { - idents.push(ident); - } else { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expected identifier, found: {0}", x), - ); - res - }), - x.span().start, - ), - ); - res - }), - ), - ); - } - } - Ok(idents) - } else { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expected identifier, found: {0}", root), - ); - res - }), - root.span().start, - ), - ); - res - }), - ), - ) - } - } - /// Try to parse OuterJoin expression `(+)` - fn parse_outer_join_expr(&mut self, id_parts: &[Ident]) -> Option { - if (self.dialect.is::() - || self.dialect.is::()) - && self.consume_tokens(&[Token::LParen, Token::Plus, Token::RParen]) - { - Some( - Expr::OuterJoin( - Box::new( - match <[Ident; 1]>::try_from(id_parts.to_vec()) { - Ok([ident]) => Expr::Identifier(ident), - Err(parts) => Expr::CompoundIdentifier(parts), - }, - ), - ), - ) - } else { - None - } - } - pub fn parse_utility_options( - &mut self, - ) -> Result, ParserError> { - self.expect_token(&Token::LParen)?; - let options = self.parse_comma_separated(Self::parse_utility_option)?; - self.expect_token(&Token::RParen)?; - Ok(options) - } - fn parse_utility_option(&mut self) -> Result { - let name = self.parse_identifier()?; - let next_token = self.peek_token(); - if next_token == Token::Comma || next_token == Token::RParen { - return Ok(UtilityOption { name, arg: None }); - } - let arg = self.parse_expr()?; - Ok(UtilityOption { - name, - arg: Some(arg), - }) - } - fn try_parse_expr_sub_query(&mut self) -> Result, ParserError> { - if !self.peek_sub_query() { - return Ok(None); - } - Ok(Some(Expr::Subquery(self.parse_query()?))) - } - fn try_parse_lambda(&mut self) -> Result, ParserError> { - if !self.dialect.supports_lambda_functions() { - return Ok(None); - } - self.maybe_parse(|p| { - let params = p.parse_comma_separated(|p| p.parse_identifier())?; - p.expect_token(&Token::RParen)?; - p.expect_token(&Token::Arrow)?; - let expr = p.parse_expr()?; - Ok( - Expr::Lambda(LambdaFunction { - params: OneOrManyWithParens::Many(params), - body: Box::new(expr), - }), - ) - }) - } - /// Parses method call expression - fn try_parse_method(&mut self, expr: Expr) -> Result { - if !self.dialect.supports_methods() { - return Ok(expr); - } - let method_chain = self - .maybe_parse(|p| { - let mut method_chain = Vec::new(); - while p.consume_token(&Token::Period) { - let tok = p.next_token(); - let name = match tok.token { - Token::Word(word) => word.into_ident(tok.span), - _ => return p.expected("identifier", tok), - }; - let func = match p - .parse_function( - ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([name]), - ), - ), - )? - { - Expr::Function(func) => func, - _ => return p.expected("function", p.peek_token()), - }; - method_chain.push(func); - } - if !method_chain.is_empty() { - Ok(method_chain) - } else { - p.expected("function", p.peek_token()) - } - })?; - if let Some(method_chain) = method_chain { - Ok( - Expr::Method(Method { - expr: Box::new(expr), - method_chain, - }), - ) - } else { - Ok(expr) - } - } - /// Tries to parse the body of an [ODBC function] call. - /// i.e. without the enclosing braces - /// - /// ```sql - /// fn myfunc(1,2,3) - /// ``` - /// - /// [ODBC function]: https://learn.microsoft.com/en-us/sql/odbc/reference/develop-app/scalar-function-calls?view=sql-server-2017 - fn maybe_parse_odbc_fn_body(&mut self) -> Result, ParserError> { - self.maybe_parse(|p| { - p.expect_keyword(Keyword::FN)?; - let fn_name = p.parse_object_name(false)?; - let mut fn_call = p.parse_function_call(fn_name)?; - fn_call.uses_odbc_syntax = true; - Ok(Expr::Function(fn_call)) - }) - } - pub fn parse_function(&mut self, name: ObjectName) -> Result { - self.parse_function_call(name).map(Expr::Function) - } - fn parse_function_call( - &mut self, - name: ObjectName, - ) -> Result { - self.expect_token(&Token::LParen)?; - if (self.dialect.is::()) && self.peek_sub_query() { - let subquery = self.parse_query()?; - self.expect_token(&Token::RParen)?; - return Ok(Function { - name, - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args: FunctionArguments::Subquery(subquery), - filter: None, - null_treatment: None, - over: None, - within_group: ::alloc::vec::Vec::new(), - }); - } - let mut args = self.parse_function_argument_list()?; - let mut parameters = FunctionArguments::None; - if (self.dialect.is::() - || self.dialect.is::()) - && self.consume_token(&Token::LParen) - { - parameters = FunctionArguments::List(args); - args = self.parse_function_argument_list()?; - } - let within_group = if self.parse_keywords(&[Keyword::WITHIN, Keyword::GROUP]) - { - self.expect_token(&Token::LParen)?; - self.expect_keywords(&[Keyword::ORDER, Keyword::BY])?; - let order_by = self.parse_comma_separated(Parser::parse_order_by_expr)?; - self.expect_token(&Token::RParen)?; - order_by - } else { - ::alloc::vec::Vec::new() - }; - let filter = if self.dialect.supports_filter_during_aggregation() - && self.parse_keyword(Keyword::FILTER) - && self.consume_token(&Token::LParen) - && self.parse_keyword(Keyword::WHERE) - { - let filter = Some(Box::new(self.parse_expr()?)); - self.expect_token(&Token::RParen)?; - filter - } else { - None - }; - let null_treatment = if args - .clauses - .iter() - .all(|clause| { - !match clause { - FunctionArgumentClause::IgnoreOrRespectNulls(_) => true, - _ => false, - } - }) - { - self.parse_null_treatment()? - } else { - None - }; - let over = if self.parse_keyword(Keyword::OVER) { - if self.consume_token(&Token::LParen) { - let window_spec = self.parse_window_spec()?; - Some(WindowType::WindowSpec(window_spec)) - } else { - Some(WindowType::NamedWindow(self.parse_identifier()?)) - } - } else { - None - }; - Ok(Function { - name, - uses_odbc_syntax: false, - parameters, - args: FunctionArguments::List(args), - null_treatment, - filter, - over, - within_group, - }) - } - /// Optionally parses a null treatment clause. - fn parse_null_treatment( - &mut self, - ) -> Result, ParserError> { - match self.parse_one_of_keywords(&[Keyword::RESPECT, Keyword::IGNORE]) { - Some(keyword) => { - self.expect_keyword_is(Keyword::NULLS)?; - Ok( - match keyword { - Keyword::RESPECT => Some(NullTreatment::RespectNulls), - Keyword::IGNORE => Some(NullTreatment::IgnoreNulls), - _ => None, - }, - ) - } - None => Ok(None), - } - } - pub fn parse_time_functions( - &mut self, - name: ObjectName, - ) -> Result { - let args = if self.consume_token(&Token::LParen) { - FunctionArguments::List(self.parse_function_argument_list()?) - } else { - FunctionArguments::None - }; - Ok( - Expr::Function(Function { - name, - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args, - filter: None, - over: None, - null_treatment: None, - within_group: ::alloc::vec::Vec::new(), - }), - ) - } - pub fn parse_window_frame_units( - &mut self, - ) -> Result { - let next_token = self.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::ROWS => Ok(WindowFrameUnits::Rows), - Keyword::RANGE => Ok(WindowFrameUnits::Range), - Keyword::GROUPS => Ok(WindowFrameUnits::Groups), - _ => self.expected("ROWS, RANGE, GROUPS", next_token)?, - } - } - _ => self.expected("ROWS, RANGE, GROUPS", next_token), - } - } - pub fn parse_window_frame(&mut self) -> Result { - let units = self.parse_window_frame_units()?; - let (start_bound, end_bound) = if self.parse_keyword(Keyword::BETWEEN) { - let start_bound = self.parse_window_frame_bound()?; - self.expect_keyword_is(Keyword::AND)?; - let end_bound = Some(self.parse_window_frame_bound()?); - (start_bound, end_bound) - } else { - (self.parse_window_frame_bound()?, None) - }; - Ok(WindowFrame { - units, - start_bound, - end_bound, - }) - } - /// Parse `CURRENT ROW` or `{ | UNBOUNDED } { PRECEDING | FOLLOWING }` - pub fn parse_window_frame_bound( - &mut self, - ) -> Result { - if self.parse_keywords(&[Keyword::CURRENT, Keyword::ROW]) { - Ok(WindowFrameBound::CurrentRow) - } else { - let rows = if self.parse_keyword(Keyword::UNBOUNDED) { - None - } else { - Some( - Box::new( - match self.peek_token().token { - Token::SingleQuotedString(_) => self.parse_interval()?, - _ => self.parse_expr()?, - }, - ), - ) - }; - if self.parse_keyword(Keyword::PRECEDING) { - Ok(WindowFrameBound::Preceding(rows)) - } else if self.parse_keyword(Keyword::FOLLOWING) { - Ok(WindowFrameBound::Following(rows)) - } else { - self.expected("PRECEDING or FOLLOWING", self.peek_token()) - } - } - } - /// Parse a group by expr. Group by expr can be one of group sets, roll up, cube, or simple expr. - fn parse_group_by_expr(&mut self) -> Result { - if self.dialect.supports_group_by_expr() { - if self.parse_keywords(&[Keyword::GROUPING, Keyword::SETS]) { - self.expect_token(&Token::LParen)?; - let result = self - .parse_comma_separated(|p| p.parse_tuple(false, true))?; - self.expect_token(&Token::RParen)?; - Ok(Expr::GroupingSets(result)) - } else if self.parse_keyword(Keyword::CUBE) { - self.expect_token(&Token::LParen)?; - let result = self - .parse_comma_separated(|p| p.parse_tuple(true, true))?; - self.expect_token(&Token::RParen)?; - Ok(Expr::Cube(result)) - } else if self.parse_keyword(Keyword::ROLLUP) { - self.expect_token(&Token::LParen)?; - let result = self - .parse_comma_separated(|p| p.parse_tuple(true, true))?; - self.expect_token(&Token::RParen)?; - Ok(Expr::Rollup(result)) - } else if self.consume_tokens(&[Token::LParen, Token::RParen]) { - Ok(Expr::Tuple(::alloc::vec::Vec::new())) - } else { - self.parse_expr() - } - } else { - self.parse_expr() - } - } - /// Parse a tuple with `(` and `)`. - /// If `lift_singleton` is true, then a singleton tuple is lifted to a tuple of length 1, otherwise it will fail. - /// If `allow_empty` is true, then an empty tuple is allowed. - fn parse_tuple( - &mut self, - lift_singleton: bool, - allow_empty: bool, - ) -> Result, ParserError> { - if lift_singleton { - if self.consume_token(&Token::LParen) { - let result = if allow_empty && self.consume_token(&Token::RParen) { - ::alloc::vec::Vec::new() - } else { - let result = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - result - }; - Ok(result) - } else { - Ok( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([self.parse_expr()?]), - ), - ) - } - } else { - self.expect_token(&Token::LParen)?; - let result = if allow_empty && self.consume_token(&Token::RParen) { - ::alloc::vec::Vec::new() - } else { - let result = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - result - }; - Ok(result) - } - } - pub fn parse_case_expr(&mut self) -> Result { - let mut operand = None; - if !self.parse_keyword(Keyword::WHEN) { - operand = Some(Box::new(self.parse_expr()?)); - self.expect_keyword_is(Keyword::WHEN)?; - } - let mut conditions = ::alloc::vec::Vec::new(); - let mut results = ::alloc::vec::Vec::new(); - loop { - conditions.push(self.parse_expr()?); - self.expect_keyword_is(Keyword::THEN)?; - results.push(self.parse_expr()?); - if !self.parse_keyword(Keyword::WHEN) { - break; - } - } - let else_result = if self.parse_keyword(Keyword::ELSE) { - Some(Box::new(self.parse_expr()?)) - } else { - None - }; - self.expect_keyword_is(Keyword::END)?; - Ok(Expr::Case { - operand, - conditions, - results, - else_result, - }) - } - pub fn parse_optional_cast_format( - &mut self, - ) -> Result, ParserError> { - if self.parse_keyword(Keyword::FORMAT) { - let value = self.parse_value()?; - match self.parse_optional_time_zone()? { - Some(tz) => Ok(Some(CastFormat::ValueAtTimeZone(value, tz))), - None => Ok(Some(CastFormat::Value(value))), - } - } else { - Ok(None) - } - } - pub fn parse_optional_time_zone( - &mut self, - ) -> Result, ParserError> { - if self.parse_keywords(&[Keyword::AT, Keyword::TIME, Keyword::ZONE]) { - self.parse_value().map(Some) - } else { - Ok(None) - } - } - /// mssql-like convert function - fn parse_mssql_convert(&mut self, is_try: bool) -> Result { - self.expect_token(&Token::LParen)?; - let data_type = self.parse_data_type()?; - self.expect_token(&Token::Comma)?; - let expr = self.parse_expr()?; - let styles = if self.consume_token(&Token::Comma) { - self.parse_comma_separated(Parser::parse_expr)? - } else { - Default::default() - }; - self.expect_token(&Token::RParen)?; - Ok(Expr::Convert { - is_try, - expr: Box::new(expr), - data_type: Some(data_type), - charset: None, - target_before_value: true, - styles, - }) - } - /// 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 - pub fn parse_convert_expr(&mut self, is_try: bool) -> Result { - if self.dialect.convert_type_before_value() { - return self.parse_mssql_convert(is_try); - } - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - if self.parse_keyword(Keyword::USING) { - let charset = self.parse_object_name(false)?; - self.expect_token(&Token::RParen)?; - return Ok(Expr::Convert { - is_try, - expr: Box::new(expr), - data_type: None, - charset: Some(charset), - target_before_value: false, - styles: ::alloc::vec::Vec::new(), - }); - } - self.expect_token(&Token::Comma)?; - let data_type = self.parse_data_type()?; - let charset = if self.parse_keywords(&[Keyword::CHARACTER, Keyword::SET]) { - Some(self.parse_object_name(false)?) - } else { - None - }; - self.expect_token(&Token::RParen)?; - Ok(Expr::Convert { - is_try, - expr: Box::new(expr), - data_type: Some(data_type), - charset, - target_before_value: false, - styles: ::alloc::vec::Vec::new(), - }) - } - /// Parse a SQL CAST function e.g. `CAST(expr AS FLOAT)` - pub fn parse_cast_expr(&mut self, kind: CastKind) -> Result { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_keyword_is(Keyword::AS)?; - let data_type = self.parse_data_type()?; - let format = self.parse_optional_cast_format()?; - self.expect_token(&Token::RParen)?; - Ok(Expr::Cast { - kind, - expr: Box::new(expr), - data_type, - format, - }) - } - /// Parse a SQL EXISTS expression e.g. `WHERE EXISTS(SELECT ...)`. - pub fn parse_exists_expr(&mut self, negated: bool) -> Result { - self.expect_token(&Token::LParen)?; - let exists_node = Expr::Exists { - negated, - subquery: self.parse_query()?, - }; - self.expect_token(&Token::RParen)?; - Ok(exists_node) - } - pub fn parse_extract_expr(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let field = self.parse_date_time_field()?; - let syntax = if self.parse_keyword(Keyword::FROM) { - ExtractSyntax::From - } else if self.consume_token(&Token::Comma) - && (self.dialect.is::() - || self.dialect.is::()) - { - ExtractSyntax::Comma - } else { - return Err( - ParserError::ParserError("Expected 'FROM' or ','".to_string()), - ); - }; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Ok(Expr::Extract { - field, - expr: Box::new(expr), - syntax, - }) - } - pub fn parse_ceil_floor_expr( - &mut self, - is_ceil: bool, - ) -> Result { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - let field = if self.parse_keyword(Keyword::TO) { - CeilFloorKind::DateTimeField(self.parse_date_time_field()?) - } else if self.consume_token(&Token::Comma) { - match self.parse_value()? { - Value::Number(n, s) => CeilFloorKind::Scale(Value::Number(n, s)), - _ => { - return Err( - ParserError::ParserError( - "Scale field can only be of number type".to_string(), - ), - ); - } - } - } else { - CeilFloorKind::DateTimeField(DateTimeField::NoDateTime) - }; - self.expect_token(&Token::RParen)?; - if is_ceil { - Ok(Expr::Ceil { - expr: Box::new(expr), - field, - }) - } else { - Ok(Expr::Floor { - expr: Box::new(expr), - field, - }) - } - } - pub fn parse_position_expr( - &mut self, - ident: Ident, - ) -> Result { - let between_prec = self.dialect.prec_value(Precedence::Between); - let position_expr = self - .maybe_parse(|p| { - p.expect_token(&Token::LParen)?; - let expr = p.parse_subexpr(between_prec)?; - p.expect_keyword_is(Keyword::IN)?; - let from = p.parse_expr()?; - p.expect_token(&Token::RParen)?; - Ok(Expr::Position { - expr: Box::new(expr), - r#in: Box::new(from), - }) - })?; - match position_expr { - Some(expr) => Ok(expr), - None => { - self.parse_function( - ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ident]), - ), - ), - ) - } - } - } - pub fn parse_substring_expr(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - let mut from_expr = None; - let special = self.consume_token(&Token::Comma); - if special || self.parse_keyword(Keyword::FROM) { - from_expr = Some(self.parse_expr()?); - } - let mut to_expr = None; - if self.parse_keyword(Keyword::FOR) || self.consume_token(&Token::Comma) { - to_expr = Some(self.parse_expr()?); - } - self.expect_token(&Token::RParen)?; - Ok(Expr::Substring { - expr: Box::new(expr), - substring_from: from_expr.map(Box::new), - substring_for: to_expr.map(Box::new), - special, - }) - } - pub fn parse_overlay_expr(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_keyword_is(Keyword::PLACING)?; - let what_expr = self.parse_expr()?; - self.expect_keyword_is(Keyword::FROM)?; - let from_expr = self.parse_expr()?; - let mut for_expr = None; - if self.parse_keyword(Keyword::FOR) { - for_expr = Some(self.parse_expr()?); - } - self.expect_token(&Token::RParen)?; - Ok(Expr::Overlay { - expr: Box::new(expr), - overlay_what: Box::new(what_expr), - overlay_from: Box::new(from_expr), - overlay_for: for_expr.map(Box::new), - }) - } - /// ```sql - /// TRIM ([WHERE] ['text' FROM] 'text') - /// TRIM ('text') - /// TRIM(, [, characters]) -- only Snowflake or BigQuery - /// ``` - pub fn parse_trim_expr(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let mut trim_where = None; - if let Token::Word(word) = self.peek_token().token { - if [Keyword::BOTH, Keyword::LEADING, Keyword::TRAILING] - .iter() - .any(|d| word.keyword == *d) - { - trim_where = Some(self.parse_trim_where()?); - } - } - let expr = self.parse_expr()?; - if self.parse_keyword(Keyword::FROM) { - let trim_what = Box::new(expr); - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Ok(Expr::Trim { - expr: Box::new(expr), - trim_where, - trim_what: Some(trim_what), - trim_characters: None, - }) - } else if self.consume_token(&Token::Comma) - && (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - { - let characters = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - Ok(Expr::Trim { - expr: Box::new(expr), - trim_where: None, - trim_what: None, - trim_characters: Some(characters), - }) - } else { - self.expect_token(&Token::RParen)?; - Ok(Expr::Trim { - expr: Box::new(expr), - trim_where, - trim_what: None, - trim_characters: None, - }) - } - } - pub fn parse_trim_where(&mut self) -> Result { - let next_token = self.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::BOTH => Ok(TrimWhereField::Both), - Keyword::LEADING => Ok(TrimWhereField::Leading), - Keyword::TRAILING => Ok(TrimWhereField::Trailing), - _ => self.expected("trim_where field", next_token)?, - } - } - _ => self.expected("trim_where field", next_token), - } - } - /// Parses an array expression `[ex1, ex2, ..]` - /// if `named` is `true`, came from an expression like `ARRAY[ex1, ex2]` - pub fn parse_array_expr(&mut self, named: bool) -> Result { - let exprs = self - .parse_comma_separated0(Parser::parse_expr, Token::RBracket)?; - self.expect_token(&Token::RBracket)?; - Ok(Expr::Array(Array { elem: exprs, named })) - } - pub fn parse_listagg_on_overflow( - &mut self, - ) -> Result, ParserError> { - if self.parse_keywords(&[Keyword::ON, Keyword::OVERFLOW]) { - if self.parse_keyword(Keyword::ERROR) { - Ok(Some(ListAggOnOverflow::Error)) - } else { - self.expect_keyword_is(Keyword::TRUNCATE)?; - let filler = match self.peek_token().token { - Token::Word( - w, - ) if w.keyword == Keyword::WITH - || w.keyword == Keyword::WITHOUT => None, - Token::SingleQuotedString(_) - | Token::EscapedStringLiteral(_) - | Token::UnicodeStringLiteral(_) - | Token::NationalStringLiteral(_) - | Token::HexStringLiteral(_) => { - Some(Box::new(self.parse_expr()?)) - } - _ => { - self.expected( - "either filler, WITH, or WITHOUT in LISTAGG", - self.peek_token(), - )? - } - }; - let with_count = self.parse_keyword(Keyword::WITH); - if !with_count && !self.parse_keyword(Keyword::WITHOUT) { - self.expected( - "either WITH or WITHOUT in LISTAGG", - self.peek_token(), - )?; - } - self.expect_keyword_is(Keyword::COUNT)?; - Ok( - Some(ListAggOnOverflow::Truncate { - filler, - with_count, - }), - ) - } - } else { - Ok(None) - } - } - pub fn parse_date_time_field(&mut self) -> Result { - let next_token = self.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::YEAR => Ok(DateTimeField::Year), - Keyword::YEARS => Ok(DateTimeField::Years), - Keyword::MONTH => Ok(DateTimeField::Month), - Keyword::MONTHS => Ok(DateTimeField::Months), - Keyword::WEEK => { - let week_day = if (self.dialect.is::() - || self.dialect.is::()) - && self.consume_token(&Token::LParen) - { - let week_day = self.parse_identifier()?; - self.expect_token(&Token::RParen)?; - Some(week_day) - } else { - None - }; - Ok(DateTimeField::Week(week_day)) - } - Keyword::WEEKS => Ok(DateTimeField::Weeks), - Keyword::DAY => Ok(DateTimeField::Day), - Keyword::DAYOFWEEK => Ok(DateTimeField::DayOfWeek), - Keyword::DAYOFYEAR => Ok(DateTimeField::DayOfYear), - Keyword::DAYS => Ok(DateTimeField::Days), - Keyword::DATE => Ok(DateTimeField::Date), - Keyword::DATETIME => Ok(DateTimeField::Datetime), - Keyword::HOUR => Ok(DateTimeField::Hour), - Keyword::HOURS => Ok(DateTimeField::Hours), - Keyword::MINUTE => Ok(DateTimeField::Minute), - Keyword::MINUTES => Ok(DateTimeField::Minutes), - Keyword::SECOND => Ok(DateTimeField::Second), - Keyword::SECONDS => Ok(DateTimeField::Seconds), - Keyword::CENTURY => Ok(DateTimeField::Century), - Keyword::DECADE => Ok(DateTimeField::Decade), - Keyword::DOY => Ok(DateTimeField::Doy), - Keyword::DOW => Ok(DateTimeField::Dow), - Keyword::EPOCH => Ok(DateTimeField::Epoch), - Keyword::ISODOW => Ok(DateTimeField::Isodow), - Keyword::ISOYEAR => Ok(DateTimeField::Isoyear), - Keyword::ISOWEEK => Ok(DateTimeField::IsoWeek), - Keyword::JULIAN => Ok(DateTimeField::Julian), - Keyword::MICROSECOND => Ok(DateTimeField::Microsecond), - Keyword::MICROSECONDS => Ok(DateTimeField::Microseconds), - Keyword::MILLENIUM => Ok(DateTimeField::Millenium), - Keyword::MILLENNIUM => Ok(DateTimeField::Millennium), - Keyword::MILLISECOND => Ok(DateTimeField::Millisecond), - Keyword::MILLISECONDS => Ok(DateTimeField::Milliseconds), - Keyword::NANOSECOND => Ok(DateTimeField::Nanosecond), - Keyword::NANOSECONDS => Ok(DateTimeField::Nanoseconds), - Keyword::QUARTER => Ok(DateTimeField::Quarter), - Keyword::TIME => Ok(DateTimeField::Time), - Keyword::TIMEZONE => Ok(DateTimeField::Timezone), - Keyword::TIMEZONE_ABBR => Ok(DateTimeField::TimezoneAbbr), - Keyword::TIMEZONE_HOUR => Ok(DateTimeField::TimezoneHour), - Keyword::TIMEZONE_MINUTE => Ok(DateTimeField::TimezoneMinute), - Keyword::TIMEZONE_REGION => Ok(DateTimeField::TimezoneRegion), - _ if self.dialect.allow_extract_custom() => { - self.prev_token(); - let custom = self.parse_identifier()?; - Ok(DateTimeField::Custom(custom)) - } - _ => self.expected("date/time field", next_token), - } - } - Token::SingleQuotedString( - _, - ) if self.dialect.allow_extract_single_quotes() => { - self.prev_token(); - let custom = self.parse_identifier()?; - Ok(DateTimeField::Custom(custom)) - } - _ => self.expected("date/time field", next_token), - } - } - pub fn parse_not(&mut self) -> Result { - match self.peek_token().token { - Token::Word(w) => { - match w.keyword { - Keyword::EXISTS => { - let negated = true; - let _ = self.parse_keyword(Keyword::EXISTS); - self.parse_exists_expr(negated) - } - _ => { - Ok(Expr::UnaryOp { - op: UnaryOperator::Not, - expr: Box::new( - self - .parse_subexpr( - self.dialect.prec_value(Precedence::UnaryNot), - )?, - ), - }) - } - } - } - _ => { - Ok(Expr::UnaryOp { - op: UnaryOperator::Not, - expr: Box::new( - self - .parse_subexpr( - self.dialect.prec_value(Precedence::UnaryNot), - )?, - ), - }) - } - } - } - /// Parse expression types that start with a left brace '{'. - /// Examples: - /// ```sql - /// -- Dictionary expr. - /// {'key1': 'value1', 'key2': 'value2'} - /// - /// -- Function call using the ODBC syntax. - /// { fn CONCAT('foo', 'bar') } - /// ``` - fn parse_lbrace_expr(&mut self) -> Result { - let token = self.expect_token(&Token::LBrace)?; - if let Some(fn_expr) = self.maybe_parse_odbc_fn_body()? { - self.expect_token(&Token::RBrace)?; - return Ok(fn_expr); - } - if self.dialect.supports_dictionary_syntax() { - self.prev_token(); - return self.parse_duckdb_struct_literal(); - } - self.expected("an expression", token) - } - /// 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. - pub fn parse_match_against(&mut self) -> Result { - let columns = self.parse_parenthesized_column_list(Mandatory, false)?; - self.expect_keyword_is(Keyword::AGAINST)?; - self.expect_token(&Token::LParen)?; - let match_value = self.parse_value()?; - let in_natural_language_mode_keywords = &[ - Keyword::IN, - Keyword::NATURAL, - Keyword::LANGUAGE, - Keyword::MODE, - ]; - let with_query_expansion_keywords = &[ - Keyword::WITH, - Keyword::QUERY, - Keyword::EXPANSION, - ]; - let in_boolean_mode_keywords = &[ - Keyword::IN, - Keyword::BOOLEAN, - Keyword::MODE, - ]; - let opt_search_modifier = if self - .parse_keywords(in_natural_language_mode_keywords) - { - if self.parse_keywords(with_query_expansion_keywords) { - Some(SearchModifier::InNaturalLanguageModeWithQueryExpansion) - } else { - Some(SearchModifier::InNaturalLanguageMode) - } - } else if self.parse_keywords(in_boolean_mode_keywords) { - Some(SearchModifier::InBooleanMode) - } else if self.parse_keywords(with_query_expansion_keywords) { - Some(SearchModifier::WithQueryExpansion) - } else { - None - }; - self.expect_token(&Token::RParen)?; - Ok(Expr::MatchAgainst { - columns, - match_value, - opt_search_modifier, - }) - } - /// Parse an `INTERVAL` expression. - /// - /// Some syntactically valid intervals: - /// - /// ```sql - /// 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 DAY - /// ``` - /// - /// Note that we do not currently attempt to parse the quoted value. - pub fn parse_interval(&mut self) -> Result { - let value = if self.dialect.require_interval_qualifier() { - self.parse_expr()? - } else { - self.parse_prefix()? - }; - let leading_field = if self.next_token_is_temporal_unit() { - Some(self.parse_date_time_field()?) - } else if self.dialect.require_interval_qualifier() { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "INTERVAL requires a unit after the literal value", - self.peek_token().span.start, - ), - ); - res - }), - ), - ); - } else { - None - }; - let (leading_precision, last_field, fsec_precision) = if leading_field - == Some(DateTimeField::Second) - { - let last_field = None; - let (leading_precision, fsec_precision) = self - .parse_optional_precision_scale()?; - (leading_precision, last_field, fsec_precision) - } else { - let leading_precision = self.parse_optional_precision()?; - if self.parse_keyword(Keyword::TO) { - let last_field = Some(self.parse_date_time_field()?); - let fsec_precision = if last_field == Some(DateTimeField::Second) { - self.parse_optional_precision()? - } else { - None - }; - (leading_precision, last_field, fsec_precision) - } else { - (leading_precision, None, None) - } - }; - Ok( - Expr::Interval(Interval { - value: Box::new(value), - leading_field, - leading_precision, - last_field, - fractional_seconds_precision: fsec_precision, - }), - ) - } - /// Peek at the next token and determine if it is a temporal unit - /// like `second`. - pub fn next_token_is_temporal_unit(&mut self) -> bool { - if let Token::Word(word) = self.peek_token().token { - match word.keyword { - Keyword::YEAR - | Keyword::YEARS - | Keyword::MONTH - | Keyword::MONTHS - | Keyword::WEEK - | Keyword::WEEKS - | Keyword::DAY - | Keyword::DAYS - | Keyword::HOUR - | Keyword::HOURS - | Keyword::MINUTE - | Keyword::MINUTES - | Keyword::SECOND - | Keyword::SECONDS - | Keyword::CENTURY - | Keyword::DECADE - | Keyword::DOW - | Keyword::DOY - | Keyword::EPOCH - | Keyword::ISODOW - | Keyword::ISOYEAR - | Keyword::JULIAN - | Keyword::MICROSECOND - | Keyword::MICROSECONDS - | Keyword::MILLENIUM - | Keyword::MILLENNIUM - | Keyword::MILLISECOND - | Keyword::MILLISECONDS - | Keyword::NANOSECOND - | Keyword::NANOSECONDS - | Keyword::QUARTER - | Keyword::TIMEZONE - | Keyword::TIMEZONE_HOUR - | Keyword::TIMEZONE_MINUTE => true, - _ => false, - } - } else { - false - } - } - /// Syntax - /// ```sql - /// -- typed - /// STRUCT<[field_name] field_type, ...>( expr1 [, ... ]) - /// -- typeless - /// STRUCT( expr1 [AS field_name] [, ... ]) - /// ``` - fn parse_struct_literal(&mut self) -> Result { - self.prev_token(); - let (fields, trailing_bracket) = self - .parse_struct_type_def(Self::parse_struct_field_def)?; - if trailing_bracket.0 { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "unmatched > in STRUCT literal", - self.peek_token().span.start, - ), - ); - res - }), - ), - ); - } - self.expect_token(&Token::LParen)?; - let values = self - .parse_comma_separated(|parser| { - parser.parse_struct_field_expr(!fields.is_empty()) - })?; - self.expect_token(&Token::RParen)?; - Ok(Expr::Struct { values, fields }) - } - /// Parse an expression value for a struct literal - /// Syntax - /// ```sql - /// expr [AS name] - /// ``` - /// - /// For biquery [1], Parameter typed_syntax is set to true if the expression - /// is to be parsed as a field expression declared using typed - /// struct syntax [2], and false if using typeless struct syntax [3]. - /// - /// [1]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#constructing_a_struct - /// [2]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#typed_struct_syntax - /// [3]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#typeless_struct_syntax - fn parse_struct_field_expr( - &mut self, - typed_syntax: bool, - ) -> Result { - let expr = self.parse_expr()?; - if self.parse_keyword(Keyword::AS) { - if typed_syntax { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Typed syntax does not allow AS", - { - self.prev_token(); - self.peek_token().span.start - }, - ), - ); - res - }), - ), - ); - } - let field_name = self.parse_identifier()?; - Ok(Expr::Named { - expr: expr.into(), - name: field_name, - }) - } else { - Ok(expr) - } - } - /// Parse a Struct type definition as a sequence of field-value pairs. - /// The syntax of the Struct elem differs by dialect so it is customised - /// by the `elem_parser` argument. - /// - /// Syntax - /// ```sql - /// Hive: - /// STRUCT - /// - /// BigQuery: - /// STRUCT<[field_name] field_type> - /// ``` - fn parse_struct_type_def( - &mut self, - mut elem_parser: F, - ) -> Result<(Vec, MatchedTrailingBracket), ParserError> - where - F: FnMut( - &mut Parser<'a>, - ) -> Result<(StructField, MatchedTrailingBracket), ParserError>, - { - let start_token = self.peek_token(); - self.expect_keyword_is(Keyword::STRUCT)?; - if Token::Lt != self.peek_token() { - return Ok((Default::default(), false.into())); - } - self.next_token(); - let mut field_defs = ::alloc::vec::Vec::new(); - let trailing_bracket = loop { - let (def, trailing_bracket) = elem_parser(self)?; - field_defs.push(def); - if !self.consume_token(&Token::Comma) { - break trailing_bracket; - } - if trailing_bracket.0 { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "unmatched > in STRUCT definition", - start_token.span.start, - ), - ); - res - }), - ), - ); - } - }; - Ok((field_defs, self.expect_closing_angle_bracket(trailing_bracket)?)) - } - /// Duckdb Struct Data Type - fn parse_duckdb_struct_type_def( - &mut self, - ) -> Result, ParserError> { - self.expect_keyword_is(Keyword::STRUCT)?; - self.expect_token(&Token::LParen)?; - let struct_body = self - .parse_comma_separated(|parser| { - let field_name = parser.parse_identifier()?; - let field_type = parser.parse_data_type()?; - Ok(StructField { - field_name: Some(field_name), - field_type, - }) - }); - self.expect_token(&Token::RParen)?; - struct_body - } - /// Parse a field definition in a [struct] or [tuple]. - /// Syntax: - /// - /// ```sql - /// [field_name] field_type - /// ``` - /// - /// [struct]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_a_struct_type - /// [tuple]: https://clickhouse.com/docs/en/sql-reference/data-types/tuple - fn parse_struct_field_def( - &mut self, - ) -> Result<(StructField, MatchedTrailingBracket), ParserError> { - let is_anonymous_field = !match ( - self.peek_nth_token(0).token, - self.peek_nth_token(1).token, - ) { - (Token::Word(_), Token::Word(_)) => true, - _ => false, - }; - let field_name = if is_anonymous_field { - None - } else { - Some(self.parse_identifier()?) - }; - let (field_type, trailing_bracket) = self.parse_data_type_helper()?; - Ok(( - StructField { - field_name, - field_type, - }, - trailing_bracket, - )) - } - /// DuckDB specific: Parse a Union type definition as a sequence of field-value pairs. - /// - /// Syntax: - /// - /// ```sql - /// UNION(field_name field_type[,...]) - /// ``` - /// - /// [1]: https://duckdb.org/docs/sql/data_types/union.html - fn parse_union_type_def(&mut self) -> Result, ParserError> { - self.expect_keyword_is(Keyword::UNION)?; - self.expect_token(&Token::LParen)?; - let fields = self - .parse_comma_separated(|p| { - Ok(UnionField { - field_name: p.parse_identifier()?, - field_type: p.parse_data_type()?, - }) - })?; - self.expect_token(&Token::RParen)?; - Ok(fields) - } - /// DuckDB specific: Parse a duckdb [dictionary] - /// - /// Syntax: - /// - /// ```sql - /// {'field_name': expr1[, ... ]} - /// ``` - /// - /// [dictionary]: https://duckdb.org/docs/sql/data_types/struct#creating-structs - fn parse_duckdb_struct_literal(&mut self) -> Result { - self.expect_token(&Token::LBrace)?; - let fields = self - .parse_comma_separated0( - Self::parse_duckdb_dictionary_field, - Token::RBrace, - )?; - self.expect_token(&Token::RBrace)?; - Ok(Expr::Dictionary(fields)) - } - /// Parse a field for a duckdb [dictionary] - /// - /// Syntax - /// - /// ```sql - /// 'name': expr - /// ``` - /// - /// [dictionary]: https://duckdb.org/docs/sql/data_types/struct#creating-structs - fn parse_duckdb_dictionary_field( - &mut self, - ) -> Result { - let key = self.parse_identifier()?; - self.expect_token(&Token::Colon)?; - let expr = self.parse_expr()?; - Ok(DictionaryField { - key, - value: Box::new(expr), - }) - } - /// DuckDB specific: Parse a duckdb [map] - /// - /// Syntax: - /// - /// ```sql - /// Map {key1: value1[, ... ]} - /// ``` - /// - /// [map]: https://duckdb.org/docs/sql/data_types/map.html#creating-maps - fn parse_duckdb_map_literal(&mut self) -> Result { - self.expect_token(&Token::LBrace)?; - let fields = self - .parse_comma_separated0(Self::parse_duckdb_map_field, Token::RBrace)?; - self.expect_token(&Token::RBrace)?; - Ok(Expr::Map(Map { entries: fields })) - } - /// Parse a field for a duckdb [map] - /// - /// Syntax - /// - /// ```sql - /// key: value - /// ``` - /// - /// [map]: https://duckdb.org/docs/sql/data_types/map.html#creating-maps - fn parse_duckdb_map_field(&mut self) -> Result { - let key = self.parse_expr()?; - self.expect_token(&Token::Colon)?; - let value = self.parse_expr()?; - Ok(MapEntry { - key: Box::new(key), - value: Box::new(value), - }) - } - /// Parse clickhouse [map] - /// - /// Syntax - /// - /// ```sql - /// Map(key_data_type, value_data_type) - /// ``` - /// - /// [map]: https://clickhouse.com/docs/en/sql-reference/data-types/map - fn parse_click_house_map_def( - &mut self, - ) -> Result<(DataType, DataType), ParserError> { - self.expect_keyword_is(Keyword::MAP)?; - self.expect_token(&Token::LParen)?; - let key_data_type = self.parse_data_type()?; - self.expect_token(&Token::Comma)?; - let value_data_type = self.parse_data_type()?; - self.expect_token(&Token::RParen)?; - Ok((key_data_type, value_data_type)) - } - /// Parse clickhouse [tuple] - /// - /// Syntax - /// - /// ```sql - /// Tuple([field_name] field_type, ...) - /// ``` - /// - /// [tuple]: https://clickhouse.com/docs/en/sql-reference/data-types/tuple - fn parse_click_house_tuple_def( - &mut self, - ) -> Result, ParserError> { - self.expect_keyword_is(Keyword::TUPLE)?; - self.expect_token(&Token::LParen)?; - let mut field_defs = ::alloc::vec::Vec::new(); - loop { - let (def, _) = self.parse_struct_field_def()?; - field_defs.push(def); - if !self.consume_token(&Token::Comma) { - break; - } - } - self.expect_token(&Token::RParen)?; - Ok(field_defs) - } - /// For nested types that use the angle bracket syntax, this matches either - /// `>`, `>>` or nothing depending on which variant is expected (specified by the previously - /// matched `trailing_bracket` argument). It returns whether there is a trailing - /// left to be matched - (i.e. if '>>' was matched). - fn expect_closing_angle_bracket( - &mut self, - trailing_bracket: MatchedTrailingBracket, - ) -> Result { - let trailing_bracket = if !trailing_bracket.0 { - match self.peek_token().token { - Token::Gt => { - self.next_token(); - false.into() - } - Token::ShiftRight => { - self.next_token(); - true.into() - } - _ => return self.expected(">", self.peek_token()), - } - } else { - false.into() - }; - Ok(trailing_bracket) - } - /// Parse an operator following an expression - pub fn parse_infix( - &mut self, - expr: Expr, - precedence: u8, - ) -> Result { - if let Some(infix) = self.dialect.parse_infix(self, &expr, precedence) { - return infix; - } - let dialect = self.dialect; - self.advance_token(); - let tok = self.get_current_token(); - let tok_index = self.get_current_index(); - let span = tok.span; - let regular_binary_operator = match &tok.token { - Token::Spaceship => Some(BinaryOperator::Spaceship), - Token::DoubleEq => Some(BinaryOperator::Eq), - Token::Eq => Some(BinaryOperator::Eq), - Token::Neq => Some(BinaryOperator::NotEq), - Token::Gt => Some(BinaryOperator::Gt), - Token::GtEq => Some(BinaryOperator::GtEq), - Token::Lt => Some(BinaryOperator::Lt), - Token::LtEq => Some(BinaryOperator::LtEq), - Token::Plus => Some(BinaryOperator::Plus), - Token::Minus => Some(BinaryOperator::Minus), - Token::Mul => Some(BinaryOperator::Multiply), - Token::Mod => Some(BinaryOperator::Modulo), - Token::StringConcat => Some(BinaryOperator::StringConcat), - Token::Pipe => Some(BinaryOperator::BitwiseOr), - Token::Caret => { - if (dialect.is::()) { - Some(BinaryOperator::PGExp) - } else { - Some(BinaryOperator::BitwiseXor) - } - } - Token::Ampersand => Some(BinaryOperator::BitwiseAnd), - Token::Div => Some(BinaryOperator::Divide), - Token::DuckIntDiv if (dialect.is::() - || dialect.is::()) => { - Some(BinaryOperator::DuckIntegerDivide) - } - Token::ShiftLeft if (dialect.is::() - || dialect.is::() - || dialect.is::()) => { - Some(BinaryOperator::PGBitwiseShiftLeft) - } - Token::ShiftRight if (dialect.is::() - || dialect.is::() - || dialect.is::()) => { - Some(BinaryOperator::PGBitwiseShiftRight) - } - Token::Sharp if (dialect.is::()) => { - Some(BinaryOperator::PGBitwiseXor) - } - Token::Overlap if (dialect.is::() - || dialect.is::()) => Some(BinaryOperator::PGOverlap), - Token::CaretAt if (dialect.is::() - || dialect.is::()) => { - Some(BinaryOperator::PGStartsWith) - } - Token::Tilde => Some(BinaryOperator::PGRegexMatch), - Token::TildeAsterisk => Some(BinaryOperator::PGRegexIMatch), - Token::ExclamationMarkTilde => Some(BinaryOperator::PGRegexNotMatch), - Token::ExclamationMarkTildeAsterisk => { - Some(BinaryOperator::PGRegexNotIMatch) - } - Token::DoubleTilde => Some(BinaryOperator::PGLikeMatch), - Token::DoubleTildeAsterisk => Some(BinaryOperator::PGILikeMatch), - Token::ExclamationMarkDoubleTilde => Some(BinaryOperator::PGNotLikeMatch), - Token::ExclamationMarkDoubleTildeAsterisk => { - Some(BinaryOperator::PGNotILikeMatch) - } - Token::Arrow => Some(BinaryOperator::Arrow), - Token::LongArrow => Some(BinaryOperator::LongArrow), - Token::HashArrow => Some(BinaryOperator::HashArrow), - Token::HashLongArrow => Some(BinaryOperator::HashLongArrow), - Token::AtArrow => Some(BinaryOperator::AtArrow), - Token::ArrowAt => Some(BinaryOperator::ArrowAt), - Token::HashMinus => Some(BinaryOperator::HashMinus), - Token::AtQuestion => Some(BinaryOperator::AtQuestion), - Token::AtAt => Some(BinaryOperator::AtAt), - Token::Question => Some(BinaryOperator::Question), - Token::QuestionAnd => Some(BinaryOperator::QuestionAnd), - Token::QuestionPipe => Some(BinaryOperator::QuestionPipe), - Token::CustomBinaryOperator(s) => Some(BinaryOperator::Custom(s.clone())), - Token::Word(w) => { - match w.keyword { - Keyword::AND => Some(BinaryOperator::And), - Keyword::OR => Some(BinaryOperator::Or), - Keyword::XOR => Some(BinaryOperator::Xor), - Keyword::OVERLAPS => Some(BinaryOperator::Overlaps), - Keyword::OPERATOR if (dialect.is::() - || dialect.is::()) => { - self.expect_token(&Token::LParen)?; - let mut idents = ::alloc::vec::Vec::new(); - loop { - self.advance_token(); - idents.push(self.get_current_token().to_string()); - if !self.consume_token(&Token::Period) { - break; - } - } - self.expect_token(&Token::RParen)?; - Some(BinaryOperator::PGCustomBinaryOperator(idents)) - } - _ => None, - } - } - _ => None, - }; - let tok = self.token_at(tok_index); - if let Some(op) = regular_binary_operator { - if let Some(keyword) = self - .parse_one_of_keywords(&[Keyword::ANY, Keyword::ALL, Keyword::SOME]) - { - self.expect_token(&Token::LParen)?; - let right = if self.peek_sub_query() { - self.prev_token(); - self.parse_subexpr(precedence)? - } else { - let right = self.parse_subexpr(precedence)?; - self.expect_token(&Token::RParen)?; - right - }; - if !match op { - BinaryOperator::Gt - | BinaryOperator::Lt - | BinaryOperator::GtEq - | BinaryOperator::LtEq - | BinaryOperator::Eq - | BinaryOperator::NotEq => true, - _ => false, - } { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Expected one of [=, >, <, =>, =<, !=] as comparison operator, found: {0}", - op, - ), - ); - res - }), - span.start, - ), - ); - res - }), - ), - ); - } - Ok( - match keyword { - Keyword::ALL => { - Expr::AllOp { - left: Box::new(expr), - compare_op: op, - right: Box::new(right), - } - } - Keyword::ANY | Keyword::SOME => { - Expr::AnyOp { - left: Box::new(expr), - compare_op: op, - right: Box::new(right), - is_some: keyword == Keyword::SOME, - } - } - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }, - ) - } else { - Ok(Expr::BinaryOp { - left: Box::new(expr), - op, - right: Box::new(self.parse_subexpr(precedence)?), - }) - } - } else if let Token::Word(w) = &tok.token { - match w.keyword { - Keyword::IS => { - if self.parse_keyword(Keyword::NULL) { - Ok(Expr::IsNull(Box::new(expr))) - } else if self.parse_keywords(&[Keyword::NOT, Keyword::NULL]) { - Ok(Expr::IsNotNull(Box::new(expr))) - } else if self.parse_keywords(&[Keyword::TRUE]) { - Ok(Expr::IsTrue(Box::new(expr))) - } else if self.parse_keywords(&[Keyword::NOT, Keyword::TRUE]) { - Ok(Expr::IsNotTrue(Box::new(expr))) - } else if self.parse_keywords(&[Keyword::FALSE]) { - Ok(Expr::IsFalse(Box::new(expr))) - } else if self.parse_keywords(&[Keyword::NOT, Keyword::FALSE]) { - Ok(Expr::IsNotFalse(Box::new(expr))) - } else if self.parse_keywords(&[Keyword::UNKNOWN]) { - Ok(Expr::IsUnknown(Box::new(expr))) - } else if self.parse_keywords(&[Keyword::NOT, Keyword::UNKNOWN]) - { - Ok(Expr::IsNotUnknown(Box::new(expr))) - } else if self - .parse_keywords(&[Keyword::DISTINCT, Keyword::FROM]) - { - let expr2 = self.parse_expr()?; - Ok(Expr::IsDistinctFrom(Box::new(expr), Box::new(expr2))) - } else if self - .parse_keywords( - &[Keyword::NOT, Keyword::DISTINCT, Keyword::FROM], - ) - { - let expr2 = self.parse_expr()?; - Ok(Expr::IsNotDistinctFrom(Box::new(expr), Box::new(expr2))) - } else if let Ok(is_normalized) = self - .parse_unicode_is_normalized(expr) - { - Ok(is_normalized) - } else { - self.expected( - "[NOT] NULL | TRUE | FALSE | DISTINCT | [form] NORMALIZED FROM after IS", - self.peek_token(), - ) - } - } - Keyword::AT => { - self.expect_keywords(&[Keyword::TIME, Keyword::ZONE])?; - Ok(Expr::AtTimeZone { - timestamp: Box::new(expr), - time_zone: Box::new(self.parse_subexpr(precedence)?), - }) - } - Keyword::NOT - | Keyword::IN - | Keyword::BETWEEN - | Keyword::LIKE - | Keyword::ILIKE - | Keyword::SIMILAR - | Keyword::REGEXP - | Keyword::RLIKE => { - self.prev_token(); - let negated = self.parse_keyword(Keyword::NOT); - let regexp = self.parse_keyword(Keyword::REGEXP); - let rlike = self.parse_keyword(Keyword::RLIKE); - if regexp || rlike { - Ok(Expr::RLike { - negated, - expr: Box::new(expr), - pattern: Box::new( - self - .parse_subexpr(self.dialect.prec_value(Precedence::Like))?, - ), - regexp, - }) - } else if self.parse_keyword(Keyword::IN) { - self.parse_in(expr, negated) - } else if self.parse_keyword(Keyword::BETWEEN) { - self.parse_between(expr, negated) - } else if self.parse_keyword(Keyword::LIKE) { - Ok(Expr::Like { - negated, - any: self.parse_keyword(Keyword::ANY), - expr: Box::new(expr), - pattern: Box::new( - self - .parse_subexpr(self.dialect.prec_value(Precedence::Like))?, - ), - escape_char: self.parse_escape_char()?, - }) - } else if self.parse_keyword(Keyword::ILIKE) { - Ok(Expr::ILike { - negated, - any: self.parse_keyword(Keyword::ANY), - expr: Box::new(expr), - pattern: Box::new( - self - .parse_subexpr(self.dialect.prec_value(Precedence::Like))?, - ), - escape_char: self.parse_escape_char()?, - }) - } else if self.parse_keywords(&[Keyword::SIMILAR, Keyword::TO]) { - Ok(Expr::SimilarTo { - negated, - expr: Box::new(expr), - pattern: Box::new( - self - .parse_subexpr(self.dialect.prec_value(Precedence::Like))?, - ), - escape_char: self.parse_escape_char()?, - }) - } else { - self.expected("IN or BETWEEN after NOT", self.peek_token()) - } - } - _ => { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("No infix parser for token {0:?}", tok.token), - ); - res - }), - tok.span.start, - ), - ); - res - }), - ), - ) - } - } - } else if Token::DoubleColon == *tok { - Ok(Expr::Cast { - kind: CastKind::DoubleColon, - expr: Box::new(expr), - data_type: self.parse_data_type()?, - format: None, - }) - } else if Token::ExclamationMark == *tok - && self.dialect.supports_factorial_operator() - { - Ok(Expr::UnaryOp { - op: UnaryOperator::PGPostfixFactorial, - expr: Box::new(expr), - }) - } else if Token::LBracket == *tok { - if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - { - let mut chain = ::alloc::vec::Vec::new(); - self.prev_token(); - self.parse_multi_dim_subscript(&mut chain)?; - self.parse_compound_field_access(expr, chain) - } else if self.dialect.supports_partiql() { - self.prev_token(); - self.parse_json_access(expr) - } else { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Array subscripting is not supported", - tok.span.start, - ), - ); - res - }), - ), - ) - } - } else if (self.dialect.is::() - || self.dialect.is::()) && Token::Colon == *tok - { - self.prev_token(); - self.parse_json_access(expr) - } else { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("No infix parser for token {0:?}", tok.token), - ); - res - }), - tok.span.start, - ), - ); - res - }), - ), - ) - } - } - /// Parse the `ESCAPE CHAR` portion of `LIKE`, `ILIKE`, and `SIMILAR TO` - pub fn parse_escape_char(&mut self) -> Result, ParserError> { - if self.parse_keyword(Keyword::ESCAPE) { - Ok(Some(self.parse_literal_string()?)) - } else { - Ok(None) - } - } - /// Parses an array subscript like - /// * `[:]` - /// * `[l]` - /// * `[l:]` - /// * `[:u]` - /// * `[l:u]` - /// * `[l:u:s]` - /// - /// Parser is right after `[` - fn parse_subscript_inner(&mut self) -> Result { - let lower_bound = if self.consume_token(&Token::Colon) { - None - } else { - Some(self.parse_expr()?) - }; - if self.consume_token(&Token::RBracket) { - if let Some(lower_bound) = lower_bound { - return Ok(Subscript::Index { - index: lower_bound, - }); - } - return Ok(Subscript::Slice { - lower_bound, - upper_bound: None, - stride: None, - }); - } - if lower_bound.is_some() { - self.expect_token(&Token::Colon)?; - } - let upper_bound = if self.consume_token(&Token::RBracket) { - return Ok(Subscript::Slice { - lower_bound, - upper_bound: None, - stride: None, - }); - } else { - Some(self.parse_expr()?) - }; - if self.consume_token(&Token::RBracket) { - return Ok(Subscript::Slice { - lower_bound, - upper_bound, - stride: None, - }); - } - self.expect_token(&Token::Colon)?; - let stride = if self.consume_token(&Token::RBracket) { - None - } else { - Some(self.parse_expr()?) - }; - if stride.is_some() { - self.expect_token(&Token::RBracket)?; - } - Ok(Subscript::Slice { - lower_bound, - upper_bound, - stride, - }) - } - /// Parse a multi-dimension array accessing like `[1:3][1][1]` - pub fn parse_multi_dim_subscript( - &mut self, - chain: &mut Vec, - ) -> Result<(), ParserError> { - while self.consume_token(&Token::LBracket) { - self.parse_subscript(chain)?; - } - Ok(()) - } - /// Parses an array subscript like `[1:3]` - /// - /// Parser is right after `[` - fn parse_subscript( - &mut self, - chain: &mut Vec, - ) -> Result<(), ParserError> { - let subscript = self.parse_subscript_inner()?; - chain.push(AccessExpr::Subscript(subscript)); - Ok(()) - } - fn parse_json_path_object_key(&mut self) -> Result { - let token = self.next_token(); - match token.token { - Token::Word( - Word { - value, - quote_style: quote_style @ (Some('"') | None), - keyword: _, - }, - ) => { - Ok(JsonPathElem::Dot { - key: value, - quoted: quote_style.is_some(), - }) - } - Token::DoubleQuotedString(key) => { - Ok(JsonPathElem::Dot { - key, - quoted: true, - }) - } - _ => self.expected("variant object key name", token), - } - } - fn parse_json_access(&mut self, expr: Expr) -> Result { - let path = self.parse_json_path()?; - Ok(Expr::JsonAccess { - value: Box::new(expr), - path, - }) - } - fn parse_json_path(&mut self) -> Result { - let mut path = Vec::new(); - loop { - match self.next_token().token { - Token::Colon if path.is_empty() => { - path.push(self.parse_json_path_object_key()?); - } - Token::Period if !path.is_empty() => { - path.push(self.parse_json_path_object_key()?); - } - Token::LBracket => { - let key = self.parse_expr()?; - self.expect_token(&Token::RBracket)?; - path.push(JsonPathElem::Bracket { key }); - } - _ => { - self.prev_token(); - break; - } - }; - } - if true { - if !!path.is_empty() { - ::core::panicking::panic("assertion failed: !path.is_empty()") - } - } - Ok(JsonPath { path }) - } - /// Parses the parens following the `[ NOT ] IN` operator. - pub fn parse_in( - &mut self, - expr: Expr, - negated: bool, - ) -> Result { - if self.parse_keyword(Keyword::UNNEST) { - self.expect_token(&Token::LParen)?; - let array_expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - return Ok(Expr::InUnnest { - expr: Box::new(expr), - array_expr: Box::new(array_expr), - negated, - }); - } - self.expect_token(&Token::LParen)?; - let in_op = if self.parse_keyword(Keyword::SELECT) - || self.parse_keyword(Keyword::WITH) - { - self.prev_token(); - Expr::InSubquery { - expr: Box::new(expr), - subquery: self.parse_query()?, - negated, - } - } else { - Expr::InList { - expr: Box::new(expr), - list: if self.dialect.supports_in_empty_list() { - self.parse_comma_separated0(Parser::parse_expr, Token::RParen)? - } else { - self.parse_comma_separated(Parser::parse_expr)? - }, - negated, - } - }; - self.expect_token(&Token::RParen)?; - Ok(in_op) - } - /// Parses `BETWEEN AND `, assuming the `BETWEEN` keyword was already consumed. - pub fn parse_between( - &mut self, - expr: Expr, - negated: bool, - ) -> Result { - let low = self.parse_subexpr(self.dialect.prec_value(Precedence::Between))?; - self.expect_keyword_is(Keyword::AND)?; - let high = self.parse_subexpr(self.dialect.prec_value(Precedence::Between))?; - Ok(Expr::Between { - expr: Box::new(expr), - negated, - low: Box::new(low), - high: Box::new(high), - }) - } - /// Parse a postgresql casting style which is in the form of `expr::datatype`. - pub fn parse_pg_cast(&mut self, expr: Expr) -> Result { - Ok(Expr::Cast { - kind: CastKind::DoubleColon, - expr: Box::new(expr), - data_type: self.parse_data_type()?, - format: None, - }) - } - /// Get the precedence of the next token - pub fn get_next_precedence(&self) -> Result { - self.dialect.get_next_precedence_default(self) - } - /// Return the token at the given location, or EOF if the index is beyond - /// the length of the current set of tokens. - pub fn token_at(&self, index: usize) -> &TokenWithSpan { - self.tokens.get(index).unwrap_or(&EOF_TOKEN) - } - /// Return the first non-whitespace token that has not yet been processed - /// or Token::EOF - /// - /// See [`Self::peek_token_ref`] to avoid the copy. - pub fn peek_token(&self) -> TokenWithSpan { - self.peek_nth_token(0) - } - /// Return a reference to the first non-whitespace token that has not yet - /// been processed or Token::EOF - pub fn peek_token_ref(&self) -> &TokenWithSpan { - self.peek_nth_token_ref(0) - } - /// Returns the `N` next non-whitespace tokens that have not yet been - /// processed. - /// - /// Example: - /// ```rust - /// # use sqlparser::dialect::GenericDialect; - /// # use sqlparser::parser::Parser; - /// # use sqlparser::keywords::Keyword; - /// # use sqlparser::tokenizer::{Token, Word}; - /// 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, .. }), - /// ] - /// )); - /// ``` - pub fn peek_tokens(&self) -> [Token; N] { - self.peek_tokens_with_location().map(|with_loc| with_loc.token) - } - /// Returns the `N` next non-whitespace tokens with locations that have not - /// yet been processed. - /// - /// See [`Self::peek_token`] for an example. - pub fn peek_tokens_with_location(&self) -> [TokenWithSpan; N] { - let mut index = self.index; - core::array::from_fn(|_| { - loop { - let token = self.tokens.get(index); - index += 1; - if let Some( - TokenWithSpan { token: Token::Whitespace(_), span: _ }, - ) = token { - continue; - } - break token - .cloned() - .unwrap_or(TokenWithSpan { - token: Token::EOF, - span: Span::empty(), - }); - } - }) - } - /// Return nth non-whitespace token that has not yet been processed - pub fn peek_nth_token(&self, n: usize) -> TokenWithSpan { - self.peek_nth_token_ref(n).clone() - } - /// Return nth non-whitespace token that has not yet been processed - pub fn peek_nth_token_ref(&self, mut n: usize) -> &TokenWithSpan { - let mut index = self.index; - loop { - index += 1; - match self.tokens.get(index - 1) { - Some(TokenWithSpan { token: Token::Whitespace(_), span: _ }) => { - continue; - } - non_whitespace => { - if n == 0 { - return non_whitespace.unwrap_or(&EOF_TOKEN); - } - n -= 1; - } - } - } - } - /// Return the first token, possibly whitespace, that has not yet been processed - /// (or None if reached end-of-file). - pub fn peek_token_no_skip(&self) -> TokenWithSpan { - self.peek_nth_token_no_skip(0) - } - /// Return nth token, possibly whitespace, that has not yet been processed. - pub fn peek_nth_token_no_skip(&self, n: usize) -> TokenWithSpan { - self.tokens - .get(self.index + n) - .cloned() - .unwrap_or(TokenWithSpan { - token: Token::EOF, - span: Span::empty(), - }) - } - /// Return true if the next tokens exactly `expected` - /// - /// Does not advance the current token. - fn peek_keywords(&mut self, expected: &[Keyword]) -> bool { - let index = self.index; - let matched = self.parse_keywords(expected); - self.index = index; - matched - } - /// Advances to the next non-whitespace token and returns a copy. - /// - /// Please use [`Self::advance_token`] and [`Self::get_current_token`] to - /// avoid the copy. - pub fn next_token(&mut self) -> TokenWithSpan { - self.advance_token(); - self.get_current_token().clone() - } - /// Returns the index of the current token - /// - /// This can be used with APIs that expect an index, such as - /// [`Self::token_at`] - pub fn get_current_index(&self) -> usize { - self.index.saturating_sub(1) - } - /// Return the next unprocessed token, possibly whitespace. - pub fn next_token_no_skip(&mut self) -> Option<&TokenWithSpan> { - self.index += 1; - self.tokens.get(self.index - 1) - } - /// Advances the current token to the next non-whitespace token - /// - /// See [`Self::get_current_token`] to get the current token after advancing - pub fn advance_token(&mut self) { - loop { - self.index += 1; - match self.tokens.get(self.index - 1) { - Some(TokenWithSpan { token: Token::Whitespace(_), span: _ }) => { - continue; - } - _ => break, - } - } - } - /// Returns a reference to the current token - /// - /// Does not advance the current token. - pub fn get_current_token(&self) -> &TokenWithSpan { - self.token_at(self.index.saturating_sub(1)) - } - /// Returns a reference to the previous token - /// - /// Does not advance the current token. - pub fn get_previous_token(&self) -> &TokenWithSpan { - self.token_at(self.index.saturating_sub(2)) - } - /// Returns a reference to the next token - /// - /// Does not advance the current token. - pub fn get_next_token(&self) -> &TokenWithSpan { - self.token_at(self.index) - } - /// 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. - /// - pub fn prev_token(&mut self) { - loop { - if !(self.index > 0) { - ::core::panicking::panic("assertion failed: self.index > 0") - } - self.index -= 1; - if let Some(TokenWithSpan { token: Token::Whitespace(_), span: _ }) = self - .tokens - .get(self.index) - { - continue; - } - return; - } - } - /// Report `found` was encountered instead of `expected` - pub fn expected( - &self, - expected: &str, - found: TokenWithSpan, - ) -> Result { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expected: {0}, found: {1}", expected, found), - ); - res - }), - found.span.start, - ), - ); - res - }), - ), - ) - } - /// report `found` was encountered instead of `expected` - pub fn expected_ref( - &self, - expected: &str, - found: &TokenWithSpan, - ) -> Result { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expected: {0}, found: {1}", expected, found), - ); - res - }), - found.span.start, - ), - ); - res - }), - ), - ) - } - /// Report that the token at `index` was found instead of `expected`. - pub fn expected_at( - &self, - expected: &str, - index: usize, - ) -> Result { - let found = self.tokens.get(index).unwrap_or(&EOF_TOKEN); - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expected: {0}, found: {1}", expected, found), - ); - res - }), - found.span.start, - ), - ); - res - }), - ), - ) - } - /// If the current token is the `expected` keyword, consume it and returns - /// true. Otherwise, no tokens are consumed and returns false. - #[must_use] - pub fn parse_keyword(&mut self, expected: Keyword) -> bool { - if self.peek_keyword(expected) { - self.advance_token(); - true - } else { - false - } - } - #[must_use] - pub fn peek_keyword(&self, expected: Keyword) -> bool { - match &self.peek_token_ref().token { - Token::Word(w) if expected == w.keyword => true, - _ => false, - } - } - /// 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. - pub fn parse_keyword_with_tokens( - &mut self, - expected: Keyword, - tokens: &[Token], - ) -> bool { - match &self.peek_token_ref().token { - Token::Word(w) if expected == w.keyword => { - for (idx, token) in tokens.iter().enumerate() { - if self.peek_nth_token_ref(idx + 1).token != *token { - return false; - } - } - for _ in 0..(tokens.len() + 1) { - self.advance_token(); - } - true - } - _ => false, - } - } - /// If the current and subsequent tokens exactly match the `keywords` - /// sequence, consume them and returns true. Otherwise, no tokens are - /// consumed and returns false - #[must_use] - pub fn parse_keywords(&mut self, keywords: &[Keyword]) -> bool { - let index = self.index; - for &keyword in keywords { - if !self.parse_keyword(keyword) { - self.index = index; - return false; - } - } - true - } - /// 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`]. - #[must_use] - pub fn parse_one_of_keywords( - &mut self, - keywords: &[Keyword], - ) -> Option { - match &self.peek_token_ref().token { - Token::Word(w) => { - keywords - .iter() - .find(|keyword| **keyword == w.keyword) - .map(|keyword| { - self.advance_token(); - *keyword - }) - } - _ => None, - } - } - /// If the current token is one of the expected keywords, consume the token - /// and return the keyword that matches. Otherwise, return an error. - pub fn expect_one_of_keywords( - &mut self, - keywords: &[Keyword], - ) -> Result { - if let Some(keyword) = self.parse_one_of_keywords(keywords) { - Ok(keyword) - } else { - let keywords: Vec = keywords - .iter() - .map(|x| ::alloc::__export::must_use({ - let res = ::alloc::fmt::format(format_args!("{0:?}", x)); - res - })) - .collect(); - self.expected_ref( - &::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("one of {0}", keywords.join(" or ")), - ); - res - }), - self.peek_token_ref(), - ) - } - } - /// If the current token is the `expected` keyword, consume the token. - /// Otherwise, return an error. - /// - pub fn expect_keyword( - &mut self, - expected: Keyword, - ) -> Result { - if self.parse_keyword(expected) { - Ok(self.get_current_token().clone()) - } else { - self.expected_ref( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0:?}", &expected), - ); - res - }) - .as_str(), - self.peek_token_ref(), - ) - } - } - /// 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. - pub fn expect_keyword_is( - &mut self, - expected: Keyword, - ) -> Result<(), ParserError> { - if self.parse_keyword(expected) { - Ok(()) - } else { - self.expected_ref( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0:?}", &expected), - ); - res - }) - .as_str(), - self.peek_token_ref(), - ) - } - } - /// If the current and subsequent tokens exactly match the `keywords` - /// sequence, consume them and returns Ok. Otherwise, return an Error. - pub fn expect_keywords( - &mut self, - expected: &[Keyword], - ) -> Result<(), ParserError> { - for &kw in expected { - self.expect_keyword_is(kw)?; - } - Ok(()) - } - /// Consume the next token if it matches the expected token, otherwise return false - /// - /// See [Self::advance_token] to consume the token unconditionally - #[must_use] - pub fn consume_token(&mut self, expected: &Token) -> bool { - if self.peek_token_ref() == expected { - self.advance_token(); - true - } else { - false - } - } - /// If the current and subsequent tokens exactly match the `tokens` - /// sequence, consume them and returns true. Otherwise, no tokens are - /// consumed and returns false - #[must_use] - pub fn consume_tokens(&mut self, tokens: &[Token]) -> bool { - let index = self.index; - for token in tokens { - if !self.consume_token(token) { - self.index = index; - return false; - } - } - true - } - /// Bail out if the current token is not an expected keyword, or consume it if it is - pub fn expect_token( - &mut self, - expected: &Token, - ) -> Result { - if self.peek_token_ref() == expected { - Ok(self.next_token()) - } else { - self.expected_ref(&expected.to_string(), self.peek_token_ref()) - } - } - fn parse(s: String, loc: Location) -> Result - where - ::Err: Display, - { - s.parse::() - .map_err(|e| { - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Could not parse \'{1}\' as {0}: {2}{3}", - core::any::type_name::(), - s, - e, - loc, - ), - ); - res - }), - ) - }) - } - /// Parse a comma-separated list of 1+ SelectItem - pub fn parse_projection(&mut self) -> Result, ParserError> { - let trailing_commas = self.options.trailing_commas - | self.dialect.supports_projection_trailing_commas(); - self.parse_comma_separated_with_trailing_commas( - |p| p.parse_select_item(), - trailing_commas, - Self::is_reserved_for_column_alias, - ) - } - pub fn parse_actions_list(&mut self) -> Result, ParserError> { - let mut values = ::alloc::vec::Vec::new(); - loop { - values.push(self.parse_grant_permission()?); - if !self.consume_token(&Token::Comma) { - break; - } else if self.options.trailing_commas { - match self.peek_token().token { - Token::Word(kw) if kw.keyword == Keyword::ON => { - break; - } - Token::RParen - | Token::SemiColon - | Token::EOF - | Token::RBracket - | Token::RBrace => break, - _ => continue, - } - } - } - Ok(values) - } - /// Parse a list of [TableWithJoins] - fn parse_table_with_joins( - &mut self, - ) -> Result, ParserError> { - let trailing_commas = self.dialect.supports_from_trailing_commas(); - self.parse_comma_separated_with_trailing_commas( - Parser::parse_table_and_joins, - trailing_commas, - |kw, _parser| { - self.dialect.get_reserved_keywords_for_table_factor().contains(kw) - }, - ) - } - /// Parse the comma of a comma-separated syntax element. - /// `R` is a predicate that should return true if the next - /// keyword is a reserved keyword. - /// Allows for control over trailing commas - /// - /// Returns true if there is a next element - fn is_parse_comma_separated_end_with_trailing_commas( - &mut self, - trailing_commas: bool, - is_reserved_keyword: &R, - ) -> bool - where - R: Fn(&Keyword, &mut Parser) -> bool, - { - if !self.consume_token(&Token::Comma) { - true - } else if trailing_commas { - let token = self.next_token().token; - let is_end = match token { - Token::Word(ref kw) if is_reserved_keyword(&kw.keyword, self) => true, - Token::RParen - | Token::SemiColon - | Token::EOF - | Token::RBracket - | Token::RBrace => true, - _ => false, - }; - self.prev_token(); - is_end - } else { - false - } - } - /// Parse the comma of a comma-separated syntax element. - /// Returns true if there is a next element - fn is_parse_comma_separated_end(&mut self) -> bool { - self.is_parse_comma_separated_end_with_trailing_commas( - self.options.trailing_commas, - &Self::is_reserved_for_column_alias, - ) - } - /// Parse a comma-separated list of 1+ items accepted by `F` - pub fn parse_comma_separated( - &mut self, - f: F, - ) -> Result, ParserError> - where - F: FnMut(&mut Parser<'a>) -> Result, - { - self.parse_comma_separated_with_trailing_commas( - f, - self.options.trailing_commas, - Self::is_reserved_for_column_alias, - ) - } - /// Parse a comma-separated list of 1+ items accepted by `F`. - /// `R` is a predicate that should return true if the next - /// keyword is a reserved keyword. - /// Allows for control over trailing commas. - fn parse_comma_separated_with_trailing_commas( - &mut self, - mut f: F, - trailing_commas: bool, - is_reserved_keyword: R, - ) -> Result, ParserError> - where - F: FnMut(&mut Parser<'a>) -> Result, - R: Fn(&Keyword, &mut Parser) -> bool, - { - let mut values = ::alloc::vec::Vec::new(); - loop { - values.push(f(self)?); - if self - .is_parse_comma_separated_end_with_trailing_commas( - trailing_commas, - &is_reserved_keyword, - ) - { - break; - } - } - Ok(values) - } - /// Parse a period-separated list of 1+ items accepted by `F` - fn parse_period_separated( - &mut self, - mut f: F, - ) -> Result, ParserError> - where - F: FnMut(&mut Parser<'a>) -> Result, - { - let mut values = ::alloc::vec::Vec::new(); - loop { - values.push(f(self)?); - if !self.consume_token(&Token::Period) { - break; - } - } - Ok(values) - } - /// Parse a keyword-separated list of 1+ items accepted by `F` - pub fn parse_keyword_separated( - &mut self, - keyword: Keyword, - mut f: F, - ) -> Result, ParserError> - where - F: FnMut(&mut Parser<'a>) -> Result, - { - let mut values = ::alloc::vec::Vec::new(); - loop { - values.push(f(self)?); - if !self.parse_keyword(keyword) { - break; - } - } - Ok(values) - } - pub fn parse_parenthesized(&mut self, mut f: F) -> Result - where - F: FnMut(&mut Parser<'a>) -> Result, - { - self.expect_token(&Token::LParen)?; - let res = f(self)?; - self.expect_token(&Token::RParen)?; - Ok(res) - } - /// 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] ...) - pub fn parse_comma_separated0( - &mut self, - f: F, - end_token: Token, - ) -> Result, ParserError> - where - F: FnMut(&mut Parser<'a>) -> Result, - { - if self.peek_token().token == end_token { - return Ok(::alloc::vec::Vec::new()); - } - if self.options.trailing_commas - && self.peek_tokens() == [Token::Comma, end_token] - { - let _ = self.consume_token(&Token::Comma); - return Ok(::alloc::vec::Vec::new()); - } - self.parse_comma_separated(f) - } - /// Default implementation of a predicate that returns true if - /// the specified keyword is reserved for column alias. - /// See [Dialect::is_column_alias] - fn is_reserved_for_column_alias(kw: &Keyword, parser: &mut Parser) -> bool { - !parser.dialect.is_column_alias(kw, parser) - } - /// Run a parser method `f`, reverting back to the current position if unsuccessful. - /// Returns `None` if `f` returns an error - pub fn maybe_parse(&mut self, f: F) -> Result, ParserError> - where - F: FnMut(&mut Parser) -> Result, - { - match self.try_parse(f) { - Ok(t) => Ok(Some(t)), - Err(ParserError::RecursionLimitExceeded) => { - Err(ParserError::RecursionLimitExceeded) - } - _ => Ok(None), - } - } - /// Run a parser method `f`, reverting back to the current position if unsuccessful. - pub fn try_parse(&mut self, mut f: F) -> Result - where - F: FnMut(&mut Parser) -> Result, - { - let index = self.index; - match f(self) { - Ok(t) => Ok(t), - Err(e) => { - self.index = index; - Err(e) - } - } - } - /// 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. - pub fn parse_all_or_distinct( - &mut self, - ) -> Result, ParserError> { - let loc = self.peek_token().span.start; - let all = self.parse_keyword(Keyword::ALL); - let distinct = self.parse_keyword(Keyword::DISTINCT); - if !distinct { - return Ok(None); - } - if all { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Cannot specify both ALL and DISTINCT".to_string(), - loc, - ), - ); - res - }), - ), - ); - } - let on = self.parse_keyword(Keyword::ON); - if !on { - return Ok(Some(Distinct::Distinct)); - } - self.expect_token(&Token::LParen)?; - let col_names = if self.consume_token(&Token::RParen) { - self.prev_token(); - Vec::new() - } else { - self.parse_comma_separated(Parser::parse_expr)? - }; - self.expect_token(&Token::RParen)?; - Ok(Some(Distinct::On(col_names))) - } - /// Parse a SQL CREATE statement - pub fn parse_create(&mut self) -> Result { - let or_replace = self.parse_keywords(&[Keyword::OR, Keyword::REPLACE]); - let or_alter = self.parse_keywords(&[Keyword::OR, Keyword::ALTER]); - let local = self.parse_one_of_keywords(&[Keyword::LOCAL]).is_some(); - let global = self.parse_one_of_keywords(&[Keyword::GLOBAL]).is_some(); - let transient = self.parse_one_of_keywords(&[Keyword::TRANSIENT]).is_some(); - let global: Option = if global { - Some(true) - } else if local { - Some(false) - } else { - None - }; - let temporary = self - .parse_one_of_keywords(&[Keyword::TEMP, Keyword::TEMPORARY]) - .is_some(); - let persistent = (self.dialect.is::()) - && self.parse_one_of_keywords(&[Keyword::PERSISTENT]).is_some(); - let create_view_params = self.parse_create_view_params()?; - if self.parse_keyword(Keyword::TABLE) { - self.parse_create_table(or_replace, temporary, global, transient) - } else if self.parse_keyword(Keyword::MATERIALIZED) - || self.parse_keyword(Keyword::VIEW) - { - self.prev_token(); - self.parse_create_view(or_replace, temporary, create_view_params) - } else if self.parse_keyword(Keyword::POLICY) { - self.parse_create_policy() - } else if self.parse_keyword(Keyword::EXTERNAL) { - self.parse_create_external_table(or_replace) - } else if self.parse_keyword(Keyword::FUNCTION) { - self.parse_create_function(or_replace, temporary) - } else if self.parse_keyword(Keyword::TRIGGER) { - self.parse_create_trigger(or_replace, false) - } else if self.parse_keywords(&[Keyword::CONSTRAINT, Keyword::TRIGGER]) { - self.parse_create_trigger(or_replace, true) - } else if self.parse_keyword(Keyword::MACRO) { - self.parse_create_macro(or_replace, temporary) - } else if self.parse_keyword(Keyword::SECRET) { - self.parse_create_secret(or_replace, temporary, persistent) - } else if or_replace { - self.expected( - "[EXTERNAL] TABLE or [MATERIALIZED] VIEW or FUNCTION after CREATE OR REPLACE", - self.peek_token(), - ) - } else if self.parse_keyword(Keyword::EXTENSION) { - self.parse_create_extension() - } else if self.parse_keyword(Keyword::INDEX) { - self.parse_create_index(false) - } else if self.parse_keywords(&[Keyword::UNIQUE, Keyword::INDEX]) { - self.parse_create_index(true) - } else if self.parse_keyword(Keyword::VIRTUAL) { - self.parse_create_virtual_table() - } else if self.parse_keyword(Keyword::SCHEMA) { - self.parse_create_schema() - } else if self.parse_keyword(Keyword::DATABASE) { - self.parse_create_database() - } else if self.parse_keyword(Keyword::ROLE) { - self.parse_create_role() - } else if self.parse_keyword(Keyword::SEQUENCE) { - self.parse_create_sequence(temporary) - } else if self.parse_keyword(Keyword::TYPE) { - self.parse_create_type() - } else if self.parse_keyword(Keyword::PROCEDURE) { - self.parse_create_procedure(or_alter) - } else if self.parse_keyword(Keyword::CONNECTOR) { - self.parse_create_connector() - } else { - self.expected("an object type after CREATE", self.peek_token()) - } - } - /// See [DuckDB Docs](https://duckdb.org/docs/sql/statements/create_secret.html) for more details. - pub fn parse_create_secret( - &mut self, - or_replace: bool, - temporary: bool, - persistent: bool, - ) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let mut storage_specifier = None; - let mut name = None; - if self.peek_token() != Token::LParen { - if self.parse_keyword(Keyword::IN) { - storage_specifier = self.parse_identifier().ok() - } else { - name = self.parse_identifier().ok(); - } - if storage_specifier.is_none() && self.peek_token() != Token::LParen - && self.parse_keyword(Keyword::IN) - { - storage_specifier = self.parse_identifier().ok(); - } - } - self.expect_token(&Token::LParen)?; - self.expect_keyword_is(Keyword::TYPE)?; - let secret_type = self.parse_identifier()?; - let mut options = Vec::new(); - if self.consume_token(&Token::Comma) { - options - .append( - &mut self - .parse_comma_separated(|p| { - let key = p.parse_identifier()?; - let value = p.parse_identifier()?; - Ok(SecretOption { key, value }) - })?, - ); - } - self.expect_token(&Token::RParen)?; - let temp = match (temporary, persistent) { - (true, false) => Some(true), - (false, true) => Some(false), - (false, false) => None, - _ => self.expected("TEMPORARY or PERSISTENT", self.peek_token())?, - }; - Ok(Statement::CreateSecret { - or_replace, - temporary: temp, - if_not_exists, - name, - storage_specifier, - secret_type, - options, - }) - } - /// Parse a CACHE TABLE statement - pub fn parse_cache_table(&mut self) -> Result { - let (mut table_flag, mut options, mut has_as, mut query) = ( - None, - ::alloc::vec::Vec::new(), - false, - None, - ); - if self.parse_keyword(Keyword::TABLE) { - let table_name = self.parse_object_name(false)?; - if self.peek_token().token != Token::EOF { - if let Token::Word(word) = self.peek_token().token { - if word.keyword == Keyword::OPTIONS { - options = self.parse_options(Keyword::OPTIONS)?; - } - } - if self.peek_token().token != Token::EOF { - let (a, q) = self.parse_as_query()?; - has_as = a; - query = Some(q); - } - Ok(Statement::Cache { - table_flag, - table_name, - has_as, - options, - query, - }) - } else { - Ok(Statement::Cache { - table_flag, - table_name, - has_as, - options, - query, - }) - } - } else { - table_flag = Some(self.parse_object_name(false)?); - if self.parse_keyword(Keyword::TABLE) { - let table_name = self.parse_object_name(false)?; - if self.peek_token() != Token::EOF { - if let Token::Word(word) = self.peek_token().token { - if word.keyword == Keyword::OPTIONS { - options = self.parse_options(Keyword::OPTIONS)?; - } - } - if self.peek_token() != Token::EOF { - let (a, q) = self.parse_as_query()?; - has_as = a; - query = Some(q); - } - Ok(Statement::Cache { - table_flag, - table_name, - has_as, - options, - query, - }) - } else { - Ok(Statement::Cache { - table_flag, - table_name, - has_as, - options, - query, - }) - } - } else { - if self.peek_token() == Token::EOF { - self.prev_token(); - } - self.expected("a `TABLE` keyword", self.peek_token()) - } - } - } - /// Parse 'AS' before as query,such as `WITH XXX AS SELECT XXX` oer `CACHE TABLE AS SELECT XXX` - pub fn parse_as_query(&mut self) -> Result<(bool, Box), ParserError> { - match self.peek_token().token { - Token::Word(word) => { - match word.keyword { - Keyword::AS => { - self.next_token(); - Ok((true, self.parse_query()?)) - } - _ => Ok((false, self.parse_query()?)), - } - } - _ => self.expected("a QUERY statement", self.peek_token()), - } - } - /// Parse a UNCACHE TABLE statement - pub fn parse_uncache_table(&mut self) -> Result { - self.expect_keyword_is(Keyword::TABLE)?; - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let table_name = self.parse_object_name(false)?; - Ok(Statement::UNCache { - table_name, - if_exists, - }) - } - /// SQLite-specific `CREATE VIRTUAL TABLE` - pub fn parse_create_virtual_table(&mut self) -> Result { - self.expect_keyword_is(Keyword::TABLE)?; - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let table_name = self.parse_object_name(false)?; - self.expect_keyword_is(Keyword::USING)?; - let module_name = self.parse_identifier()?; - let module_args = self.parse_parenthesized_column_list(Optional, false)?; - Ok(Statement::CreateVirtualTable { - name: table_name, - if_not_exists, - module_name, - module_args, - }) - } - pub fn parse_create_schema(&mut self) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let schema_name = self.parse_schema_name()?; - Ok(Statement::CreateSchema { - schema_name, - if_not_exists, - }) - } - fn parse_schema_name(&mut self) -> Result { - if self.parse_keyword(Keyword::AUTHORIZATION) { - Ok(SchemaName::UnnamedAuthorization(self.parse_identifier()?)) - } else { - let name = self.parse_object_name(false)?; - if self.parse_keyword(Keyword::AUTHORIZATION) { - Ok(SchemaName::NamedAuthorization(name, self.parse_identifier()?)) - } else { - Ok(SchemaName::Simple(name)) - } - } - } - pub fn parse_create_database(&mut self) -> Result { - let ine = self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let db_name = self.parse_object_name(false)?; - let mut location = None; - let mut managed_location = None; - loop { - match self - .parse_one_of_keywords( - &[Keyword::LOCATION, Keyword::MANAGEDLOCATION], - ) - { - Some(Keyword::LOCATION) => { - location = Some(self.parse_literal_string()?); - } - Some(Keyword::MANAGEDLOCATION) => { - managed_location = Some(self.parse_literal_string()?); - } - _ => break, - } - } - Ok(Statement::CreateDatabase { - db_name, - if_not_exists: ine, - location, - managed_location, - }) - } - pub fn parse_optional_create_function_using( - &mut self, - ) -> Result, ParserError> { - if !self.parse_keyword(Keyword::USING) { - return Ok(None); - } - let keyword = self - .expect_one_of_keywords( - &[Keyword::JAR, Keyword::FILE, Keyword::ARCHIVE], - )?; - let uri = self.parse_literal_string()?; - match keyword { - Keyword::JAR => Ok(Some(CreateFunctionUsing::Jar(uri))), - Keyword::FILE => Ok(Some(CreateFunctionUsing::File(uri))), - Keyword::ARCHIVE => Ok(Some(CreateFunctionUsing::Archive(uri))), - _ => { - self.expected( - "JAR, FILE or ARCHIVE, got {:?}", - TokenWithSpan::wrap( - Token::make_keyword( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0:?}", keyword), - ); - res - }) - .as_str(), - ), - ), - ) - } - } - } - pub fn parse_create_function( - &mut self, - or_replace: bool, - temporary: bool, - ) -> Result { - if (self.dialect.is::()) { - self.parse_hive_create_function(or_replace, temporary) - } else if (self.dialect.is::() - || self.dialect.is::()) - { - self.parse_postgres_create_function(or_replace, temporary) - } else if (self.dialect.is::()) { - self.parse_create_macro(or_replace, temporary) - } else if (self.dialect.is::()) { - self.parse_bigquery_create_function(or_replace, temporary) - } else { - self.prev_token(); - self.expected("an object type after CREATE", self.peek_token()) - } - } - /// Parse `CREATE FUNCTION` for [Postgres] - /// - /// [Postgres]: https://www.postgresql.org/docs/15/sql-createfunction.html - fn parse_postgres_create_function( - &mut self, - or_replace: bool, - temporary: bool, - ) -> Result { - let name = self.parse_object_name(false)?; - self.expect_token(&Token::LParen)?; - let args = if Token::RParen != self.peek_token_ref().token { - self.parse_comma_separated(Parser::parse_function_arg)? - } else { - ::alloc::vec::Vec::new() - }; - self.expect_token(&Token::RParen)?; - let return_type = if self.parse_keyword(Keyword::RETURNS) { - Some(self.parse_data_type()?) - } else { - None - }; - struct Body { - language: Option, - behavior: Option, - function_body: Option, - called_on_null: Option, - parallel: Option, - } - #[automatically_derived] - impl ::core::default::Default for Body { - #[inline] - fn default() -> Body { - Body { - language: ::core::default::Default::default(), - behavior: ::core::default::Default::default(), - function_body: ::core::default::Default::default(), - called_on_null: ::core::default::Default::default(), - parallel: ::core::default::Default::default(), - } - } - } - let mut body = Body::default(); - loop { - fn ensure_not_set( - field: &Option, - name: &str, - ) -> Result<(), ParserError> { - if field.is_some() { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0} specified more than once", name), - ); - res - }), - ), - ); - } - Ok(()) - } - if self.parse_keyword(Keyword::AS) { - ensure_not_set(&body.function_body, "AS")?; - body.function_body = Some( - CreateFunctionBody::AsBeforeOptions( - self.parse_create_function_body_string()?, - ), - ); - } else if self.parse_keyword(Keyword::LANGUAGE) { - ensure_not_set(&body.language, "LANGUAGE")?; - body.language = Some(self.parse_identifier()?); - } else if self.parse_keyword(Keyword::IMMUTABLE) { - ensure_not_set(&body.behavior, "IMMUTABLE | STABLE | VOLATILE")?; - body.behavior = Some(FunctionBehavior::Immutable); - } else if self.parse_keyword(Keyword::STABLE) { - ensure_not_set(&body.behavior, "IMMUTABLE | STABLE | VOLATILE")?; - body.behavior = Some(FunctionBehavior::Stable); - } else if self.parse_keyword(Keyword::VOLATILE) { - ensure_not_set(&body.behavior, "IMMUTABLE | STABLE | VOLATILE")?; - body.behavior = Some(FunctionBehavior::Volatile); - } else if self - .parse_keywords( - &[Keyword::CALLED, Keyword::ON, Keyword::NULL, Keyword::INPUT], - ) - { - ensure_not_set( - &body.called_on_null, - "CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT", - )?; - body.called_on_null = Some(FunctionCalledOnNull::CalledOnNullInput); - } else if self - .parse_keywords( - &[ - Keyword::RETURNS, - Keyword::NULL, - Keyword::ON, - Keyword::NULL, - Keyword::INPUT, - ], - ) - { - ensure_not_set( - &body.called_on_null, - "CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT", - )?; - body.called_on_null = Some( - FunctionCalledOnNull::ReturnsNullOnNullInput, - ); - } else if self.parse_keyword(Keyword::STRICT) { - ensure_not_set( - &body.called_on_null, - "CALLED ON NULL INPUT | RETURNS NULL ON NULL INPUT | STRICT", - )?; - body.called_on_null = Some(FunctionCalledOnNull::Strict); - } else if self.parse_keyword(Keyword::PARALLEL) { - ensure_not_set( - &body.parallel, - "PARALLEL { UNSAFE | RESTRICTED | SAFE }", - )?; - if self.parse_keyword(Keyword::UNSAFE) { - body.parallel = Some(FunctionParallel::Unsafe); - } else if self.parse_keyword(Keyword::RESTRICTED) { - body.parallel = Some(FunctionParallel::Restricted); - } else if self.parse_keyword(Keyword::SAFE) { - body.parallel = Some(FunctionParallel::Safe); - } else { - return self - .expected( - "one of UNSAFE | RESTRICTED | SAFE", - self.peek_token(), - ); - } - } else if self.parse_keyword(Keyword::RETURN) { - ensure_not_set(&body.function_body, "RETURN")?; - body.function_body = Some( - CreateFunctionBody::Return(self.parse_expr()?), - ); - } else { - break; - } - } - Ok( - Statement::CreateFunction(CreateFunction { - or_replace, - temporary, - name, - args: Some(args), - return_type, - behavior: body.behavior, - called_on_null: body.called_on_null, - parallel: body.parallel, - language: body.language, - function_body: body.function_body, - if_not_exists: false, - using: None, - determinism_specifier: None, - options: None, - remote_connection: None, - }), - ) - } - /// Parse `CREATE FUNCTION` for [Hive] - /// - /// [Hive]: https://cwiki.apache.org/confluence/display/hive/languagemanual+ddl#LanguageManualDDL-Create/Drop/ReloadFunction - fn parse_hive_create_function( - &mut self, - or_replace: bool, - temporary: bool, - ) -> Result { - let name = self.parse_object_name(false)?; - self.expect_keyword_is(Keyword::AS)?; - let as_ = self.parse_create_function_body_string()?; - let using = self.parse_optional_create_function_using()?; - Ok( - Statement::CreateFunction(CreateFunction { - or_replace, - temporary, - name, - function_body: Some(CreateFunctionBody::AsBeforeOptions(as_)), - using, - if_not_exists: false, - args: None, - return_type: None, - behavior: None, - called_on_null: None, - parallel: None, - language: None, - determinism_specifier: None, - options: None, - remote_connection: None, - }), - ) - } - /// Parse `CREATE FUNCTION` for [BigQuery] - /// - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#create_function_statement - fn parse_bigquery_create_function( - &mut self, - or_replace: bool, - temporary: bool, - ) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let name = self.parse_object_name(false)?; - let parse_function_param = | - parser: &mut Parser, - | -> Result { - let name = parser.parse_identifier()?; - let data_type = parser.parse_data_type()?; - Ok(OperateFunctionArg { - mode: None, - name: Some(name), - data_type, - default_expr: None, - }) - }; - self.expect_token(&Token::LParen)?; - let args = self.parse_comma_separated0(parse_function_param, Token::RParen)?; - self.expect_token(&Token::RParen)?; - let return_type = if self.parse_keyword(Keyword::RETURNS) { - Some(self.parse_data_type()?) - } else { - None - }; - let determinism_specifier = if self.parse_keyword(Keyword::DETERMINISTIC) { - Some(FunctionDeterminismSpecifier::Deterministic) - } else if self.parse_keywords(&[Keyword::NOT, Keyword::DETERMINISTIC]) { - Some(FunctionDeterminismSpecifier::NotDeterministic) - } else { - None - }; - let language = if self.parse_keyword(Keyword::LANGUAGE) { - Some(self.parse_identifier()?) - } else { - None - }; - let remote_connection = if self - .parse_keywords(&[Keyword::REMOTE, Keyword::WITH, Keyword::CONNECTION]) - { - Some(self.parse_object_name(false)?) - } else { - None - }; - let mut options = self.maybe_parse_options(Keyword::OPTIONS)?; - let function_body = if remote_connection.is_none() { - self.expect_keyword_is(Keyword::AS)?; - let expr = self.parse_expr()?; - if options.is_none() { - options = self.maybe_parse_options(Keyword::OPTIONS)?; - Some(CreateFunctionBody::AsBeforeOptions(expr)) - } else { - Some(CreateFunctionBody::AsAfterOptions(expr)) - } - } else { - None - }; - Ok( - Statement::CreateFunction(CreateFunction { - or_replace, - temporary, - if_not_exists, - name, - args: Some(args), - return_type, - function_body, - language, - determinism_specifier, - options, - remote_connection, - using: None, - behavior: None, - called_on_null: None, - parallel: None, - }), - ) - } - fn parse_function_arg(&mut self) -> Result { - let mode = if self.parse_keyword(Keyword::IN) { - Some(ArgMode::In) - } else if self.parse_keyword(Keyword::OUT) { - Some(ArgMode::Out) - } else if self.parse_keyword(Keyword::INOUT) { - Some(ArgMode::InOut) - } else { - None - }; - let mut name = None; - let mut data_type = self.parse_data_type()?; - if let DataType::Custom(n, _) = &data_type { - match n.0[0].clone() { - ObjectNamePart::Identifier(ident) => name = Some(ident), - } - data_type = self.parse_data_type()?; - } - let default_expr = if self.parse_keyword(Keyword::DEFAULT) - || self.consume_token(&Token::Eq) - { - Some(self.parse_expr()?) - } else { - None - }; - Ok(OperateFunctionArg { - mode, - name, - data_type, - default_expr, - }) - } - /// Parse statements of the DropTrigger type such as: - /// - /// ```sql - /// DROP TRIGGER [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ] - /// ``` - pub fn parse_drop_trigger(&mut self) -> Result { - if !(self.dialect.is::() - || self.dialect.is::()) - { - self.prev_token(); - return self.expected("an object type after DROP", self.peek_token()); - } - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let trigger_name = self.parse_object_name(false)?; - self.expect_keyword_is(Keyword::ON)?; - let table_name = self.parse_object_name(false)?; - let option = self - .parse_one_of_keywords(&[Keyword::CASCADE, Keyword::RESTRICT]) - .map(|keyword| match keyword { - Keyword::CASCADE => ReferentialAction::Cascade, - Keyword::RESTRICT => ReferentialAction::Restrict, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }); - Ok(Statement::DropTrigger { - if_exists, - trigger_name, - table_name, - option, - }) - } - pub fn parse_create_trigger( - &mut self, - or_replace: bool, - is_constraint: bool, - ) -> Result { - if !(self.dialect.is::() - || self.dialect.is::()) - { - self.prev_token(); - return self.expected("an object type after CREATE", self.peek_token()); - } - let name = self.parse_object_name(false)?; - let period = self.parse_trigger_period()?; - let events = self - .parse_keyword_separated(Keyword::OR, Parser::parse_trigger_event)?; - self.expect_keyword_is(Keyword::ON)?; - let table_name = self.parse_object_name(false)?; - let referenced_table_name = if self.parse_keyword(Keyword::FROM) { - self.parse_object_name(true).ok() - } else { - None - }; - let characteristics = self.parse_constraint_characteristics()?; - let mut referencing = ::alloc::vec::Vec::new(); - if self.parse_keyword(Keyword::REFERENCING) { - while let Some(refer) = self.parse_trigger_referencing()? { - referencing.push(refer); - } - } - self.expect_keyword_is(Keyword::FOR)?; - let include_each = self.parse_keyword(Keyword::EACH); - let trigger_object = match self - .expect_one_of_keywords(&[Keyword::ROW, Keyword::STATEMENT])? - { - Keyword::ROW => TriggerObject::Row, - Keyword::STATEMENT => TriggerObject::Statement, - _ => ::core::panicking::panic("internal error: entered unreachable code"), - }; - let condition = self - .parse_keyword(Keyword::WHEN) - .then(|| self.parse_expr()) - .transpose()?; - self.expect_keyword_is(Keyword::EXECUTE)?; - let exec_body = self.parse_trigger_exec_body()?; - Ok(Statement::CreateTrigger { - or_replace, - is_constraint, - name, - period, - events, - table_name, - referenced_table_name, - referencing, - trigger_object, - include_each, - condition, - exec_body, - characteristics, - }) - } - pub fn parse_trigger_period(&mut self) -> Result { - Ok( - match self - .expect_one_of_keywords( - &[Keyword::BEFORE, Keyword::AFTER, Keyword::INSTEAD], - )? - { - Keyword::BEFORE => TriggerPeriod::Before, - Keyword::AFTER => TriggerPeriod::After, - Keyword::INSTEAD => { - self.expect_keyword_is(Keyword::OF) - .map(|_| TriggerPeriod::InsteadOf)? - } - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }, - ) - } - pub fn parse_trigger_event(&mut self) -> Result { - Ok( - match self - .expect_one_of_keywords( - &[ - Keyword::INSERT, - Keyword::UPDATE, - Keyword::DELETE, - Keyword::TRUNCATE, - ], - )? - { - Keyword::INSERT => TriggerEvent::Insert, - Keyword::UPDATE => { - if self.parse_keyword(Keyword::OF) { - let cols = self - .parse_comma_separated(Parser::parse_identifier)?; - TriggerEvent::Update(cols) - } else { - TriggerEvent::Update(::alloc::vec::Vec::new()) - } - } - Keyword::DELETE => TriggerEvent::Delete, - Keyword::TRUNCATE => TriggerEvent::Truncate, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }, - ) - } - pub fn parse_trigger_referencing( - &mut self, - ) -> Result, ParserError> { - let refer_type = match self - .parse_one_of_keywords(&[Keyword::OLD, Keyword::NEW]) - { - Some(Keyword::OLD) if self.parse_keyword(Keyword::TABLE) => { - TriggerReferencingType::OldTable - } - Some(Keyword::NEW) if self.parse_keyword(Keyword::TABLE) => { - TriggerReferencingType::NewTable - } - _ => { - return Ok(None); - } - }; - let is_as = self.parse_keyword(Keyword::AS); - let transition_relation_name = self.parse_object_name(false)?; - Ok( - Some(TriggerReferencing { - refer_type, - is_as, - transition_relation_name, - }), - ) - } - pub fn parse_trigger_exec_body( - &mut self, - ) -> Result { - Ok(TriggerExecBody { - exec_type: match self - .expect_one_of_keywords(&[Keyword::FUNCTION, Keyword::PROCEDURE])? - { - Keyword::FUNCTION => TriggerExecBodyType::Function, - Keyword::PROCEDURE => TriggerExecBodyType::Procedure, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }, - func_desc: self.parse_function_desc()?, - }) - } - pub fn parse_create_macro( - &mut self, - or_replace: bool, - temporary: bool, - ) -> Result { - if (self.dialect.is::() - || self.dialect.is::()) - { - let name = self.parse_object_name(false)?; - self.expect_token(&Token::LParen)?; - let args = if self.consume_token(&Token::RParen) { - self.prev_token(); - None - } else { - Some(self.parse_comma_separated(Parser::parse_macro_arg)?) - }; - self.expect_token(&Token::RParen)?; - self.expect_keyword_is(Keyword::AS)?; - Ok(Statement::CreateMacro { - or_replace, - temporary, - name, - args, - definition: if self.parse_keyword(Keyword::TABLE) { - MacroDefinition::Table(self.parse_query()?) - } else { - MacroDefinition::Expr(self.parse_expr()?) - }, - }) - } else { - self.prev_token(); - self.expected("an object type after CREATE", self.peek_token()) - } - } - fn parse_macro_arg(&mut self) -> Result { - let name = self.parse_identifier()?; - let default_expr = if self.consume_token(&Token::Assignment) - || self.consume_token(&Token::RArrow) - { - Some(self.parse_expr()?) - } else { - None - }; - Ok(MacroArg { name, default_expr }) - } - pub fn parse_create_external_table( - &mut self, - or_replace: bool, - ) -> Result { - self.expect_keyword_is(Keyword::TABLE)?; - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let table_name = self.parse_object_name(false)?; - let (columns, constraints) = self.parse_columns()?; - let hive_distribution = self.parse_hive_distribution()?; - let hive_formats = self.parse_hive_formats()?; - let file_format = if let Some(ff) = &hive_formats.storage { - match ff { - HiveIOFormat::FileFormat { format } => Some(*format), - _ => None, - } - } else { - None - }; - let location = hive_formats.location.clone(); - let table_properties = self.parse_options(Keyword::TBLPROPERTIES)?; - Ok( - CreateTableBuilder::new(table_name) - .columns(columns) - .constraints(constraints) - .hive_distribution(hive_distribution) - .hive_formats(Some(hive_formats)) - .table_properties(table_properties) - .or_replace(or_replace) - .if_not_exists(if_not_exists) - .external(true) - .file_format(file_format) - .location(location) - .build(), - ) - } - pub fn parse_file_format(&mut self) -> Result { - let next_token = self.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::AVRO => Ok(FileFormat::AVRO), - Keyword::JSONFILE => Ok(FileFormat::JSONFILE), - Keyword::ORC => Ok(FileFormat::ORC), - Keyword::PARQUET => Ok(FileFormat::PARQUET), - Keyword::RCFILE => Ok(FileFormat::RCFILE), - Keyword::SEQUENCEFILE => Ok(FileFormat::SEQUENCEFILE), - Keyword::TEXTFILE => Ok(FileFormat::TEXTFILE), - _ => self.expected("fileformat", next_token), - } - } - _ => self.expected("fileformat", next_token), - } - } - pub fn parse_analyze_format(&mut self) -> Result { - let next_token = self.next_token(); - match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::TEXT => Ok(AnalyzeFormat::TEXT), - Keyword::GRAPHVIZ => Ok(AnalyzeFormat::GRAPHVIZ), - Keyword::JSON => Ok(AnalyzeFormat::JSON), - _ => self.expected("fileformat", next_token), - } - } - _ => self.expected("fileformat", next_token), - } - } - pub fn parse_create_view( - &mut self, - or_replace: bool, - temporary: bool, - create_view_params: Option, - ) -> Result { - let materialized = self.parse_keyword(Keyword::MATERIALIZED); - self.expect_keyword_is(Keyword::VIEW)?; - let if_not_exists = (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let allow_unquoted_hyphen = (self.dialect.is::()); - let name = self.parse_object_name(allow_unquoted_hyphen)?; - let columns = self.parse_view_columns()?; - let mut options = CreateTableOptions::None; - let with_options = self.parse_options(Keyword::WITH)?; - if !with_options.is_empty() { - options = CreateTableOptions::With(with_options); - } - let cluster_by = if self.parse_keyword(Keyword::CLUSTER) { - self.expect_keyword_is(Keyword::BY)?; - self.parse_parenthesized_column_list(Optional, false)? - } else { - ::alloc::vec::Vec::new() - }; - if (self.dialect.is::() - || self.dialect.is::()) - { - if let Some(opts) = self.maybe_parse_options(Keyword::OPTIONS)? { - if !opts.is_empty() { - options = CreateTableOptions::Options(opts); - } - } - } - let to = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::TO) - { - Some(self.parse_object_name(false)?) - } else { - None - }; - let comment = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::COMMENT) - { - self.expect_token(&Token::Eq)?; - let next_token = self.next_token(); - match next_token.token { - Token::SingleQuotedString(str) => Some(str), - _ => self.expected("string literal", next_token)?, - } - } else { - None - }; - self.expect_keyword_is(Keyword::AS)?; - let query = self.parse_query()?; - let with_no_schema_binding = (self.dialect.is::() - || self.dialect.is::()) - && self - .parse_keywords( - &[Keyword::WITH, Keyword::NO, Keyword::SCHEMA, Keyword::BINDING], - ); - Ok(Statement::CreateView { - name, - columns, - query, - materialized, - or_replace, - options, - cluster_by, - comment, - with_no_schema_binding, - if_not_exists, - temporary, - to, - params: create_view_params, - }) - } - /// Parse optional parameters for the `CREATE VIEW` statement supported by [MySQL]. - /// - /// [MySQL]: https://dev.mysql.com/doc/refman/9.1/en/create-view.html - fn parse_create_view_params( - &mut self, - ) -> Result, ParserError> { - let algorithm = if self.parse_keyword(Keyword::ALGORITHM) { - self.expect_token(&Token::Eq)?; - Some( - match self - .expect_one_of_keywords( - &[Keyword::UNDEFINED, Keyword::MERGE, Keyword::TEMPTABLE], - )? - { - Keyword::UNDEFINED => CreateViewAlgorithm::Undefined, - Keyword::MERGE => CreateViewAlgorithm::Merge, - Keyword::TEMPTABLE => CreateViewAlgorithm::TempTable, - _ => { - self.prev_token(); - let found = self.next_token(); - return self - .expected( - "UNDEFINED or MERGE or TEMPTABLE after ALGORITHM =", - found, - ); - } - }, - ) - } else { - None - }; - let definer = if self.parse_keyword(Keyword::DEFINER) { - self.expect_token(&Token::Eq)?; - Some(self.parse_grantee_name()?) - } else { - None - }; - let security = if self.parse_keywords(&[Keyword::SQL, Keyword::SECURITY]) { - Some( - match self - .expect_one_of_keywords(&[Keyword::DEFINER, Keyword::INVOKER])? - { - Keyword::DEFINER => CreateViewSecurity::Definer, - Keyword::INVOKER => CreateViewSecurity::Invoker, - _ => { - self.prev_token(); - let found = self.next_token(); - return self - .expected("DEFINER or INVOKER after SQL SECURITY", found); - } - }, - ) - } else { - None - }; - if algorithm.is_some() || definer.is_some() || security.is_some() { - Ok( - Some(CreateViewParams { - algorithm, - definer, - security, - }), - ) - } else { - Ok(None) - } - } - pub fn parse_create_role(&mut self) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let names = self.parse_comma_separated(|p| p.parse_object_name(false))?; - let _ = self.parse_keyword(Keyword::WITH); - let optional_keywords = if (self.dialect.is::()) { - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Keyword::AUTHORIZATION]), - ) - } else if (self.dialect.is::()) { - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - Keyword::LOGIN, - Keyword::NOLOGIN, - Keyword::INHERIT, - Keyword::NOINHERIT, - Keyword::BYPASSRLS, - Keyword::NOBYPASSRLS, - Keyword::PASSWORD, - Keyword::CREATEDB, - Keyword::NOCREATEDB, - Keyword::CREATEROLE, - Keyword::NOCREATEROLE, - Keyword::SUPERUSER, - Keyword::NOSUPERUSER, - Keyword::REPLICATION, - Keyword::NOREPLICATION, - Keyword::CONNECTION, - Keyword::VALID, - Keyword::IN, - Keyword::ROLE, - Keyword::ADMIN, - Keyword::USER, - ]), - ) - } else { - ::alloc::vec::Vec::new() - }; - let mut authorization_owner = None; - let mut login = None; - let mut inherit = None; - let mut bypassrls = None; - let mut password = None; - let mut create_db = None; - let mut create_role = None; - let mut superuser = None; - let mut replication = None; - let mut connection_limit = None; - let mut valid_until = None; - let mut in_role = ::alloc::vec::Vec::new(); - let mut in_group = ::alloc::vec::Vec::new(); - let mut role = ::alloc::vec::Vec::new(); - let mut user = ::alloc::vec::Vec::new(); - let mut admin = ::alloc::vec::Vec::new(); - while let Some(keyword) = self.parse_one_of_keywords(&optional_keywords) { - let loc = self - .tokens - .get(self.index - 1) - .map_or(Location { line: 0, column: 0 }, |t| t.span.start); - match keyword { - Keyword::AUTHORIZATION => { - if authorization_owner.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple AUTHORIZATION", loc), - ); - res - }), - ), - ) - } else { - authorization_owner = Some(self.parse_object_name(false)?); - Ok(()) - } - } - Keyword::LOGIN | Keyword::NOLOGIN => { - if login.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple LOGIN or NOLOGIN", - loc, - ), - ); - res - }), - ), - ) - } else { - login = Some(keyword == Keyword::LOGIN); - Ok(()) - } - } - Keyword::INHERIT | Keyword::NOINHERIT => { - if inherit.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple INHERIT or NOINHERIT", - loc, - ), - ); - res - }), - ), - ) - } else { - inherit = Some(keyword == Keyword::INHERIT); - Ok(()) - } - } - Keyword::BYPASSRLS | Keyword::NOBYPASSRLS => { - if bypassrls.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple BYPASSRLS or NOBYPASSRLS", - loc, - ), - ); - res - }), - ), - ) - } else { - bypassrls = Some(keyword == Keyword::BYPASSRLS); - Ok(()) - } - } - Keyword::CREATEDB | Keyword::NOCREATEDB => { - if create_db.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple CREATEDB or NOCREATEDB", - loc, - ), - ); - res - }), - ), - ) - } else { - create_db = Some(keyword == Keyword::CREATEDB); - Ok(()) - } - } - Keyword::CREATEROLE | Keyword::NOCREATEROLE => { - if create_role.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple CREATEROLE or NOCREATEROLE", - loc, - ), - ); - res - }), - ), - ) - } else { - create_role = Some(keyword == Keyword::CREATEROLE); - Ok(()) - } - } - Keyword::SUPERUSER | Keyword::NOSUPERUSER => { - if superuser.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple SUPERUSER or NOSUPERUSER", - loc, - ), - ); - res - }), - ), - ) - } else { - superuser = Some(keyword == Keyword::SUPERUSER); - Ok(()) - } - } - Keyword::REPLICATION | Keyword::NOREPLICATION => { - if replication.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple REPLICATION or NOREPLICATION", - loc, - ), - ); - res - }), - ), - ) - } else { - replication = Some(keyword == Keyword::REPLICATION); - Ok(()) - } - } - Keyword::PASSWORD => { - if password.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple PASSWORD", loc), - ); - res - }), - ), - ) - } else { - password = if self.parse_keyword(Keyword::NULL) { - Some(Password::NullPassword) - } else { - Some(Password::Password(Expr::Value(self.parse_value()?))) - }; - Ok(()) - } - } - Keyword::CONNECTION => { - self.expect_keyword_is(Keyword::LIMIT)?; - if connection_limit.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Found multiple CONNECTION LIMIT", - loc, - ), - ); - res - }), - ), - ) - } else { - connection_limit = Some( - Expr::Value(self.parse_number_value()?), - ); - Ok(()) - } - } - Keyword::VALID => { - self.expect_keyword_is(Keyword::UNTIL)?; - if valid_until.is_some() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple VALID UNTIL", loc), - ); - res - }), - ), - ) - } else { - valid_until = Some(Expr::Value(self.parse_value()?)); - Ok(()) - } - } - Keyword::IN => { - if self.parse_keyword(Keyword::ROLE) { - if !in_role.is_empty() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple IN ROLE", loc), - ); - res - }), - ), - ) - } else { - in_role = self - .parse_comma_separated(|p| p.parse_identifier())?; - Ok(()) - } - } else if self.parse_keyword(Keyword::GROUP) { - if !in_group.is_empty() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple IN GROUP", loc), - ); - res - }), - ), - ) - } else { - in_group = self - .parse_comma_separated(|p| p.parse_identifier())?; - Ok(()) - } - } else { - self.expected("ROLE or GROUP after IN", self.peek_token()) - } - } - Keyword::ROLE => { - if !role.is_empty() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple ROLE", loc), - ); - res - }), - ), - ) - } else { - role = self.parse_comma_separated(|p| p.parse_identifier())?; - Ok(()) - } - } - Keyword::USER => { - if !user.is_empty() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple USER", loc), - ); - res - }), - ), - ) - } else { - user = self.parse_comma_separated(|p| p.parse_identifier())?; - Ok(()) - } - } - Keyword::ADMIN => { - if !admin.is_empty() { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}{1}", "Found multiple ADMIN", loc), - ); - res - }), - ), - ) - } else { - admin = self - .parse_comma_separated(|p| p.parse_identifier())?; - Ok(()) - } - } - _ => break, - }? - } - Ok(Statement::CreateRole { - names, - if_not_exists, - login, - inherit, - bypassrls, - password, - create_db, - create_role, - replication, - superuser, - connection_limit, - valid_until, - in_role, - in_group, - role, - user, - admin, - authorization_owner, - }) - } - pub fn parse_owner(&mut self) -> Result { - let owner = match self - .parse_one_of_keywords( - &[ - Keyword::CURRENT_USER, - Keyword::CURRENT_ROLE, - Keyword::SESSION_USER, - ], - ) - { - Some(Keyword::CURRENT_USER) => Owner::CurrentUser, - Some(Keyword::CURRENT_ROLE) => Owner::CurrentRole, - Some(Keyword::SESSION_USER) => Owner::SessionUser, - Some(_) => { - ::core::panicking::panic("internal error: entered unreachable code") - } - None => { - match self.parse_identifier() { - Ok(ident) => Owner::Ident(ident), - Err(e) => { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Expected: CURRENT_USER, CURRENT_ROLE, SESSION_USER or identifier after OWNER TO. {0}", - e, - ), - ); - res - }), - ), - ); - } - } - } - }; - Ok(owner) - } - /// ```sql - /// 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 ) ] - /// ``` - /// - /// [PostgreSQL Documentation](https://www.postgresql.org/docs/current/sql-createpolicy.html) - pub fn parse_create_policy(&mut self) -> Result { - let name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::ON)?; - let table_name = self.parse_object_name(false)?; - let policy_type = if self.parse_keyword(Keyword::AS) { - let keyword = self - .expect_one_of_keywords( - &[Keyword::PERMISSIVE, Keyword::RESTRICTIVE], - )?; - Some( - match keyword { - Keyword::PERMISSIVE => CreatePolicyType::Permissive, - Keyword::RESTRICTIVE => CreatePolicyType::Restrictive, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }, - ) - } else { - None - }; - let command = if self.parse_keyword(Keyword::FOR) { - let keyword = self - .expect_one_of_keywords( - &[ - Keyword::ALL, - Keyword::SELECT, - Keyword::INSERT, - Keyword::UPDATE, - Keyword::DELETE, - ], - )?; - Some( - match keyword { - Keyword::ALL => CreatePolicyCommand::All, - Keyword::SELECT => CreatePolicyCommand::Select, - Keyword::INSERT => CreatePolicyCommand::Insert, - Keyword::UPDATE => CreatePolicyCommand::Update, - Keyword::DELETE => CreatePolicyCommand::Delete, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }, - ) - } else { - None - }; - let to = if self.parse_keyword(Keyword::TO) { - Some(self.parse_comma_separated(|p| p.parse_owner())?) - } else { - None - }; - let using = if self.parse_keyword(Keyword::USING) { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Some(expr) - } else { - None - }; - let with_check = if self.parse_keywords(&[Keyword::WITH, Keyword::CHECK]) { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Some(expr) - } else { - None - }; - Ok(CreatePolicy { - name, - table_name, - policy_type, - command, - to, - using, - with_check, - }) - } - /// ```sql - /// CREATE CONNECTOR [IF NOT EXISTS] connector_name - /// [TYPE datasource_type] - /// [URL datasource_url] - /// [COMMENT connector_comment] - /// [WITH DCPROPERTIES(property_name=property_value, ...)] - /// ``` - /// - /// [Hive Documentation](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=27362034#LanguageManualDDL-CreateDataConnectorCreateConnector) - pub fn parse_create_connector(&mut self) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let name = self.parse_identifier()?; - let connector_type = if self.parse_keyword(Keyword::TYPE) { - Some(self.parse_literal_string()?) - } else { - None - }; - let url = if self.parse_keyword(Keyword::URL) { - Some(self.parse_literal_string()?) - } else { - None - }; - let comment = self.parse_optional_inline_comment()?; - let with_dcproperties = match self - .parse_options_with_keywords(&[Keyword::WITH, Keyword::DCPROPERTIES])? - { - properties if !properties.is_empty() => Some(properties), - _ => None, - }; - Ok( - Statement::CreateConnector(CreateConnector { - name, - if_not_exists, - connector_type, - url, - comment, - with_dcproperties, - }), - ) - } - pub fn parse_drop(&mut self) -> Result { - let temporary = (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::TEMPORARY); - let persistent = (self.dialect.is::()) - && self.parse_one_of_keywords(&[Keyword::PERSISTENT]).is_some(); - let object_type = if self.parse_keyword(Keyword::TABLE) { - ObjectType::Table - } else if self.parse_keyword(Keyword::VIEW) { - ObjectType::View - } else if self.parse_keyword(Keyword::INDEX) { - ObjectType::Index - } else if self.parse_keyword(Keyword::ROLE) { - ObjectType::Role - } else if self.parse_keyword(Keyword::SCHEMA) { - ObjectType::Schema - } else if self.parse_keyword(Keyword::DATABASE) { - ObjectType::Database - } else if self.parse_keyword(Keyword::SEQUENCE) { - ObjectType::Sequence - } else if self.parse_keyword(Keyword::STAGE) { - ObjectType::Stage - } else if self.parse_keyword(Keyword::TYPE) { - ObjectType::Type - } else if self.parse_keyword(Keyword::FUNCTION) { - return self.parse_drop_function(); - } else if self.parse_keyword(Keyword::POLICY) { - return self.parse_drop_policy(); - } else if self.parse_keyword(Keyword::CONNECTOR) { - return self.parse_drop_connector(); - } else if self.parse_keyword(Keyword::PROCEDURE) { - return self.parse_drop_procedure(); - } else if self.parse_keyword(Keyword::SECRET) { - return self.parse_drop_secret(temporary, persistent); - } else if self.parse_keyword(Keyword::TRIGGER) { - return self.parse_drop_trigger(); - } else if self.parse_keyword(Keyword::EXTENSION) { - return self.parse_drop_extension(); - } else { - return self - .expected( - "CONNECTOR, DATABASE, EXTENSION, FUNCTION, INDEX, POLICY, PROCEDURE, ROLE, SCHEMA, SECRET, SEQUENCE, STAGE, TABLE, TRIGGER, TYPE, or VIEW after DROP", - self.peek_token(), - ); - }; - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let names = self.parse_comma_separated(|p| p.parse_object_name(false))?; - let loc = self.peek_token().span.start; - let cascade = self.parse_keyword(Keyword::CASCADE); - let restrict = self.parse_keyword(Keyword::RESTRICT); - let purge = self.parse_keyword(Keyword::PURGE); - if cascade && restrict { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Cannot specify both CASCADE and RESTRICT in DROP", - loc, - ), - ); - res - }), - ), - ); - } - if object_type == ObjectType::Role && (cascade || restrict || purge) { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Cannot specify CASCADE, RESTRICT, or PURGE in DROP ROLE", - loc, - ), - ); - res - }), - ), - ); - } - Ok(Statement::Drop { - object_type, - if_exists, - names, - cascade, - restrict, - purge, - temporary, - }) - } - fn parse_optional_drop_behavior(&mut self) -> Option { - match self.parse_one_of_keywords(&[Keyword::CASCADE, Keyword::RESTRICT]) { - Some(Keyword::CASCADE) => Some(DropBehavior::Cascade), - Some(Keyword::RESTRICT) => Some(DropBehavior::Restrict), - _ => None, - } - } - /// ```sql - /// DROP FUNCTION [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...] - /// [ CASCADE | RESTRICT ] - /// ``` - fn parse_drop_function(&mut self) -> Result { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let func_desc = self.parse_comma_separated(Parser::parse_function_desc)?; - let drop_behavior = self.parse_optional_drop_behavior(); - Ok(Statement::DropFunction { - if_exists, - func_desc, - drop_behavior, - }) - } - /// ```sql - /// DROP POLICY [ IF EXISTS ] name ON table_name [ CASCADE | RESTRICT ] - /// ``` - /// - /// [PostgreSQL Documentation](https://www.postgresql.org/docs/current/sql-droppolicy.html) - fn parse_drop_policy(&mut self) -> Result { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::ON)?; - let table_name = self.parse_object_name(false)?; - let drop_behavior = self.parse_optional_drop_behavior(); - Ok(Statement::DropPolicy { - if_exists, - name, - table_name, - drop_behavior, - }) - } - /// ```sql - /// DROP CONNECTOR [IF EXISTS] name - /// ``` - /// - /// See [Hive](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=27362034#LanguageManualDDL-DropConnector) - fn parse_drop_connector(&mut self) -> Result { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let name = self.parse_identifier()?; - Ok(Statement::DropConnector { - if_exists, - name, - }) - } - /// ```sql - /// DROP PROCEDURE [ IF EXISTS ] name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] [, ...] - /// [ CASCADE | RESTRICT ] - /// ``` - fn parse_drop_procedure(&mut self) -> Result { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let proc_desc = self.parse_comma_separated(Parser::parse_function_desc)?; - let drop_behavior = self.parse_optional_drop_behavior(); - Ok(Statement::DropProcedure { - if_exists, - proc_desc, - drop_behavior, - }) - } - fn parse_function_desc(&mut self) -> Result { - let name = self.parse_object_name(false)?; - let args = if self.consume_token(&Token::LParen) { - if self.consume_token(&Token::RParen) { - None - } else { - let args = self.parse_comma_separated(Parser::parse_function_arg)?; - self.expect_token(&Token::RParen)?; - Some(args) - } - } else { - None - }; - Ok(FunctionDesc { name, args }) - } - /// See [DuckDB Docs](https://duckdb.org/docs/sql/statements/create_secret.html) for more details. - fn parse_drop_secret( - &mut self, - temporary: bool, - persistent: bool, - ) -> Result { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let name = self.parse_identifier()?; - let storage_specifier = if self.parse_keyword(Keyword::FROM) { - self.parse_identifier().ok() - } else { - None - }; - let temp = match (temporary, persistent) { - (true, false) => Some(true), - (false, true) => Some(false), - (false, false) => None, - _ => self.expected("TEMPORARY or PERSISTENT", self.peek_token())?, - }; - Ok(Statement::DropSecret { - if_exists, - temporary: temp, - name, - storage_specifier, - }) - } - /// Parse a `DECLARE` statement. - /// - /// ```sql - /// DECLARE name [ BINARY ] [ ASENSITIVE | INSENSITIVE ] [ [ NO ] SCROLL ] - /// CURSOR [ { WITH | WITHOUT } HOLD ] FOR query - /// ``` - /// - /// The syntax can vary significantly between warehouses. See the grammar - /// on the warehouse specific function in such cases. - pub fn parse_declare(&mut self) -> Result { - if (self.dialect.is::()) { - return self.parse_big_query_declare(); - } - if (self.dialect.is::()) { - return self.parse_snowflake_declare(); - } - if (self.dialect.is::()) { - return self.parse_mssql_declare(); - } - let name = self.parse_identifier()?; - let binary = Some(self.parse_keyword(Keyword::BINARY)); - let sensitive = if self.parse_keyword(Keyword::INSENSITIVE) { - Some(true) - } else if self.parse_keyword(Keyword::ASENSITIVE) { - Some(false) - } else { - None - }; - let scroll = if self.parse_keyword(Keyword::SCROLL) { - Some(true) - } else if self.parse_keywords(&[Keyword::NO, Keyword::SCROLL]) { - Some(false) - } else { - None - }; - self.expect_keyword_is(Keyword::CURSOR)?; - let declare_type = Some(DeclareType::Cursor); - let hold = match self - .parse_one_of_keywords(&[Keyword::WITH, Keyword::WITHOUT]) - { - Some(keyword) => { - self.expect_keyword_is(Keyword::HOLD)?; - match keyword { - Keyword::WITH => Some(true), - Keyword::WITHOUT => Some(false), - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - } - } - None => None, - }; - self.expect_keyword_is(Keyword::FOR)?; - let query = Some(self.parse_query()?); - Ok(Statement::Declare { - stmts: <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - Declare { - names: <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([name]), - ), - data_type: None, - assignment: None, - declare_type, - binary, - sensitive, - scroll, - hold, - for_query: query, - }, - ]), - ), - }) - } - /// Parse a [BigQuery] `DECLARE` statement. - /// - /// Syntax: - /// ```text - /// DECLARE variable_name[, ...] [{ | }]; - /// ``` - /// [BigQuery]: https://cloud.google.com/bigquery/docs/reference/standard-sql/procedural-language#declare - pub fn parse_big_query_declare(&mut self) -> Result { - let names = self.parse_comma_separated(Parser::parse_identifier)?; - let data_type = match self.peek_token().token { - Token::Word(w) if w.keyword == Keyword::DEFAULT => None, - _ => Some(self.parse_data_type()?), - }; - let expr = if data_type.is_some() { - if self.parse_keyword(Keyword::DEFAULT) { - Some(self.parse_expr()?) - } else { - None - } - } else { - self.expect_keyword_is(Keyword::DEFAULT)?; - Some(self.parse_expr()?) - }; - Ok(Statement::Declare { - stmts: <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - Declare { - names, - data_type, - assignment: expr - .map(|expr| DeclareAssignment::Default(Box::new(expr))), - declare_type: None, - binary: None, - sensitive: None, - scroll: None, - hold: None, - for_query: None, - }, - ]), - ), - }) - } - /// Parse a [Snowflake] `DECLARE` statement. - /// - /// Syntax: - /// ```text - /// DECLARE - /// [{ - /// | - /// | - /// | }; ... ] - /// - /// - /// [] [ { DEFAULT | := } ] - /// - /// - /// CURSOR FOR - /// - /// - /// RESULTSET [ { DEFAULT | := } ( ) ] ; - /// - /// - /// EXCEPTION [ ( , '' ) ] ; - /// ``` - /// - /// [Snowflake]: https://docs.snowflake.com/en/sql-reference/snowflake-scripting/declare - pub fn parse_snowflake_declare(&mut self) -> Result { - let mut stmts = ::alloc::vec::Vec::new(); - loop { - let name = self.parse_identifier()?; - let (declare_type, for_query, assigned_expr, data_type) = if self - .parse_keyword(Keyword::CURSOR) - { - self.expect_keyword_is(Keyword::FOR)?; - match self.peek_token().token { - Token::Word(w) if w.keyword == Keyword::SELECT => { - ( - Some(DeclareType::Cursor), - Some(self.parse_query()?), - None, - None, - ) - } - _ => { - ( - Some(DeclareType::Cursor), - None, - Some(DeclareAssignment::For(Box::new(self.parse_expr()?))), - None, - ) - } - } - } else if self.parse_keyword(Keyword::RESULTSET) { - let assigned_expr = if self.peek_token().token != Token::SemiColon { - self.parse_snowflake_variable_declaration_expression()? - } else { - None - }; - (Some(DeclareType::ResultSet), None, assigned_expr, None) - } else if self.parse_keyword(Keyword::EXCEPTION) { - let assigned_expr = if self.peek_token().token == Token::LParen { - Some(DeclareAssignment::Expr(Box::new(self.parse_expr()?))) - } else { - None - }; - (Some(DeclareType::Exception), None, assigned_expr, None) - } else { - let (assigned_expr, data_type) = if let Some(assigned_expr) = self - .parse_snowflake_variable_declaration_expression()? - { - (Some(assigned_expr), None) - } else if let Token::Word(_) = self.peek_token().token { - let data_type = self.parse_data_type()?; - ( - self.parse_snowflake_variable_declaration_expression()?, - Some(data_type), - ) - } else { - (None, None) - }; - (None, None, assigned_expr, data_type) - }; - let stmt = Declare { - names: <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([name]), - ), - data_type, - assignment: assigned_expr, - declare_type, - binary: None, - sensitive: None, - scroll: None, - hold: None, - for_query, - }; - stmts.push(stmt); - if self.consume_token(&Token::SemiColon) { - match self.peek_token().token { - Token::Word( - w, - ) if ALL_KEYWORDS - .binary_search(&w.value.to_uppercase().as_str()) - .is_err() => { - continue; - } - _ => { - self.prev_token(); - } - } - } - break; - } - Ok(Statement::Declare { stmts }) - } - /// Parse a [MsSql] `DECLARE` statement. - /// - /// Syntax: - /// ```text - /// DECLARE - /// ``` - /// [MsSql]: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/declare-local-variable-transact-sql?view=sql-server-ver16 - pub fn parse_mssql_declare(&mut self) -> Result { - let stmts = self.parse_comma_separated(Parser::parse_mssql_declare_stmt)?; - Ok(Statement::Declare { stmts }) - } - /// Parse the body of a [MsSql] `DECLARE`statement. - /// - /// Syntax: - /// ```text - /// ``` - /// [MsSql]: https://learn.microsoft.com/en-us/sql/t-sql/language-elements/declare-local-variable-transact-sql?view=sql-server-ver16 - pub fn parse_mssql_declare_stmt(&mut self) -> Result { - let name = { - let ident = self.parse_identifier()?; - if !ident.value.starts_with('@') { - Err( - ParserError::TokenizerError( - "Invalid MsSql variable declaration.".to_string(), - ), - ) - } else { - Ok(ident) - } - }?; - let (declare_type, data_type) = match self.peek_token().token { - Token::Word(w) => { - match w.keyword { - Keyword::CURSOR => { - self.next_token(); - (Some(DeclareType::Cursor), None) - } - Keyword::AS => { - self.next_token(); - (None, Some(self.parse_data_type()?)) - } - _ => (None, Some(self.parse_data_type()?)), - } - } - _ => (None, Some(self.parse_data_type()?)), - }; - let assignment = self.parse_mssql_variable_declaration_expression()?; - Ok(Declare { - names: <[_]>::into_vec(#[rustc_box] ::alloc::boxed::Box::new([name])), - data_type, - assignment, - declare_type, - binary: None, - sensitive: None, - scroll: None, - hold: None, - for_query: None, - }) - } - /// Parses the assigned expression in a variable declaration. - /// - /// Syntax: - /// ```text - /// [ { DEFAULT | := } ] - /// ``` - /// - pub fn parse_snowflake_variable_declaration_expression( - &mut self, - ) -> Result, ParserError> { - Ok( - match self.peek_token().token { - Token::Word(w) if w.keyword == Keyword::DEFAULT => { - self.next_token(); - Some(DeclareAssignment::Default(Box::new(self.parse_expr()?))) - } - Token::Assignment => { - self.next_token(); - Some( - DeclareAssignment::DuckAssignment( - Box::new(self.parse_expr()?), - ), - ) - } - _ => None, - }, - ) - } - /// Parses the assigned expression in a variable declaration. - /// - /// Syntax: - /// ```text - /// [ = ] - /// ``` - pub fn parse_mssql_variable_declaration_expression( - &mut self, - ) -> Result, ParserError> { - Ok( - match self.peek_token().token { - Token::Eq => { - self.next_token(); - Some( - DeclareAssignment::MsSqlAssignment( - Box::new(self.parse_expr()?), - ), - ) - } - _ => None, - }, - ) - } - pub fn parse_fetch_statement(&mut self) -> Result { - let direction = if self.parse_keyword(Keyword::NEXT) { - FetchDirection::Next - } else if self.parse_keyword(Keyword::PRIOR) { - FetchDirection::Prior - } else if self.parse_keyword(Keyword::FIRST) { - FetchDirection::First - } else if self.parse_keyword(Keyword::LAST) { - FetchDirection::Last - } else if self.parse_keyword(Keyword::ABSOLUTE) { - FetchDirection::Absolute { - limit: self.parse_number_value()?, - } - } else if self.parse_keyword(Keyword::RELATIVE) { - FetchDirection::Relative { - limit: self.parse_number_value()?, - } - } else if self.parse_keyword(Keyword::FORWARD) { - if self.parse_keyword(Keyword::ALL) { - FetchDirection::ForwardAll - } else { - FetchDirection::Forward { - limit: Some(self.parse_number_value()?), - } - } - } else if self.parse_keyword(Keyword::BACKWARD) { - if self.parse_keyword(Keyword::ALL) { - FetchDirection::BackwardAll - } else { - FetchDirection::Backward { - limit: Some(self.parse_number_value()?), - } - } - } else if self.parse_keyword(Keyword::ALL) { - FetchDirection::All - } else { - FetchDirection::Count { - limit: self.parse_number_value()?, - } - }; - self.expect_one_of_keywords(&[Keyword::FROM, Keyword::IN])?; - let name = self.parse_identifier()?; - let into = if self.parse_keyword(Keyword::INTO) { - Some(self.parse_object_name(false)?) - } else { - None - }; - Ok(Statement::Fetch { - name, - direction, - into, - }) - } - pub fn parse_discard(&mut self) -> Result { - let object_type = if self.parse_keyword(Keyword::ALL) { - DiscardObject::ALL - } else if self.parse_keyword(Keyword::PLANS) { - DiscardObject::PLANS - } else if self.parse_keyword(Keyword::SEQUENCES) { - DiscardObject::SEQUENCES - } else if self.parse_keyword(Keyword::TEMP) - || self.parse_keyword(Keyword::TEMPORARY) - { - DiscardObject::TEMP - } else { - return self - .expected( - "ALL, PLANS, SEQUENCES, TEMP or TEMPORARY after DISCARD", - self.peek_token(), - ); - }; - Ok(Statement::Discard { object_type }) - } - pub fn parse_create_index( - &mut self, - unique: bool, - ) -> Result { - let concurrently = self.parse_keyword(Keyword::CONCURRENTLY); - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let index_name = if if_not_exists || !self.parse_keyword(Keyword::ON) { - let index_name = self.parse_object_name(false)?; - self.expect_keyword_is(Keyword::ON)?; - Some(index_name) - } else { - None - }; - let table_name = self.parse_object_name(false)?; - let using = if self.parse_keyword(Keyword::USING) { - Some(self.parse_index_type()?) - } else { - None - }; - self.expect_token(&Token::LParen)?; - let columns = if let Some(using) = &using { - match using { - IndexType::GIN => { - self.parse_comma_separated( - Parser::parse_create_index_expr::, - )? - } - IndexType::GiST => { - self.parse_comma_separated( - Parser::parse_create_index_expr::, - )? - } - IndexType::Hash => { - self.parse_comma_separated( - Parser::parse_create_index_expr::, - )? - } - IndexType::Bloom => { - self.parse_comma_separated( - Parser::parse_create_index_expr::, - )? - } - IndexType::BTree => { - self.parse_comma_separated( - Parser::parse_create_index_expr::, - )? - } - IndexType::SPGiST | IndexType::BRIN => { - self.parse_comma_separated(Parser::parse_order_by_expr)? - .into_iter() - .map(|expr| expr.into()) - .collect() - } - } - } else { - self.parse_comma_separated(Parser::parse_order_by_expr)? - .into_iter() - .map(|expr| expr.into()) - .collect() - }; - self.expect_token(&Token::RParen)?; - let include = if self.parse_keyword(Keyword::INCLUDE) { - self.expect_token(&Token::LParen)?; - let columns = self.parse_comma_separated(|p| p.parse_identifier())?; - self.expect_token(&Token::RParen)?; - columns - } else { - ::alloc::vec::Vec::new() - }; - let nulls_distinct = if self.parse_keyword(Keyword::NULLS) { - let not = self.parse_keyword(Keyword::NOT); - self.expect_keyword_is(Keyword::DISTINCT)?; - Some(!not) - } else { - None - }; - let with = if self.dialect.supports_create_index_with_clause() - && self.parse_keyword(Keyword::WITH) - { - self.expect_token(&Token::LParen)?; - let with_params = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - with_params - } else { - Vec::new() - }; - let predicate = if self.parse_keyword(Keyword::WHERE) { - Some(self.parse_expr()?) - } else { - None - }; - Ok( - Statement::CreateIndex(CreateIndex { - name: index_name, - table_name, - using, - columns, - unique, - concurrently, - if_not_exists, - include, - nulls_distinct, - with, - predicate, - }), - ) - } - pub fn parse_create_extension(&mut self) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let name = self.parse_identifier()?; - let (schema, version, cascade) = if self.parse_keyword(Keyword::WITH) { - let schema = if self.parse_keyword(Keyword::SCHEMA) { - Some(self.parse_identifier()?) - } else { - None - }; - let version = if self.parse_keyword(Keyword::VERSION) { - Some(self.parse_identifier()?) - } else { - None - }; - let cascade = self.parse_keyword(Keyword::CASCADE); - (schema, version, cascade) - } else { - (None, None, false) - }; - Ok(Statement::CreateExtension { - name, - if_not_exists, - schema, - version, - cascade, - }) - } - /// Parse a PostgreSQL-specific [Statement::DropExtension] statement. - pub fn parse_drop_extension(&mut self) -> Result { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let names = self.parse_comma_separated(|p| p.parse_identifier())?; - let cascade_or_restrict = self - .parse_one_of_keywords(&[Keyword::CASCADE, Keyword::RESTRICT]); - Ok(Statement::DropExtension { - names, - if_exists, - cascade_or_restrict: cascade_or_restrict - .map(|k| match k { - Keyword::CASCADE => Ok(ReferentialAction::Cascade), - Keyword::RESTRICT => Ok(ReferentialAction::Restrict), - _ => self.expected("CASCADE or RESTRICT", self.peek_token()), - }) - .transpose()?, - }) - } - pub fn parse_hive_distribution( - &mut self, - ) -> Result { - if self.parse_keywords(&[Keyword::PARTITIONED, Keyword::BY]) { - self.expect_token(&Token::LParen)?; - let columns = self.parse_comma_separated(Parser::parse_column_def)?; - self.expect_token(&Token::RParen)?; - Ok(HiveDistributionStyle::PARTITIONED { - columns, - }) - } else { - Ok(HiveDistributionStyle::NONE) - } - } - pub fn parse_hive_formats(&mut self) -> Result { - let mut hive_format = HiveFormat::default(); - loop { - match self - .parse_one_of_keywords( - &[ - Keyword::ROW, - Keyword::STORED, - Keyword::LOCATION, - Keyword::WITH, - ], - ) - { - Some(Keyword::ROW) => { - hive_format.row_format = Some(self.parse_row_format()?); - } - Some(Keyword::STORED) => { - self.expect_keyword_is(Keyword::AS)?; - if self.parse_keyword(Keyword::INPUTFORMAT) { - let input_format = self.parse_expr()?; - self.expect_keyword_is(Keyword::OUTPUTFORMAT)?; - let output_format = self.parse_expr()?; - hive_format.storage = Some(HiveIOFormat::IOF { - input_format, - output_format, - }); - } else { - let format = self.parse_file_format()?; - hive_format.storage = Some(HiveIOFormat::FileFormat { - format, - }); - } - } - Some(Keyword::LOCATION) => { - hive_format.location = Some(self.parse_literal_string()?); - } - Some(Keyword::WITH) => { - self.prev_token(); - let properties = self - .parse_options_with_keywords( - &[Keyword::WITH, Keyword::SERDEPROPERTIES], - )?; - if !properties.is_empty() { - hive_format.serde_properties = Some(properties); - } else { - break; - } - } - None => break, - _ => break, - } - } - Ok(hive_format) - } - pub fn parse_row_format(&mut self) -> Result { - self.expect_keyword_is(Keyword::FORMAT)?; - match self.parse_one_of_keywords(&[Keyword::SERDE, Keyword::DELIMITED]) { - Some(Keyword::SERDE) => { - let class = self.parse_literal_string()?; - Ok(HiveRowFormat::SERDE { class }) - } - _ => { - let mut row_delimiters = ::alloc::vec::Vec::new(); - loop { - match self - .parse_one_of_keywords( - &[ - Keyword::FIELDS, - Keyword::COLLECTION, - Keyword::MAP, - Keyword::LINES, - Keyword::NULL, - ], - ) - { - Some(Keyword::FIELDS) => { - if self.parse_keywords(&[Keyword::TERMINATED, Keyword::BY]) - { - row_delimiters - .push(HiveRowDelimiter { - delimiter: HiveDelimiter::FieldsTerminatedBy, - char: self.parse_identifier()?, - }); - if self.parse_keywords(&[Keyword::ESCAPED, Keyword::BY]) { - row_delimiters - .push(HiveRowDelimiter { - delimiter: HiveDelimiter::FieldsEscapedBy, - char: self.parse_identifier()?, - }); - } - } else { - break; - } - } - Some(Keyword::COLLECTION) => { - if self - .parse_keywords( - &[Keyword::ITEMS, Keyword::TERMINATED, Keyword::BY], - ) - { - row_delimiters - .push(HiveRowDelimiter { - delimiter: HiveDelimiter::CollectionItemsTerminatedBy, - char: self.parse_identifier()?, - }); - } else { - break; - } - } - Some(Keyword::MAP) => { - if self - .parse_keywords( - &[Keyword::KEYS, Keyword::TERMINATED, Keyword::BY], - ) - { - row_delimiters - .push(HiveRowDelimiter { - delimiter: HiveDelimiter::MapKeysTerminatedBy, - char: self.parse_identifier()?, - }); - } else { - break; - } - } - Some(Keyword::LINES) => { - if self.parse_keywords(&[Keyword::TERMINATED, Keyword::BY]) - { - row_delimiters - .push(HiveRowDelimiter { - delimiter: HiveDelimiter::LinesTerminatedBy, - char: self.parse_identifier()?, - }); - } else { - break; - } - } - Some(Keyword::NULL) => { - if self.parse_keywords(&[Keyword::DEFINED, Keyword::AS]) { - row_delimiters - .push(HiveRowDelimiter { - delimiter: HiveDelimiter::NullDefinedAs, - char: self.parse_identifier()?, - }); - } else { - break; - } - } - _ => { - break; - } - } - } - Ok(HiveRowFormat::DELIMITED { - delimiters: row_delimiters, - }) - } - } - } - fn parse_optional_on_cluster(&mut self) -> Result, ParserError> { - if self.parse_keywords(&[Keyword::ON, Keyword::CLUSTER]) { - Ok(Some(self.parse_identifier()?)) - } else { - Ok(None) - } - } - pub fn parse_create_table( - &mut self, - or_replace: bool, - temporary: bool, - global: Option, - transient: bool, - ) -> Result { - let allow_unquoted_hyphen = (self.dialect.is::()); - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let table_name = self.parse_object_name(allow_unquoted_hyphen)?; - let on_cluster = self.parse_optional_on_cluster()?; - let like = if self.parse_keyword(Keyword::LIKE) - || self.parse_keyword(Keyword::ILIKE) - { - self.parse_object_name(allow_unquoted_hyphen).ok() - } else { - None - }; - let clone = if self.parse_keyword(Keyword::CLONE) { - self.parse_object_name(allow_unquoted_hyphen).ok() - } else { - None - }; - let (columns, constraints) = self.parse_columns()?; - let mut comment = if (self.dialect.is::()) - && self.parse_keyword(Keyword::COMMENT) - { - let next_token = self.next_token(); - match next_token.token { - Token::SingleQuotedString(str) => { - Some(CommentDef::AfterColumnDefsWithoutEq(str)) - } - _ => self.expected("comment", next_token)?, - } - } else { - None - }; - let without_rowid = self.parse_keywords(&[Keyword::WITHOUT, Keyword::ROWID]); - let hive_distribution = self.parse_hive_distribution()?; - let clustered_by = self.parse_optional_clustered_by()?; - let hive_formats = self.parse_hive_formats()?; - let with_options = self.parse_options(Keyword::WITH)?; - let table_properties = self.parse_options(Keyword::TBLPROPERTIES)?; - let engine = if self.parse_keyword(Keyword::ENGINE) { - self.expect_token(&Token::Eq)?; - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => { - let name = w.value; - let parameters = if self.peek_token() == Token::LParen { - Some(self.parse_parenthesized_identifiers()?) - } else { - None - }; - Some(TableEngine { name, parameters }) - } - _ => self.expected("identifier", next_token)?, - } - } else { - None - }; - let auto_increment_offset = if self.parse_keyword(Keyword::AUTO_INCREMENT) { - let _ = self.consume_token(&Token::Eq); - let next_token = self.next_token(); - match next_token.token { - Token::Number(s, _) => { - Some(Self::parse::(s, next_token.span.start)?) - } - _ => self.expected("literal int", next_token)?, - } - } else { - None - }; - let primary_key = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::PRIMARY, Keyword::KEY]) - { - Some(Box::new(self.parse_expr()?)) - } else { - None - }; - let order_by = if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - if self.consume_token(&Token::LParen) { - let columns = if self.peek_token() != Token::RParen { - self.parse_comma_separated(|p| p.parse_expr())? - } else { - ::alloc::vec::Vec::new() - }; - self.expect_token(&Token::RParen)?; - Some(OneOrManyWithParens::Many(columns)) - } else { - Some(OneOrManyWithParens::One(self.parse_expr()?)) - } - } else { - None - }; - let create_table_config = self.parse_optional_create_table_config()?; - let default_charset = if self - .parse_keywords(&[Keyword::DEFAULT, Keyword::CHARSET]) - { - self.expect_token(&Token::Eq)?; - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => Some(w.value), - _ => self.expected("identifier", next_token)?, - } - } else { - None - }; - let collation = if self.parse_keywords(&[Keyword::COLLATE]) { - self.expect_token(&Token::Eq)?; - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => Some(w.value), - _ => self.expected("identifier", next_token)?, - } - } else { - None - }; - let on_commit = if self.parse_keywords(&[Keyword::ON, Keyword::COMMIT]) { - Some(self.parse_create_table_on_commit()?) - } else { - None - }; - let strict = self.parse_keyword(Keyword::STRICT); - if !(self.dialect.is::()) - && self.parse_keyword(Keyword::COMMENT) - { - self.prev_token(); - comment = self.parse_optional_inline_comment()?; - } - let query = if self.parse_keyword(Keyword::AS) { - Some(self.parse_query()?) - } else if self.dialect.supports_create_table_select() - && self.parse_keyword(Keyword::SELECT) - { - self.prev_token(); - Some(self.parse_query()?) - } else { - None - }; - Ok( - CreateTableBuilder::new(table_name) - .temporary(temporary) - .columns(columns) - .constraints(constraints) - .with_options(with_options) - .table_properties(table_properties) - .or_replace(or_replace) - .if_not_exists(if_not_exists) - .transient(transient) - .hive_distribution(hive_distribution) - .hive_formats(Some(hive_formats)) - .global(global) - .query(query) - .without_rowid(without_rowid) - .like(like) - .clone_clause(clone) - .engine(engine) - .comment(comment) - .auto_increment_offset(auto_increment_offset) - .order_by(order_by) - .default_charset(default_charset) - .collation(collation) - .on_commit(on_commit) - .on_cluster(on_cluster) - .clustered_by(clustered_by) - .partition_by(create_table_config.partition_by) - .cluster_by(create_table_config.cluster_by) - .options(create_table_config.options) - .primary_key(primary_key) - .strict(strict) - .build(), - ) - } - pub(crate) fn parse_create_table_on_commit( - &mut self, - ) -> Result { - if self.parse_keywords(&[Keyword::DELETE, Keyword::ROWS]) { - Ok(OnCommit::DeleteRows) - } else if self.parse_keywords(&[Keyword::PRESERVE, Keyword::ROWS]) { - Ok(OnCommit::PreserveRows) - } else if self.parse_keywords(&[Keyword::DROP]) { - Ok(OnCommit::Drop) - } else { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Expecting DELETE ROWS, PRESERVE ROWS or DROP", - self.peek_token(), - ), - ); - res - }), - ), - ) - } - } - /// Parse configuration like partitioning, clustering information during the table creation. - /// - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/data-definition-language#syntax_2) - /// [PostgreSQL](https://www.postgresql.org/docs/current/ddl-partitioning.html) - fn parse_optional_create_table_config( - &mut self, - ) -> Result { - let partition_by = if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::PARTITION, Keyword::BY]) - { - Some(Box::new(self.parse_expr()?)) - } else { - None - }; - let mut cluster_by = None; - let mut options = None; - if (self.dialect.is::() - || self.dialect.is::()) - { - if self.parse_keywords(&[Keyword::CLUSTER, Keyword::BY]) { - cluster_by = Some( - WrappedCollection::NoWrapping( - self.parse_comma_separated(|p| p.parse_identifier())?, - ), - ); - } - if let Token::Word(word) = self.peek_token().token { - if word.keyword == Keyword::OPTIONS { - options = Some(self.parse_options(Keyword::OPTIONS)?); - } - } - } - Ok(CreateTableConfiguration { - partition_by, - cluster_by, - options, - }) - } - pub fn parse_optional_inline_comment( - &mut self, - ) -> Result, ParserError> { - let comment = if self.parse_keyword(Keyword::COMMENT) { - let has_eq = self.consume_token(&Token::Eq); - let next_token = self.next_token(); - match next_token.token { - Token::SingleQuotedString(str) => { - Some( - if has_eq { - CommentDef::WithEq(str) - } else { - CommentDef::WithoutEq(str) - }, - ) - } - _ => self.expected("comment", next_token)?, - } - } else { - None - }; - Ok(comment) - } - pub fn parse_optional_procedure_parameters( - &mut self, - ) -> Result>, ParserError> { - let mut params = ::alloc::vec::Vec::new(); - if !self.consume_token(&Token::LParen) || self.consume_token(&Token::RParen) - { - return Ok(Some(params)); - } - loop { - if let Token::Word(_) = self.peek_token().token { - params.push(self.parse_procedure_param()?) - } - let comma = self.consume_token(&Token::Comma); - if self.consume_token(&Token::RParen) { - break; - } else if !comma { - return self - .expected( - "',' or ')' after parameter definition", - self.peek_token(), - ); - } - } - Ok(Some(params)) - } - pub fn parse_columns( - &mut self, - ) -> Result<(Vec, Vec), ParserError> { - let mut columns = ::alloc::vec::Vec::new(); - let mut constraints = ::alloc::vec::Vec::new(); - if !self.consume_token(&Token::LParen) || self.consume_token(&Token::RParen) - { - return Ok((columns, constraints)); - } - loop { - if let Some(constraint) = self.parse_optional_table_constraint()? { - constraints.push(constraint); - } else if let Token::Word(_) = self.peek_token().token { - columns.push(self.parse_column_def()?); - } else { - return self - .expected( - "column name or constraint definition", - self.peek_token(), - ); - } - let comma = self.consume_token(&Token::Comma); - let rparen = self.peek_token().token == Token::RParen; - if !comma && !rparen { - return self - .expected( - "',' or ')' after column definition", - self.peek_token(), - ); - } - if rparen - && (!comma - || self.dialect.supports_column_definition_trailing_commas() - || self.options.trailing_commas) - { - let _ = self.consume_token(&Token::RParen); - break; - } - } - Ok((columns, constraints)) - } - pub fn parse_procedure_param(&mut self) -> Result { - let name = self.parse_identifier()?; - let data_type = self.parse_data_type()?; - Ok(ProcedureParam { name, data_type }) - } - pub fn parse_column_def(&mut self) -> Result { - let name = self.parse_identifier()?; - let data_type = if self.is_column_type_sqlite_unspecified() { - DataType::Unspecified - } else { - self.parse_data_type()? - }; - let mut collation = if self.parse_keyword(Keyword::COLLATE) { - Some(self.parse_object_name(false)?) - } else { - None - }; - let mut options = ::alloc::vec::Vec::new(); - loop { - if self.parse_keyword(Keyword::CONSTRAINT) { - let name = Some(self.parse_identifier()?); - if let Some(option) = self.parse_optional_column_option()? { - options.push(ColumnOptionDef { name, option }); - } else { - return self - .expected( - "constraint details after CONSTRAINT ", - self.peek_token(), - ); - } - } else if let Some(option) = self.parse_optional_column_option()? { - options - .push(ColumnOptionDef { - name: None, - option, - }); - } else if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::COLLATE) - { - collation = Some(self.parse_object_name(false)?); - } else { - break; - }; - } - Ok(ColumnDef { - name, - data_type, - collation, - options, - }) - } - fn is_column_type_sqlite_unspecified(&mut self) -> bool { - if (self.dialect.is::()) { - match self.peek_token().token { - Token::Word(word) => { - match word.keyword { - Keyword::CONSTRAINT - | Keyword::PRIMARY - | Keyword::NOT - | Keyword::UNIQUE - | Keyword::CHECK - | Keyword::DEFAULT - | Keyword::COLLATE - | Keyword::REFERENCES - | Keyword::GENERATED - | Keyword::AS => true, - _ => false, - } - } - _ => true, - } - } else { - false - } - } - pub fn parse_optional_column_option( - &mut self, - ) -> Result, ParserError> { - if let Some(option) = self.dialect.parse_column_option(self)? { - return option; - } - if self.parse_keywords(&[Keyword::CHARACTER, Keyword::SET]) { - Ok(Some(ColumnOption::CharacterSet(self.parse_object_name(false)?))) - } else if self.parse_keywords(&[Keyword::NOT, Keyword::NULL]) { - Ok(Some(ColumnOption::NotNull)) - } else if self.parse_keywords(&[Keyword::COMMENT]) { - let next_token = self.next_token(); - match next_token.token { - Token::SingleQuotedString(value, ..) => { - Ok(Some(ColumnOption::Comment(value))) - } - _ => self.expected("string", next_token), - } - } else if self.parse_keyword(Keyword::NULL) { - Ok(Some(ColumnOption::Null)) - } else if self.parse_keyword(Keyword::DEFAULT) { - Ok(Some(ColumnOption::Default(self.parse_expr()?))) - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::MATERIALIZED) - { - Ok(Some(ColumnOption::Materialized(self.parse_expr()?))) - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::ALIAS) - { - Ok(Some(ColumnOption::Alias(self.parse_expr()?))) - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::EPHEMERAL) - { - if match self.peek_token().token { - Token::Comma | Token::RParen => true, - _ => false, - } { - Ok(Some(ColumnOption::Ephemeral(None))) - } else { - Ok(Some(ColumnOption::Ephemeral(Some(self.parse_expr()?)))) - } - } else if self.parse_keywords(&[Keyword::PRIMARY, Keyword::KEY]) { - let characteristics = self.parse_constraint_characteristics()?; - Ok( - Some(ColumnOption::Unique { - is_primary: true, - characteristics, - }), - ) - } else if self.parse_keyword(Keyword::UNIQUE) { - let characteristics = self.parse_constraint_characteristics()?; - Ok( - Some(ColumnOption::Unique { - is_primary: false, - characteristics, - }), - ) - } else if self.parse_keyword(Keyword::REFERENCES) { - let foreign_table = self.parse_object_name(false)?; - let referred_columns = self - .parse_parenthesized_column_list(Optional, false)?; - let mut on_delete = None; - let mut on_update = None; - loop { - if on_delete.is_none() - && self.parse_keywords(&[Keyword::ON, Keyword::DELETE]) - { - on_delete = Some(self.parse_referential_action()?); - } else if on_update.is_none() - && self.parse_keywords(&[Keyword::ON, Keyword::UPDATE]) - { - on_update = Some(self.parse_referential_action()?); - } else { - break; - } - } - let characteristics = self.parse_constraint_characteristics()?; - Ok( - Some(ColumnOption::ForeignKey { - foreign_table, - referred_columns, - on_delete, - on_update, - characteristics, - }), - ) - } else if self.parse_keyword(Keyword::CHECK) { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Ok(Some(ColumnOption::Check(expr))) - } else if self.parse_keyword(Keyword::AUTO_INCREMENT) - && (self.dialect.is::() - || self.dialect.is::()) - { - Ok( - Some( - ColumnOption::DialectSpecific( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - Token::make_keyword("AUTO_INCREMENT"), - ]), - ), - ), - ), - ) - } else if self.parse_keyword(Keyword::AUTOINCREMENT) - && (self.dialect.is::() - || self.dialect.is::()) - { - Ok( - Some( - ColumnOption::DialectSpecific( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - Token::make_keyword("AUTOINCREMENT"), - ]), - ), - ), - ), - ) - } else if self.parse_keyword(Keyword::ASC) - && self.dialect.supports_asc_desc_in_column_definition() - { - Ok( - Some( - ColumnOption::DialectSpecific( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Token::make_keyword("ASC")]), - ), - ), - ), - ) - } else if self.parse_keyword(Keyword::DESC) - && self.dialect.supports_asc_desc_in_column_definition() - { - Ok( - Some( - ColumnOption::DialectSpecific( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Token::make_keyword("DESC")]), - ), - ), - ), - ) - } else if self.parse_keywords(&[Keyword::ON, Keyword::UPDATE]) - && (self.dialect.is::() - || self.dialect.is::()) - { - let expr = self.parse_expr()?; - Ok(Some(ColumnOption::OnUpdate(expr))) - } else if self.parse_keyword(Keyword::GENERATED) { - self.parse_optional_column_option_generated() - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::OPTIONS) - { - self.prev_token(); - Ok(Some(ColumnOption::Options(self.parse_options(Keyword::OPTIONS)?))) - } else if self.parse_keyword(Keyword::AS) - && (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - { - self.parse_optional_column_option_as() - } else if self.parse_keyword(Keyword::IDENTITY) - && (self.dialect.is::() - || self.dialect.is::()) - { - let parameters = if self.consume_token(&Token::LParen) { - let seed = self.parse_number()?; - self.expect_token(&Token::Comma)?; - let increment = self.parse_number()?; - self.expect_token(&Token::RParen)?; - Some( - IdentityPropertyFormatKind::FunctionCall(IdentityParameters { - seed, - increment, - }), - ) - } else { - None - }; - Ok( - Some( - ColumnOption::Identity( - IdentityPropertyKind::Identity(IdentityProperty { - parameters, - order: None, - }), - ), - ), - ) - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::ON, Keyword::CONFLICT]) - { - Ok( - Some( - ColumnOption::OnConflict( - self - .expect_one_of_keywords( - &[ - Keyword::ROLLBACK, - Keyword::ABORT, - Keyword::FAIL, - Keyword::IGNORE, - Keyword::REPLACE, - ], - )?, - ), - ), - ) - } else { - Ok(None) - } - } - pub(crate) fn parse_tag(&mut self) -> Result { - let name = self.parse_identifier()?; - self.expect_token(&Token::Eq)?; - let value = self.parse_literal_string()?; - Ok(Tag::new(name, value)) - } - fn parse_optional_column_option_generated( - &mut self, - ) -> Result, ParserError> { - if self.parse_keywords(&[Keyword::ALWAYS, Keyword::AS, Keyword::IDENTITY]) { - let mut sequence_options = ::alloc::vec::Vec::new(); - if self.expect_token(&Token::LParen).is_ok() { - sequence_options = self.parse_create_sequence_options()?; - self.expect_token(&Token::RParen)?; - } - Ok( - Some(ColumnOption::Generated { - generated_as: GeneratedAs::Always, - sequence_options: Some(sequence_options), - generation_expr: None, - generation_expr_mode: None, - generated_keyword: true, - }), - ) - } else if self - .parse_keywords( - &[Keyword::BY, Keyword::DEFAULT, Keyword::AS, Keyword::IDENTITY], - ) - { - let mut sequence_options = ::alloc::vec::Vec::new(); - if self.expect_token(&Token::LParen).is_ok() { - sequence_options = self.parse_create_sequence_options()?; - self.expect_token(&Token::RParen)?; - } - Ok( - Some(ColumnOption::Generated { - generated_as: GeneratedAs::ByDefault, - sequence_options: Some(sequence_options), - generation_expr: None, - generation_expr_mode: None, - generated_keyword: true, - }), - ) - } else if self.parse_keywords(&[Keyword::ALWAYS, Keyword::AS]) { - if self.expect_token(&Token::LParen).is_ok() { - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - let (gen_as, expr_mode) = if self.parse_keywords(&[Keyword::STORED]) - { - Ok(( - GeneratedAs::ExpStored, - Some(GeneratedExpressionMode::Stored), - )) - } else if (self.dialect.is::()) { - self.expected("STORED", self.peek_token()) - } else if self.parse_keywords(&[Keyword::VIRTUAL]) { - Ok((GeneratedAs::Always, Some(GeneratedExpressionMode::Virtual))) - } else { - Ok((GeneratedAs::Always, None)) - }?; - Ok( - Some(ColumnOption::Generated { - generated_as: gen_as, - sequence_options: None, - generation_expr: Some(expr), - generation_expr_mode: expr_mode, - generated_keyword: true, - }), - ) - } else { - Ok(None) - } - } else { - Ok(None) - } - } - fn parse_optional_column_option_as( - &mut self, - ) -> Result, ParserError> { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - let (gen_as, expr_mode) = if self.parse_keywords(&[Keyword::STORED]) { - (GeneratedAs::ExpStored, Some(GeneratedExpressionMode::Stored)) - } else if self.parse_keywords(&[Keyword::VIRTUAL]) { - (GeneratedAs::Always, Some(GeneratedExpressionMode::Virtual)) - } else { - (GeneratedAs::Always, None) - }; - Ok( - Some(ColumnOption::Generated { - generated_as: gen_as, - sequence_options: None, - generation_expr: Some(expr), - generation_expr_mode: expr_mode, - generated_keyword: false, - }), - ) - } - pub fn parse_optional_clustered_by( - &mut self, - ) -> Result, ParserError> { - let clustered_by = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::CLUSTERED, Keyword::BY]) - { - let columns = self.parse_parenthesized_column_list(Mandatory, false)?; - let sorted_by = if self.parse_keywords(&[Keyword::SORTED, Keyword::BY]) { - self.expect_token(&Token::LParen)?; - let sorted_by_columns = self - .parse_comma_separated(|p| p.parse_order_by_expr())?; - self.expect_token(&Token::RParen)?; - Some(sorted_by_columns) - } else { - None - }; - self.expect_keyword_is(Keyword::INTO)?; - let num_buckets = self.parse_number_value()?; - self.expect_keyword_is(Keyword::BUCKETS)?; - Some(ClusteredBy { - columns, - sorted_by, - num_buckets, - }) - } else { - None - }; - Ok(clustered_by) - } - pub fn parse_referential_action( - &mut self, - ) -> Result { - if self.parse_keyword(Keyword::RESTRICT) { - Ok(ReferentialAction::Restrict) - } else if self.parse_keyword(Keyword::CASCADE) { - Ok(ReferentialAction::Cascade) - } else if self.parse_keywords(&[Keyword::SET, Keyword::NULL]) { - Ok(ReferentialAction::SetNull) - } else if self.parse_keywords(&[Keyword::NO, Keyword::ACTION]) { - Ok(ReferentialAction::NoAction) - } else if self.parse_keywords(&[Keyword::SET, Keyword::DEFAULT]) { - Ok(ReferentialAction::SetDefault) - } else { - self.expected( - "one of RESTRICT, CASCADE, SET NULL, NO ACTION or SET DEFAULT", - self.peek_token(), - ) - } - } - pub fn parse_constraint_characteristics( - &mut self, - ) -> Result, ParserError> { - let mut cc = ConstraintCharacteristics::default(); - loop { - if cc.deferrable.is_none() - && self.parse_keywords(&[Keyword::NOT, Keyword::DEFERRABLE]) - { - cc.deferrable = Some(false); - } else if cc.deferrable.is_none() - && self.parse_keyword(Keyword::DEFERRABLE) - { - cc.deferrable = Some(true); - } else if cc.initially.is_none() - && self.parse_keyword(Keyword::INITIALLY) - { - if self.parse_keyword(Keyword::DEFERRED) { - cc.initially = Some(DeferrableInitial::Deferred); - } else if self.parse_keyword(Keyword::IMMEDIATE) { - cc.initially = Some(DeferrableInitial::Immediate); - } else { - self.expected( - "one of DEFERRED or IMMEDIATE", - self.peek_token(), - )?; - } - } else if cc.enforced.is_none() && self.parse_keyword(Keyword::ENFORCED) - { - cc.enforced = Some(true); - } else if cc.enforced.is_none() - && self.parse_keywords(&[Keyword::NOT, Keyword::ENFORCED]) - { - cc.enforced = Some(false); - } else { - break; - } - } - if cc.deferrable.is_some() || cc.initially.is_some() || cc.enforced.is_some() - { - Ok(Some(cc)) - } else { - Ok(None) - } - } - pub fn parse_optional_table_constraint( - &mut self, - ) -> Result, ParserError> { - let name = if self.parse_keyword(Keyword::CONSTRAINT) { - Some(self.parse_identifier()?) - } else { - None - }; - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) if w.keyword == Keyword::UNIQUE => { - let index_type_display = self.parse_index_type_display(); - if !(self.dialect.is::() - || self.dialect.is::()) - && !index_type_display.is_none() - { - return self - .expected( - "`index_name` or `(column_name [, ...])`", - self.peek_token(), - ); - } - let nulls_distinct = self.parse_optional_nulls_distinct()?; - let index_name = self.parse_optional_indent()?; - let index_type = self.parse_optional_using_then_index_type()?; - let columns = self - .parse_parenthesized_column_list(Mandatory, false)?; - let index_options = self.parse_index_options()?; - let characteristics = self.parse_constraint_characteristics()?; - Ok( - Some(TableConstraint::Unique { - name, - index_name, - index_type_display, - index_type, - columns, - index_options, - characteristics, - nulls_distinct, - }), - ) - } - Token::Word(w) if w.keyword == Keyword::PRIMARY => { - self.expect_keyword_is(Keyword::KEY)?; - let index_name = self.parse_optional_indent()?; - let index_type = self.parse_optional_using_then_index_type()?; - let columns = self - .parse_parenthesized_column_list(Mandatory, false)?; - let index_options = self.parse_index_options()?; - let characteristics = self.parse_constraint_characteristics()?; - Ok( - Some(TableConstraint::PrimaryKey { - name, - index_name, - index_type, - columns, - index_options, - characteristics, - }), - ) - } - Token::Word(w) if w.keyword == Keyword::FOREIGN => { - self.expect_keyword_is(Keyword::KEY)?; - let columns = self - .parse_parenthesized_column_list(Mandatory, false)?; - self.expect_keyword_is(Keyword::REFERENCES)?; - let foreign_table = self.parse_object_name(false)?; - let referred_columns = self - .parse_parenthesized_column_list(Optional, false)?; - let mut on_delete = None; - let mut on_update = None; - loop { - if on_delete.is_none() - && self.parse_keywords(&[Keyword::ON, Keyword::DELETE]) - { - on_delete = Some(self.parse_referential_action()?); - } else if on_update.is_none() - && self.parse_keywords(&[Keyword::ON, Keyword::UPDATE]) - { - on_update = Some(self.parse_referential_action()?); - } else { - break; - } - } - let characteristics = self.parse_constraint_characteristics()?; - Ok( - Some(TableConstraint::ForeignKey { - name, - columns, - foreign_table, - referred_columns, - on_delete, - on_update, - characteristics, - }), - ) - } - Token::Word(w) if w.keyword == Keyword::CHECK => { - self.expect_token(&Token::LParen)?; - let expr = Box::new(self.parse_expr()?); - self.expect_token(&Token::RParen)?; - Ok( - Some(TableConstraint::Check { - name, - expr, - }), - ) - } - Token::Word( - w, - ) if (w.keyword == Keyword::INDEX || w.keyword == Keyword::KEY) - && (self.dialect.is::() - || self.dialect.is::()) && name.is_none() => { - let display_as_key = w.keyword == Keyword::KEY; - let name = match self.peek_token().token { - Token::Word(word) if word.keyword == Keyword::USING => None, - _ => self.parse_optional_indent()?, - }; - let index_type = self.parse_optional_using_then_index_type()?; - let columns = self - .parse_parenthesized_column_list(Mandatory, false)?; - Ok( - Some(TableConstraint::Index { - display_as_key, - name, - index_type, - columns, - }), - ) - } - Token::Word( - w, - ) if (w.keyword == Keyword::FULLTEXT || w.keyword == Keyword::SPATIAL) - && (self.dialect.is::() - || self.dialect.is::()) => { - if let Some(name) = name { - return self - .expected( - "FULLTEXT or SPATIAL option without constraint name", - TokenWithSpan { - token: Token::make_keyword(&name.to_string()), - span: next_token.span, - }, - ); - } - let fulltext = w.keyword == Keyword::FULLTEXT; - let index_type_display = self.parse_index_type_display(); - let opt_index_name = self.parse_optional_indent()?; - let columns = self - .parse_parenthesized_column_list(Mandatory, false)?; - Ok( - Some(TableConstraint::FulltextOrSpatial { - fulltext, - index_type_display, - opt_index_name, - columns, - }), - ) - } - _ => { - if name.is_some() { - self.expected("PRIMARY, UNIQUE, FOREIGN, or CHECK", next_token) - } else { - self.prev_token(); - Ok(None) - } - } - } - } - fn parse_optional_nulls_distinct( - &mut self, - ) -> Result { - Ok( - if self.parse_keyword(Keyword::NULLS) { - let not = self.parse_keyword(Keyword::NOT); - self.expect_keyword_is(Keyword::DISTINCT)?; - if not { - NullsDistinctOption::NotDistinct - } else { - NullsDistinctOption::Distinct - } - } else { - NullsDistinctOption::None - }, - ) - } - pub fn maybe_parse_options( - &mut self, - keyword: Keyword, - ) -> Result>, ParserError> { - if let Token::Word(word) = self.peek_token().token { - if word.keyword == keyword { - return Ok(Some(self.parse_options(keyword)?)); - } - } - Ok(None) - } - pub fn parse_options( - &mut self, - keyword: Keyword, - ) -> Result, ParserError> { - if self.parse_keyword(keyword) { - self.expect_token(&Token::LParen)?; - let options = self - .parse_comma_separated0(Parser::parse_sql_option, Token::RParen)?; - self.expect_token(&Token::RParen)?; - Ok(options) - } else { - Ok(::alloc::vec::Vec::new()) - } - } - pub fn parse_options_with_keywords( - &mut self, - keywords: &[Keyword], - ) -> Result, ParserError> { - if self.parse_keywords(keywords) { - self.expect_token(&Token::LParen)?; - let options = self.parse_comma_separated(Parser::parse_sql_option)?; - self.expect_token(&Token::RParen)?; - Ok(options) - } else { - Ok(::alloc::vec::Vec::new()) - } - } - pub fn parse_index_type(&mut self) -> Result { - if self.parse_keyword(Keyword::BTREE) { - Ok(IndexType::BTree) - } else if self.parse_keyword(Keyword::HASH) { - Ok(IndexType::Hash) - } else if self.parse_keyword(Keyword::GIN) { - Ok(IndexType::GIN) - } else if self.parse_keyword(Keyword::GIST) { - Ok(IndexType::GiST) - } else if self.parse_keyword(Keyword::SPGIST) { - Ok(IndexType::SPGiST) - } else if self.parse_keyword(Keyword::BRIN) { - Ok(IndexType::BRIN) - } else if self.parse_keyword(Keyword::BLOOM) { - Ok(IndexType::Bloom) - } else { - self.expected( - "index type {BTREE | HASH | GIN | GIST | SPGIST | BRIN | BLOOM}", - self.peek_token(), - ) - } - } - /// Parse [USING {BTREE | HASH}] - pub fn parse_optional_using_then_index_type( - &mut self, - ) -> Result, ParserError> { - if self.parse_keyword(Keyword::USING) { - Ok(Some(self.parse_index_type()?)) - } else { - Ok(None) - } - } - /// Parse `[ident]`, mostly `ident` is name, like: - /// `window_name`, `index_name`, ... - pub fn parse_optional_indent(&mut self) -> Result, ParserError> { - self.maybe_parse(|parser| parser.parse_identifier()) - } - #[must_use] - pub fn parse_index_type_display(&mut self) -> KeyOrIndexDisplay { - if self.parse_keyword(Keyword::KEY) { - KeyOrIndexDisplay::Key - } else if self.parse_keyword(Keyword::INDEX) { - KeyOrIndexDisplay::Index - } else { - KeyOrIndexDisplay::None - } - } - pub fn parse_optional_index_option( - &mut self, - ) -> Result, ParserError> { - if let Some(index_type) = self.parse_optional_using_then_index_type()? { - Ok(Some(IndexOption::Using(index_type))) - } else if self.parse_keyword(Keyword::COMMENT) { - let s = self.parse_literal_string()?; - Ok(Some(IndexOption::Comment(s))) - } else { - Ok(None) - } - } - pub fn parse_index_options(&mut self) -> Result, ParserError> { - let mut options = Vec::new(); - loop { - match self.parse_optional_index_option()? { - Some(index_option) => options.push(index_option), - None => return Ok(options), - } - } - } - pub fn parse_sql_option(&mut self) -> Result { - let is_mssql = (self.dialect.is::() - || self.dialect.is::()); - match self.peek_token().token { - Token::Word(w) if w.keyword == Keyword::HEAP && is_mssql => { - Ok(SqlOption::Ident(self.parse_identifier()?)) - } - Token::Word(w) if w.keyword == Keyword::PARTITION && is_mssql => { - self.parse_option_partition() - } - Token::Word(w) if w.keyword == Keyword::CLUSTERED && is_mssql => { - self.parse_option_clustered() - } - _ => { - let name = self.parse_identifier()?; - self.expect_token(&Token::Eq)?; - let value = self.parse_expr()?; - Ok(SqlOption::KeyValue { - key: name, - value, - }) - } - } - } - pub fn parse_option_clustered(&mut self) -> Result { - if self - .parse_keywords( - &[ - Keyword::CLUSTERED, - Keyword::COLUMNSTORE, - Keyword::INDEX, - Keyword::ORDER, - ], - ) - { - Ok( - SqlOption::Clustered( - TableOptionsClustered::ColumnstoreIndexOrder( - self - .parse_parenthesized_column_list( - IsOptional::Mandatory, - false, - )?, - ), - ), - ) - } else if self - .parse_keywords( - &[Keyword::CLUSTERED, Keyword::COLUMNSTORE, Keyword::INDEX], - ) - { - Ok(SqlOption::Clustered(TableOptionsClustered::ColumnstoreIndex)) - } else if self.parse_keywords(&[Keyword::CLUSTERED, Keyword::INDEX]) { - self.expect_token(&Token::LParen)?; - let columns = self - .parse_comma_separated(|p| { - let name = p.parse_identifier()?; - let asc = p.parse_asc_desc(); - Ok(ClusteredIndex { name, asc }) - })?; - self.expect_token(&Token::RParen)?; - Ok(SqlOption::Clustered(TableOptionsClustered::Index(columns))) - } else { - Err(ParserError::ParserError("invalid CLUSTERED sequence".to_string())) - } - } - pub fn parse_option_partition(&mut self) -> Result { - self.expect_keyword_is(Keyword::PARTITION)?; - self.expect_token(&Token::LParen)?; - let column_name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::RANGE)?; - let range_direction = if self.parse_keyword(Keyword::LEFT) { - Some(PartitionRangeDirection::Left) - } else if self.parse_keyword(Keyword::RIGHT) { - Some(PartitionRangeDirection::Right) - } else { - None - }; - self.expect_keywords(&[Keyword::FOR, Keyword::VALUES])?; - self.expect_token(&Token::LParen)?; - let for_values = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - self.expect_token(&Token::RParen)?; - Ok(SqlOption::Partition { - column_name, - range_direction, - for_values, - }) - } - pub fn parse_partition(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let partitions = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - Ok(Partition::Partitions(partitions)) - } - pub fn parse_projection_select( - &mut self, - ) -> Result { - self.expect_token(&Token::LParen)?; - self.expect_keyword_is(Keyword::SELECT)?; - let projection = self.parse_projection()?; - let group_by = self.parse_optional_group_by()?; - let order_by = self.parse_optional_order_by()?; - self.expect_token(&Token::RParen)?; - Ok(ProjectionSelect { - projection, - group_by, - order_by, - }) - } - pub fn parse_alter_table_add_projection( - &mut self, - ) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let name = self.parse_identifier()?; - let query = self.parse_projection_select()?; - Ok(AlterTableOperation::AddProjection { - if_not_exists, - name, - select: query, - }) - } - pub fn parse_alter_table_operation( - &mut self, - ) -> Result { - let operation = if self.parse_keyword(Keyword::ADD) { - if let Some(constraint) = self.parse_optional_table_constraint()? { - AlterTableOperation::AddConstraint(constraint) - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::PROJECTION) - { - return self.parse_alter_table_add_projection(); - } else { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let mut new_partitions = ::alloc::vec::Vec::new(); - loop { - if self.parse_keyword(Keyword::PARTITION) { - new_partitions.push(self.parse_partition()?); - } else { - break; - } - } - if !new_partitions.is_empty() { - AlterTableOperation::AddPartitions { - if_not_exists, - new_partitions, - } - } else { - let column_keyword = self.parse_keyword(Keyword::COLUMN); - let if_not_exists = if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - { - self - .parse_keywords( - &[Keyword::IF, Keyword::NOT, Keyword::EXISTS], - ) || if_not_exists - } else { - false - }; - let column_def = self.parse_column_def()?; - let column_position = self.parse_column_position()?; - AlterTableOperation::AddColumn { - column_keyword, - if_not_exists, - column_def, - column_position, - } - } - } - } else if self.parse_keyword(Keyword::RENAME) { - if (self.dialect.is::()) - && self.parse_keyword(Keyword::CONSTRAINT) - { - let old_name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::TO)?; - let new_name = self.parse_identifier()?; - AlterTableOperation::RenameConstraint { - old_name, - new_name, - } - } else if self.parse_keyword(Keyword::TO) { - let table_name = self.parse_object_name(false)?; - AlterTableOperation::RenameTable { - table_name, - } - } else { - let _ = self.parse_keyword(Keyword::COLUMN); - let old_column_name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::TO)?; - let new_column_name = self.parse_identifier()?; - AlterTableOperation::RenameColumn { - old_column_name, - new_column_name, - } - } - } else if self.parse_keyword(Keyword::DISABLE) { - if self - .parse_keywords(&[Keyword::ROW, Keyword::LEVEL, Keyword::SECURITY]) - { - AlterTableOperation::DisableRowLevelSecurity { - } - } else if self.parse_keyword(Keyword::RULE) { - let name = self.parse_identifier()?; - AlterTableOperation::DisableRule { - name, - } - } else if self.parse_keyword(Keyword::TRIGGER) { - let name = self.parse_identifier()?; - AlterTableOperation::DisableTrigger { - name, - } - } else { - return self - .expected( - "ROW LEVEL SECURITY, RULE, or TRIGGER after DISABLE", - self.peek_token(), - ); - } - } else if self.parse_keyword(Keyword::ENABLE) { - if self.parse_keywords(&[Keyword::ALWAYS, Keyword::RULE]) { - let name = self.parse_identifier()?; - AlterTableOperation::EnableAlwaysRule { - name, - } - } else if self.parse_keywords(&[Keyword::ALWAYS, Keyword::TRIGGER]) { - let name = self.parse_identifier()?; - AlterTableOperation::EnableAlwaysTrigger { - name, - } - } else if self - .parse_keywords(&[Keyword::ROW, Keyword::LEVEL, Keyword::SECURITY]) - { - AlterTableOperation::EnableRowLevelSecurity { - } - } else if self.parse_keywords(&[Keyword::REPLICA, Keyword::RULE]) { - let name = self.parse_identifier()?; - AlterTableOperation::EnableReplicaRule { - name, - } - } else if self.parse_keywords(&[Keyword::REPLICA, Keyword::TRIGGER]) { - let name = self.parse_identifier()?; - AlterTableOperation::EnableReplicaTrigger { - name, - } - } else if self.parse_keyword(Keyword::RULE) { - let name = self.parse_identifier()?; - AlterTableOperation::EnableRule { - name, - } - } else if self.parse_keyword(Keyword::TRIGGER) { - let name = self.parse_identifier()?; - AlterTableOperation::EnableTrigger { - name, - } - } else { - return self - .expected( - "ALWAYS, REPLICA, ROW LEVEL SECURITY, RULE, or TRIGGER after ENABLE", - self.peek_token(), - ); - } - } else if self.parse_keywords(&[Keyword::CLEAR, Keyword::PROJECTION]) - && (self.dialect.is::() - || self.dialect.is::()) - { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let name = self.parse_identifier()?; - let partition = if self - .parse_keywords(&[Keyword::IN, Keyword::PARTITION]) - { - Some(self.parse_identifier()?) - } else { - None - }; - AlterTableOperation::ClearProjection { - if_exists, - name, - partition, - } - } else if self.parse_keywords(&[Keyword::MATERIALIZE, Keyword::PROJECTION]) - && (self.dialect.is::() - || self.dialect.is::()) - { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let name = self.parse_identifier()?; - let partition = if self - .parse_keywords(&[Keyword::IN, Keyword::PARTITION]) - { - Some(self.parse_identifier()?) - } else { - None - }; - AlterTableOperation::MaterializeProjection { - if_exists, - name, - partition, - } - } else if self.parse_keyword(Keyword::DROP) { - if self - .parse_keywords(&[Keyword::IF, Keyword::EXISTS, Keyword::PARTITION]) - { - self.expect_token(&Token::LParen)?; - let partitions = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - AlterTableOperation::DropPartitions { - partitions, - if_exists: true, - } - } else if self.parse_keyword(Keyword::PARTITION) { - self.expect_token(&Token::LParen)?; - let partitions = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - AlterTableOperation::DropPartitions { - partitions, - if_exists: false, - } - } else if self.parse_keyword(Keyword::CONSTRAINT) { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let name = self.parse_identifier()?; - let drop_behavior = self.parse_optional_drop_behavior(); - AlterTableOperation::DropConstraint { - if_exists, - name, - drop_behavior, - } - } else if self.parse_keywords(&[Keyword::PRIMARY, Keyword::KEY]) - && (self.dialect.is::() - || self.dialect.is::()) - { - AlterTableOperation::DropPrimaryKey - } else if self.parse_keyword(Keyword::PROJECTION) - && (self.dialect.is::() - || self.dialect.is::()) - { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let name = self.parse_identifier()?; - AlterTableOperation::DropProjection { - if_exists, - name, - } - } else if self.parse_keywords(&[Keyword::CLUSTERING, Keyword::KEY]) { - AlterTableOperation::DropClusteringKey - } else { - let _ = self.parse_keyword(Keyword::COLUMN); - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let column_name = self.parse_identifier()?; - let drop_behavior = self.parse_optional_drop_behavior(); - AlterTableOperation::DropColumn { - column_name, - if_exists, - drop_behavior, - } - } - } else if self.parse_keyword(Keyword::PARTITION) { - self.expect_token(&Token::LParen)?; - let before = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - self.expect_keyword_is(Keyword::RENAME)?; - self.expect_keywords(&[Keyword::TO, Keyword::PARTITION])?; - self.expect_token(&Token::LParen)?; - let renames = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - AlterTableOperation::RenamePartitions { - old_partitions: before, - new_partitions: renames, - } - } else if self.parse_keyword(Keyword::CHANGE) { - let _ = self.parse_keyword(Keyword::COLUMN); - let old_name = self.parse_identifier()?; - let new_name = self.parse_identifier()?; - let data_type = self.parse_data_type()?; - let mut options = ::alloc::vec::Vec::new(); - while let Some(option) = self.parse_optional_column_option()? { - options.push(option); - } - let column_position = self.parse_column_position()?; - AlterTableOperation::ChangeColumn { - old_name, - new_name, - data_type, - options, - column_position, - } - } else if self.parse_keyword(Keyword::MODIFY) { - let _ = self.parse_keyword(Keyword::COLUMN); - let col_name = self.parse_identifier()?; - let data_type = self.parse_data_type()?; - let mut options = ::alloc::vec::Vec::new(); - while let Some(option) = self.parse_optional_column_option()? { - options.push(option); - } - let column_position = self.parse_column_position()?; - AlterTableOperation::ModifyColumn { - col_name, - data_type, - options, - column_position, - } - } else if self.parse_keyword(Keyword::ALTER) { - let _ = self.parse_keyword(Keyword::COLUMN); - let column_name = self.parse_identifier()?; - let is_postgresql = (self.dialect.is::()); - let op: AlterColumnOperation = if self - .parse_keywords(&[Keyword::SET, Keyword::NOT, Keyword::NULL]) - { - AlterColumnOperation::SetNotNull { - } - } else if self - .parse_keywords(&[Keyword::DROP, Keyword::NOT, Keyword::NULL]) - { - AlterColumnOperation::DropNotNull { - } - } else if self.parse_keywords(&[Keyword::SET, Keyword::DEFAULT]) { - AlterColumnOperation::SetDefault { - value: self.parse_expr()?, - } - } else if self.parse_keywords(&[Keyword::DROP, Keyword::DEFAULT]) { - AlterColumnOperation::DropDefault { - } - } else if self - .parse_keywords(&[Keyword::SET, Keyword::DATA, Keyword::TYPE]) - || (is_postgresql && self.parse_keyword(Keyword::TYPE)) - { - let data_type = self.parse_data_type()?; - let using = if is_postgresql && self.parse_keyword(Keyword::USING) { - Some(self.parse_expr()?) - } else { - None - }; - AlterColumnOperation::SetDataType { - data_type, - using, - } - } else if self.parse_keywords(&[Keyword::ADD, Keyword::GENERATED]) { - let generated_as = if self.parse_keyword(Keyword::ALWAYS) { - Some(GeneratedAs::Always) - } else if self.parse_keywords(&[Keyword::BY, Keyword::DEFAULT]) { - Some(GeneratedAs::ByDefault) - } else { - None - }; - self.expect_keywords(&[Keyword::AS, Keyword::IDENTITY])?; - let mut sequence_options: Option> = None; - if self.peek_token().token == Token::LParen { - self.expect_token(&Token::LParen)?; - sequence_options = Some(self.parse_create_sequence_options()?); - self.expect_token(&Token::RParen)?; - } - AlterColumnOperation::AddGenerated { - generated_as, - sequence_options, - } - } else { - let message = if is_postgresql { - "SET/DROP NOT NULL, SET DEFAULT, SET DATA TYPE, or ADD GENERATED after ALTER COLUMN" - } else { - "SET/DROP NOT NULL, SET DEFAULT, or SET DATA TYPE after ALTER COLUMN" - }; - return self.expected(message, self.peek_token()); - }; - AlterTableOperation::AlterColumn { - column_name, - op, - } - } else if self.parse_keyword(Keyword::SWAP) { - self.expect_keyword_is(Keyword::WITH)?; - let table_name = self.parse_object_name(false)?; - AlterTableOperation::SwapWith { - table_name, - } - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::OWNER, Keyword::TO]) - { - let new_owner = self.parse_owner()?; - AlterTableOperation::OwnerTo { - new_owner, - } - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::ATTACH) - { - AlterTableOperation::AttachPartition { - partition: self.parse_part_or_partition()?, - } - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::DETACH) - { - AlterTableOperation::DetachPartition { - partition: self.parse_part_or_partition()?, - } - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::FREEZE) - { - let partition = self.parse_part_or_partition()?; - let with_name = if self.parse_keyword(Keyword::WITH) { - self.expect_keyword_is(Keyword::NAME)?; - Some(self.parse_identifier()?) - } else { - None - }; - AlterTableOperation::FreezePartition { - partition, - with_name, - } - } else if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::UNFREEZE) - { - let partition = self.parse_part_or_partition()?; - let with_name = if self.parse_keyword(Keyword::WITH) { - self.expect_keyword_is(Keyword::NAME)?; - Some(self.parse_identifier()?) - } else { - None - }; - AlterTableOperation::UnfreezePartition { - partition, - with_name, - } - } else if self.parse_keywords(&[Keyword::CLUSTER, Keyword::BY]) { - self.expect_token(&Token::LParen)?; - let exprs = self.parse_comma_separated(|parser| parser.parse_expr())?; - self.expect_token(&Token::RParen)?; - AlterTableOperation::ClusterBy { - exprs, - } - } else if self.parse_keywords(&[Keyword::SUSPEND, Keyword::RECLUSTER]) { - AlterTableOperation::SuspendRecluster - } else if self.parse_keywords(&[Keyword::RESUME, Keyword::RECLUSTER]) { - AlterTableOperation::ResumeRecluster - } else { - let options: Vec = self - .parse_options_with_keywords( - &[Keyword::SET, Keyword::TBLPROPERTIES], - )?; - if !options.is_empty() { - AlterTableOperation::SetTblProperties { - table_properties: options, - } - } else { - return self - .expected( - "ADD, RENAME, PARTITION, SWAP, DROP, or SET TBLPROPERTIES after ALTER TABLE", - self.peek_token(), - ); - } - }; - Ok(operation) - } - fn parse_part_or_partition(&mut self) -> Result { - let keyword = self - .expect_one_of_keywords(&[Keyword::PART, Keyword::PARTITION])?; - match keyword { - Keyword::PART => Ok(Partition::Part(self.parse_expr()?)), - Keyword::PARTITION => Ok(Partition::Expr(self.parse_expr()?)), - _ => ::core::panicking::panic("internal error: entered unreachable code"), - } - } - pub fn parse_alter(&mut self) -> Result { - let object_type = self - .expect_one_of_keywords( - &[ - Keyword::VIEW, - Keyword::TABLE, - Keyword::INDEX, - Keyword::ROLE, - Keyword::POLICY, - Keyword::CONNECTOR, - ], - )?; - match object_type { - Keyword::VIEW => self.parse_alter_view(), - Keyword::TABLE => { - let if_exists = self.parse_keywords(&[Keyword::IF, Keyword::EXISTS]); - let only = self.parse_keyword(Keyword::ONLY); - let table_name = self.parse_object_name(false)?; - let on_cluster = self.parse_optional_on_cluster()?; - let operations = self - .parse_comma_separated(Parser::parse_alter_table_operation)?; - let mut location = None; - if self.parse_keyword(Keyword::LOCATION) { - location = Some(HiveSetLocation { - has_set: false, - location: self.parse_identifier()?, - }); - } else if self.parse_keywords(&[Keyword::SET, Keyword::LOCATION]) { - location = Some(HiveSetLocation { - has_set: true, - location: self.parse_identifier()?, - }); - } - Ok(Statement::AlterTable { - name: table_name, - if_exists, - only, - operations, - location, - on_cluster, - }) - } - Keyword::INDEX => { - let index_name = self.parse_object_name(false)?; - let operation = if self.parse_keyword(Keyword::RENAME) { - if self.parse_keyword(Keyword::TO) { - let index_name = self.parse_object_name(false)?; - AlterIndexOperation::RenameIndex { - index_name, - } - } else { - return self.expected("TO after RENAME", self.peek_token()); - } - } else { - return self - .expected("RENAME after ALTER INDEX", self.peek_token()); - }; - Ok(Statement::AlterIndex { - name: index_name, - operation, - }) - } - Keyword::ROLE => self.parse_alter_role(), - Keyword::POLICY => self.parse_alter_policy(), - Keyword::CONNECTOR => self.parse_alter_connector(), - _ => ::core::panicking::panic("internal error: entered unreachable code"), - } - } - pub fn parse_alter_view(&mut self) -> Result { - let name = self.parse_object_name(false)?; - let columns = self.parse_parenthesized_column_list(Optional, false)?; - let with_options = self.parse_options(Keyword::WITH)?; - self.expect_keyword_is(Keyword::AS)?; - let query = self.parse_query()?; - Ok(Statement::AlterView { - name, - columns, - query, - with_options, - }) - } - /// Parse a `CALL procedure_name(arg1, arg2, ...)` - /// or `CALL procedure_name` statement - pub fn parse_call(&mut self) -> Result { - let object_name = self.parse_object_name(false)?; - if self.peek_token().token == Token::LParen { - match self.parse_function(object_name)? { - Expr::Function(f) => Ok(Statement::Call(f)), - other => { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Expected a simple procedure call but found: {0}", - other, - ), - ); - res - }), - self.peek_token().span.start, - ), - ); - res - }), - ), - ) - } - } - } else { - Ok( - Statement::Call(Function { - name: object_name, - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args: FunctionArguments::None, - over: None, - filter: None, - null_treatment: None, - within_group: ::alloc::vec::Vec::new(), - }), - ) - } - } - /// Parse a copy statement - pub fn parse_copy(&mut self) -> Result { - let source; - if self.consume_token(&Token::LParen) { - source = CopySource::Query(self.parse_query()?); - self.expect_token(&Token::RParen)?; - } else { - let table_name = self.parse_object_name(false)?; - let columns = self.parse_parenthesized_column_list(Optional, false)?; - source = CopySource::Table { - table_name, - columns, - }; - } - let to = match self.parse_one_of_keywords(&[Keyword::FROM, Keyword::TO]) { - Some(Keyword::FROM) => false, - Some(Keyword::TO) => true, - _ => self.expected("FROM or TO", self.peek_token())?, - }; - if !to { - if let CopySource::Query(_) = source { - return Err( - ParserError::ParserError( - "COPY ... FROM does not support query as a source" - .to_string(), - ), - ); - } - } - let target = if self.parse_keyword(Keyword::STDIN) { - CopyTarget::Stdin - } else if self.parse_keyword(Keyword::STDOUT) { - CopyTarget::Stdout - } else if self.parse_keyword(Keyword::PROGRAM) { - CopyTarget::Program { - command: self.parse_literal_string()?, - } - } else { - CopyTarget::File { - filename: self.parse_literal_string()?, - } - }; - let _ = self.parse_keyword(Keyword::WITH); - let mut options = ::alloc::vec::Vec::new(); - if self.consume_token(&Token::LParen) { - options = self.parse_comma_separated(Parser::parse_copy_option)?; - self.expect_token(&Token::RParen)?; - } - let mut legacy_options = ::alloc::vec::Vec::new(); - while let Some(opt) = self - .maybe_parse(|parser| parser.parse_copy_legacy_option())? - { - legacy_options.push(opt); - } - let values = if let CopyTarget::Stdin = target { - self.expect_token(&Token::SemiColon)?; - self.parse_tsv() - } else { - ::alloc::vec::Vec::new() - }; - Ok(Statement::Copy { - source, - to, - target, - options, - legacy_options, - values, - }) - } - pub fn parse_close(&mut self) -> Result { - let cursor = if self.parse_keyword(Keyword::ALL) { - CloseCursor::All - } else { - let name = self.parse_identifier()?; - CloseCursor::Specific { name } - }; - Ok(Statement::Close { cursor }) - } - fn parse_copy_option(&mut self) -> Result { - let ret = match self - .parse_one_of_keywords( - &[ - Keyword::FORMAT, - Keyword::FREEZE, - Keyword::DELIMITER, - Keyword::NULL, - Keyword::HEADER, - Keyword::QUOTE, - Keyword::ESCAPE, - Keyword::FORCE_QUOTE, - Keyword::FORCE_NOT_NULL, - Keyword::FORCE_NULL, - Keyword::ENCODING, - ], - ) - { - Some(Keyword::FORMAT) => CopyOption::Format(self.parse_identifier()?), - Some(Keyword::FREEZE) => { - CopyOption::Freeze( - !match self - .parse_one_of_keywords(&[Keyword::TRUE, Keyword::FALSE]) - { - Some(Keyword::FALSE) => true, - _ => false, - }, - ) - } - Some(Keyword::DELIMITER) => { - CopyOption::Delimiter(self.parse_literal_char()?) - } - Some(Keyword::NULL) => CopyOption::Null(self.parse_literal_string()?), - Some(Keyword::HEADER) => { - CopyOption::Header( - !match self - .parse_one_of_keywords(&[Keyword::TRUE, Keyword::FALSE]) - { - Some(Keyword::FALSE) => true, - _ => false, - }, - ) - } - Some(Keyword::QUOTE) => CopyOption::Quote(self.parse_literal_char()?), - Some(Keyword::ESCAPE) => CopyOption::Escape(self.parse_literal_char()?), - Some(Keyword::FORCE_QUOTE) => { - CopyOption::ForceQuote( - self.parse_parenthesized_column_list(Mandatory, false)?, - ) - } - Some(Keyword::FORCE_NOT_NULL) => { - CopyOption::ForceNotNull( - self.parse_parenthesized_column_list(Mandatory, false)?, - ) - } - Some(Keyword::FORCE_NULL) => { - CopyOption::ForceNull( - self.parse_parenthesized_column_list(Mandatory, false)?, - ) - } - Some(Keyword::ENCODING) => { - CopyOption::Encoding(self.parse_literal_string()?) - } - _ => self.expected("option", self.peek_token())?, - }; - Ok(ret) - } - fn parse_copy_legacy_option(&mut self) -> Result { - let ret = match self - .parse_one_of_keywords( - &[Keyword::BINARY, Keyword::DELIMITER, Keyword::NULL, Keyword::CSV], - ) - { - Some(Keyword::BINARY) => CopyLegacyOption::Binary, - Some(Keyword::DELIMITER) => { - let _ = self.parse_keyword(Keyword::AS); - CopyLegacyOption::Delimiter(self.parse_literal_char()?) - } - Some(Keyword::NULL) => { - let _ = self.parse_keyword(Keyword::AS); - CopyLegacyOption::Null(self.parse_literal_string()?) - } - Some(Keyword::CSV) => { - CopyLegacyOption::Csv({ - let mut opts = ::alloc::vec::Vec::new(); - while let Some(opt) = self - .maybe_parse(|parser| parser.parse_copy_legacy_csv_option())? - { - opts.push(opt); - } - opts - }) - } - _ => self.expected("option", self.peek_token())?, - }; - Ok(ret) - } - fn parse_copy_legacy_csv_option( - &mut self, - ) -> Result { - let ret = match self - .parse_one_of_keywords( - &[Keyword::HEADER, Keyword::QUOTE, Keyword::ESCAPE, Keyword::FORCE], - ) - { - Some(Keyword::HEADER) => CopyLegacyCsvOption::Header, - Some(Keyword::QUOTE) => { - let _ = self.parse_keyword(Keyword::AS); - CopyLegacyCsvOption::Quote(self.parse_literal_char()?) - } - Some(Keyword::ESCAPE) => { - let _ = self.parse_keyword(Keyword::AS); - CopyLegacyCsvOption::Escape(self.parse_literal_char()?) - } - Some( - Keyword::FORCE, - ) if self.parse_keywords(&[Keyword::NOT, Keyword::NULL]) => { - CopyLegacyCsvOption::ForceNotNull( - self.parse_comma_separated(|p| p.parse_identifier())?, - ) - } - Some(Keyword::FORCE) if self.parse_keywords(&[Keyword::QUOTE]) => { - CopyLegacyCsvOption::ForceQuote( - self.parse_comma_separated(|p| p.parse_identifier())?, - ) - } - _ => self.expected("csv option", self.peek_token())?, - }; - Ok(ret) - } - fn parse_literal_char(&mut self) -> Result { - let s = self.parse_literal_string()?; - if s.len() != 1 { - let loc = self - .tokens - .get(self.index - 1) - .map_or(Location { line: 0, column: 0 }, |t| t.span.start); - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expect a char, found {0:?}", s), - ); - res - }), - loc, - ), - ); - res - }), - ), - ); - } - Ok(s.chars().next().unwrap()) - } - /// Parse a tab separated values in - /// COPY payload - pub fn parse_tsv(&mut self) -> Vec> { - self.parse_tab_value() - } - pub fn parse_tab_value(&mut self) -> Vec> { - let mut values = ::alloc::vec::Vec::new(); - let mut content = String::from(""); - while let Some(t) = self.next_token_no_skip().map(|t| &t.token) { - match t { - Token::Whitespace(Whitespace::Tab) => { - values.push(Some(content.to_string())); - content.clear(); - } - Token::Whitespace(Whitespace::Newline) => { - values.push(Some(content.to_string())); - content.clear(); - } - Token::Backslash => { - if self.consume_token(&Token::Period) { - return values; - } - if let Token::Word(w) = self.next_token().token { - if w.value == "N" { - values.push(None); - } - } - } - _ => { - content.push_str(&t.to_string()); - } - } - } - values - } - /// Parse a literal value (numbers, strings, date/time, booleans) - pub fn parse_value(&mut self) -> Result { - let next_token = self.next_token(); - let span = next_token.span; - match next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::TRUE if self.dialect.supports_boolean_literals() => { - Ok(Value::Boolean(true)) - } - Keyword::FALSE if self.dialect.supports_boolean_literals() => { - Ok(Value::Boolean(false)) - } - Keyword::NULL => Ok(Value::Null), - Keyword::NoKeyword if w.quote_style.is_some() => { - match w.quote_style { - Some('"') => Ok(Value::DoubleQuotedString(w.value)), - Some('\'') => Ok(Value::SingleQuotedString(w.value)), - _ => { - self.expected( - "A value?", - TokenWithSpan { - token: Token::Word(w), - span, - }, - )? - } - } - } - _ => { - self.expected( - "a concrete value", - TokenWithSpan { - token: Token::Word(w), - span, - }, - ) - } - } - } - Token::Number(n, l) => Ok(Value::Number(Self::parse(n, span.start)?, l)), - Token::SingleQuotedString(ref s) => { - Ok(Value::SingleQuotedString(s.to_string())) - } - Token::DoubleQuotedString(ref s) => { - Ok(Value::DoubleQuotedString(s.to_string())) - } - Token::TripleSingleQuotedString(ref s) => { - Ok(Value::TripleSingleQuotedString(s.to_string())) - } - Token::TripleDoubleQuotedString(ref s) => { - Ok(Value::TripleDoubleQuotedString(s.to_string())) - } - Token::DollarQuotedString(ref s) => { - Ok(Value::DollarQuotedString(s.clone())) - } - Token::SingleQuotedByteStringLiteral(ref s) => { - Ok(Value::SingleQuotedByteStringLiteral(s.clone())) - } - Token::DoubleQuotedByteStringLiteral(ref s) => { - Ok(Value::DoubleQuotedByteStringLiteral(s.clone())) - } - Token::TripleSingleQuotedByteStringLiteral(ref s) => { - Ok(Value::TripleSingleQuotedByteStringLiteral(s.clone())) - } - Token::TripleDoubleQuotedByteStringLiteral(ref s) => { - Ok(Value::TripleDoubleQuotedByteStringLiteral(s.clone())) - } - Token::SingleQuotedRawStringLiteral(ref s) => { - Ok(Value::SingleQuotedRawStringLiteral(s.clone())) - } - Token::DoubleQuotedRawStringLiteral(ref s) => { - Ok(Value::DoubleQuotedRawStringLiteral(s.clone())) - } - Token::TripleSingleQuotedRawStringLiteral(ref s) => { - Ok(Value::TripleSingleQuotedRawStringLiteral(s.clone())) - } - Token::TripleDoubleQuotedRawStringLiteral(ref s) => { - Ok(Value::TripleDoubleQuotedRawStringLiteral(s.clone())) - } - Token::NationalStringLiteral(ref s) => { - Ok(Value::NationalStringLiteral(s.to_string())) - } - Token::EscapedStringLiteral(ref s) => { - Ok(Value::EscapedStringLiteral(s.to_string())) - } - Token::UnicodeStringLiteral(ref s) => { - Ok(Value::UnicodeStringLiteral(s.to_string())) - } - Token::HexStringLiteral(ref s) => { - Ok(Value::HexStringLiteral(s.to_string())) - } - Token::Placeholder(ref s) => Ok(Value::Placeholder(s.to_string())), - tok @ Token::Colon | tok @ Token::AtSign => { - let next_token = self.next_token(); - let ident = match next_token.token { - Token::Word(w) => Ok(w.into_ident(next_token.span)), - Token::Number(w, false) => Ok(Ident::new(w)), - _ => self.expected("placeholder", next_token), - }?; - let placeholder = tok.to_string() + &ident.value; - Ok(Value::Placeholder(placeholder)) - } - unexpected => { - self.expected( - "a value", - TokenWithSpan { - token: unexpected, - span, - }, - ) - } - } - } - /// Parse an unsigned numeric literal - pub fn parse_number_value(&mut self) -> Result { - match self.parse_value()? { - v @ Value::Number(_, _) => Ok(v), - v @ Value::Placeholder(_) => Ok(v), - _ => { - self.prev_token(); - self.expected("literal number", self.peek_token()) - } - } - } - /// Parse a numeric literal as an expression. Returns a [`Expr::UnaryOp`] if the number is signed, - /// otherwise returns a [`Expr::Value`] - pub fn parse_number(&mut self) -> Result { - let next_token = self.next_token(); - match next_token.token { - Token::Plus => { - Ok(Expr::UnaryOp { - op: UnaryOperator::Plus, - expr: Box::new(Expr::Value(self.parse_number_value()?)), - }) - } - Token::Minus => { - Ok(Expr::UnaryOp { - op: UnaryOperator::Minus, - expr: Box::new(Expr::Value(self.parse_number_value()?)), - }) - } - _ => { - self.prev_token(); - Ok(Expr::Value(self.parse_number_value()?)) - } - } - } - fn parse_introduced_string_value(&mut self) -> Result { - let next_token = self.next_token(); - let span = next_token.span; - match next_token.token { - Token::SingleQuotedString(ref s) => { - Ok(Value::SingleQuotedString(s.to_string())) - } - Token::DoubleQuotedString(ref s) => { - Ok(Value::DoubleQuotedString(s.to_string())) - } - Token::HexStringLiteral(ref s) => { - Ok(Value::HexStringLiteral(s.to_string())) - } - unexpected => { - self.expected( - "a string value", - TokenWithSpan { - token: unexpected, - span, - }, - ) - } - } - } - /// Parse an unsigned literal integer/long - pub fn parse_literal_uint(&mut self) -> Result { - let next_token = self.next_token(); - match next_token.token { - Token::Number(s, _) => Self::parse::(s, next_token.span.start), - _ => self.expected("literal int", next_token), - } - } - /// Parse the body of a `CREATE FUNCTION` specified as a string. - /// e.g. `CREATE FUNCTION ... AS $$ body $$`. - fn parse_create_function_body_string(&mut self) -> Result { - let peek_token = self.peek_token(); - match peek_token.token { - Token::DollarQuotedString( - s, - ) if (self.dialect.is::() - || self.dialect.is::()) => { - self.next_token(); - Ok(Expr::Value(Value::DollarQuotedString(s))) - } - _ => { - Ok( - Expr::Value( - Value::SingleQuotedString(self.parse_literal_string()?), - ), - ) - } - } - } - /// Parse a literal string - pub fn parse_literal_string(&mut self) -> Result { - let next_token = self.next_token(); - match next_token.token { - Token::Word(Word { value, keyword: Keyword::NoKeyword, .. }) => Ok(value), - Token::SingleQuotedString(s) => Ok(s), - Token::DoubleQuotedString(s) => Ok(s), - Token::EscapedStringLiteral( - s, - ) if (self.dialect.is::() - || self.dialect.is::()) => Ok(s), - Token::UnicodeStringLiteral(s) => Ok(s), - _ => self.expected("literal string", next_token), - } - } - /// Parse a literal unicode normalization clause - pub fn parse_unicode_is_normalized( - &mut self, - expr: Expr, - ) -> Result { - let neg = self.parse_keyword(Keyword::NOT); - let normalized_form = self - .maybe_parse(|parser| { - match parser - .parse_one_of_keywords( - &[Keyword::NFC, Keyword::NFD, Keyword::NFKC, Keyword::NFKD], - ) - { - Some(Keyword::NFC) => Ok(NormalizationForm::NFC), - Some(Keyword::NFD) => Ok(NormalizationForm::NFD), - Some(Keyword::NFKC) => Ok(NormalizationForm::NFKC), - Some(Keyword::NFKD) => Ok(NormalizationForm::NFKD), - _ => { - parser - .expected("unicode normalization form", parser.peek_token()) - } - } - })?; - if self.parse_keyword(Keyword::NORMALIZED) { - return Ok(Expr::IsNormalized { - expr: Box::new(expr), - form: normalized_form, - negated: neg, - }); - } - self.expected("unicode normalization form", self.peek_token()) - } - pub fn parse_enum_values(&mut self) -> Result, ParserError> { - self.expect_token(&Token::LParen)?; - let values = self - .parse_comma_separated(|parser| { - let name = parser.parse_literal_string()?; - let e = if parser.consume_token(&Token::Eq) { - let value = parser.parse_number()?; - EnumMember::NamedValue(name, value) - } else { - EnumMember::Name(name) - }; - Ok(e) - })?; - self.expect_token(&Token::RParen)?; - Ok(values) - } - /// Parse a SQL datatype (in the context of a CREATE TABLE statement for example) - pub fn parse_data_type(&mut self) -> Result { - let (ty, trailing_bracket) = self.parse_data_type_helper()?; - if trailing_bracket.0 { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("unmatched > after parsing data type {0}", ty), - ); - res - }), - self.peek_token(), - ), - ); - res - }), - ), - ); - } - Ok(ty) - } - fn parse_data_type_helper( - &mut self, - ) -> Result<(DataType, MatchedTrailingBracket), ParserError> { - let dialect = self.dialect; - self.advance_token(); - let next_token = self.get_current_token(); - let next_token_index = self.get_current_index(); - let mut trailing_bracket: MatchedTrailingBracket = false.into(); - let mut data = match &next_token.token { - Token::Word(w) => { - match w.keyword { - Keyword::BOOLEAN => Ok(DataType::Boolean), - Keyword::BOOL => Ok(DataType::Bool), - Keyword::FLOAT => { - Ok(DataType::Float(self.parse_optional_precision()?)) - } - Keyword::REAL => Ok(DataType::Real), - Keyword::FLOAT4 => Ok(DataType::Float4), - Keyword::FLOAT32 => Ok(DataType::Float32), - Keyword::FLOAT64 => Ok(DataType::Float64), - Keyword::FLOAT8 => Ok(DataType::Float8), - Keyword::DOUBLE => { - if self.parse_keyword(Keyword::PRECISION) { - Ok(DataType::DoublePrecision) - } else { - Ok( - DataType::Double( - self.parse_exact_number_optional_precision_scale()?, - ), - ) - } - } - Keyword::TINYINT => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedTinyInt(optional_precision?)) - } else { - Ok(DataType::TinyInt(optional_precision?)) - } - } - Keyword::INT2 => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedInt2(optional_precision?)) - } else { - Ok(DataType::Int2(optional_precision?)) - } - } - Keyword::SMALLINT => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedSmallInt(optional_precision?)) - } else { - Ok(DataType::SmallInt(optional_precision?)) - } - } - Keyword::MEDIUMINT => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedMediumInt(optional_precision?)) - } else { - Ok(DataType::MediumInt(optional_precision?)) - } - } - Keyword::INT => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedInt(optional_precision?)) - } else { - Ok(DataType::Int(optional_precision?)) - } - } - Keyword::INT4 => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedInt4(optional_precision?)) - } else { - Ok(DataType::Int4(optional_precision?)) - } - } - Keyword::INT8 => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedInt8(optional_precision?)) - } else { - Ok(DataType::Int8(optional_precision?)) - } - } - Keyword::INT16 => Ok(DataType::Int16), - Keyword::INT32 => Ok(DataType::Int32), - Keyword::INT64 => Ok(DataType::Int64), - Keyword::INT128 => Ok(DataType::Int128), - Keyword::INT256 => Ok(DataType::Int256), - Keyword::INTEGER => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedInteger(optional_precision?)) - } else { - Ok(DataType::Integer(optional_precision?)) - } - } - Keyword::BIGINT => { - let optional_precision = self.parse_optional_precision(); - if self.parse_keyword(Keyword::UNSIGNED) { - Ok(DataType::UnsignedBigInt(optional_precision?)) - } else { - Ok(DataType::BigInt(optional_precision?)) - } - } - Keyword::UINT8 => Ok(DataType::UInt8), - Keyword::UINT16 => Ok(DataType::UInt16), - Keyword::UINT32 => Ok(DataType::UInt32), - Keyword::UINT64 => Ok(DataType::UInt64), - Keyword::UINT128 => Ok(DataType::UInt128), - Keyword::UINT256 => Ok(DataType::UInt256), - Keyword::VARCHAR => { - Ok( - DataType::Varchar(self.parse_optional_character_length()?), - ) - } - Keyword::NVARCHAR => { - Ok( - DataType::Nvarchar(self.parse_optional_character_length()?), - ) - } - Keyword::CHARACTER => { - if self.parse_keyword(Keyword::VARYING) { - Ok( - DataType::CharacterVarying( - self.parse_optional_character_length()?, - ), - ) - } else if self - .parse_keywords(&[Keyword::LARGE, Keyword::OBJECT]) - { - Ok( - DataType::CharacterLargeObject( - self.parse_optional_precision()?, - ), - ) - } else { - Ok( - DataType::Character(self.parse_optional_character_length()?), - ) - } - } - Keyword::CHAR => { - if self.parse_keyword(Keyword::VARYING) { - Ok( - DataType::CharVarying( - self.parse_optional_character_length()?, - ), - ) - } else if self - .parse_keywords(&[Keyword::LARGE, Keyword::OBJECT]) - { - Ok( - DataType::CharLargeObject(self.parse_optional_precision()?), - ) - } else { - Ok(DataType::Char(self.parse_optional_character_length()?)) - } - } - Keyword::CLOB => { - Ok(DataType::Clob(self.parse_optional_precision()?)) - } - Keyword::BINARY => { - Ok(DataType::Binary(self.parse_optional_precision()?)) - } - Keyword::VARBINARY => { - Ok(DataType::Varbinary(self.parse_optional_precision()?)) - } - Keyword::BLOB => { - Ok(DataType::Blob(self.parse_optional_precision()?)) - } - Keyword::TINYBLOB => Ok(DataType::TinyBlob), - Keyword::MEDIUMBLOB => Ok(DataType::MediumBlob), - Keyword::LONGBLOB => Ok(DataType::LongBlob), - Keyword::BYTES => { - Ok(DataType::Bytes(self.parse_optional_precision()?)) - } - Keyword::BIT => { - if self.parse_keyword(Keyword::VARYING) { - Ok(DataType::BitVarying(self.parse_optional_precision()?)) - } else { - Ok(DataType::Bit(self.parse_optional_precision()?)) - } - } - Keyword::UUID => Ok(DataType::Uuid), - Keyword::DATE => Ok(DataType::Date), - Keyword::DATE32 => Ok(DataType::Date32), - Keyword::DATETIME => { - Ok(DataType::Datetime(self.parse_optional_precision()?)) - } - Keyword::DATETIME64 => { - self.prev_token(); - let (precision, time_zone) = self.parse_datetime_64()?; - Ok(DataType::Datetime64(precision, time_zone)) - } - Keyword::TIMESTAMP => { - let precision = self.parse_optional_precision()?; - let tz = if self.parse_keyword(Keyword::WITH) { - self.expect_keywords(&[Keyword::TIME, Keyword::ZONE])?; - TimezoneInfo::WithTimeZone - } else if self.parse_keyword(Keyword::WITHOUT) { - self.expect_keywords(&[Keyword::TIME, Keyword::ZONE])?; - TimezoneInfo::WithoutTimeZone - } else { - TimezoneInfo::None - }; - Ok(DataType::Timestamp(precision, tz)) - } - Keyword::TIMESTAMPTZ => { - Ok( - DataType::Timestamp( - self.parse_optional_precision()?, - TimezoneInfo::Tz, - ), - ) - } - Keyword::TIME => { - let precision = self.parse_optional_precision()?; - let tz = if self.parse_keyword(Keyword::WITH) { - self.expect_keywords(&[Keyword::TIME, Keyword::ZONE])?; - TimezoneInfo::WithTimeZone - } else if self.parse_keyword(Keyword::WITHOUT) { - self.expect_keywords(&[Keyword::TIME, Keyword::ZONE])?; - TimezoneInfo::WithoutTimeZone - } else { - TimezoneInfo::None - }; - Ok(DataType::Time(precision, tz)) - } - Keyword::TIMETZ => { - Ok( - DataType::Time( - self.parse_optional_precision()?, - TimezoneInfo::Tz, - ), - ) - } - Keyword::INTERVAL => Ok(DataType::Interval), - Keyword::JSON => Ok(DataType::JSON), - Keyword::JSONB => Ok(DataType::JSONB), - Keyword::REGCLASS => Ok(DataType::Regclass), - Keyword::STRING => { - Ok(DataType::String(self.parse_optional_precision()?)) - } - Keyword::FIXEDSTRING => { - self.expect_token(&Token::LParen)?; - let character_length = self.parse_literal_uint()?; - self.expect_token(&Token::RParen)?; - Ok(DataType::FixedString(character_length)) - } - Keyword::TEXT => Ok(DataType::Text), - Keyword::TINYTEXT => Ok(DataType::TinyText), - Keyword::MEDIUMTEXT => Ok(DataType::MediumText), - Keyword::LONGTEXT => Ok(DataType::LongText), - Keyword::BYTEA => Ok(DataType::Bytea), - Keyword::NUMERIC => { - Ok( - DataType::Numeric( - self.parse_exact_number_optional_precision_scale()?, - ), - ) - } - Keyword::DECIMAL => { - Ok( - DataType::Decimal( - self.parse_exact_number_optional_precision_scale()?, - ), - ) - } - Keyword::DEC => { - Ok( - DataType::Dec( - self.parse_exact_number_optional_precision_scale()?, - ), - ) - } - Keyword::BIGNUMERIC => { - Ok( - DataType::BigNumeric( - self.parse_exact_number_optional_precision_scale()?, - ), - ) - } - Keyword::BIGDECIMAL => { - Ok( - DataType::BigDecimal( - self.parse_exact_number_optional_precision_scale()?, - ), - ) - } - Keyword::ENUM => { - Ok(DataType::Enum(self.parse_enum_values()?, None)) - } - Keyword::ENUM8 => { - Ok(DataType::Enum(self.parse_enum_values()?, Some(8))) - } - Keyword::ENUM16 => { - Ok(DataType::Enum(self.parse_enum_values()?, Some(16))) - } - Keyword::SET => Ok(DataType::Set(self.parse_string_values()?)), - Keyword::ARRAY => { - if (self.dialect.is::()) { - Ok(DataType::Array(ArrayElemTypeDef::None)) - } else if (self.dialect.is::()) { - Ok( - self - .parse_sub_type(|internal_type| { - DataType::Array( - ArrayElemTypeDef::Parenthesis(internal_type), - ) - })?, - ) - } else { - self.expect_token(&Token::Lt)?; - let (inside_type, _trailing_bracket) = self - .parse_data_type_helper()?; - trailing_bracket = self - .expect_closing_angle_bracket(_trailing_bracket)?; - Ok( - DataType::Array( - ArrayElemTypeDef::AngleBracket(Box::new(inside_type)), - ), - ) - } - } - Keyword::STRUCT if (dialect.is::()) => { - self.prev_token(); - let field_defs = self.parse_duckdb_struct_type_def()?; - Ok( - DataType::Struct(field_defs, StructBracketKind::Parentheses), - ) - } - Keyword::STRUCT if (dialect.is::() - || dialect.is::()) => { - self.prev_token(); - let (field_defs, _trailing_bracket) = self - .parse_struct_type_def(Self::parse_struct_field_def)?; - trailing_bracket = _trailing_bracket; - Ok( - DataType::Struct( - field_defs, - StructBracketKind::AngleBrackets, - ), - ) - } - Keyword::UNION if (dialect.is::() - || dialect.is::()) => { - self.prev_token(); - let fields = self.parse_union_type_def()?; - Ok(DataType::Union(fields)) - } - Keyword::NULLABLE if (dialect.is::() - || dialect.is::()) => { - Ok(self.parse_sub_type(DataType::Nullable)?) - } - Keyword::LOWCARDINALITY if (dialect.is::() - || dialect.is::()) => { - Ok(self.parse_sub_type(DataType::LowCardinality)?) - } - Keyword::MAP if (dialect.is::() - || dialect.is::()) => { - self.prev_token(); - let (key_data_type, value_data_type) = self - .parse_click_house_map_def()?; - Ok( - DataType::Map( - Box::new(key_data_type), - Box::new(value_data_type), - ), - ) - } - Keyword::NESTED if (dialect.is::() - || dialect.is::()) => { - self.expect_token(&Token::LParen)?; - let field_defs = self - .parse_comma_separated(Parser::parse_column_def)?; - self.expect_token(&Token::RParen)?; - Ok(DataType::Nested(field_defs)) - } - Keyword::TUPLE if (dialect.is::() - || dialect.is::()) => { - self.prev_token(); - let field_defs = self.parse_click_house_tuple_def()?; - Ok(DataType::Tuple(field_defs)) - } - Keyword::TRIGGER => Ok(DataType::Trigger), - Keyword::ANY if self.peek_keyword(Keyword::TYPE) => { - let _ = self.parse_keyword(Keyword::TYPE); - Ok(DataType::AnyType) - } - Keyword::TABLE => { - let columns = self.parse_returns_table_columns()?; - Ok(DataType::Table(columns)) - } - _ => { - self.prev_token(); - let type_name = self.parse_object_name(false)?; - if let Some(modifiers) = self - .parse_optional_type_modifiers()? - { - Ok(DataType::Custom(type_name, modifiers)) - } else { - Ok(DataType::Custom(type_name, ::alloc::vec::Vec::new())) - } - } - } - } - _ => self.expected_at("a data type name", next_token_index), - }?; - while self.consume_token(&Token::LBracket) { - let size = if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - { - self.maybe_parse(|p| p.parse_literal_uint())? - } else { - None - }; - self.expect_token(&Token::RBracket)?; - data = DataType::Array( - ArrayElemTypeDef::SquareBracket(Box::new(data), size), - ); - } - Ok((data, trailing_bracket)) - } - fn parse_returns_table_column(&mut self) -> Result { - let name = self.parse_identifier()?; - let data_type = self.parse_data_type()?; - Ok(ColumnDef { - name, - data_type, - collation: None, - options: Vec::new(), - }) - } - fn parse_returns_table_columns( - &mut self, - ) -> Result, ParserError> { - self.expect_token(&Token::LParen)?; - let columns = self - .parse_comma_separated(Parser::parse_returns_table_column)?; - self.expect_token(&Token::RParen)?; - Ok(columns) - } - pub fn parse_string_values(&mut self) -> Result, ParserError> { - self.expect_token(&Token::LParen)?; - let mut values = Vec::new(); - loop { - let next_token = self.next_token(); - match next_token.token { - Token::SingleQuotedString(value) => values.push(value), - _ => self.expected("a string", next_token)?, - } - let next_token = self.next_token(); - match next_token.token { - Token::Comma => {} - Token::RParen => break, - _ => self.expected(", or }", next_token)?, - } - } - Ok(values) - } - /// Strictly parse `identifier AS identifier` - pub fn parse_identifier_with_alias( - &mut self, - ) -> Result { - let ident = self.parse_identifier()?; - self.expect_keyword_is(Keyword::AS)?; - let alias = self.parse_identifier()?; - Ok(IdentWithAlias { ident, alias }) - } - /// Optionally parses an alias for a select list item - fn maybe_parse_select_item_alias( - &mut self, - ) -> Result, ParserError> { - fn validator(explicit: bool, kw: &Keyword, parser: &mut Parser) -> bool { - parser.dialect.is_select_item_alias(explicit, kw, parser) - } - self.parse_optional_alias_inner(None, validator) - } - /// 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. - pub fn maybe_parse_table_alias( - &mut self, - ) -> Result, ParserError> { - fn validator(explicit: bool, kw: &Keyword, parser: &mut Parser) -> bool { - parser.dialect.is_table_factor_alias(explicit, kw, parser) - } - match self.parse_optional_alias_inner(None, validator)? { - Some(name) => { - let columns = self.parse_table_alias_column_defs()?; - Ok(Some(TableAlias { name, columns })) - } - None => Ok(None), - } - } - fn parse_table_index_hints( - &mut self, - ) -> Result, ParserError> { - let mut hints = ::alloc::vec::Vec::new(); - while let Some(hint_type) = self - .parse_one_of_keywords(&[Keyword::USE, Keyword::IGNORE, Keyword::FORCE]) - { - let hint_type = match hint_type { - Keyword::USE => TableIndexHintType::Use, - Keyword::IGNORE => TableIndexHintType::Ignore, - Keyword::FORCE => TableIndexHintType::Force, - _ => { - return self - .expected( - "expected to match USE/IGNORE/FORCE keyword", - self.peek_token(), - ); - } - }; - let index_type = match self - .parse_one_of_keywords(&[Keyword::INDEX, Keyword::KEY]) - { - Some(Keyword::INDEX) => TableIndexType::Index, - Some(Keyword::KEY) => TableIndexType::Key, - _ => { - return self - .expected( - "expected to match INDEX/KEY keyword", - self.peek_token(), - ); - } - }; - let for_clause = if self.parse_keyword(Keyword::FOR) { - let clause = if self.parse_keyword(Keyword::JOIN) { - TableIndexHintForClause::Join - } else if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - TableIndexHintForClause::OrderBy - } else if self.parse_keywords(&[Keyword::GROUP, Keyword::BY]) { - TableIndexHintForClause::GroupBy - } else { - return self - .expected( - "expected to match FOR/ORDER BY/GROUP BY table hint in for clause", - self.peek_token(), - ); - }; - Some(clause) - } else { - None - }; - self.expect_token(&Token::LParen)?; - let index_names = if self.peek_token().token != Token::RParen { - self.parse_comma_separated(Parser::parse_identifier)? - } else { - ::alloc::vec::Vec::new() - }; - self.expect_token(&Token::RParen)?; - hints - .push(TableIndexHints { - hint_type, - index_type, - for_clause, - index_names, - }); - } - Ok(hints) - } - /// 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`. - pub fn parse_optional_alias( - &mut self, - reserved_kwds: &[Keyword], - ) -> Result, ParserError> { - fn validator(_explicit: bool, _kw: &Keyword, _parser: &mut Parser) -> bool { - false - } - self.parse_optional_alias_inner(Some(reserved_kwds), validator) - } - /// Parses an optional alias after a SQL element such as a select list item - /// or a table name. - /// - /// This method accepts an optional list of reserved keywords or a function - /// to call to validate if a keyword should be parsed as an alias, to allow - /// callers to customize the parsing logic based on their context. - fn parse_optional_alias_inner( - &mut self, - reserved_kwds: Option<&[Keyword]>, - validator: F, - ) -> Result, ParserError> - where - F: Fn(bool, &Keyword, &mut Parser) -> bool, - { - let after_as = self.parse_keyword(Keyword::AS); - let next_token = self.next_token(); - match next_token.token { - Token::Word( - w, - ) if after_as - || reserved_kwds.is_some_and(|x| !x.contains(&w.keyword)) => { - Ok(Some(w.into_ident(next_token.span))) - } - Token::Word(w) if validator(after_as, &w.keyword, self) => { - Ok(Some(w.into_ident(next_token.span))) - } - Token::SingleQuotedString(s) => Ok(Some(Ident::with_quote('\'', s))), - Token::DoubleQuotedString(s) => Ok(Some(Ident::with_quote('\"', s))), - _ => { - if after_as { - return self.expected("an identifier after AS", next_token); - } - self.prev_token(); - Ok(None) - } - } - } - pub fn parse_optional_group_by( - &mut self, - ) -> Result, ParserError> { - if self.parse_keywords(&[Keyword::GROUP, Keyword::BY]) { - let expressions = if self.parse_keyword(Keyword::ALL) { - None - } else { - Some(self.parse_comma_separated(Parser::parse_group_by_expr)?) - }; - let mut modifiers = ::alloc::vec::Vec::new(); - if (self.dialect.is::() - || self.dialect.is::()) - { - loop { - if !self.parse_keyword(Keyword::WITH) { - break; - } - let keyword = self - .expect_one_of_keywords( - &[Keyword::ROLLUP, Keyword::CUBE, Keyword::TOTALS], - )?; - modifiers - .push( - match keyword { - Keyword::ROLLUP => GroupByWithModifier::Rollup, - Keyword::CUBE => GroupByWithModifier::Cube, - Keyword::TOTALS => GroupByWithModifier::Totals, - _ => { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "BUG: expected to match GroupBy modifier keyword", - self.peek_token().span.start, - ), - ); - res - }), - ), - ); - } - }, - ); - } - } - let group_by = match expressions { - None => GroupByExpr::All(modifiers), - Some(exprs) => GroupByExpr::Expressions(exprs, modifiers), - }; - Ok(Some(group_by)) - } else { - Ok(None) - } - } - pub fn parse_optional_order_by( - &mut self, - ) -> Result, ParserError> { - if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - let order_by_exprs = self - .parse_comma_separated(Parser::parse_order_by_expr)?; - let interpolate = if (self.dialect.is::() - || self.dialect.is::()) - { - self.parse_interpolations()? - } else { - None - }; - Ok( - Some(OrderBy { - exprs: order_by_exprs, - interpolate, - }), - ) - } else { - Ok(None) - } - } - /// Parse a table object for insertion - /// e.g. `some_database.some_table` or `FUNCTION some_table_func(...)` - pub fn parse_table_object(&mut self) -> Result { - if self.dialect.supports_insert_table_function() - && self.parse_keyword(Keyword::FUNCTION) - { - let fn_name = self.parse_object_name(false)?; - self.parse_function_call(fn_name).map(TableObject::TableFunction) - } else { - self.parse_object_name(false).map(TableObject::TableName) - } - } - /// Parse a possibly qualified, possibly quoted identifier, optionally allowing for wildcards, - /// e.g. *, *.*, `foo`.*, or "foo"."bar" - fn parse_object_name_with_wildcards( - &mut self, - in_table_clause: bool, - allow_wildcards: bool, - ) -> Result { - let mut idents = ::alloc::vec::Vec::new(); - if (self.dialect.is::()) && in_table_clause { - loop { - let (ident, end_with_period) = self - .parse_unquoted_hyphenated_identifier()?; - idents.push(ident); - if !self.consume_token(&Token::Period) && !end_with_period { - break; - } - } - } else { - loop { - let ident = if allow_wildcards - && self.peek_token().token == Token::Mul - { - let span = self.next_token().span; - Ident { - value: Token::Mul.to_string(), - quote_style: None, - span, - } - } else { - if self.dialect.supports_object_name_double_dot_notation() - && idents.len() == 1 && self.consume_token(&Token::Period) - { - idents.push(Ident::new("")); - } - self.parse_identifier()? - }; - idents.push(ident); - if !self.consume_token(&Token::Period) { - break; - } - } - } - Ok(ObjectName::from(idents)) - } - /// 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. - pub fn parse_object_name( - &mut self, - in_table_clause: bool, - ) -> Result { - let ObjectName(mut idents) = self - .parse_object_name_with_wildcards(in_table_clause, false)?; - if (self.dialect.is::()) - && idents - .iter() - .any(|part| { - part.as_ident().is_some_and(|ident| ident.value.contains('.')) - }) - { - idents = idents - .into_iter() - .flat_map(|part| match part.as_ident() { - Some(ident) => { - ident - .value - .split('.') - .map(|value| { - ObjectNamePart::Identifier(Ident { - value: value.into(), - quote_style: ident.quote_style, - span: ident.span, - }) - }) - .collect::>() - } - None => { - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([part]), - ) - } - }) - .collect(); - } - Ok(ObjectName(idents)) - } - /// Parse identifiers - pub fn parse_identifiers(&mut self) -> Result, ParserError> { - let mut idents = ::alloc::vec::Vec::new(); - loop { - match &self.peek_token_ref().token { - Token::Word(w) => { - idents.push(w.clone().into_ident(self.peek_token_ref().span)); - } - Token::EOF | Token::Eq => break, - _ => {} - } - self.advance_token(); - } - Ok(idents) - } - /// 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: - /// - /// ```rust - /// 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: +" - /// ); - /// ``` - /// - /// [parse_identifiers]: Parser::parse_identifiers - pub fn parse_multipart_identifier(&mut self) -> Result, ParserError> { - let mut idents = ::alloc::vec::Vec::new(); - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => idents.push(w.into_ident(next_token.span)), - Token::EOF => { - return Err( - ParserError::ParserError( - "Empty input when parsing identifier".to_string(), - ), - )?; - } - token => { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Unexpected token in identifier: {0}", token), - ); - res - }), - ), - )?; - } - }; - loop { - match self.next_token().token { - Token::Period => { - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => idents.push(w.into_ident(next_token.span)), - Token::EOF => { - return Err( - ParserError::ParserError( - "Trailing period in identifier".to_string(), - ), - )?; - } - token => { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Unexpected token following period in identifier: {0}", - token, - ), - ); - res - }), - ), - )?; - } - } - } - Token::EOF => break, - token => { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Unexpected token in identifier: {0}", token), - ); - res - }), - ), - )?; - } - } - } - Ok(idents) - } - /// Parse a simple one-word identifier (possibly quoted, possibly a keyword) - pub fn parse_identifier(&mut self) -> Result { - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => Ok(w.into_ident(next_token.span)), - Token::SingleQuotedString(s) => Ok(Ident::with_quote('\'', s)), - Token::DoubleQuotedString(s) => Ok(Ident::with_quote('\"', s)), - _ => self.expected("identifier", next_token), - } - } - /// On BigQuery, hyphens are permitted in unquoted identifiers inside of a FROM or - /// TABLE clause. - /// - /// The first segment must be an ordinary unquoted identifier, e.g. it must not start - /// with a digit. Subsequent segments are either must either be valid identifiers or - /// integers, e.g. foo-123 is allowed, but foo-123a is not. - /// - /// [BigQuery-lexical](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical) - /// - /// Return a tuple of the identifier and a boolean indicating it ends with a period. - fn parse_unquoted_hyphenated_identifier( - &mut self, - ) -> Result<(Ident, bool), ParserError> { - match self.peek_token().token { - Token::Word(w) => { - let quote_style_is_none = w.quote_style.is_none(); - let mut requires_whitespace = false; - let mut ident = w.into_ident(self.next_token().span); - if quote_style_is_none { - while match self.peek_token_no_skip().token { - Token::Minus => true, - _ => false, - } { - self.next_token(); - ident.value.push('-'); - let token = self - .next_token_no_skip() - .cloned() - .unwrap_or(TokenWithSpan::wrap(Token::EOF)); - requires_whitespace = match token.token { - Token::Word( - next_word, - ) if next_word.quote_style.is_none() => { - ident.value.push_str(&next_word.value); - false - } - Token::Number(s, false) => { - if s.ends_with('.') { - let Some(s) = s - .split('.') - .next() - .filter(|s| { - !s.is_empty() && s.chars().all(|c| c.is_ascii_digit()) - }) else { - return self - .expected( - "continuation of hyphenated identifier", - TokenWithSpan::new(Token::Number(s, false), token.span), - ); - }; - ident.value.push_str(s); - return Ok((ident, true)); - } else { - ident.value.push_str(&s); - } - !match self.peek_token().token { - Token::Period => true, - _ => false, - } - } - _ => { - return self - .expected("continuation of hyphenated identifier", token); - } - }; - } - if requires_whitespace { - let token = self.next_token(); - if !match token.token { - Token::EOF | Token::Whitespace(_) => true, - _ => false, - } { - return self - .expected( - "whitespace following hyphenated identifier", - token, - ); - } - } - } - Ok((ident, false)) - } - _ => Ok((self.parse_identifier()?, false)), - } - } - /// Parses a parenthesized, comma-separated list of column definitions within a view. - fn parse_view_columns(&mut self) -> Result, ParserError> { - if self.consume_token(&Token::LParen) { - if self.peek_token().token == Token::RParen { - self.next_token(); - Ok(::alloc::vec::Vec::new()) - } else { - let cols = self - .parse_comma_separated_with_trailing_commas( - Parser::parse_view_column, - self.dialect.supports_column_definition_trailing_commas(), - Self::is_reserved_for_column_alias, - )?; - self.expect_token(&Token::RParen)?; - Ok(cols) - } - } else { - Ok(::alloc::vec::Vec::new()) - } - } - /// Parses a column definition within a view. - fn parse_view_column(&mut self) -> Result { - let name = self.parse_identifier()?; - let options = if ((self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::OPTIONS)) - || ((self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::COMMENT)) - { - self.prev_token(); - self.parse_optional_column_option()? - .map(|option| <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([option]), - )) - } else { - None - }; - let data_type = if (self.dialect.is::()) { - Some(self.parse_data_type()?) - } else { - None - }; - Ok(ViewColumnDef { - name, - data_type, - options, - }) - } - /// Parses a parenthesized comma-separated list of unqualified, possibly quoted identifiers. - /// For example: `(col1, "col 2", ...)` - pub fn parse_parenthesized_column_list( - &mut self, - optional: IsOptional, - allow_empty: bool, - ) -> Result, ParserError> { - self.parse_parenthesized_column_list_inner( - optional, - allow_empty, - |p| p.parse_identifier(), - ) - } - /// Parses a parenthesized comma-separated list of qualified, possibly quoted identifiers. - /// For example: `(db1.sc1.tbl1.col1, db1.sc1.tbl1."col 2", ...)` - pub fn parse_parenthesized_qualified_column_list( - &mut self, - optional: IsOptional, - allow_empty: bool, - ) -> Result, ParserError> { - self.parse_parenthesized_column_list_inner( - optional, - allow_empty, - |p| { p.parse_object_name(true) }, - ) - } - /// Parses a parenthesized comma-separated list of columns using - /// the provided function to parse each element. - fn parse_parenthesized_column_list_inner( - &mut self, - optional: IsOptional, - allow_empty: bool, - mut f: F, - ) -> Result, ParserError> - where - F: FnMut(&mut Parser) -> Result, - { - if self.consume_token(&Token::LParen) { - if allow_empty && self.peek_token().token == Token::RParen { - self.next_token(); - Ok(::alloc::vec::Vec::new()) - } else { - let cols = self.parse_comma_separated(|p| f(p))?; - self.expect_token(&Token::RParen)?; - Ok(cols) - } - } else if optional == Optional { - Ok(::alloc::vec::Vec::new()) - } else { - self.expected("a list of columns in parentheses", self.peek_token()) - } - } - /// Parses a parenthesized comma-separated list of table alias column definitions. - fn parse_table_alias_column_defs( - &mut self, - ) -> Result, ParserError> { - if self.consume_token(&Token::LParen) { - let cols = self - .parse_comma_separated(|p| { - let name = p.parse_identifier()?; - let data_type = p.maybe_parse(|p| p.parse_data_type())?; - Ok(TableAliasColumnDef { - name, - data_type, - }) - })?; - self.expect_token(&Token::RParen)?; - Ok(cols) - } else { - Ok(::alloc::vec::Vec::new()) - } - } - pub fn parse_precision(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let n = self.parse_literal_uint()?; - self.expect_token(&Token::RParen)?; - Ok(n) - } - pub fn parse_optional_precision(&mut self) -> Result, ParserError> { - if self.consume_token(&Token::LParen) { - let n = self.parse_literal_uint()?; - self.expect_token(&Token::RParen)?; - Ok(Some(n)) - } else { - Ok(None) - } - } - /// Parse datetime64 [1] - /// Syntax - /// ```sql - /// DateTime64(precision[, timezone]) - /// ``` - /// - /// [1]: https://clickhouse.com/docs/en/sql-reference/data-types/datetime64 - pub fn parse_datetime_64( - &mut self, - ) -> Result<(u64, Option), ParserError> { - self.expect_keyword_is(Keyword::DATETIME64)?; - self.expect_token(&Token::LParen)?; - let precision = self.parse_literal_uint()?; - let time_zone = if self.consume_token(&Token::Comma) { - Some(self.parse_literal_string()?) - } else { - None - }; - self.expect_token(&Token::RParen)?; - Ok((precision, time_zone)) - } - pub fn parse_optional_character_length( - &mut self, - ) -> Result, ParserError> { - if self.consume_token(&Token::LParen) { - let character_length = self.parse_character_length()?; - self.expect_token(&Token::RParen)?; - Ok(Some(character_length)) - } else { - Ok(None) - } - } - pub fn parse_character_length( - &mut self, - ) -> Result { - if self.parse_keyword(Keyword::MAX) { - return Ok(CharacterLength::Max); - } - let length = self.parse_literal_uint()?; - let unit = if self.parse_keyword(Keyword::CHARACTERS) { - Some(CharLengthUnits::Characters) - } else if self.parse_keyword(Keyword::OCTETS) { - Some(CharLengthUnits::Octets) - } else { - None - }; - Ok(CharacterLength::IntegerLength { - length, - unit, - }) - } - pub fn parse_optional_precision_scale( - &mut self, - ) -> Result<(Option, Option), ParserError> { - if self.consume_token(&Token::LParen) { - let n = self.parse_literal_uint()?; - let scale = if self.consume_token(&Token::Comma) { - Some(self.parse_literal_uint()?) - } else { - None - }; - self.expect_token(&Token::RParen)?; - Ok((Some(n), scale)) - } else { - Ok((None, None)) - } - } - pub fn parse_exact_number_optional_precision_scale( - &mut self, - ) -> Result { - if self.consume_token(&Token::LParen) { - let precision = self.parse_literal_uint()?; - let scale = if self.consume_token(&Token::Comma) { - Some(self.parse_literal_uint()?) - } else { - None - }; - self.expect_token(&Token::RParen)?; - match scale { - None => Ok(ExactNumberInfo::Precision(precision)), - Some(scale) => { - Ok(ExactNumberInfo::PrecisionAndScale(precision, scale)) - } - } - } else { - Ok(ExactNumberInfo::None) - } - } - pub fn parse_optional_type_modifiers( - &mut self, - ) -> Result>, ParserError> { - if self.consume_token(&Token::LParen) { - let mut modifiers = Vec::new(); - loop { - let next_token = self.next_token(); - match next_token.token { - Token::Word(w) => modifiers.push(w.to_string()), - Token::Number(n, _) => modifiers.push(n), - Token::SingleQuotedString(s) => modifiers.push(s), - Token::Comma => { - continue; - } - Token::RParen => { - break; - } - _ => self.expected("type modifiers", next_token)?, - } - } - Ok(Some(modifiers)) - } else { - Ok(None) - } - } - /// Parse a parenthesized sub data type - fn parse_sub_type(&mut self, parent_type: F) -> Result - where - F: FnOnce(Box) -> DataType, - { - self.expect_token(&Token::LParen)?; - let inside_type = self.parse_data_type()?; - self.expect_token(&Token::RParen)?; - Ok(parent_type(inside_type.into())) - } - pub fn parse_delete(&mut self) -> Result { - let (tables, with_from_keyword) = if !self.parse_keyword(Keyword::FROM) { - if (self.dialect.is::() - || self.dialect.is::()) - { - (::alloc::vec::Vec::new(), false) - } else { - let tables = self - .parse_comma_separated(|p| p.parse_object_name(false))?; - self.expect_keyword_is(Keyword::FROM)?; - (tables, true) - } - } else { - (::alloc::vec::Vec::new(), true) - }; - let from = self.parse_comma_separated(Parser::parse_table_and_joins)?; - let using = if self.parse_keyword(Keyword::USING) { - Some(self.parse_comma_separated(Parser::parse_table_and_joins)?) - } else { - None - }; - let selection = if self.parse_keyword(Keyword::WHERE) { - Some(self.parse_expr()?) - } else { - None - }; - let returning = if self.parse_keyword(Keyword::RETURNING) { - Some(self.parse_comma_separated(Parser::parse_select_item)?) - } else { - None - }; - let order_by = if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - self.parse_comma_separated(Parser::parse_order_by_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let limit = if self.parse_keyword(Keyword::LIMIT) { - self.parse_limit()? - } else { - None - }; - Ok( - Statement::Delete(Delete { - tables, - from: if with_from_keyword { - FromTable::WithFromKeyword(from) - } else { - FromTable::WithoutKeyword(from) - }, - using, - selection, - returning, - order_by, - limit, - }), - ) - } - pub fn parse_kill(&mut self) -> Result { - let modifier_keyword = self - .parse_one_of_keywords( - &[Keyword::CONNECTION, Keyword::QUERY, Keyword::MUTATION], - ); - let id = self.parse_literal_uint()?; - let modifier = match modifier_keyword { - Some(Keyword::CONNECTION) => Some(KillType::Connection), - Some(Keyword::QUERY) => Some(KillType::Query), - Some(Keyword::MUTATION) => { - if (self.dialect.is::() - || self.dialect.is::()) - { - Some(KillType::Mutation) - } else { - self.expected( - "Unsupported type for KILL, allowed: CONNECTION | QUERY", - self.peek_token(), - )? - } - } - _ => None, - }; - Ok(Statement::Kill { modifier, id }) - } - pub fn parse_explain( - &mut self, - describe_alias: DescribeAlias, - ) -> Result { - let mut analyze = false; - let mut verbose = false; - let mut query_plan = false; - let mut estimate = false; - let mut format = None; - let mut options = None; - if describe_alias == DescribeAlias::Explain - && self.dialect.supports_explain_with_utility_options() - && self.peek_token().token == Token::LParen - { - options = Some(self.parse_utility_options()?) - } else if self.parse_keywords(&[Keyword::QUERY, Keyword::PLAN]) { - query_plan = true; - } else if self.parse_keyword(Keyword::ESTIMATE) { - estimate = true; - } else { - analyze = self.parse_keyword(Keyword::ANALYZE); - verbose = self.parse_keyword(Keyword::VERBOSE); - if self.parse_keyword(Keyword::FORMAT) { - format = Some(self.parse_analyze_format()?); - } - } - match self.maybe_parse(|parser| parser.parse_statement())? { - Some(Statement::Explain { .. }) - | Some(Statement::ExplainTable { .. }) => { - Err( - ParserError::ParserError( - "Explain must be root of the plan".to_string(), - ), - ) - } - Some(statement) => { - Ok(Statement::Explain { - describe_alias, - analyze, - verbose, - query_plan, - estimate, - statement: Box::new(statement), - format, - options, - }) - } - _ => { - let hive_format = match self - .parse_one_of_keywords(&[Keyword::EXTENDED, Keyword::FORMATTED]) - { - Some(Keyword::EXTENDED) => Some(HiveDescribeFormat::Extended), - Some(Keyword::FORMATTED) => Some(HiveDescribeFormat::Formatted), - _ => None, - }; - let has_table_keyword = if self - .dialect - .describe_requires_table_keyword() - { - self.parse_keyword(Keyword::TABLE) - } else { - false - }; - let table_name = self.parse_object_name(false)?; - Ok(Statement::ExplainTable { - describe_alias, - hive_format, - has_table_keyword, - table_name, - }) - } - } - } - /// 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 - pub fn parse_query(&mut self) -> Result, ParserError> { - let _guard = self.recursion_counter.try_decrease()?; - let with = if self.parse_keyword(Keyword::WITH) { - let with_token = self.get_current_token(); - Some(With { - with_token: with_token.clone().into(), - recursive: self.parse_keyword(Keyword::RECURSIVE), - cte_tables: self.parse_comma_separated(Parser::parse_cte)?, - }) - } else { - None - }; - if self.parse_keyword(Keyword::INSERT) { - Ok( - Query { - with, - body: self.parse_insert_setexpr_boxed()?, - limit: None, - limit_by: ::alloc::vec::Vec::new(), - order_by: None, - offset: None, - fetch: None, - locks: ::alloc::vec::Vec::new(), - for_clause: None, - settings: None, - format_clause: None, - } - .into(), - ) - } else if self.parse_keyword(Keyword::UPDATE) { - Ok( - Query { - with, - body: self.parse_update_setexpr_boxed()?, - limit: None, - limit_by: ::alloc::vec::Vec::new(), - order_by: None, - offset: None, - fetch: None, - locks: ::alloc::vec::Vec::new(), - for_clause: None, - settings: None, - format_clause: None, - } - .into(), - ) - } else { - let body = self.parse_query_body(self.dialect.prec_unknown())?; - let order_by = self.parse_optional_order_by()?; - let mut limit = None; - let mut offset = None; - for _x in 0..2 { - if limit.is_none() && self.parse_keyword(Keyword::LIMIT) { - limit = self.parse_limit()?; - } - if offset.is_none() && self.parse_keyword(Keyword::OFFSET) { - offset = Some(self.parse_offset()?); - } - if self.dialect.supports_limit_comma() && limit.is_some() - && offset.is_none() && self.consume_token(&Token::Comma) - { - offset = Some(Offset { - value: limit.unwrap(), - rows: OffsetRows::None, - }); - limit = Some(self.parse_expr()?); - } - } - let limit_by = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::BY) - { - self.parse_comma_separated(Parser::parse_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let settings = self.parse_settings()?; - let fetch = if self.parse_keyword(Keyword::FETCH) { - Some(self.parse_fetch()?) - } else { - None - }; - let mut for_clause = None; - let mut locks = Vec::new(); - while self.parse_keyword(Keyword::FOR) { - if let Some(parsed_for_clause) = self.parse_for_clause()? { - for_clause = Some(parsed_for_clause); - break; - } else { - locks.push(self.parse_lock()?); - } - } - let format_clause = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::FORMAT) - { - if self.parse_keyword(Keyword::NULL) { - Some(FormatClause::Null) - } else { - let ident = self.parse_identifier()?; - Some(FormatClause::Identifier(ident)) - } - } else { - None - }; - Ok( - Query { - with, - body, - order_by, - limit, - limit_by, - offset, - fetch, - locks, - for_clause, - settings, - format_clause, - } - .into(), - ) - } - } - fn parse_settings(&mut self) -> Result>, ParserError> { - let settings = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::SETTINGS) - { - let key_values = self - .parse_comma_separated(|p| { - let key = p.parse_identifier()?; - p.expect_token(&Token::Eq)?; - let value = p.parse_value()?; - Ok(Setting { key, value }) - })?; - Some(key_values) - } else { - None - }; - Ok(settings) - } - /// Parse a mssql `FOR [XML | JSON | BROWSE]` clause - pub fn parse_for_clause(&mut self) -> Result, ParserError> { - if self.parse_keyword(Keyword::XML) { - Ok(Some(self.parse_for_xml()?)) - } else if self.parse_keyword(Keyword::JSON) { - Ok(Some(self.parse_for_json()?)) - } else if self.parse_keyword(Keyword::BROWSE) { - Ok(Some(ForClause::Browse)) - } else { - Ok(None) - } - } - /// Parse a mssql `FOR XML` clause - pub fn parse_for_xml(&mut self) -> Result { - let for_xml = if self.parse_keyword(Keyword::RAW) { - let mut element_name = None; - if self.peek_token().token == Token::LParen { - self.expect_token(&Token::LParen)?; - element_name = Some(self.parse_literal_string()?); - self.expect_token(&Token::RParen)?; - } - ForXml::Raw(element_name) - } else if self.parse_keyword(Keyword::AUTO) { - ForXml::Auto - } else if self.parse_keyword(Keyword::EXPLICIT) { - ForXml::Explicit - } else if self.parse_keyword(Keyword::PATH) { - let mut element_name = None; - if self.peek_token().token == Token::LParen { - self.expect_token(&Token::LParen)?; - element_name = Some(self.parse_literal_string()?); - self.expect_token(&Token::RParen)?; - } - ForXml::Path(element_name) - } else { - return Err( - ParserError::ParserError( - "Expected FOR XML [RAW | AUTO | EXPLICIT | PATH ]".to_string(), - ), - ); - }; - let mut elements = false; - let mut binary_base64 = false; - let mut root = None; - let mut r#type = false; - while self.peek_token().token == Token::Comma { - self.next_token(); - if self.parse_keyword(Keyword::ELEMENTS) { - elements = true; - } else if self.parse_keyword(Keyword::BINARY) { - self.expect_keyword_is(Keyword::BASE64)?; - binary_base64 = true; - } else if self.parse_keyword(Keyword::ROOT) { - self.expect_token(&Token::LParen)?; - root = Some(self.parse_literal_string()?); - self.expect_token(&Token::RParen)?; - } else if self.parse_keyword(Keyword::TYPE) { - r#type = true; - } - } - Ok(ForClause::Xml { - for_xml, - elements, - binary_base64, - root, - r#type, - }) - } - /// Parse a mssql `FOR JSON` clause - pub fn parse_for_json(&mut self) -> Result { - let for_json = if self.parse_keyword(Keyword::AUTO) { - ForJson::Auto - } else if self.parse_keyword(Keyword::PATH) { - ForJson::Path - } else { - return Err( - ParserError::ParserError( - "Expected FOR JSON [AUTO | PATH ]".to_string(), - ), - ); - }; - let mut root = None; - let mut include_null_values = false; - let mut without_array_wrapper = false; - while self.peek_token().token == Token::Comma { - self.next_token(); - if self.parse_keyword(Keyword::ROOT) { - self.expect_token(&Token::LParen)?; - root = Some(self.parse_literal_string()?); - self.expect_token(&Token::RParen)?; - } else if self.parse_keyword(Keyword::INCLUDE_NULL_VALUES) { - include_null_values = true; - } else if self.parse_keyword(Keyword::WITHOUT_ARRAY_WRAPPER) { - without_array_wrapper = true; - } - } - Ok(ForClause::Json { - for_json, - root, - include_null_values, - without_array_wrapper, - }) - } - /// Parse a CTE (`alias [( col1, col2, ... )] AS (subquery)`) - pub fn parse_cte(&mut self) -> Result { - let name = self.parse_identifier()?; - let mut cte = if self.parse_keyword(Keyword::AS) { - let mut is_materialized = None; - if (self.dialect.is::()) { - if self.parse_keyword(Keyword::MATERIALIZED) { - is_materialized = Some(CteAsMaterialized::Materialized); - } else if self.parse_keywords(&[Keyword::NOT, Keyword::MATERIALIZED]) - { - is_materialized = Some(CteAsMaterialized::NotMaterialized); - } - } - self.expect_token(&Token::LParen)?; - let query = self.parse_query()?; - let closing_paren_token = self.expect_token(&Token::RParen)?; - let alias = TableAlias { - name, - columns: ::alloc::vec::Vec::new(), - }; - Cte { - alias, - query, - from: None, - materialized: is_materialized, - closing_paren_token: closing_paren_token.into(), - } - } else { - let columns = self.parse_table_alias_column_defs()?; - self.expect_keyword_is(Keyword::AS)?; - let mut is_materialized = None; - if (self.dialect.is::()) { - if self.parse_keyword(Keyword::MATERIALIZED) { - is_materialized = Some(CteAsMaterialized::Materialized); - } else if self.parse_keywords(&[Keyword::NOT, Keyword::MATERIALIZED]) - { - is_materialized = Some(CteAsMaterialized::NotMaterialized); - } - } - self.expect_token(&Token::LParen)?; - let query = self.parse_query()?; - let closing_paren_token = self.expect_token(&Token::RParen)?; - let alias = TableAlias { name, columns }; - Cte { - alias, - query, - from: None, - materialized: is_materialized, - closing_paren_token: closing_paren_token.into(), - } - }; - if self.parse_keyword(Keyword::FROM) { - cte.from = Some(self.parse_identifier()?); - } - Ok(cte) - } - /// Parse a "query body", which is an expression with roughly the - /// following grammar: - /// ```sql - /// 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_body - /// ``` - pub fn parse_query_body( - &mut self, - precedence: u8, - ) -> Result, ParserError> { - let expr = if self.peek_keyword(Keyword::SELECT) { - SetExpr::Select(self.parse_select().map(Box::new)?) - } else if self.consume_token(&Token::LParen) { - let subquery = self.parse_query()?; - self.expect_token(&Token::RParen)?; - SetExpr::Query(subquery) - } else if self.parse_keyword(Keyword::VALUES) { - let is_mysql = (self.dialect.is::()); - SetExpr::Values(self.parse_values(is_mysql)?) - } else if self.parse_keyword(Keyword::TABLE) { - SetExpr::Table(Box::new(self.parse_as_table()?)) - } else { - return self - .expected( - "SELECT, VALUES, or a subquery in the query body", - self.peek_token(), - ); - }; - self.parse_remaining_set_exprs(expr, precedence) - } - /// Parse any extra set expressions that may be present in a query body - /// - /// (this is its own function to reduce required stack size in debug builds) - fn parse_remaining_set_exprs( - &mut self, - mut expr: SetExpr, - precedence: u8, - ) -> Result, ParserError> { - loop { - let op = self.parse_set_operator(&self.peek_token().token); - let next_precedence = match op { - Some(SetOperator::Union) - | Some(SetOperator::Except) - | Some(SetOperator::Minus) => 10, - Some(SetOperator::Intersect) => 20, - None => break, - }; - if precedence >= next_precedence { - break; - } - self.next_token(); - let set_quantifier = self.parse_set_quantifier(&op); - expr = SetExpr::SetOperation { - left: Box::new(expr), - op: op.unwrap(), - set_quantifier, - right: self.parse_query_body(next_precedence)?, - }; - } - Ok(expr.into()) - } - pub fn parse_set_operator(&mut self, token: &Token) -> Option { - match token { - Token::Word(w) if w.keyword == Keyword::UNION => Some(SetOperator::Union), - Token::Word(w) if w.keyword == Keyword::EXCEPT => { - Some(SetOperator::Except) - } - Token::Word(w) if w.keyword == Keyword::INTERSECT => { - Some(SetOperator::Intersect) - } - Token::Word(w) if w.keyword == Keyword::MINUS => Some(SetOperator::Minus), - _ => None, - } - } - pub fn parse_set_quantifier( - &mut self, - op: &Option, - ) -> SetQuantifier { - match op { - Some( - SetOperator::Except - | SetOperator::Intersect - | SetOperator::Union - | SetOperator::Minus, - ) => { - if self - .parse_keywords(&[Keyword::DISTINCT, Keyword::BY, Keyword::NAME]) - { - SetQuantifier::DistinctByName - } else if self.parse_keywords(&[Keyword::BY, Keyword::NAME]) { - SetQuantifier::ByName - } else if self.parse_keyword(Keyword::ALL) { - if self.parse_keywords(&[Keyword::BY, Keyword::NAME]) { - SetQuantifier::AllByName - } else { - SetQuantifier::All - } - } else if self.parse_keyword(Keyword::DISTINCT) { - SetQuantifier::Distinct - } else { - SetQuantifier::None - } - } - _ => SetQuantifier::None, - } - } - /// Parse a restricted `SELECT` statement (no CTEs / `UNION` / `ORDER BY`) - pub fn parse_select(&mut self) -> Result { - let select_token = self.expect_keyword(Keyword::SELECT)?; - let value_table_mode = if (self.dialect.is::()) - && self.parse_keyword(Keyword::AS) - { - if self.parse_keyword(Keyword::VALUE) { - Some(ValueTableMode::AsValue) - } else if self.parse_keyword(Keyword::STRUCT) { - Some(ValueTableMode::AsStruct) - } else { - self.expected("VALUE or STRUCT", self.peek_token())? - } - } else { - None - }; - let mut top_before_distinct = false; - let mut top = None; - if self.dialect.supports_top_before_distinct() - && self.parse_keyword(Keyword::TOP) - { - top = Some(self.parse_top()?); - top_before_distinct = true; - } - let distinct = self.parse_all_or_distinct()?; - if !self.dialect.supports_top_before_distinct() - && self.parse_keyword(Keyword::TOP) - { - top = Some(self.parse_top()?); - } - let projection = if self.dialect.supports_empty_projections() - && self.peek_keyword(Keyword::FROM) - { - ::alloc::vec::Vec::new() - } else { - self.parse_projection()? - }; - let into = if self.parse_keyword(Keyword::INTO) { - let temporary = self - .parse_one_of_keywords(&[Keyword::TEMP, Keyword::TEMPORARY]) - .is_some(); - let unlogged = self.parse_keyword(Keyword::UNLOGGED); - let table = self.parse_keyword(Keyword::TABLE); - let name = self.parse_object_name(false)?; - Some(SelectInto { - temporary, - unlogged, - table, - name, - }) - } else { - None - }; - let from = if self.parse_keyword(Keyword::FROM) { - self.parse_table_with_joins()? - } else { - ::alloc::vec::Vec::new() - }; - let mut lateral_views = ::alloc::vec::Vec::new(); - loop { - if self.parse_keywords(&[Keyword::LATERAL, Keyword::VIEW]) { - let outer = self.parse_keyword(Keyword::OUTER); - let lateral_view = self.parse_expr()?; - let lateral_view_name = self.parse_object_name(false)?; - let lateral_col_alias = self - .parse_comma_separated(|parser| { - parser - .parse_optional_alias( - &[ - Keyword::WHERE, - Keyword::GROUP, - Keyword::CLUSTER, - Keyword::HAVING, - Keyword::LATERAL, - ], - ) - })? - .into_iter() - .flatten() - .collect(); - lateral_views - .push(LateralView { - lateral_view, - lateral_view_name, - lateral_col_alias, - outer, - }); - } else { - break; - } - } - let prewhere = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::PREWHERE) - { - Some(self.parse_expr()?) - } else { - None - }; - let selection = if self.parse_keyword(Keyword::WHERE) { - Some(self.parse_expr()?) - } else { - None - }; - let group_by = self - .parse_optional_group_by()? - .unwrap_or_else(|| GroupByExpr::Expressions( - ::alloc::vec::Vec::new(), - ::alloc::vec::Vec::new(), - )); - let cluster_by = if self.parse_keywords(&[Keyword::CLUSTER, Keyword::BY]) { - self.parse_comma_separated(Parser::parse_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let distribute_by = if self - .parse_keywords(&[Keyword::DISTRIBUTE, Keyword::BY]) - { - self.parse_comma_separated(Parser::parse_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let sort_by = if self.parse_keywords(&[Keyword::SORT, Keyword::BY]) { - self.parse_comma_separated(Parser::parse_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let having = if self.parse_keyword(Keyword::HAVING) { - Some(self.parse_expr()?) - } else { - None - }; - let (named_windows, qualify, window_before_qualify) = if self - .parse_keyword(Keyword::WINDOW) - { - let named_windows = self - .parse_comma_separated(Parser::parse_named_window)?; - if self.parse_keyword(Keyword::QUALIFY) { - (named_windows, Some(self.parse_expr()?), true) - } else { - (named_windows, None, true) - } - } else if self.parse_keyword(Keyword::QUALIFY) { - let qualify = Some(self.parse_expr()?); - if self.parse_keyword(Keyword::WINDOW) { - ( - self.parse_comma_separated(Parser::parse_named_window)?, - qualify, - false, - ) - } else { - (Default::default(), qualify, false) - } - } else { - Default::default() - }; - let connect_by = if self.dialect.supports_connect_by() - && self - .parse_one_of_keywords(&[Keyword::START, Keyword::CONNECT]) - .is_some() - { - self.prev_token(); - Some(self.parse_connect_by()?) - } else { - None - }; - Ok(Select { - select_token: AttachedToken(select_token), - distinct, - top, - top_before_distinct, - projection, - into, - from, - lateral_views, - prewhere, - selection, - group_by, - cluster_by, - distribute_by, - sort_by, - having, - named_window: named_windows, - window_before_qualify, - qualify, - value_table_mode, - connect_by, - }) - } - /// Invoke `f` after first setting the parser's `ParserState` to `state`. - /// - /// Upon return, restores the parser's state to what it started at. - fn with_state( - &mut self, - state: ParserState, - mut f: F, - ) -> Result - where - F: FnMut(&mut Parser) -> Result, - { - let current_state = self.state; - self.state = state; - let res = f(self); - self.state = current_state; - res - } - pub fn parse_connect_by(&mut self) -> Result { - let (condition, relationships) = if self - .parse_keywords(&[Keyword::CONNECT, Keyword::BY]) - { - let relationships = self - .with_state( - ParserState::ConnectBy, - |parser| { parser.parse_comma_separated(Parser::parse_expr) }, - )?; - self.expect_keywords(&[Keyword::START, Keyword::WITH])?; - let condition = self.parse_expr()?; - (condition, relationships) - } else { - self.expect_keywords(&[Keyword::START, Keyword::WITH])?; - let condition = self.parse_expr()?; - self.expect_keywords(&[Keyword::CONNECT, Keyword::BY])?; - let relationships = self - .with_state( - ParserState::ConnectBy, - |parser| { parser.parse_comma_separated(Parser::parse_expr) }, - )?; - (condition, relationships) - }; - Ok(ConnectBy { - condition, - relationships, - }) - } - /// Parse `CREATE TABLE x AS TABLE y` - pub fn parse_as_table(&mut self) -> Result { - let token1 = self.next_token(); - let token2 = self.next_token(); - let token3 = self.next_token(); - let table_name; - let schema_name; - if token2 == Token::Period { - match token1.token { - Token::Word(w) => { - schema_name = w.value; - } - _ => { - return self.expected("Schema name", token1); - } - } - match token3.token { - Token::Word(w) => { - table_name = w.value; - } - _ => { - return self.expected("Table name", token3); - } - } - Ok(Table { - table_name: Some(table_name), - schema_name: Some(schema_name), - }) - } else { - match token1.token { - Token::Word(w) => { - table_name = w.value; - } - _ => { - return self.expected("Table name", token1); - } - } - Ok(Table { - table_name: Some(table_name), - schema_name: None, - }) - } - } - /// Parse a `SET ROLE` statement. Expects SET to be consumed already. - fn parse_set_role( - &mut self, - modifier: Option, - ) -> Result { - self.expect_keyword_is(Keyword::ROLE)?; - let context_modifier = match modifier { - Some(Keyword::LOCAL) => ContextModifier::Local, - Some(Keyword::SESSION) => ContextModifier::Session, - _ => ContextModifier::None, - }; - let role_name = if self.parse_keyword(Keyword::NONE) { - None - } else { - Some(self.parse_identifier()?) - }; - Ok(Statement::SetRole { - context_modifier, - role_name, - }) - } - pub fn parse_set(&mut self) -> Result { - let modifier = self - .parse_one_of_keywords( - &[Keyword::SESSION, Keyword::LOCAL, Keyword::HIVEVAR], - ); - if let Some(Keyword::HIVEVAR) = modifier { - self.expect_token(&Token::Colon)?; - } else if let Some(set_role_stmt) = self - .maybe_parse(|parser| parser.parse_set_role(modifier))? - { - return Ok(set_role_stmt); - } - let variables = if self.parse_keywords(&[Keyword::TIME, Keyword::ZONE]) { - OneOrManyWithParens::One( - ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new(["TIMEZONE".into()]), - ), - ), - ) - } else if self.dialect.supports_parenthesized_set_variables() - && self.consume_token(&Token::LParen) - { - let variables = OneOrManyWithParens::Many( - self - .parse_comma_separated(|parser: &mut Parser<'a>| { - parser.parse_identifier() - })? - .into_iter() - .map(|ident| ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ident]), - ), - )) - .collect(), - ); - self.expect_token(&Token::RParen)?; - variables - } else { - OneOrManyWithParens::One(self.parse_object_name(false)?) - }; - if match &variables { - OneOrManyWithParens::One( - variable, - ) if variable.to_string().eq_ignore_ascii_case("NAMES") - && (self.dialect.is::() - || self.dialect.is::()) => true, - _ => false, - } { - if self.parse_keyword(Keyword::DEFAULT) { - return Ok(Statement::SetNamesDefault {}); - } - let charset_name = self.parse_literal_string()?; - let collation_name = if self - .parse_one_of_keywords(&[Keyword::COLLATE]) - .is_some() - { - Some(self.parse_literal_string()?) - } else { - None - }; - return Ok(Statement::SetNames { - charset_name, - collation_name, - }); - } - let parenthesized_assignment = match &variables { - OneOrManyWithParens::Many(_) => true, - _ => false, - }; - if self.consume_token(&Token::Eq) || self.parse_keyword(Keyword::TO) { - if parenthesized_assignment { - self.expect_token(&Token::LParen)?; - } - let mut values = ::alloc::vec::Vec::new(); - loop { - let value = if let Some(expr) = self.try_parse_expr_sub_query()? { - expr - } else if let Ok(expr) = self.parse_expr() { - expr - } else { - self.expected("variable value", self.peek_token())? - }; - values.push(value); - if self.consume_token(&Token::Comma) { - continue; - } - if parenthesized_assignment { - self.expect_token(&Token::RParen)?; - } - return Ok(Statement::SetVariable { - local: modifier == Some(Keyword::LOCAL), - hivevar: Some(Keyword::HIVEVAR) == modifier, - variables, - value: values, - }); - } - } - let OneOrManyWithParens::One(variable) = variables else { - return self.expected("set variable", self.peek_token()); - }; - if variable.to_string().eq_ignore_ascii_case("TIMEZONE") { - match self.parse_expr() { - Ok(expr) => { - Ok(Statement::SetTimeZone { - local: modifier == Some(Keyword::LOCAL), - value: expr, - }) - } - _ => self.expected("timezone value", self.peek_token())?, - } - } else if variable.to_string() == "CHARACTERISTICS" { - self.expect_keywords(&[Keyword::AS, Keyword::TRANSACTION])?; - Ok(Statement::SetTransaction { - modes: self.parse_transaction_modes()?, - snapshot: None, - session: true, - }) - } else if variable.to_string() == "TRANSACTION" && modifier.is_none() { - if self.parse_keyword(Keyword::SNAPSHOT) { - let snapshot_id = self.parse_value()?; - return Ok(Statement::SetTransaction { - modes: ::alloc::vec::Vec::new(), - snapshot: Some(snapshot_id), - session: false, - }); - } - Ok(Statement::SetTransaction { - modes: self.parse_transaction_modes()?, - snapshot: None, - session: false, - }) - } else if self.dialect.supports_set_stmt_without_operator() { - self.prev_token(); - self.parse_set_session_params() - } else { - self.expected("equals sign or TO", self.peek_token()) - } - } - pub fn parse_set_session_params(&mut self) -> Result { - if self.parse_keyword(Keyword::STATISTICS) { - let topic = match self - .parse_one_of_keywords( - &[Keyword::IO, Keyword::PROFILE, Keyword::TIME, Keyword::XML], - ) - { - Some(Keyword::IO) => SessionParamStatsTopic::IO, - Some(Keyword::PROFILE) => SessionParamStatsTopic::Profile, - Some(Keyword::TIME) => SessionParamStatsTopic::Time, - Some(Keyword::XML) => SessionParamStatsTopic::Xml, - _ => { - return self - .expected("IO, PROFILE, TIME or XML", self.peek_token()); - } - }; - let value = self.parse_session_param_value()?; - Ok( - Statement::SetSessionParam( - SetSessionParamKind::Statistics(SetSessionParamStatistics { - topic, - value, - }), - ), - ) - } else if self.parse_keyword(Keyword::IDENTITY_INSERT) { - let obj = self.parse_object_name(false)?; - let value = self.parse_session_param_value()?; - Ok( - Statement::SetSessionParam( - SetSessionParamKind::IdentityInsert(SetSessionParamIdentityInsert { - obj, - value, - }), - ), - ) - } else if self.parse_keyword(Keyword::OFFSETS) { - let keywords = self - .parse_comma_separated(|parser| { - let next_token = parser.next_token(); - match &next_token.token { - Token::Word(w) => Ok(w.to_string()), - _ => parser.expected("SQL keyword", next_token), - } - })?; - let value = self.parse_session_param_value()?; - Ok( - Statement::SetSessionParam( - SetSessionParamKind::Offsets(SetSessionParamOffsets { - keywords, - value, - }), - ), - ) - } else { - let names = self - .parse_comma_separated(|parser| { - let next_token = parser.next_token(); - match next_token.token { - Token::Word(w) => Ok(w.to_string()), - _ => parser.expected("Session param name", next_token), - } - })?; - let value = self.parse_expr()?.to_string(); - Ok( - Statement::SetSessionParam( - SetSessionParamKind::Generic(SetSessionParamGeneric { - names, - value, - }), - ), - ) - } - } - fn parse_session_param_value( - &mut self, - ) -> Result { - if self.parse_keyword(Keyword::ON) { - Ok(SessionParamValue::On) - } else if self.parse_keyword(Keyword::OFF) { - Ok(SessionParamValue::Off) - } else { - self.expected("ON or OFF", self.peek_token()) - } - } - pub fn parse_show(&mut self) -> Result { - let terse = self.parse_keyword(Keyword::TERSE); - let extended = self.parse_keyword(Keyword::EXTENDED); - let full = self.parse_keyword(Keyword::FULL); - let session = self.parse_keyword(Keyword::SESSION); - let global = self.parse_keyword(Keyword::GLOBAL); - let external = self.parse_keyword(Keyword::EXTERNAL); - if self.parse_one_of_keywords(&[Keyword::COLUMNS, Keyword::FIELDS]).is_some() - { - Ok(self.parse_show_columns(extended, full)?) - } else if self.parse_keyword(Keyword::TABLES) { - Ok(self.parse_show_tables(terse, extended, full, external)?) - } else if self.parse_keywords(&[Keyword::MATERIALIZED, Keyword::VIEWS]) { - Ok(self.parse_show_views(terse, true)?) - } else if self.parse_keyword(Keyword::VIEWS) { - Ok(self.parse_show_views(terse, false)?) - } else if self.parse_keyword(Keyword::FUNCTIONS) { - Ok(self.parse_show_functions()?) - } else if extended || full { - Err( - ParserError::ParserError( - "EXTENDED/FULL are not supported with this type of SHOW query" - .to_string(), - ), - ) - } else if self.parse_one_of_keywords(&[Keyword::CREATE]).is_some() { - Ok(self.parse_show_create()?) - } else if self.parse_keyword(Keyword::COLLATION) { - Ok(self.parse_show_collation()?) - } else if self.parse_keyword(Keyword::VARIABLES) - && (self.dialect.is::() - || self.dialect.is::()) - { - Ok(Statement::ShowVariables { - filter: self.parse_show_statement_filter()?, - session, - global, - }) - } else if self.parse_keyword(Keyword::STATUS) - && (self.dialect.is::() - || self.dialect.is::()) - { - Ok(Statement::ShowStatus { - filter: self.parse_show_statement_filter()?, - session, - global, - }) - } else if self.parse_keyword(Keyword::DATABASES) { - self.parse_show_databases(terse) - } else if self.parse_keyword(Keyword::SCHEMAS) { - self.parse_show_schemas(terse) - } else { - Ok(Statement::ShowVariable { - variable: self.parse_identifiers()?, - }) - } - } - fn parse_show_databases( - &mut self, - terse: bool, - ) -> Result { - let history = self.parse_keyword(Keyword::HISTORY); - let show_options = self.parse_show_stmt_options()?; - Ok(Statement::ShowDatabases { - terse, - history, - show_options, - }) - } - fn parse_show_schemas(&mut self, terse: bool) -> Result { - let history = self.parse_keyword(Keyword::HISTORY); - let show_options = self.parse_show_stmt_options()?; - Ok(Statement::ShowSchemas { - terse, - history, - show_options, - }) - } - pub fn parse_show_create(&mut self) -> Result { - let obj_type = match self - .expect_one_of_keywords( - &[ - Keyword::TABLE, - Keyword::TRIGGER, - Keyword::FUNCTION, - Keyword::PROCEDURE, - Keyword::EVENT, - Keyword::VIEW, - ], - )? - { - Keyword::TABLE => Ok(ShowCreateObject::Table), - Keyword::TRIGGER => Ok(ShowCreateObject::Trigger), - Keyword::FUNCTION => Ok(ShowCreateObject::Function), - Keyword::PROCEDURE => Ok(ShowCreateObject::Procedure), - Keyword::EVENT => Ok(ShowCreateObject::Event), - Keyword::VIEW => Ok(ShowCreateObject::View), - keyword => { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Unable to map keyword to ShowCreateObject: {0:?}", - keyword, - ), - ); - res - }), - ), - ) - } - }?; - let obj_name = self.parse_object_name(false)?; - Ok(Statement::ShowCreate { - obj_type, - obj_name, - }) - } - pub fn parse_show_columns( - &mut self, - extended: bool, - full: bool, - ) -> Result { - let show_options = self.parse_show_stmt_options()?; - Ok(Statement::ShowColumns { - extended, - full, - show_options, - }) - } - fn parse_show_tables( - &mut self, - terse: bool, - extended: bool, - full: bool, - external: bool, - ) -> Result { - let history = !external && self.parse_keyword(Keyword::HISTORY); - let show_options = self.parse_show_stmt_options()?; - Ok(Statement::ShowTables { - terse, - history, - extended, - full, - external, - show_options, - }) - } - fn parse_show_views( - &mut self, - terse: bool, - materialized: bool, - ) -> Result { - let show_options = self.parse_show_stmt_options()?; - Ok(Statement::ShowViews { - materialized, - terse, - show_options, - }) - } - pub fn parse_show_functions(&mut self) -> Result { - let filter = self.parse_show_statement_filter()?; - Ok(Statement::ShowFunctions { filter }) - } - pub fn parse_show_collation(&mut self) -> Result { - let filter = self.parse_show_statement_filter()?; - Ok(Statement::ShowCollation { filter }) - } - pub fn parse_show_statement_filter( - &mut self, - ) -> Result, ParserError> { - if self.parse_keyword(Keyword::LIKE) { - Ok(Some(ShowStatementFilter::Like(self.parse_literal_string()?))) - } else if self.parse_keyword(Keyword::ILIKE) { - Ok(Some(ShowStatementFilter::ILike(self.parse_literal_string()?))) - } else if self.parse_keyword(Keyword::WHERE) { - Ok(Some(ShowStatementFilter::Where(self.parse_expr()?))) - } else { - self.maybe_parse(|parser| -> Result { - parser.parse_literal_string() - })? - .map_or( - Ok(None), - |filter| { Ok(Some(ShowStatementFilter::NoKeyword(filter))) }, - ) - } - } - pub fn parse_use(&mut self) -> Result { - let parsed_keyword = if (self.dialect.is::()) { - if self.parse_keyword(Keyword::DEFAULT) { - return Ok(Statement::Use(Use::Default)); - } - None - } else if (self.dialect.is::()) { - self.parse_one_of_keywords( - &[Keyword::CATALOG, Keyword::DATABASE, Keyword::SCHEMA], - ) - } else if (self.dialect.is::()) { - self.parse_one_of_keywords( - &[ - Keyword::DATABASE, - Keyword::SCHEMA, - Keyword::WAREHOUSE, - Keyword::ROLE, - Keyword::SECONDARY, - ], - ) - } else { - None - }; - let result = if match parsed_keyword { - Some(Keyword::SECONDARY) => true, - _ => false, - } { - self.parse_secondary_roles()? - } else { - let obj_name = self.parse_object_name(false)?; - match parsed_keyword { - Some(Keyword::CATALOG) => Use::Catalog(obj_name), - Some(Keyword::DATABASE) => Use::Database(obj_name), - Some(Keyword::SCHEMA) => Use::Schema(obj_name), - Some(Keyword::WAREHOUSE) => Use::Warehouse(obj_name), - Some(Keyword::ROLE) => Use::Role(obj_name), - _ => Use::Object(obj_name), - } - }; - Ok(Statement::Use(result)) - } - fn parse_secondary_roles(&mut self) -> Result { - self.expect_one_of_keywords(&[Keyword::ROLES, Keyword::ROLE])?; - if self.parse_keyword(Keyword::NONE) { - Ok(Use::SecondaryRoles(SecondaryRoles::None)) - } else if self.parse_keyword(Keyword::ALL) { - Ok(Use::SecondaryRoles(SecondaryRoles::All)) - } else { - let roles = self - .parse_comma_separated(|parser| parser.parse_identifier())?; - Ok(Use::SecondaryRoles(SecondaryRoles::List(roles))) - } - } - pub fn parse_table_and_joins(&mut self) -> Result { - let relation = self.parse_table_factor()?; - let mut joins = ::alloc::vec::Vec::new(); - loop { - let global = self.parse_keyword(Keyword::GLOBAL); - let join = if self.parse_keyword(Keyword::CROSS) { - let join_operator = if self.parse_keyword(Keyword::JOIN) { - JoinOperator::CrossJoin - } else if self.parse_keyword(Keyword::APPLY) { - JoinOperator::CrossApply - } else { - return self - .expected("JOIN or APPLY after CROSS", self.peek_token()); - }; - Join { - relation: self.parse_table_factor()?, - global, - join_operator, - } - } else if self.parse_keyword(Keyword::OUTER) { - self.expect_keyword_is(Keyword::APPLY)?; - Join { - relation: self.parse_table_factor()?, - global, - join_operator: JoinOperator::OuterApply, - } - } else if self.parse_keyword(Keyword::ASOF) { - self.expect_keyword_is(Keyword::JOIN)?; - let relation = self.parse_table_factor()?; - self.expect_keyword_is(Keyword::MATCH_CONDITION)?; - let match_condition = self.parse_parenthesized(Self::parse_expr)?; - Join { - relation, - global, - join_operator: JoinOperator::AsOf { - match_condition, - constraint: self.parse_join_constraint(false)?, - }, - } - } else { - let natural = self.parse_keyword(Keyword::NATURAL); - let peek_keyword = if let Token::Word(w) = self.peek_token().token { - w.keyword - } else { - Keyword::NoKeyword - }; - let join_operator_type = match peek_keyword { - Keyword::INNER | Keyword::JOIN => { - let inner = self.parse_keyword(Keyword::INNER); - self.expect_keyword_is(Keyword::JOIN)?; - if inner { JoinOperator::Inner } else { JoinOperator::Join } - } - kw @ Keyword::LEFT | kw @ Keyword::RIGHT => { - let _ = self.next_token(); - let is_left = kw == Keyword::LEFT; - let join_type = self - .parse_one_of_keywords( - &[ - Keyword::OUTER, - Keyword::SEMI, - Keyword::ANTI, - Keyword::JOIN, - ], - ); - match join_type { - Some(Keyword::OUTER) => { - self.expect_keyword_is(Keyword::JOIN)?; - if is_left { - JoinOperator::LeftOuter - } else { - JoinOperator::RightOuter - } - } - Some(Keyword::SEMI) => { - self.expect_keyword_is(Keyword::JOIN)?; - if is_left { - JoinOperator::LeftSemi - } else { - JoinOperator::RightSemi - } - } - Some(Keyword::ANTI) => { - self.expect_keyword_is(Keyword::JOIN)?; - if is_left { - JoinOperator::LeftAnti - } else { - JoinOperator::RightAnti - } - } - Some(Keyword::JOIN) => { - if is_left { - JoinOperator::LeftOuter - } else { - JoinOperator::RightOuter - } - } - _ => { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "expected OUTER, SEMI, ANTI or JOIN after {0:?}", - kw, - ), - ); - res - }), - ), - ); - } - } - } - Keyword::ANTI => { - let _ = self.next_token(); - self.expect_keyword_is(Keyword::JOIN)?; - JoinOperator::Anti - } - Keyword::SEMI => { - let _ = self.next_token(); - self.expect_keyword_is(Keyword::JOIN)?; - JoinOperator::Semi - } - Keyword::FULL => { - let _ = self.next_token(); - let _ = self.parse_keyword(Keyword::OUTER); - self.expect_keyword_is(Keyword::JOIN)?; - JoinOperator::FullOuter - } - Keyword::OUTER => { - return self - .expected("LEFT, RIGHT, or FULL", self.peek_token()); - } - _ if natural => { - return self - .expected("a join type after NATURAL", self.peek_token()); - } - _ => break, - }; - let relation = self.parse_table_factor()?; - let join_constraint = self.parse_join_constraint(natural)?; - Join { - relation, - global, - join_operator: join_operator_type(join_constraint), - } - }; - joins.push(join); - } - Ok(TableWithJoins { relation, joins }) - } - /// A table name or a parenthesized subquery, followed by optional `[AS] alias` - pub fn parse_table_factor(&mut self) -> Result { - if self.parse_keyword(Keyword::LATERAL) { - if self.consume_token(&Token::LParen) { - self.parse_derived_table_factor(Lateral) - } else { - let name = self.parse_object_name(false)?; - self.expect_token(&Token::LParen)?; - let args = self.parse_optional_args()?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::Function { - lateral: true, - name, - args, - alias, - }) - } - } else if self.parse_keyword(Keyword::TABLE) { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::TableFunction { - expr, - alias, - }) - } else if self.consume_token(&Token::LParen) { - if let Some(mut table) = self - .maybe_parse(|parser| parser.parse_derived_table_factor(NotLateral))? - { - while let Some(kw) = self - .parse_one_of_keywords(&[Keyword::PIVOT, Keyword::UNPIVOT]) - { - table = match kw { - Keyword::PIVOT => self.parse_pivot_table_factor(table)?, - Keyword::UNPIVOT => self.parse_unpivot_table_factor(table)?, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }; - } - return Ok(table); - } - let mut table_and_joins = self.parse_table_and_joins()?; - #[allow(clippy::if_same_then_else)] - if !table_and_joins.joins.is_empty() { - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::NestedJoin { - table_with_joins: Box::new(table_and_joins), - alias, - }) - } else if let TableFactor::NestedJoin { - table_with_joins: _, - alias: _, - } = &table_and_joins.relation - { - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::NestedJoin { - table_with_joins: Box::new(table_and_joins), - alias, - }) - } else if (self.dialect.is::() - || self.dialect.is::()) - { - self.expect_token(&Token::RParen)?; - if let Some(outer_alias) = self.maybe_parse_table_alias()? { - match &mut table_and_joins.relation { - TableFactor::Derived { alias, .. } - | TableFactor::Table { alias, .. } - | TableFactor::Function { alias, .. } - | TableFactor::UNNEST { alias, .. } - | TableFactor::JsonTable { alias, .. } - | TableFactor::OpenJsonTable { alias, .. } - | TableFactor::TableFunction { alias, .. } - | TableFactor::Pivot { alias, .. } - | TableFactor::Unpivot { alias, .. } - | TableFactor::MatchRecognize { alias, .. } - | TableFactor::NestedJoin { alias, .. } => { - if let Some(inner_alias) = alias { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("duplicate alias {0}", inner_alias), - ); - res - }), - ), - ); - } - alias.replace(outer_alias); - } - }; - } - Ok(table_and_joins.relation) - } else { - self.expected("joined table", self.peek_token()) - } - } else if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - && match self.peek_tokens() { - [Token::Word(Word { keyword: Keyword::VALUES, .. }), Token::LParen, - ] => true, - _ => false, - } - { - self.expect_keyword_is(Keyword::VALUES)?; - let values = SetExpr::Values(self.parse_values(false)?); - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::Derived { - lateral: false, - subquery: Box::new(Query { - with: None, - body: Box::new(values), - order_by: None, - limit: None, - limit_by: ::alloc::vec::Vec::new(), - offset: None, - fetch: None, - locks: ::alloc::vec::Vec::new(), - for_clause: None, - settings: None, - format_clause: None, - }), - alias, - }) - } else if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::UNNEST) - { - self.expect_token(&Token::LParen)?; - let array_exprs = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - let with_ordinality = self - .parse_keywords(&[Keyword::WITH, Keyword::ORDINALITY]); - let alias = match self.maybe_parse_table_alias() { - Ok(Some(alias)) => Some(alias), - Ok(None) => None, - Err(e) => return Err(e), - }; - let with_offset = match self - .expect_keywords(&[Keyword::WITH, Keyword::OFFSET]) - { - Ok(()) => true, - Err(_) => false, - }; - let with_offset_alias = if with_offset { - match self.parse_optional_alias(keywords::RESERVED_FOR_COLUMN_ALIAS) - { - Ok(Some(alias)) => Some(alias), - Ok(None) => None, - Err(e) => return Err(e), - } - } else { - None - }; - Ok(TableFactor::UNNEST { - alias, - array_exprs, - with_offset, - with_offset_alias, - with_ordinality, - }) - } else if self - .parse_keyword_with_tokens(Keyword::JSON_TABLE, &[Token::LParen]) - { - let json_expr = self.parse_expr()?; - self.expect_token(&Token::Comma)?; - let json_path = self.parse_value()?; - self.expect_keyword_is(Keyword::COLUMNS)?; - self.expect_token(&Token::LParen)?; - let columns = self - .parse_comma_separated(Parser::parse_json_table_column_def)?; - self.expect_token(&Token::RParen)?; - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::JsonTable { - json_expr, - json_path, - columns, - alias, - }) - } else if self.parse_keyword_with_tokens(Keyword::OPENJSON, &[Token::LParen]) - { - self.prev_token(); - self.parse_open_json_table_factor() - } else { - let name = self.parse_object_name(true)?; - let json_path = match self.peek_token().token { - Token::LBracket if self.dialect.supports_partiql() => { - Some(self.parse_json_path()?) - } - _ => None, - }; - let partitions: Vec = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::PARTITION) - { - self.parse_parenthesized_identifiers()? - } else { - ::alloc::vec::Vec::new() - }; - let version = self.maybe_parse_table_version()?; - let args = if self.consume_token(&Token::LParen) { - Some(self.parse_table_function_args()?) - } else { - None - }; - let with_ordinality = self - .parse_keywords(&[Keyword::WITH, Keyword::ORDINALITY]); - let mut sample = None; - if self.dialect.supports_table_sample_before_alias() { - if let Some(parsed_sample) = self.maybe_parse_table_sample()? { - sample = Some(TableSampleKind::BeforeTableAlias(parsed_sample)); - } - } - let alias = self.maybe_parse_table_alias()?; - let index_hints = if self.dialect.supports_table_hints() { - self.maybe_parse(|p| p.parse_table_index_hints())? - .unwrap_or(::alloc::vec::Vec::new()) - } else { - ::alloc::vec::Vec::new() - }; - let mut with_hints = ::alloc::vec::Vec::new(); - if self.parse_keyword(Keyword::WITH) { - if self.consume_token(&Token::LParen) { - with_hints = self.parse_comma_separated(Parser::parse_expr)?; - self.expect_token(&Token::RParen)?; - } else { - self.prev_token(); - } - } - if !self.dialect.supports_table_sample_before_alias() { - if let Some(parsed_sample) = self.maybe_parse_table_sample()? { - sample = Some(TableSampleKind::AfterTableAlias(parsed_sample)); - } - } - let mut table = TableFactor::Table { - name, - alias, - args, - with_hints, - version, - partitions, - with_ordinality, - json_path, - sample, - index_hints, - }; - while let Some(kw) = self - .parse_one_of_keywords(&[Keyword::PIVOT, Keyword::UNPIVOT]) - { - table = match kw { - Keyword::PIVOT => self.parse_pivot_table_factor(table)?, - Keyword::UNPIVOT => self.parse_unpivot_table_factor(table)?, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }; - } - if self.dialect.supports_match_recognize() - && self.parse_keyword(Keyword::MATCH_RECOGNIZE) - { - table = self.parse_match_recognize(table)?; - } - Ok(table) - } - } - fn maybe_parse_table_sample( - &mut self, - ) -> Result>, ParserError> { - let modifier = if self.parse_keyword(Keyword::TABLESAMPLE) { - TableSampleModifier::TableSample - } else if self.parse_keyword(Keyword::SAMPLE) { - TableSampleModifier::Sample - } else { - return Ok(None); - }; - let name = match self - .parse_one_of_keywords( - &[Keyword::BERNOULLI, Keyword::ROW, Keyword::SYSTEM, Keyword::BLOCK], - ) - { - Some(Keyword::BERNOULLI) => Some(TableSampleMethod::Bernoulli), - Some(Keyword::ROW) => Some(TableSampleMethod::Row), - Some(Keyword::SYSTEM) => Some(TableSampleMethod::System), - Some(Keyword::BLOCK) => Some(TableSampleMethod::Block), - _ => None, - }; - let parenthesized = self.consume_token(&Token::LParen); - let (quantity, bucket) = if parenthesized - && self.parse_keyword(Keyword::BUCKET) - { - let selected_bucket = self.parse_number_value()?; - self.expect_keywords(&[Keyword::OUT, Keyword::OF])?; - let total = self.parse_number_value()?; - let on = if self.parse_keyword(Keyword::ON) { - Some(self.parse_expr()?) - } else { - None - }; - ( - None, - Some(TableSampleBucket { - bucket: selected_bucket, - total, - on, - }), - ) - } else { - let value = match self.maybe_parse(|p| p.parse_expr())? { - Some(num) => num, - None => { - if let Token::Word(w) = self.next_token().token { - Expr::Value(Value::Placeholder(w.value)) - } else { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Expecting number or byte length e.g. 100M", - self.peek_token().span.start, - ), - ); - res - }), - ), - ); - } - } - }; - let unit = if self.parse_keyword(Keyword::ROWS) { - Some(TableSampleUnit::Rows) - } else if self.parse_keyword(Keyword::PERCENT) { - Some(TableSampleUnit::Percent) - } else { - None - }; - ( - Some(TableSampleQuantity { - parenthesized, - value, - unit, - }), - None, - ) - }; - if parenthesized { - self.expect_token(&Token::RParen)?; - } - let seed = if self.parse_keyword(Keyword::REPEATABLE) { - Some(self.parse_table_sample_seed(TableSampleSeedModifier::Repeatable)?) - } else if self.parse_keyword(Keyword::SEED) { - Some(self.parse_table_sample_seed(TableSampleSeedModifier::Seed)?) - } else { - None - }; - let offset = if self.parse_keyword(Keyword::OFFSET) { - Some(self.parse_expr()?) - } else { - None - }; - Ok( - Some( - Box::new(TableSample { - modifier, - name, - quantity, - seed, - bucket, - offset, - }), - ), - ) - } - fn parse_table_sample_seed( - &mut self, - modifier: TableSampleSeedModifier, - ) -> Result { - self.expect_token(&Token::LParen)?; - let value = self.parse_number_value()?; - self.expect_token(&Token::RParen)?; - Ok(TableSampleSeed { modifier, value }) - } - /// Parses `OPENJSON( jsonExpression [ , path ] ) [ ]` clause, - /// assuming the `OPENJSON` keyword was already consumed. - fn parse_open_json_table_factor(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let json_expr = self.parse_expr()?; - let json_path = if self.consume_token(&Token::Comma) { - Some(self.parse_value()?) - } else { - None - }; - self.expect_token(&Token::RParen)?; - let columns = if self.parse_keyword(Keyword::WITH) { - self.expect_token(&Token::LParen)?; - let columns = self - .parse_comma_separated(Parser::parse_openjson_table_column_def)?; - self.expect_token(&Token::RParen)?; - columns - } else { - Vec::new() - }; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::OpenJsonTable { - json_expr, - json_path, - columns, - alias, - }) - } - fn parse_match_recognize( - &mut self, - table: TableFactor, - ) -> Result { - self.expect_token(&Token::LParen)?; - let partition_by = if self.parse_keywords(&[Keyword::PARTITION, Keyword::BY]) - { - self.parse_comma_separated(Parser::parse_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let order_by = if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - self.parse_comma_separated(Parser::parse_order_by_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let measures = if self.parse_keyword(Keyword::MEASURES) { - self.parse_comma_separated(|p| { - let expr = p.parse_expr()?; - let _ = p.parse_keyword(Keyword::AS); - let alias = p.parse_identifier()?; - Ok(Measure { expr, alias }) - })? - } else { - ::alloc::vec::Vec::new() - }; - let rows_per_match = if self - .parse_keywords( - &[Keyword::ONE, Keyword::ROW, Keyword::PER, Keyword::MATCH], - ) - { - Some(RowsPerMatch::OneRow) - } else if self - .parse_keywords( - &[Keyword::ALL, Keyword::ROWS, Keyword::PER, Keyword::MATCH], - ) - { - Some( - RowsPerMatch::AllRows( - if self - .parse_keywords( - &[Keyword::SHOW, Keyword::EMPTY, Keyword::MATCHES], - ) - { - Some(EmptyMatchesMode::Show) - } else if self - .parse_keywords( - &[Keyword::OMIT, Keyword::EMPTY, Keyword::MATCHES], - ) - { - Some(EmptyMatchesMode::Omit) - } else if self - .parse_keywords( - &[Keyword::WITH, Keyword::UNMATCHED, Keyword::ROWS], - ) - { - Some(EmptyMatchesMode::WithUnmatched) - } else { - None - }, - ), - ) - } else { - None - }; - let after_match_skip = if self - .parse_keywords(&[Keyword::AFTER, Keyword::MATCH, Keyword::SKIP]) - { - if self.parse_keywords(&[Keyword::PAST, Keyword::LAST, Keyword::ROW]) { - Some(AfterMatchSkip::PastLastRow) - } else if self - .parse_keywords(&[Keyword::TO, Keyword::NEXT, Keyword::ROW]) - { - Some(AfterMatchSkip::ToNextRow) - } else if self.parse_keywords(&[Keyword::TO, Keyword::FIRST]) { - Some(AfterMatchSkip::ToFirst(self.parse_identifier()?)) - } else if self.parse_keywords(&[Keyword::TO, Keyword::LAST]) { - Some(AfterMatchSkip::ToLast(self.parse_identifier()?)) - } else { - let found = self.next_token(); - return self.expected("after match skip option", found); - } - } else { - None - }; - self.expect_keyword_is(Keyword::PATTERN)?; - let pattern = self.parse_parenthesized(Self::parse_pattern)?; - self.expect_keyword_is(Keyword::DEFINE)?; - let symbols = self - .parse_comma_separated(|p| { - let symbol = p.parse_identifier()?; - p.expect_keyword_is(Keyword::AS)?; - let definition = p.parse_expr()?; - Ok(SymbolDefinition { - symbol, - definition, - }) - })?; - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::MatchRecognize { - table: Box::new(table), - partition_by, - order_by, - measures, - rows_per_match, - after_match_skip, - pattern, - symbols, - alias, - }) - } - fn parse_base_pattern(&mut self) -> Result { - match self.next_token().token { - Token::Caret => { - Ok(MatchRecognizePattern::Symbol(MatchRecognizeSymbol::Start)) - } - Token::Placeholder(s) if s == "$" => { - Ok(MatchRecognizePattern::Symbol(MatchRecognizeSymbol::End)) - } - Token::LBrace => { - self.expect_token(&Token::Minus)?; - let symbol = self - .parse_identifier() - .map(MatchRecognizeSymbol::Named)?; - self.expect_token(&Token::Minus)?; - self.expect_token(&Token::RBrace)?; - Ok(MatchRecognizePattern::Exclude(symbol)) - } - Token::Word( - Word { value, quote_style: None, .. }, - ) if value == "PERMUTE" => { - self.expect_token(&Token::LParen)?; - let symbols = self - .parse_comma_separated(|p| { - p.parse_identifier().map(MatchRecognizeSymbol::Named) - })?; - self.expect_token(&Token::RParen)?; - Ok(MatchRecognizePattern::Permute(symbols)) - } - Token::LParen => { - let pattern = self.parse_pattern()?; - self.expect_token(&Token::RParen)?; - Ok(MatchRecognizePattern::Group(Box::new(pattern))) - } - _ => { - self.prev_token(); - self.parse_identifier() - .map(MatchRecognizeSymbol::Named) - .map(MatchRecognizePattern::Symbol) - } - } - } - fn parse_repetition_pattern( - &mut self, - ) -> Result { - let mut pattern = self.parse_base_pattern()?; - loop { - let token = self.next_token(); - let quantifier = match token.token { - Token::Mul => RepetitionQuantifier::ZeroOrMore, - Token::Plus => RepetitionQuantifier::OneOrMore, - Token::Placeholder(s) if s == "?" => RepetitionQuantifier::AtMostOne, - Token::LBrace => { - let token = self.next_token(); - match token.token { - Token::Comma => { - let next_token = self.next_token(); - let Token::Number(n, _) = next_token.token else { - return self.expected("literal number", next_token); - }; - self.expect_token(&Token::RBrace)?; - RepetitionQuantifier::AtMost( - Self::parse(n, token.span.start)?, - ) - } - Token::Number(n, _) if self.consume_token(&Token::Comma) => { - let next_token = self.next_token(); - match next_token.token { - Token::Number(m, _) => { - self.expect_token(&Token::RBrace)?; - RepetitionQuantifier::Range( - Self::parse(n, token.span.start)?, - Self::parse(m, token.span.start)?, - ) - } - Token::RBrace => { - RepetitionQuantifier::AtLeast( - Self::parse(n, token.span.start)?, - ) - } - _ => { - return self.expected("} or upper bound", next_token); - } - } - } - Token::Number(n, _) => { - self.expect_token(&Token::RBrace)?; - RepetitionQuantifier::Exactly( - Self::parse(n, token.span.start)?, - ) - } - _ => return self.expected("quantifier range", token), - } - } - _ => { - self.prev_token(); - break; - } - }; - pattern = MatchRecognizePattern::Repetition( - Box::new(pattern), - quantifier, - ); - } - Ok(pattern) - } - fn parse_concat_pattern( - &mut self, - ) -> Result { - let mut patterns = <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([self.parse_repetition_pattern()?]), - ); - while !match self.peek_token().token { - Token::RParen | Token::Pipe => true, - _ => false, - } { - patterns.push(self.parse_repetition_pattern()?); - } - match <[MatchRecognizePattern; 1]>::try_from(patterns) { - Ok([pattern]) => Ok(pattern), - Err(patterns) => Ok(MatchRecognizePattern::Concat(patterns)), - } - } - fn parse_pattern(&mut self) -> Result { - let pattern = self.parse_concat_pattern()?; - if self.consume_token(&Token::Pipe) { - match self.parse_pattern()? { - MatchRecognizePattern::Alternation(mut patterns) => { - patterns.insert(0, pattern); - Ok(MatchRecognizePattern::Alternation(patterns)) - } - next => { - Ok( - MatchRecognizePattern::Alternation( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([pattern, next]), - ), - ), - ) - } - } - } else { - Ok(pattern) - } - } - /// Parses a the timestamp version specifier (i.e. query historical data) - pub fn maybe_parse_table_version( - &mut self, - ) -> Result, ParserError> { - if self.dialect.supports_timestamp_versioning() { - if self - .parse_keywords( - &[Keyword::FOR, Keyword::SYSTEM_TIME, Keyword::AS, Keyword::OF], - ) - { - let expr = self.parse_expr()?; - return Ok(Some(TableVersion::ForSystemTimeAsOf(expr))); - } else if self.peek_keyword(Keyword::AT) - || self.peek_keyword(Keyword::BEFORE) - { - let func_name = self.parse_object_name(true)?; - let func = self.parse_function(func_name)?; - return Ok(Some(TableVersion::Function(func))); - } - } - Ok(None) - } - /// Parses MySQL's JSON_TABLE column definition. - /// For example: `id INT EXISTS PATH '$' DEFAULT '0' ON EMPTY ERROR ON ERROR` - pub fn parse_json_table_column_def( - &mut self, - ) -> Result { - if self.parse_keyword(Keyword::NESTED) { - let _has_path_keyword = self.parse_keyword(Keyword::PATH); - let path = self.parse_value()?; - self.expect_keyword_is(Keyword::COLUMNS)?; - let columns = self - .parse_parenthesized(|p| { - p.parse_comma_separated(Self::parse_json_table_column_def) - })?; - return Ok( - JsonTableColumn::Nested(JsonTableNestedColumn { - path, - columns, - }), - ); - } - let name = self.parse_identifier()?; - if self.parse_keyword(Keyword::FOR) { - self.expect_keyword_is(Keyword::ORDINALITY)?; - return Ok(JsonTableColumn::ForOrdinality(name)); - } - let r#type = self.parse_data_type()?; - let exists = self.parse_keyword(Keyword::EXISTS); - self.expect_keyword_is(Keyword::PATH)?; - let path = self.parse_value()?; - let mut on_empty = None; - let mut on_error = None; - while let Some(error_handling) = self - .parse_json_table_column_error_handling()? - { - if self.parse_keyword(Keyword::EMPTY) { - on_empty = Some(error_handling); - } else { - self.expect_keyword_is(Keyword::ERROR)?; - on_error = Some(error_handling); - } - } - Ok( - JsonTableColumn::Named(JsonTableNamedColumn { - name, - r#type, - path, - exists, - on_empty, - on_error, - }), - ) - } - /// Parses MSSQL's `OPENJSON WITH` column definition. - /// - /// ```sql - /// colName type [ column_path ] [ AS JSON ] - /// ``` - /// - /// Reference: - pub fn parse_openjson_table_column_def( - &mut self, - ) -> Result { - let name = self.parse_identifier()?; - let r#type = self.parse_data_type()?; - let path = if let Token::SingleQuotedString(path) = self.peek_token().token { - self.next_token(); - Some(path) - } else { - None - }; - let as_json = self.parse_keyword(Keyword::AS); - if as_json { - self.expect_keyword_is(Keyword::JSON)?; - } - Ok(OpenJsonTableColumn { - name, - r#type, - path, - as_json, - }) - } - fn parse_json_table_column_error_handling( - &mut self, - ) -> Result, ParserError> { - let res = if self.parse_keyword(Keyword::NULL) { - JsonTableColumnErrorHandling::Null - } else if self.parse_keyword(Keyword::ERROR) { - JsonTableColumnErrorHandling::Error - } else if self.parse_keyword(Keyword::DEFAULT) { - JsonTableColumnErrorHandling::Default(self.parse_value()?) - } else { - return Ok(None); - }; - self.expect_keyword_is(Keyword::ON)?; - Ok(Some(res)) - } - pub fn parse_derived_table_factor( - &mut self, - lateral: IsLateral, - ) -> Result { - let subquery = self.parse_query()?; - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::Derived { - lateral: match lateral { - Lateral => true, - NotLateral => false, - }, - subquery, - alias, - }) - } - fn parse_aliased_function_call(&mut self) -> Result { - let function_name = match self.next_token().token { - Token::Word(w) => Ok(w.value), - _ => self.expected("a function identifier", self.peek_token()), - }?; - let expr = self - .parse_function( - ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Ident::new(function_name)]), - ), - ), - )?; - let alias = if self.parse_keyword(Keyword::AS) { - Some(self.parse_identifier()?) - } else { - None - }; - Ok(ExprWithAlias { expr, alias }) - } - /// Parses an expression with an optional alias - /// - /// Examples: - /// - /// ```sql - /// SUM(price) AS total_price - /// ``` - /// ```sql - /// SUM(price) - /// ``` - /// - /// Example - /// ``` - /// # use sqlparser::parser::{Parser, ParserError}; - /// # use sqlparser::dialect::GenericDialect; - /// # fn main() ->Result<(), ParserError> { - /// 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)); - /// # Ok(()) - /// # } - pub fn parse_expr_with_alias(&mut self) -> Result { - let expr = self.parse_expr()?; - let alias = if self.parse_keyword(Keyword::AS) { - Some(self.parse_identifier()?) - } else { - None - }; - Ok(ExprWithAlias { expr, alias }) - } - pub fn parse_pivot_table_factor( - &mut self, - table: TableFactor, - ) -> Result { - self.expect_token(&Token::LParen)?; - let aggregate_functions = self - .parse_comma_separated(Self::parse_aliased_function_call)?; - self.expect_keyword_is(Keyword::FOR)?; - let value_column = self.parse_period_separated(|p| p.parse_identifier())?; - self.expect_keyword_is(Keyword::IN)?; - self.expect_token(&Token::LParen)?; - let value_source = if self.parse_keyword(Keyword::ANY) { - let order_by = if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - self.parse_comma_separated(Parser::parse_order_by_expr)? - } else { - ::alloc::vec::Vec::new() - }; - PivotValueSource::Any(order_by) - } else if self.peek_sub_query() { - PivotValueSource::Subquery(self.parse_query()?) - } else { - PivotValueSource::List( - self.parse_comma_separated(Self::parse_expr_with_alias)?, - ) - }; - self.expect_token(&Token::RParen)?; - let default_on_null = if self - .parse_keywords(&[Keyword::DEFAULT, Keyword::ON, Keyword::NULL]) - { - self.expect_token(&Token::LParen)?; - let expr = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Some(expr) - } else { - None - }; - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::Pivot { - table: Box::new(table), - aggregate_functions, - value_column, - value_source, - default_on_null, - alias, - }) - } - pub fn parse_unpivot_table_factor( - &mut self, - table: TableFactor, - ) -> Result { - self.expect_token(&Token::LParen)?; - let value = self.parse_identifier()?; - self.expect_keyword_is(Keyword::FOR)?; - let name = self.parse_identifier()?; - self.expect_keyword_is(Keyword::IN)?; - let columns = self.parse_parenthesized_column_list(Mandatory, false)?; - self.expect_token(&Token::RParen)?; - let alias = self.maybe_parse_table_alias()?; - Ok(TableFactor::Unpivot { - table: Box::new(table), - value, - name, - columns, - alias, - }) - } - pub fn parse_join_constraint( - &mut self, - natural: bool, - ) -> Result { - if natural { - Ok(JoinConstraint::Natural) - } else if self.parse_keyword(Keyword::ON) { - let constraint = self.parse_expr()?; - Ok(JoinConstraint::On(constraint)) - } else if self.parse_keyword(Keyword::USING) { - let columns = self - .parse_parenthesized_qualified_column_list(Mandatory, false)?; - Ok(JoinConstraint::Using(columns)) - } else { - Ok(JoinConstraint::None) - } - } - /// Parse a GRANT statement. - pub fn parse_grant(&mut self) -> Result { - let (privileges, objects) = self.parse_grant_revoke_privileges_objects()?; - self.expect_keyword_is(Keyword::TO)?; - let grantees = self.parse_grantees()?; - let with_grant_option = self - .parse_keywords(&[Keyword::WITH, Keyword::GRANT, Keyword::OPTION]); - let granted_by = self - .parse_keywords(&[Keyword::GRANTED, Keyword::BY]) - .then(|| self.parse_identifier().unwrap()); - Ok(Statement::Grant { - privileges, - objects, - grantees, - with_grant_option, - granted_by, - }) - } - fn parse_grantees(&mut self) -> Result, ParserError> { - let mut values = ::alloc::vec::Vec::new(); - let mut grantee_type = GranteesType::None; - loop { - grantee_type = if self.parse_keyword(Keyword::ROLE) { - GranteesType::Role - } else if self.parse_keyword(Keyword::USER) { - GranteesType::User - } else if self.parse_keyword(Keyword::SHARE) { - GranteesType::Share - } else if self.parse_keyword(Keyword::GROUP) { - GranteesType::Group - } else if self.parse_keyword(Keyword::PUBLIC) { - GranteesType::Public - } else if self.parse_keywords(&[Keyword::DATABASE, Keyword::ROLE]) { - GranteesType::DatabaseRole - } else if self.parse_keywords(&[Keyword::APPLICATION, Keyword::ROLE]) { - GranteesType::ApplicationRole - } else if self.parse_keyword(Keyword::APPLICATION) { - GranteesType::Application - } else { - grantee_type - }; - let grantee = if grantee_type == GranteesType::Public { - Grantee { - grantee_type: grantee_type.clone(), - name: None, - } - } else { - let mut name = self.parse_grantee_name()?; - if self.consume_token(&Token::Colon) { - let ident = self.parse_identifier()?; - if let GranteeName::ObjectName(namespace) = name { - name = GranteeName::ObjectName( - ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - Ident::new( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("{0}:{1}", namespace, ident), - ); - res - }), - ), - ]), - ), - ), - ); - } - } - Grantee { - grantee_type: grantee_type.clone(), - name: Some(name), - } - }; - values.push(grantee); - if !self.consume_token(&Token::Comma) { - break; - } - } - Ok(values) - } - pub fn parse_grant_revoke_privileges_objects( - &mut self, - ) -> Result<(Privileges, Option), ParserError> { - let privileges = if self.parse_keyword(Keyword::ALL) { - Privileges::All { - with_privileges_keyword: self.parse_keyword(Keyword::PRIVILEGES), - } - } else { - let actions = self.parse_actions_list()?; - Privileges::Actions(actions) - }; - let objects = if self.parse_keyword(Keyword::ON) { - if self - .parse_keywords( - &[Keyword::ALL, Keyword::TABLES, Keyword::IN, Keyword::SCHEMA], - ) - { - Some(GrantObjects::AllTablesInSchema { - schemas: self - .parse_comma_separated(|p| p.parse_object_name(false))?, - }) - } else if self - .parse_keywords( - &[Keyword::ALL, Keyword::SEQUENCES, Keyword::IN, Keyword::SCHEMA], - ) - { - Some(GrantObjects::AllSequencesInSchema { - schemas: self - .parse_comma_separated(|p| p.parse_object_name(false))?, - }) - } else { - let object_type = self - .parse_one_of_keywords( - &[ - Keyword::SEQUENCE, - Keyword::DATABASE, - Keyword::DATABASE, - Keyword::SCHEMA, - Keyword::TABLE, - Keyword::VIEW, - Keyword::WAREHOUSE, - Keyword::INTEGRATION, - Keyword::VIEW, - Keyword::WAREHOUSE, - Keyword::INTEGRATION, - ], - ); - let objects = self - .parse_comma_separated(|p| { - p.parse_object_name_with_wildcards(false, true) - }); - match object_type { - Some(Keyword::DATABASE) => { - Some(GrantObjects::Databases(objects?)) - } - Some(Keyword::SCHEMA) => Some(GrantObjects::Schemas(objects?)), - Some(Keyword::SEQUENCE) => { - Some(GrantObjects::Sequences(objects?)) - } - Some(Keyword::WAREHOUSE) => { - Some(GrantObjects::Warehouses(objects?)) - } - Some(Keyword::INTEGRATION) => { - Some(GrantObjects::Integrations(objects?)) - } - Some(Keyword::VIEW) => Some(GrantObjects::Views(objects?)), - Some(Keyword::TABLE) | None => { - Some(GrantObjects::Tables(objects?)) - } - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - } - } - } else { - None - }; - Ok((privileges, objects)) - } - pub fn parse_grant_permission(&mut self) -> Result { - fn parse_columns( - parser: &mut Parser, - ) -> Result>, ParserError> { - let columns = parser.parse_parenthesized_column_list(Optional, false)?; - if columns.is_empty() { Ok(None) } else { Ok(Some(columns)) } - } - if self.parse_keywords(&[Keyword::IMPORTED, Keyword::PRIVILEGES]) { - Ok(Action::ImportedPrivileges) - } else if self - .parse_keywords(&[Keyword::ADD, Keyword::SEARCH, Keyword::OPTIMIZATION]) - { - Ok(Action::AddSearchOptimization) - } else if self.parse_keywords(&[Keyword::ATTACH, Keyword::LISTING]) { - Ok(Action::AttachListing) - } else if self.parse_keywords(&[Keyword::ATTACH, Keyword::POLICY]) { - Ok(Action::AttachPolicy) - } else if self - .parse_keywords(&[Keyword::BIND, Keyword::SERVICE, Keyword::ENDPOINT]) - { - Ok(Action::BindServiceEndpoint) - } else if self.parse_keywords(&[Keyword::DATABASE, Keyword::ROLE]) { - let role = self.parse_object_name(false)?; - Ok(Action::DatabaseRole { role }) - } else if self.parse_keywords(&[Keyword::EVOLVE, Keyword::SCHEMA]) { - Ok(Action::EvolveSchema) - } else if self.parse_keywords(&[Keyword::IMPORT, Keyword::SHARE]) { - Ok(Action::ImportShare) - } else if self.parse_keywords(&[Keyword::MANAGE, Keyword::VERSIONS]) { - Ok(Action::ManageVersions) - } else if self.parse_keywords(&[Keyword::MANAGE, Keyword::RELEASES]) { - Ok(Action::ManageReleases) - } else if self - .parse_keywords( - &[Keyword::OVERRIDE, Keyword::SHARE, Keyword::RESTRICTIONS], - ) - { - Ok(Action::OverrideShareRestrictions) - } else if self - .parse_keywords( - &[ - Keyword::PURCHASE, - Keyword::DATA, - Keyword::EXCHANGE, - Keyword::LISTING, - ], - ) - { - Ok(Action::PurchaseDataExchangeListing) - } else if self.parse_keywords(&[Keyword::RESOLVE, Keyword::ALL]) { - Ok(Action::ResolveAll) - } else if self.parse_keywords(&[Keyword::READ, Keyword::SESSION]) { - Ok(Action::ReadSession) - } else if self.parse_keyword(Keyword::APPLY) { - let apply_type = self.parse_action_apply_type()?; - Ok(Action::Apply { apply_type }) - } else if self.parse_keyword(Keyword::APPLYBUDGET) { - Ok(Action::ApplyBudget) - } else if self.parse_keyword(Keyword::AUDIT) { - Ok(Action::Audit) - } else if self.parse_keyword(Keyword::CONNECT) { - Ok(Action::Connect) - } else if self.parse_keyword(Keyword::CREATE) { - let obj_type = self.maybe_parse_action_create_object_type(); - Ok(Action::Create { obj_type }) - } else if self.parse_keyword(Keyword::DELETE) { - Ok(Action::Delete) - } else if self.parse_keyword(Keyword::EXECUTE) { - let obj_type = self.maybe_parse_action_execute_obj_type(); - Ok(Action::Execute { obj_type }) - } else if self.parse_keyword(Keyword::FAILOVER) { - Ok(Action::Failover) - } else if self.parse_keyword(Keyword::INSERT) { - Ok(Action::Insert { - columns: parse_columns(self)?, - }) - } else if self.parse_keyword(Keyword::MANAGE) { - let manage_type = self.parse_action_manage_type()?; - Ok(Action::Manage { manage_type }) - } else if self.parse_keyword(Keyword::MODIFY) { - let modify_type = self.parse_action_modify_type()?; - Ok(Action::Modify { modify_type }) - } else if self.parse_keyword(Keyword::MONITOR) { - let monitor_type = self.parse_action_monitor_type()?; - Ok(Action::Monitor { monitor_type }) - } else if self.parse_keyword(Keyword::OPERATE) { - Ok(Action::Operate) - } else if self.parse_keyword(Keyword::REFERENCES) { - Ok(Action::References { - columns: parse_columns(self)?, - }) - } else if self.parse_keyword(Keyword::READ) { - Ok(Action::Read) - } else if self.parse_keyword(Keyword::REPLICATE) { - Ok(Action::Replicate) - } else if self.parse_keyword(Keyword::ROLE) { - let role = self.parse_identifier()?; - Ok(Action::Role { role }) - } else if self.parse_keyword(Keyword::SELECT) { - Ok(Action::Select { - columns: parse_columns(self)?, - }) - } else if self.parse_keyword(Keyword::TEMPORARY) { - Ok(Action::Temporary) - } else if self.parse_keyword(Keyword::TRIGGER) { - Ok(Action::Trigger) - } else if self.parse_keyword(Keyword::TRUNCATE) { - Ok(Action::Truncate) - } else if self.parse_keyword(Keyword::UPDATE) { - Ok(Action::Update { - columns: parse_columns(self)?, - }) - } else if self.parse_keyword(Keyword::USAGE) { - Ok(Action::Usage) - } else if self.parse_keyword(Keyword::OWNERSHIP) { - Ok(Action::Ownership) - } else { - self.expected("a privilege keyword", self.peek_token())? - } - } - fn maybe_parse_action_create_object_type( - &mut self, - ) -> Option { - if self.parse_keywords(&[Keyword::APPLICATION, Keyword::PACKAGE]) { - Some(ActionCreateObjectType::ApplicationPackage) - } else if self.parse_keywords(&[Keyword::COMPUTE, Keyword::POOL]) { - Some(ActionCreateObjectType::ComputePool) - } else if self - .parse_keywords(&[Keyword::DATA, Keyword::EXCHANGE, Keyword::LISTING]) - { - Some(ActionCreateObjectType::DataExchangeListing) - } else if self.parse_keywords(&[Keyword::EXTERNAL, Keyword::VOLUME]) { - Some(ActionCreateObjectType::ExternalVolume) - } else if self.parse_keywords(&[Keyword::FAILOVER, Keyword::GROUP]) { - Some(ActionCreateObjectType::FailoverGroup) - } else if self.parse_keywords(&[Keyword::NETWORK, Keyword::POLICY]) { - Some(ActionCreateObjectType::NetworkPolicy) - } else if self.parse_keywords(&[Keyword::ORGANIZATION, Keyword::LISTING]) { - Some(ActionCreateObjectType::OrganiationListing) - } else if self.parse_keywords(&[Keyword::REPLICATION, Keyword::GROUP]) { - Some(ActionCreateObjectType::ReplicationGroup) - } else if self.parse_keyword(Keyword::ACCOUNT) { - Some(ActionCreateObjectType::Account) - } else if self.parse_keyword(Keyword::APPLICATION) { - Some(ActionCreateObjectType::Application) - } else if self.parse_keyword(Keyword::DATABASE) { - Some(ActionCreateObjectType::Database) - } else if self.parse_keyword(Keyword::INTEGRATION) { - Some(ActionCreateObjectType::Integration) - } else if self.parse_keyword(Keyword::ROLE) { - Some(ActionCreateObjectType::Role) - } else if self.parse_keyword(Keyword::SHARE) { - Some(ActionCreateObjectType::Share) - } else if self.parse_keyword(Keyword::USER) { - Some(ActionCreateObjectType::User) - } else if self.parse_keyword(Keyword::WAREHOUSE) { - Some(ActionCreateObjectType::Warehouse) - } else { - None - } - } - fn parse_action_apply_type(&mut self) -> Result { - if self.parse_keywords(&[Keyword::AGGREGATION, Keyword::POLICY]) { - Ok(ActionApplyType::AggregationPolicy) - } else if self.parse_keywords(&[Keyword::AUTHENTICATION, Keyword::POLICY]) { - Ok(ActionApplyType::AuthenticationPolicy) - } else if self.parse_keywords(&[Keyword::JOIN, Keyword::POLICY]) { - Ok(ActionApplyType::JoinPolicy) - } else if self.parse_keywords(&[Keyword::MASKING, Keyword::POLICY]) { - Ok(ActionApplyType::MaskingPolicy) - } else if self.parse_keywords(&[Keyword::PACKAGES, Keyword::POLICY]) { - Ok(ActionApplyType::PackagesPolicy) - } else if self.parse_keywords(&[Keyword::PASSWORD, Keyword::POLICY]) { - Ok(ActionApplyType::PasswordPolicy) - } else if self.parse_keywords(&[Keyword::PROJECTION, Keyword::POLICY]) { - Ok(ActionApplyType::ProjectionPolicy) - } else if self - .parse_keywords(&[Keyword::ROW, Keyword::ACCESS, Keyword::POLICY]) - { - Ok(ActionApplyType::RowAccessPolicy) - } else if self.parse_keywords(&[Keyword::SESSION, Keyword::POLICY]) { - Ok(ActionApplyType::SessionPolicy) - } else if self.parse_keyword(Keyword::TAG) { - Ok(ActionApplyType::Tag) - } else { - self.expected("GRANT APPLY type", self.peek_token()) - } - } - fn maybe_parse_action_execute_obj_type( - &mut self, - ) -> Option { - if self.parse_keywords(&[Keyword::DATA, Keyword::METRIC, Keyword::FUNCTION]) - { - Some(ActionExecuteObjectType::DataMetricFunction) - } else if self.parse_keywords(&[Keyword::MANAGED, Keyword::ALERT]) { - Some(ActionExecuteObjectType::ManagedAlert) - } else if self.parse_keywords(&[Keyword::MANAGED, Keyword::TASK]) { - Some(ActionExecuteObjectType::ManagedTask) - } else if self.parse_keyword(Keyword::ALERT) { - Some(ActionExecuteObjectType::Alert) - } else if self.parse_keyword(Keyword::TASK) { - Some(ActionExecuteObjectType::Task) - } else { - None - } - } - fn parse_action_manage_type(&mut self) -> Result { - if self.parse_keywords(&[Keyword::ACCOUNT, Keyword::SUPPORT, Keyword::CASES]) - { - Ok(ActionManageType::AccountSupportCases) - } else if self.parse_keywords(&[Keyword::EVENT, Keyword::SHARING]) { - Ok(ActionManageType::EventSharing) - } else if self - .parse_keywords(&[Keyword::LISTING, Keyword::AUTO, Keyword::FULFILLMENT]) - { - Ok(ActionManageType::ListingAutoFulfillment) - } else if self - .parse_keywords( - &[Keyword::ORGANIZATION, Keyword::SUPPORT, Keyword::CASES], - ) - { - Ok(ActionManageType::OrganizationSupportCases) - } else if self - .parse_keywords(&[Keyword::USER, Keyword::SUPPORT, Keyword::CASES]) - { - Ok(ActionManageType::UserSupportCases) - } else if self.parse_keyword(Keyword::GRANTS) { - Ok(ActionManageType::Grants) - } else if self.parse_keyword(Keyword::WAREHOUSES) { - Ok(ActionManageType::Warehouses) - } else { - self.expected("GRANT MANAGE type", self.peek_token()) - } - } - fn parse_action_modify_type(&mut self) -> Result { - if self.parse_keywords(&[Keyword::LOG, Keyword::LEVEL]) { - Ok(ActionModifyType::LogLevel) - } else if self.parse_keywords(&[Keyword::TRACE, Keyword::LEVEL]) { - Ok(ActionModifyType::TraceLevel) - } else if self - .parse_keywords(&[Keyword::SESSION, Keyword::LOG, Keyword::LEVEL]) - { - Ok(ActionModifyType::SessionLogLevel) - } else if self - .parse_keywords(&[Keyword::SESSION, Keyword::TRACE, Keyword::LEVEL]) - { - Ok(ActionModifyType::SessionTraceLevel) - } else { - self.expected("GRANT MODIFY type", self.peek_token()) - } - } - fn parse_action_monitor_type( - &mut self, - ) -> Result { - if self.parse_keyword(Keyword::EXECUTION) { - Ok(ActionMonitorType::Execution) - } else if self.parse_keyword(Keyword::SECURITY) { - Ok(ActionMonitorType::Security) - } else if self.parse_keyword(Keyword::USAGE) { - Ok(ActionMonitorType::Usage) - } else { - self.expected("GRANT MONITOR type", self.peek_token()) - } - } - pub fn parse_grantee_name(&mut self) -> Result { - let mut name = self.parse_object_name(false)?; - if self.dialect.supports_user_host_grantee() && name.0.len() == 1 - && name.0[0].as_ident().is_some() && self.consume_token(&Token::AtSign) - { - let user = name.0.pop().unwrap().as_ident().unwrap().clone(); - let host = self.parse_identifier()?; - Ok(GranteeName::UserHost { - user, - host, - }) - } else { - Ok(GranteeName::ObjectName(name)) - } - } - /// Parse a REVOKE statement - pub fn parse_revoke(&mut self) -> Result { - let (privileges, objects) = self.parse_grant_revoke_privileges_objects()?; - self.expect_keyword_is(Keyword::FROM)?; - let grantees = self.parse_grantees()?; - let granted_by = self - .parse_keywords(&[Keyword::GRANTED, Keyword::BY]) - .then(|| self.parse_identifier().unwrap()); - let cascade = self.parse_cascade_option(); - Ok(Statement::Revoke { - privileges, - objects, - grantees, - granted_by, - cascade, - }) - } - /// Parse an REPLACE statement - pub fn parse_replace(&mut self) -> Result { - if !(self.dialect.is::() - || self.dialect.is::()) - { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Unsupported statement REPLACE", - self.peek_token().span.start, - ), - ); - res - }), - ), - ); - } - let mut insert = self.parse_insert()?; - if let Statement::Insert(Insert { replace_into, .. }) = &mut insert { - *replace_into = true; - } - Ok(insert) - } - /// Parse an INSERT statement, returning a `Box`ed SetExpr - /// - /// This is used to reduce the size of the stack frames in debug builds - fn parse_insert_setexpr_boxed(&mut self) -> Result, ParserError> { - Ok(Box::new(SetExpr::Insert(self.parse_insert()?))) - } - /// Parse an INSERT statement - pub fn parse_insert(&mut self) -> Result { - let or = self.parse_conflict_clause(); - let priority = if !(self.dialect.is::() - || self.dialect.is::()) - { - None - } else if self.parse_keyword(Keyword::LOW_PRIORITY) { - Some(MysqlInsertPriority::LowPriority) - } else if self.parse_keyword(Keyword::DELAYED) { - Some(MysqlInsertPriority::Delayed) - } else if self.parse_keyword(Keyword::HIGH_PRIORITY) { - Some(MysqlInsertPriority::HighPriority) - } else { - None - }; - let ignore = (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::IGNORE); - let replace_into = false; - let overwrite = self.parse_keyword(Keyword::OVERWRITE); - let into = self.parse_keyword(Keyword::INTO); - let local = self.parse_keyword(Keyword::LOCAL); - if self.parse_keyword(Keyword::DIRECTORY) { - let path = self.parse_literal_string()?; - let file_format = if self.parse_keywords(&[Keyword::STORED, Keyword::AS]) - { - Some(self.parse_file_format()?) - } else { - None - }; - let source = self.parse_query()?; - Ok(Statement::Directory { - local, - path, - overwrite, - file_format, - source, - }) - } else { - let table = self.parse_keyword(Keyword::TABLE); - let table_object = self.parse_table_object()?; - let table_alias = if (self.dialect.is::()) - && self.parse_keyword(Keyword::AS) - { - Some(self.parse_identifier()?) - } else { - None - }; - let is_mysql = (self.dialect.is::()); - let (columns, partitioned, after_columns, source, assignments) = if self - .parse_keywords(&[Keyword::DEFAULT, Keyword::VALUES]) - { - ( - ::alloc::vec::Vec::new(), - None, - ::alloc::vec::Vec::new(), - None, - ::alloc::vec::Vec::new(), - ) - } else { - let (columns, partitioned, after_columns) = if !self - .peek_subquery_start() - { - let columns = self - .parse_parenthesized_column_list(Optional, is_mysql)?; - let partitioned = self.parse_insert_partition()?; - let after_columns = if (self.dialect.is::()) { - self.parse_parenthesized_column_list(Optional, false)? - } else { - ::alloc::vec::Vec::new() - }; - (columns, partitioned, after_columns) - } else { - Default::default() - }; - let (source, assignments) = if self.peek_keyword(Keyword::FORMAT) - || self.peek_keyword(Keyword::SETTINGS) - { - (None, ::alloc::vec::Vec::new()) - } else if self.dialect.supports_insert_set() - && self.parse_keyword(Keyword::SET) - { - (None, self.parse_comma_separated(Parser::parse_assignment)?) - } else { - (Some(self.parse_query()?), ::alloc::vec::Vec::new()) - }; - (columns, partitioned, after_columns, source, assignments) - }; - let (format_clause, settings) = if self.dialect.supports_insert_format() - { - let settings = self.parse_settings()?; - let format = if self.parse_keyword(Keyword::FORMAT) { - Some(self.parse_input_format_clause()?) - } else { - None - }; - (format, settings) - } else { - Default::default() - }; - let insert_alias = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::AS) - { - let row_alias = self.parse_object_name(false)?; - let col_aliases = Some( - self.parse_parenthesized_column_list(Optional, false)?, - ); - Some(InsertAliases { - row_alias, - col_aliases, - }) - } else { - None - }; - let on = if self.parse_keyword(Keyword::ON) { - if self.parse_keyword(Keyword::CONFLICT) { - let conflict_target = if self - .parse_keywords(&[Keyword::ON, Keyword::CONSTRAINT]) - { - Some( - ConflictTarget::OnConstraint(self.parse_object_name(false)?), - ) - } else if self.peek_token() == Token::LParen { - Some( - ConflictTarget::Columns( - self - .parse_parenthesized_column_list( - IsOptional::Mandatory, - false, - )?, - ), - ) - } else { - None - }; - self.expect_keyword_is(Keyword::DO)?; - let action = if self.parse_keyword(Keyword::NOTHING) { - OnConflictAction::DoNothing - } else { - self.expect_keyword_is(Keyword::UPDATE)?; - self.expect_keyword_is(Keyword::SET)?; - let assignments = self - .parse_comma_separated(Parser::parse_assignment)?; - let selection = if self.parse_keyword(Keyword::WHERE) { - Some(self.parse_expr()?) - } else { - None - }; - OnConflictAction::DoUpdate(DoUpdate { - assignments, - selection, - }) - }; - Some( - OnInsert::OnConflict(OnConflict { - conflict_target, - action, - }), - ) - } else { - self.expect_keyword_is(Keyword::DUPLICATE)?; - self.expect_keyword_is(Keyword::KEY)?; - self.expect_keyword_is(Keyword::UPDATE)?; - let l = self.parse_comma_separated(Parser::parse_assignment)?; - Some(OnInsert::DuplicateKeyUpdate(l)) - } - } else { - None - }; - let returning = if self.parse_keyword(Keyword::RETURNING) { - Some(self.parse_comma_separated(Parser::parse_select_item)?) - } else { - None - }; - Ok( - Statement::Insert(Insert { - or, - table: table_object, - table_alias, - ignore, - into, - overwrite, - partitioned, - columns, - after_columns, - source, - assignments, - has_table_keyword: table, - on, - returning, - replace_into, - priority, - insert_alias, - settings, - format_clause, - }), - ) - } - } - pub fn parse_input_format_clause( - &mut self, - ) -> Result { - let ident = self.parse_identifier()?; - let values = self - .maybe_parse(|p| p.parse_comma_separated(|p| p.parse_expr()))? - .unwrap_or_default(); - Ok(InputFormatClause { ident, values }) - } - /// Returns true if the immediate tokens look like the - /// beginning of a subquery. `(SELECT ...` - fn peek_subquery_start(&mut self) -> bool { - let [maybe_lparen, maybe_select] = self.peek_tokens(); - Token::LParen == maybe_lparen - && match maybe_select { - Token::Word(w) if w.keyword == Keyword::SELECT => true, - _ => false, - } - } - fn parse_conflict_clause(&mut self) -> Option { - if self.parse_keywords(&[Keyword::OR, Keyword::REPLACE]) { - Some(SqliteOnConflict::Replace) - } else if self.parse_keywords(&[Keyword::OR, Keyword::ROLLBACK]) { - Some(SqliteOnConflict::Rollback) - } else if self.parse_keywords(&[Keyword::OR, Keyword::ABORT]) { - Some(SqliteOnConflict::Abort) - } else if self.parse_keywords(&[Keyword::OR, Keyword::FAIL]) { - Some(SqliteOnConflict::Fail) - } else if self.parse_keywords(&[Keyword::OR, Keyword::IGNORE]) { - Some(SqliteOnConflict::Ignore) - } else if self.parse_keyword(Keyword::REPLACE) { - Some(SqliteOnConflict::Replace) - } else { - None - } - } - pub fn parse_insert_partition( - &mut self, - ) -> Result>, ParserError> { - if self.parse_keyword(Keyword::PARTITION) { - self.expect_token(&Token::LParen)?; - let partition_cols = Some( - self.parse_comma_separated(Parser::parse_expr)?, - ); - self.expect_token(&Token::RParen)?; - Ok(partition_cols) - } else { - Ok(None) - } - } - pub fn parse_load_data_table_format( - &mut self, - ) -> Result, ParserError> { - if self.parse_keyword(Keyword::INPUTFORMAT) { - let input_format = self.parse_expr()?; - self.expect_keyword_is(Keyword::SERDE)?; - let serde = self.parse_expr()?; - Ok( - Some(HiveLoadDataFormat { - input_format, - serde, - }), - ) - } else { - Ok(None) - } - } - /// Parse an UPDATE statement, returning a `Box`ed SetExpr - /// - /// This is used to reduce the size of the stack frames in debug builds - fn parse_update_setexpr_boxed(&mut self) -> Result, ParserError> { - Ok(Box::new(SetExpr::Update(self.parse_update()?))) - } - pub fn parse_update(&mut self) -> Result { - let or = self.parse_conflict_clause(); - let table = self.parse_table_and_joins()?; - let from_before_set = if self.parse_keyword(Keyword::FROM) { - Some(UpdateTableFromKind::BeforeSet(self.parse_table_with_joins()?)) - } else { - None - }; - self.expect_keyword(Keyword::SET)?; - let assignments = self.parse_comma_separated(Parser::parse_assignment)?; - let from = if from_before_set.is_none() && self.parse_keyword(Keyword::FROM) - { - Some(UpdateTableFromKind::AfterSet(self.parse_table_with_joins()?)) - } else { - from_before_set - }; - let selection = if self.parse_keyword(Keyword::WHERE) { - Some(self.parse_expr()?) - } else { - None - }; - let returning = if self.parse_keyword(Keyword::RETURNING) { - Some(self.parse_comma_separated(Parser::parse_select_item)?) - } else { - None - }; - Ok(Statement::Update { - table, - assignments, - from, - selection, - returning, - or, - }) - } - /// Parse a `var = expr` assignment, used in an UPDATE statement - pub fn parse_assignment(&mut self) -> Result { - let target = self.parse_assignment_target()?; - self.expect_token(&Token::Eq)?; - let value = self.parse_expr()?; - Ok(Assignment { target, value }) - } - /// Parse the left-hand side of an assignment, used in an UPDATE statement - pub fn parse_assignment_target( - &mut self, - ) -> Result { - if self.consume_token(&Token::LParen) { - let columns = self - .parse_comma_separated(|p| p.parse_object_name(false))?; - self.expect_token(&Token::RParen)?; - Ok(AssignmentTarget::Tuple(columns)) - } else { - let column = self.parse_object_name(false)?; - Ok(AssignmentTarget::ColumnName(column)) - } - } - pub fn parse_function_args(&mut self) -> Result { - let arg = if self.dialect.supports_named_fn_args_with_expr_name() { - self.maybe_parse(|p| { - let name = p.parse_expr()?; - let operator = p.parse_function_named_arg_operator()?; - let arg = p.parse_wildcard_expr()?.into(); - Ok(FunctionArg::ExprNamed { - name, - arg, - operator, - }) - })? - } else { - self.maybe_parse(|p| { - let name = p.parse_identifier()?; - let operator = p.parse_function_named_arg_operator()?; - let arg = p.parse_wildcard_expr()?.into(); - Ok(FunctionArg::Named { - name, - arg, - operator, - }) - })? - }; - if let Some(arg) = arg { - return Ok(arg); - } - Ok(FunctionArg::Unnamed(self.parse_wildcard_expr()?.into())) - } - fn parse_function_named_arg_operator( - &mut self, - ) -> Result { - if self.parse_keyword(Keyword::VALUE) { - return Ok(FunctionArgOperator::Value); - } - let tok = self.next_token(); - match tok.token { - Token::RArrow if self - .dialect - .supports_named_fn_args_with_rarrow_operator() => { - Ok(FunctionArgOperator::RightArrow) - } - Token::Eq if self.dialect.supports_named_fn_args_with_eq_operator() => { - Ok(FunctionArgOperator::Equals) - } - Token::Assignment if self - .dialect - .supports_named_fn_args_with_assignment_operator() => { - Ok(FunctionArgOperator::Assignment) - } - Token::Colon if self - .dialect - .supports_named_fn_args_with_colon_operator() => { - Ok(FunctionArgOperator::Colon) - } - _ => { - self.prev_token(); - self.expected("argument operator", tok) - } - } - } - pub fn parse_optional_args(&mut self) -> Result, ParserError> { - if self.consume_token(&Token::RParen) { - Ok(::alloc::vec::Vec::new()) - } else { - let args = self.parse_comma_separated(Parser::parse_function_args)?; - self.expect_token(&Token::RParen)?; - Ok(args) - } - } - fn parse_table_function_args( - &mut self, - ) -> Result { - if self.consume_token(&Token::RParen) { - return Ok(TableFunctionArgs { - args: ::alloc::vec::Vec::new(), - settings: None, - }); - } - let mut args = ::alloc::vec::Vec::new(); - let settings = loop { - if let Some(settings) = self.parse_settings()? { - break Some(settings); - } - args.push(self.parse_function_args()?); - if self.is_parse_comma_separated_end() { - break None; - } - }; - self.expect_token(&Token::RParen)?; - Ok(TableFunctionArgs { - args, - settings, - }) - } - /// Parses a potentially empty list of arguments to a window function - /// (including the closing parenthesis). - /// - /// Examples: - /// ```sql - /// FIRST_VALUE(x ORDER BY 1,2,3); - /// FIRST_VALUE(x IGNORE NULL); - /// ``` - fn parse_function_argument_list( - &mut self, - ) -> Result { - let mut clauses = ::alloc::vec::Vec::new(); - if let Some(null_clause) = self.parse_json_null_clause() { - clauses.push(FunctionArgumentClause::JsonNullClause(null_clause)); - } - if self.consume_token(&Token::RParen) { - return Ok(FunctionArgumentList { - duplicate_treatment: None, - args: ::alloc::vec::Vec::new(), - clauses, - }); - } - let duplicate_treatment = self.parse_duplicate_treatment()?; - let args = self.parse_comma_separated(Parser::parse_function_args)?; - if self.dialect.supports_window_function_null_treatment_arg() { - if let Some(null_treatment) = self.parse_null_treatment()? { - clauses - .push( - FunctionArgumentClause::IgnoreOrRespectNulls(null_treatment), - ); - } - } - if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - clauses - .push( - FunctionArgumentClause::OrderBy( - self.parse_comma_separated(Parser::parse_order_by_expr)?, - ), - ); - } - if self.parse_keyword(Keyword::LIMIT) { - clauses.push(FunctionArgumentClause::Limit(self.parse_expr()?)); - } - if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::HAVING) - { - let kind = match self - .expect_one_of_keywords(&[Keyword::MIN, Keyword::MAX])? - { - Keyword::MIN => HavingBoundKind::Min, - Keyword::MAX => HavingBoundKind::Max, - _ => { - ::core::panicking::panic( - "internal error: entered unreachable code", - ) - } - }; - clauses - .push( - FunctionArgumentClause::Having( - HavingBound(kind, self.parse_expr()?), - ), - ) - } - if (self.dialect.is::() || self.dialect.is::()) - && self.parse_keyword(Keyword::SEPARATOR) - { - clauses.push(FunctionArgumentClause::Separator(self.parse_value()?)); - } - if let Some(on_overflow) = self.parse_listagg_on_overflow()? { - clauses.push(FunctionArgumentClause::OnOverflow(on_overflow)); - } - if let Some(null_clause) = self.parse_json_null_clause() { - clauses.push(FunctionArgumentClause::JsonNullClause(null_clause)); - } - self.expect_token(&Token::RParen)?; - Ok(FunctionArgumentList { - duplicate_treatment, - args, - clauses, - }) - } - /// Parses MSSQL's json-null-clause - fn parse_json_null_clause(&mut self) -> Option { - if self.parse_keywords(&[Keyword::ABSENT, Keyword::ON, Keyword::NULL]) { - Some(JsonNullClause::AbsentOnNull) - } else if self.parse_keywords(&[Keyword::NULL, Keyword::ON, Keyword::NULL]) { - Some(JsonNullClause::NullOnNull) - } else { - None - } - } - fn parse_duplicate_treatment( - &mut self, - ) -> Result, ParserError> { - let loc = self.peek_token().span.start; - match ( - self.parse_keyword(Keyword::ALL), - self.parse_keyword(Keyword::DISTINCT), - ) { - (true, false) => Ok(Some(DuplicateTreatment::All)), - (false, true) => Ok(Some(DuplicateTreatment::Distinct)), - (false, false) => Ok(None), - (true, true) => { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "Cannot specify both ALL and DISTINCT".to_string(), - loc, - ), - ); - res - }), - ), - ) - } - } - } - /// Parse a comma-delimited list of projections after SELECT - pub fn parse_select_item(&mut self) -> Result { - match self.parse_wildcard_expr()? { - Expr::QualifiedWildcard(prefix, token) => { - Ok( - SelectItem::QualifiedWildcard( - SelectItemQualifiedWildcardKind::ObjectName(prefix), - self.parse_wildcard_additional_options(token.0)?, - ), - ) - } - Expr::Wildcard(token) => { - Ok( - SelectItem::Wildcard( - self.parse_wildcard_additional_options(token.0)?, - ), - ) - } - Expr::Identifier( - v, - ) if v.value.to_lowercase() == "from" && v.quote_style.is_none() => { - Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Expected an expression, found: {0}", v), - ); - res - }), - self.peek_token().span.start, - ), - ); - res - }), - ), - ) - } - Expr::BinaryOp { - left, - op: BinaryOperator::Eq, - right, - } if self.dialect.supports_eq_alias_assignment() - && match left.as_ref() { - Expr::Identifier(_) => true, - _ => false, - } => { - let Expr::Identifier(alias) = *left else { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "{0}{1}", - "BUG: expected identifier expression as alias", - self.peek_token().span.start, - ), - ); - res - }), - ), - ); - }; - Ok(SelectItem::ExprWithAlias { - expr: *right, - alias, - }) - } - expr if self.dialect.supports_select_expr_star() - && self.consume_tokens(&[Token::Period, Token::Mul]) => { - let wildcard_token = self.get_previous_token().clone(); - Ok( - SelectItem::QualifiedWildcard( - SelectItemQualifiedWildcardKind::Expr(expr), - self.parse_wildcard_additional_options(wildcard_token)?, - ), - ) - } - expr => { - self.maybe_parse_select_item_alias() - .map(|alias| match alias { - Some(alias) => { - SelectItem::ExprWithAlias { - expr, - alias, - } - } - None => SelectItem::UnnamedExpr(expr), - }) - } - } - } - /// Parse an [`WildcardAdditionalOptions`] information for wildcard select items. - /// - /// If it is not possible to parse it, will return an option. - pub fn parse_wildcard_additional_options( - &mut self, - wildcard_token: TokenWithSpan, - ) -> Result { - let opt_ilike = if (self.dialect.is::() - || self.dialect.is::()) - { - self.parse_optional_select_item_ilike()? - } else { - None - }; - let opt_exclude = if opt_ilike.is_none() - && (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - { - self.parse_optional_select_item_exclude()? - } else { - None - }; - let opt_except = if self.dialect.supports_select_wildcard_except() { - self.parse_optional_select_item_except()? - } else { - None - }; - let opt_replace = if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) - { - self.parse_optional_select_item_replace()? - } else { - None - }; - let opt_rename = if (self.dialect.is::() - || self.dialect.is::()) - { - self.parse_optional_select_item_rename()? - } else { - None - }; - Ok(WildcardAdditionalOptions { - wildcard_token: wildcard_token.into(), - opt_ilike, - opt_exclude, - opt_except, - opt_rename, - opt_replace, - }) - } - /// Parse an [`Ilike`](IlikeSelectItem) information for wildcard select items. - /// - /// If it is not possible to parse it, will return an option. - pub fn parse_optional_select_item_ilike( - &mut self, - ) -> Result, ParserError> { - let opt_ilike = if self.parse_keyword(Keyword::ILIKE) { - let next_token = self.next_token(); - let pattern = match next_token.token { - Token::SingleQuotedString(s) => s, - _ => return self.expected("ilike pattern", next_token), - }; - Some(IlikeSelectItem { pattern }) - } else { - None - }; - Ok(opt_ilike) - } - /// Parse an [`Exclude`](ExcludeSelectItem) information for wildcard select items. - /// - /// If it is not possible to parse it, will return an option. - pub fn parse_optional_select_item_exclude( - &mut self, - ) -> Result, ParserError> { - let opt_exclude = if self.parse_keyword(Keyword::EXCLUDE) { - if self.consume_token(&Token::LParen) { - let columns = self - .parse_comma_separated(|parser| parser.parse_identifier())?; - self.expect_token(&Token::RParen)?; - Some(ExcludeSelectItem::Multiple(columns)) - } else { - let column = self.parse_identifier()?; - Some(ExcludeSelectItem::Single(column)) - } - } else { - None - }; - Ok(opt_exclude) - } - /// Parse an [`Except`](ExceptSelectItem) information for wildcard select items. - /// - /// If it is not possible to parse it, will return an option. - pub fn parse_optional_select_item_except( - &mut self, - ) -> Result, ParserError> { - let opt_except = if self.parse_keyword(Keyword::EXCEPT) { - if self.peek_token().token == Token::LParen { - let idents = self.parse_parenthesized_column_list(Mandatory, false)?; - match &idents[..] { - [] => { - return self - .expected( - "at least one column should be parsed by the expect clause", - self.peek_token(), - )?; - } - [first, idents @ ..] => { - Some(ExceptSelectItem { - first_element: first.clone(), - additional_elements: idents.to_vec(), - }) - } - } - } else { - let ident = self.parse_identifier()?; - Some(ExceptSelectItem { - first_element: ident, - additional_elements: ::alloc::vec::Vec::new(), - }) - } - } else { - None - }; - Ok(opt_except) - } - /// Parse a [`Rename`](RenameSelectItem) information for wildcard select items. - pub fn parse_optional_select_item_rename( - &mut self, - ) -> Result, ParserError> { - let opt_rename = if self.parse_keyword(Keyword::RENAME) { - if self.consume_token(&Token::LParen) { - let idents = self - .parse_comma_separated(|parser| { - parser.parse_identifier_with_alias() - })?; - self.expect_token(&Token::RParen)?; - Some(RenameSelectItem::Multiple(idents)) - } else { - let ident = self.parse_identifier_with_alias()?; - Some(RenameSelectItem::Single(ident)) - } - } else { - None - }; - Ok(opt_rename) - } - /// Parse a [`Replace`](ReplaceSelectItem) information for wildcard select items. - pub fn parse_optional_select_item_replace( - &mut self, - ) -> Result, ParserError> { - let opt_replace = if self.parse_keyword(Keyword::REPLACE) { - if self.consume_token(&Token::LParen) { - let items = self - .parse_comma_separated(|parser| { - Ok(Box::new(parser.parse_replace_elements()?)) - })?; - self.expect_token(&Token::RParen)?; - Some(ReplaceSelectItem { items }) - } else { - let tok = self.next_token(); - return self.expected("( after REPLACE but", tok); - } - } else { - None - }; - Ok(opt_replace) - } - pub fn parse_replace_elements( - &mut self, - ) -> Result { - let expr = self.parse_expr()?; - let as_keyword = self.parse_keyword(Keyword::AS); - let ident = self.parse_identifier()?; - Ok(ReplaceSelectElement { - expr, - column_name: ident, - as_keyword, - }) - } - /// Parse ASC or DESC, returns an Option with true if ASC, false of DESC or `None` if none of - /// them. - pub fn parse_asc_desc(&mut self) -> Option { - if self.parse_keyword(Keyword::ASC) { - Some(true) - } else if self.parse_keyword(Keyword::DESC) { - Some(false) - } else { - None - } - } - /// Parse an expression, optionally followed by ASC or DESC (used in ORDER BY) - pub fn parse_order_by_expr(&mut self) -> Result { - let expr = self.parse_expr()?; - let asc = self.parse_asc_desc(); - let nulls_first = if self.parse_keywords(&[Keyword::NULLS, Keyword::FIRST]) { - Some(true) - } else if self.parse_keywords(&[Keyword::NULLS, Keyword::LAST]) { - Some(false) - } else { - None - }; - let with_fill = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::WITH, Keyword::FILL]) - { - Some(self.parse_with_fill()?) - } else { - None - }; - Ok(OrderByExpr { - expr, - asc, - nulls_first, - with_fill, - }) - } - /// Parse an expression, optionally followed by ASC or DESC (used in ORDER BY) - pub fn parse_create_index_expr( - &mut self, - ) -> Result { - let expr = self.parse_expr()?; - let operator_class: Option = self - .parse_one_of_keywords(OPS::KEYWORDS) - .map(Into::into); - let asc = self.parse_asc_desc(); - let nulls_first = if self.parse_keywords(&[Keyword::NULLS, Keyword::FIRST]) { - Some(true) - } else if self.parse_keywords(&[Keyword::NULLS, Keyword::LAST]) { - Some(false) - } else { - None - }; - let with_fill = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keywords(&[Keyword::WITH, Keyword::FILL]) - { - Some(self.parse_with_fill()?) - } else { - None - }; - Ok(IndexColumn { - column: OrderByExpr { - expr, - asc, - nulls_first, - with_fill, - }, - operator_class: operator_class.map(Into::into), - }) - } - pub fn parse_with_fill(&mut self) -> Result { - let from = if self.parse_keyword(Keyword::FROM) { - Some(self.parse_expr()?) - } else { - None - }; - let to = if self.parse_keyword(Keyword::TO) { - Some(self.parse_expr()?) - } else { - None - }; - let step = if self.parse_keyword(Keyword::STEP) { - Some(self.parse_expr()?) - } else { - None - }; - Ok(WithFill { from, to, step }) - } - pub fn parse_interpolations( - &mut self, - ) -> Result, ParserError> { - if !self.parse_keyword(Keyword::INTERPOLATE) { - return Ok(None); - } - if self.consume_token(&Token::LParen) { - let interpolations = self - .parse_comma_separated0(|p| p.parse_interpolation(), Token::RParen)?; - self.expect_token(&Token::RParen)?; - return Ok( - Some(Interpolate { - exprs: Some(interpolations), - }), - ); - } - Ok(Some(Interpolate { exprs: None })) - } - pub fn parse_interpolation(&mut self) -> Result { - let column = self.parse_identifier()?; - let expr = if self.parse_keyword(Keyword::AS) { - Some(self.parse_expr()?) - } else { - None - }; - Ok(InterpolateExpr { column, expr }) - } - /// Parse a TOP clause, MSSQL equivalent of LIMIT, - /// that follows after `SELECT [DISTINCT]`. - pub fn parse_top(&mut self) -> Result { - let quantity = if self.consume_token(&Token::LParen) { - let quantity = self.parse_expr()?; - self.expect_token(&Token::RParen)?; - Some(TopQuantity::Expr(quantity)) - } else { - let next_token = self.next_token(); - let quantity = match next_token.token { - Token::Number(s, _) => Self::parse::(s, next_token.span.start)?, - _ => self.expected("literal int", next_token)?, - }; - Some(TopQuantity::Constant(quantity)) - }; - let percent = self.parse_keyword(Keyword::PERCENT); - let with_ties = self.parse_keywords(&[Keyword::WITH, Keyword::TIES]); - Ok(Top { - with_ties, - percent, - quantity, - }) - } - /// Parse a LIMIT clause - pub fn parse_limit(&mut self) -> Result, ParserError> { - if self.parse_keyword(Keyword::ALL) { - Ok(None) - } else { - Ok(Some(self.parse_expr()?)) - } - } - /// Parse an OFFSET clause - pub fn parse_offset(&mut self) -> Result { - let value = self.parse_expr()?; - let rows = if self.parse_keyword(Keyword::ROW) { - OffsetRows::Row - } else if self.parse_keyword(Keyword::ROWS) { - OffsetRows::Rows - } else { - OffsetRows::None - }; - Ok(Offset { value, rows }) - } - /// Parse a FETCH clause - pub fn parse_fetch(&mut self) -> Result { - self.expect_one_of_keywords(&[Keyword::FIRST, Keyword::NEXT])?; - let (quantity, percent) = if self - .parse_one_of_keywords(&[Keyword::ROW, Keyword::ROWS]) - .is_some() - { - (None, false) - } else { - let quantity = Expr::Value(self.parse_value()?); - let percent = self.parse_keyword(Keyword::PERCENT); - self.expect_one_of_keywords(&[Keyword::ROW, Keyword::ROWS])?; - (Some(quantity), percent) - }; - let with_ties = if self.parse_keyword(Keyword::ONLY) { - false - } else if self.parse_keywords(&[Keyword::WITH, Keyword::TIES]) { - true - } else { - return self.expected("one of ONLY or WITH TIES", self.peek_token()); - }; - Ok(Fetch { - with_ties, - percent, - quantity, - }) - } - /// Parse a FOR UPDATE/FOR SHARE clause - pub fn parse_lock(&mut self) -> Result { - let lock_type = match self - .expect_one_of_keywords(&[Keyword::UPDATE, Keyword::SHARE])? - { - Keyword::UPDATE => LockType::Update, - Keyword::SHARE => LockType::Share, - _ => ::core::panicking::panic("internal error: entered unreachable code"), - }; - let of = if self.parse_keyword(Keyword::OF) { - Some(self.parse_object_name(false)?) - } else { - None - }; - let nonblock = if self.parse_keyword(Keyword::NOWAIT) { - Some(NonBlock::Nowait) - } else if self.parse_keywords(&[Keyword::SKIP, Keyword::LOCKED]) { - Some(NonBlock::SkipLocked) - } else { - None - }; - Ok(LockClause { - lock_type, - of, - nonblock, - }) - } - pub fn parse_values( - &mut self, - allow_empty: bool, - ) -> Result { - let mut explicit_row = false; - let rows = self - .parse_comma_separated(|parser| { - if parser.parse_keyword(Keyword::ROW) { - explicit_row = true; - } - parser.expect_token(&Token::LParen)?; - if allow_empty && parser.peek_token().token == Token::RParen { - parser.next_token(); - Ok(::alloc::vec::Vec::new()) - } else { - let exprs = parser.parse_comma_separated(Parser::parse_expr)?; - parser.expect_token(&Token::RParen)?; - Ok(exprs) - } - })?; - Ok(Values { explicit_row, rows }) - } - pub fn parse_start_transaction(&mut self) -> Result { - self.expect_keyword_is(Keyword::TRANSACTION)?; - Ok(Statement::StartTransaction { - modes: self.parse_transaction_modes()?, - begin: false, - transaction: Some(BeginTransactionKind::Transaction), - modifier: None, - }) - } - pub fn parse_begin(&mut self) -> Result { - let modifier = if !self.dialect.supports_start_transaction_modifier() { - None - } else if self.parse_keyword(Keyword::DEFERRED) { - Some(TransactionModifier::Deferred) - } else if self.parse_keyword(Keyword::IMMEDIATE) { - Some(TransactionModifier::Immediate) - } else if self.parse_keyword(Keyword::EXCLUSIVE) { - Some(TransactionModifier::Exclusive) - } else if self.parse_keyword(Keyword::TRY) { - Some(TransactionModifier::Try) - } else if self.parse_keyword(Keyword::CATCH) { - Some(TransactionModifier::Catch) - } else { - None - }; - let transaction = match self - .parse_one_of_keywords(&[Keyword::TRANSACTION, Keyword::WORK]) - { - Some(Keyword::TRANSACTION) => Some(BeginTransactionKind::Transaction), - Some(Keyword::WORK) => Some(BeginTransactionKind::Work), - _ => None, - }; - Ok(Statement::StartTransaction { - modes: self.parse_transaction_modes()?, - begin: true, - transaction, - modifier, - }) - } - pub fn parse_end(&mut self) -> Result { - let modifier = if !self.dialect.supports_end_transaction_modifier() { - None - } else if self.parse_keyword(Keyword::TRY) { - Some(TransactionModifier::Try) - } else if self.parse_keyword(Keyword::CATCH) { - Some(TransactionModifier::Catch) - } else { - None - }; - Ok(Statement::Commit { - chain: self.parse_commit_rollback_chain()?, - end: true, - modifier, - }) - } - pub fn parse_transaction_modes( - &mut self, - ) -> Result, ParserError> { - let mut modes = ::alloc::vec::Vec::new(); - let mut required = false; - loop { - let mode = if self.parse_keywords(&[Keyword::ISOLATION, Keyword::LEVEL]) - { - let iso_level = if self - .parse_keywords(&[Keyword::READ, Keyword::UNCOMMITTED]) - { - TransactionIsolationLevel::ReadUncommitted - } else if self.parse_keywords(&[Keyword::READ, Keyword::COMMITTED]) { - TransactionIsolationLevel::ReadCommitted - } else if self.parse_keywords(&[Keyword::REPEATABLE, Keyword::READ]) - { - TransactionIsolationLevel::RepeatableRead - } else if self.parse_keyword(Keyword::SERIALIZABLE) { - TransactionIsolationLevel::Serializable - } else if self.parse_keyword(Keyword::SNAPSHOT) { - TransactionIsolationLevel::Snapshot - } else { - self.expected("isolation level", self.peek_token())? - }; - TransactionMode::IsolationLevel(iso_level) - } else if self.parse_keywords(&[Keyword::READ, Keyword::ONLY]) { - TransactionMode::AccessMode(TransactionAccessMode::ReadOnly) - } else if self.parse_keywords(&[Keyword::READ, Keyword::WRITE]) { - TransactionMode::AccessMode(TransactionAccessMode::ReadWrite) - } else if required { - self.expected("transaction mode", self.peek_token())? - } else { - break; - }; - modes.push(mode); - required = self.consume_token(&Token::Comma); - } - Ok(modes) - } - pub fn parse_commit(&mut self) -> Result { - Ok(Statement::Commit { - chain: self.parse_commit_rollback_chain()?, - end: false, - modifier: None, - }) - } - pub fn parse_rollback(&mut self) -> Result { - let chain = self.parse_commit_rollback_chain()?; - let savepoint = self.parse_rollback_savepoint()?; - Ok(Statement::Rollback { - chain, - savepoint, - }) - } - pub fn parse_commit_rollback_chain(&mut self) -> Result { - let _ = self.parse_one_of_keywords(&[Keyword::TRANSACTION, Keyword::WORK]); - if self.parse_keyword(Keyword::AND) { - let chain = !self.parse_keyword(Keyword::NO); - self.expect_keyword_is(Keyword::CHAIN)?; - Ok(chain) - } else { - Ok(false) - } - } - pub fn parse_rollback_savepoint( - &mut self, - ) -> Result, ParserError> { - if self.parse_keyword(Keyword::TO) { - let _ = self.parse_keyword(Keyword::SAVEPOINT); - let savepoint = self.parse_identifier()?; - Ok(Some(savepoint)) - } else { - Ok(None) - } - } - /// Parse a 'RAISERROR' statement - pub fn parse_raiserror(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let message = Box::new(self.parse_expr()?); - self.expect_token(&Token::Comma)?; - let severity = Box::new(self.parse_expr()?); - self.expect_token(&Token::Comma)?; - let state = Box::new(self.parse_expr()?); - let arguments = if self.consume_token(&Token::Comma) { - self.parse_comma_separated(Parser::parse_expr)? - } else { - ::alloc::vec::Vec::new() - }; - self.expect_token(&Token::RParen)?; - let options = if self.parse_keyword(Keyword::WITH) { - self.parse_comma_separated(Parser::parse_raiserror_option)? - } else { - ::alloc::vec::Vec::new() - }; - Ok(Statement::RaisError { - message, - severity, - state, - arguments, - options, - }) - } - pub fn parse_raiserror_option( - &mut self, - ) -> Result { - match self - .expect_one_of_keywords( - &[Keyword::LOG, Keyword::NOWAIT, Keyword::SETERROR], - )? - { - Keyword::LOG => Ok(RaisErrorOption::Log), - Keyword::NOWAIT => Ok(RaisErrorOption::NoWait), - Keyword::SETERROR => Ok(RaisErrorOption::SetError), - _ => { - self.expected( - "LOG, NOWAIT OR SETERROR raiserror option", - self.peek_token(), - ) - } - } - } - pub fn parse_deallocate(&mut self) -> Result { - let prepare = self.parse_keyword(Keyword::PREPARE); - let name = self.parse_identifier()?; - Ok(Statement::Deallocate { - name, - prepare, - }) - } - pub fn parse_execute(&mut self) -> Result { - let name = self.parse_object_name(false)?; - let has_parentheses = self.consume_token(&Token::LParen); - let end_token = match (has_parentheses, self.peek_token().token) { - (true, _) => Token::RParen, - (false, Token::EOF) => Token::EOF, - (false, Token::Word(w)) if w.keyword == Keyword::USING => Token::Word(w), - (false, _) => Token::SemiColon, - }; - let parameters = self.parse_comma_separated0(Parser::parse_expr, end_token)?; - if has_parentheses { - self.expect_token(&Token::RParen)?; - } - let mut using = ::alloc::vec::Vec::new(); - if self.parse_keyword(Keyword::USING) { - using.push(self.parse_expr()?); - while self.consume_token(&Token::Comma) { - using.push(self.parse_expr()?); - } - } - Ok(Statement::Execute { - name, - parameters, - has_parentheses, - using, - }) - } - pub fn parse_prepare(&mut self) -> Result { - let name = self.parse_identifier()?; - let mut data_types = ::alloc::vec::Vec::new(); - if self.consume_token(&Token::LParen) { - data_types = self.parse_comma_separated(Parser::parse_data_type)?; - self.expect_token(&Token::RParen)?; - } - self.expect_keyword_is(Keyword::AS)?; - let statement = Box::new(self.parse_statement()?); - Ok(Statement::Prepare { - name, - data_types, - statement, - }) - } - pub fn parse_unload(&mut self) -> Result { - self.expect_token(&Token::LParen)?; - let query = self.parse_query()?; - self.expect_token(&Token::RParen)?; - self.expect_keyword_is(Keyword::TO)?; - let to = self.parse_identifier()?; - let with_options = self.parse_options(Keyword::WITH)?; - Ok(Statement::Unload { - query, - to, - with: with_options, - }) - } - pub fn parse_merge_clauses(&mut self) -> Result, ParserError> { - let mut clauses = ::alloc::vec::Vec::new(); - loop { - if self.peek_token() == Token::EOF - || self.peek_token() == Token::SemiColon - { - break; - } - self.expect_keyword_is(Keyword::WHEN)?; - let mut clause_kind = MergeClauseKind::Matched; - if self.parse_keyword(Keyword::NOT) { - clause_kind = MergeClauseKind::NotMatched; - } - self.expect_keyword_is(Keyword::MATCHED)?; - if match clause_kind { - MergeClauseKind::NotMatched => true, - _ => false, - } && self.parse_keywords(&[Keyword::BY, Keyword::SOURCE]) - { - clause_kind = MergeClauseKind::NotMatchedBySource; - } else if match clause_kind { - MergeClauseKind::NotMatched => true, - _ => false, - } && self.parse_keywords(&[Keyword::BY, Keyword::TARGET]) - { - clause_kind = MergeClauseKind::NotMatchedByTarget; - } - let predicate = if self.parse_keyword(Keyword::AND) { - Some(self.parse_expr()?) - } else { - None - }; - self.expect_keyword_is(Keyword::THEN)?; - let merge_clause = match self - .parse_one_of_keywords( - &[Keyword::UPDATE, Keyword::INSERT, Keyword::DELETE], - ) - { - Some(Keyword::UPDATE) => { - if match clause_kind { - MergeClauseKind::NotMatched - | MergeClauseKind::NotMatchedByTarget => true, - _ => false, - } { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "UPDATE is not allowed in a {0} merge clause", - clause_kind, - ), - ); - res - }), - ), - ); - } - self.expect_keyword_is(Keyword::SET)?; - MergeAction::Update { - assignments: self - .parse_comma_separated(Parser::parse_assignment)?, - } - } - Some(Keyword::DELETE) => { - if match clause_kind { - MergeClauseKind::NotMatched - | MergeClauseKind::NotMatchedByTarget => true, - _ => false, - } { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "DELETE is not allowed in a {0} merge clause", - clause_kind, - ), - ); - res - }), - ), - ); - } - MergeAction::Delete - } - Some(Keyword::INSERT) => { - if !match clause_kind { - MergeClauseKind::NotMatched - | MergeClauseKind::NotMatchedByTarget => true, - _ => false, - } { - return Err( - ParserError::ParserError( - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "INSERT is not allowed in a {0} merge clause", - clause_kind, - ), - ); - res - }), - ), - ); - } - let is_mysql = (self.dialect.is::()); - let columns = self - .parse_parenthesized_column_list(Optional, is_mysql)?; - let kind = if (self.dialect.is::() - || self.dialect.is::()) - && self.parse_keyword(Keyword::ROW) - { - MergeInsertKind::Row - } else { - self.expect_keyword_is(Keyword::VALUES)?; - let values = self.parse_values(is_mysql)?; - MergeInsertKind::Values(values) - }; - MergeAction::Insert(MergeInsertExpr { columns, kind }) - } - _ => { - return Err( - ParserError::ParserError( - "expected UPDATE, DELETE or INSERT in merge clause" - .to_string(), - ), - ); - } - }; - clauses - .push(MergeClause { - clause_kind, - predicate, - action: merge_clause, - }); - } - Ok(clauses) - } - pub fn parse_merge(&mut self) -> Result { - let into = self.parse_keyword(Keyword::INTO); - let table = self.parse_table_factor()?; - self.expect_keyword_is(Keyword::USING)?; - let source = self.parse_table_factor()?; - self.expect_keyword_is(Keyword::ON)?; - let on = self.parse_expr()?; - let clauses = self.parse_merge_clauses()?; - Ok(Statement::Merge { - into, - table, - source, - on: Box::new(on), - clauses, - }) - } - fn parse_pragma_value(&mut self) -> Result { - match self.parse_value()? { - v @ Value::SingleQuotedString(_) => Ok(v), - v @ Value::DoubleQuotedString(_) => Ok(v), - v @ Value::Number(_, _) => Ok(v), - v @ Value::Placeholder(_) => Ok(v), - _ => { - self.prev_token(); - self.expected("number or string or ? placeholder", self.peek_token()) - } - } - } - pub fn parse_pragma(&mut self) -> Result { - let name = self.parse_object_name(false)?; - if self.consume_token(&Token::LParen) { - let value = self.parse_pragma_value()?; - self.expect_token(&Token::RParen)?; - Ok(Statement::Pragma { - name, - value: Some(value), - is_eq: false, - }) - } else if self.consume_token(&Token::Eq) { - Ok(Statement::Pragma { - name, - value: Some(self.parse_pragma_value()?), - is_eq: true, - }) - } else { - Ok(Statement::Pragma { - name, - value: None, - is_eq: false, - }) - } - } - /// `INSTALL [extension_name]` - pub fn parse_install(&mut self) -> Result { - let extension_name = self.parse_identifier()?; - Ok(Statement::Install { - extension_name, - }) - } - /// Parse a SQL LOAD statement - pub fn parse_load(&mut self) -> Result { - if self.dialect.supports_load_extension() { - let extension_name = self.parse_identifier()?; - Ok(Statement::Load { extension_name }) - } else if self.parse_keyword(Keyword::DATA) - && self.dialect.supports_load_data() - { - let local = self.parse_one_of_keywords(&[Keyword::LOCAL]).is_some(); - self.expect_keyword_is(Keyword::INPATH)?; - let inpath = self.parse_literal_string()?; - let overwrite = self - .parse_one_of_keywords(&[Keyword::OVERWRITE]) - .is_some(); - self.expect_keyword_is(Keyword::INTO)?; - self.expect_keyword_is(Keyword::TABLE)?; - let table_name = self.parse_object_name(false)?; - let partitioned = self.parse_insert_partition()?; - let table_format = self.parse_load_data_table_format()?; - Ok(Statement::LoadData { - local, - inpath, - overwrite, - table_name, - partitioned, - table_format, - }) - } else { - self.expected( - "`DATA` or an extension name after `LOAD`", - self.peek_token(), - ) - } - } - /// ```sql - /// OPTIMIZE TABLE [db.]name [ON CLUSTER cluster] [PARTITION partition | PARTITION ID 'partition_id'] [FINAL] [DEDUPLICATE [BY expression]] - /// ``` - /// [ClickHouse](https://clickhouse.com/docs/en/sql-reference/statements/optimize) - pub fn parse_optimize_table(&mut self) -> Result { - self.expect_keyword_is(Keyword::TABLE)?; - let name = self.parse_object_name(false)?; - let on_cluster = self.parse_optional_on_cluster()?; - let partition = if self.parse_keyword(Keyword::PARTITION) { - if self.parse_keyword(Keyword::ID) { - Some(Partition::Identifier(self.parse_identifier()?)) - } else { - Some(Partition::Expr(self.parse_expr()?)) - } - } else { - None - }; - let include_final = self.parse_keyword(Keyword::FINAL); - let deduplicate = if self.parse_keyword(Keyword::DEDUPLICATE) { - if self.parse_keyword(Keyword::BY) { - Some(Deduplicate::ByExpression(self.parse_expr()?)) - } else { - Some(Deduplicate::All) - } - } else { - None - }; - Ok(Statement::OptimizeTable { - name, - on_cluster, - partition, - include_final, - deduplicate, - }) - } - /// ```sql - /// CREATE [ { TEMPORARY | TEMP } ] SEQUENCE [ IF NOT EXISTS ] - /// ``` - /// - /// See [Postgres docs](https://www.postgresql.org/docs/current/sql-createsequence.html) for more details. - pub fn parse_create_sequence( - &mut self, - temporary: bool, - ) -> Result { - let if_not_exists = self - .parse_keywords(&[Keyword::IF, Keyword::NOT, Keyword::EXISTS]); - let name = self.parse_object_name(false)?; - let mut data_type: Option = None; - if self.parse_keywords(&[Keyword::AS]) { - data_type = Some(self.parse_data_type()?); - } - let sequence_options = self.parse_create_sequence_options()?; - let owned_by = if self.parse_keywords(&[Keyword::OWNED, Keyword::BY]) { - if self.parse_keywords(&[Keyword::NONE]) { - Some( - ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Ident::new("NONE")]), - ), - ), - ) - } else { - Some(self.parse_object_name(false)?) - } - } else { - None - }; - Ok(Statement::CreateSequence { - temporary, - if_not_exists, - name, - data_type, - sequence_options, - owned_by, - }) - } - fn parse_create_sequence_options( - &mut self, - ) -> Result, ParserError> { - let mut sequence_options = ::alloc::vec::Vec::new(); - if self.parse_keywords(&[Keyword::INCREMENT]) { - if self.parse_keywords(&[Keyword::BY]) { - sequence_options - .push(SequenceOptions::IncrementBy(self.parse_number()?, true)); - } else { - sequence_options - .push(SequenceOptions::IncrementBy(self.parse_number()?, false)); - } - } - if self.parse_keyword(Keyword::MINVALUE) { - sequence_options - .push(SequenceOptions::MinValue(Some(self.parse_number()?))); - } else if self.parse_keywords(&[Keyword::NO, Keyword::MINVALUE]) { - sequence_options.push(SequenceOptions::MinValue(None)); - } - if self.parse_keywords(&[Keyword::MAXVALUE]) { - sequence_options - .push(SequenceOptions::MaxValue(Some(self.parse_number()?))); - } else if self.parse_keywords(&[Keyword::NO, Keyword::MAXVALUE]) { - sequence_options.push(SequenceOptions::MaxValue(None)); - } - if self.parse_keywords(&[Keyword::START]) { - if self.parse_keywords(&[Keyword::WITH]) { - sequence_options - .push(SequenceOptions::StartWith(self.parse_number()?, true)); - } else { - sequence_options - .push(SequenceOptions::StartWith(self.parse_number()?, false)); - } - } - if self.parse_keywords(&[Keyword::CACHE]) { - sequence_options.push(SequenceOptions::Cache(self.parse_number()?)); - } - if self.parse_keywords(&[Keyword::NO, Keyword::CYCLE]) { - sequence_options.push(SequenceOptions::Cycle(true)); - } else if self.parse_keywords(&[Keyword::CYCLE]) { - sequence_options.push(SequenceOptions::Cycle(false)); - } - Ok(sequence_options) - } - /// The index of the first unprocessed token. - pub fn index(&self) -> usize { - self.index - } - pub fn parse_named_window( - &mut self, - ) -> Result { - let ident = self.parse_identifier()?; - self.expect_keyword_is(Keyword::AS)?; - let window_expr = if self.consume_token(&Token::LParen) { - NamedWindowExpr::WindowSpec(self.parse_window_spec()?) - } else if self.dialect.supports_window_clause_named_window_reference() { - NamedWindowExpr::NamedWindow(self.parse_identifier()?) - } else { - return self.expected("(", self.peek_token()); - }; - Ok(NamedWindowDefinition(ident, window_expr)) - } - pub fn parse_create_procedure( - &mut self, - or_alter: bool, - ) -> Result { - let name = self.parse_object_name(false)?; - let params = self.parse_optional_procedure_parameters()?; - self.expect_keyword_is(Keyword::AS)?; - self.expect_keyword_is(Keyword::BEGIN)?; - let statements = self.parse_statements()?; - self.expect_keyword_is(Keyword::END)?; - Ok(Statement::CreateProcedure { - name, - or_alter, - params, - body: statements, - }) - } - pub fn parse_window_spec(&mut self) -> Result { - let window_name = match self.peek_token().token { - Token::Word(word) if word.keyword == Keyword::NoKeyword => { - self.parse_optional_indent()? - } - _ => None, - }; - let partition_by = if self.parse_keywords(&[Keyword::PARTITION, Keyword::BY]) - { - self.parse_comma_separated(Parser::parse_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let order_by = if self.parse_keywords(&[Keyword::ORDER, Keyword::BY]) { - self.parse_comma_separated(Parser::parse_order_by_expr)? - } else { - ::alloc::vec::Vec::new() - }; - let window_frame = if !self.consume_token(&Token::RParen) { - let window_frame = self.parse_window_frame()?; - self.expect_token(&Token::RParen)?; - Some(window_frame) - } else { - None - }; - Ok(WindowSpec { - window_name, - partition_by, - order_by, - window_frame, - }) - } - pub fn parse_create_type(&mut self) -> Result { - let name = self.parse_object_name(false)?; - self.expect_keyword_is(Keyword::AS)?; - let mut attributes = ::alloc::vec::Vec::new(); - if !self.consume_token(&Token::LParen) || self.consume_token(&Token::RParen) - { - return Ok(Statement::CreateType { - name, - representation: UserDefinedTypeRepresentation::Composite { - attributes, - }, - }); - } - loop { - let attr_name = self.parse_identifier()?; - let attr_data_type = self.parse_data_type()?; - let attr_collation = if self.parse_keyword(Keyword::COLLATE) { - Some(self.parse_object_name(false)?) - } else { - None - }; - attributes - .push(UserDefinedTypeCompositeAttributeDef { - name: attr_name, - data_type: attr_data_type, - collation: attr_collation, - }); - let comma = self.consume_token(&Token::Comma); - if self.consume_token(&Token::RParen) { - break; - } else if !comma { - return self - .expected( - "',' or ')' after attribute definition", - self.peek_token(), - ); - } - } - Ok(Statement::CreateType { - name, - representation: UserDefinedTypeRepresentation::Composite { - attributes, - }, - }) - } - fn parse_parenthesized_identifiers( - &mut self, - ) -> Result, ParserError> { - self.expect_token(&Token::LParen)?; - let partitions = self.parse_comma_separated(|p| p.parse_identifier())?; - self.expect_token(&Token::RParen)?; - Ok(partitions) - } - fn parse_column_position( - &mut self, - ) -> Result, ParserError> { - if (self.dialect.is::() || self.dialect.is::()) - { - if self.parse_keyword(Keyword::FIRST) { - Ok(Some(MySQLColumnPosition::First)) - } else if self.parse_keyword(Keyword::AFTER) { - let ident = self.parse_identifier()?; - Ok(Some(MySQLColumnPosition::After(ident))) - } else { - Ok(None) - } - } else { - Ok(None) - } - } - /// Consume the parser and return its underlying token buffer - pub fn into_tokens(self) -> Vec { - self.tokens - } - /// Returns true if the next keyword indicates a sub query, i.e. SELECT or WITH - fn peek_sub_query(&mut self) -> bool { - if self.parse_one_of_keywords(&[Keyword::SELECT, Keyword::WITH]).is_some() { - self.prev_token(); - return true; - } - false - } - fn parse_show_stmt_options( - &mut self, - ) -> Result { - let show_in; - let mut filter_position = None; - if self.dialect.supports_show_like_before_in() { - if let Some(filter) = self.parse_show_statement_filter()? { - filter_position = Some(ShowStatementFilterPosition::Infix(filter)); - } - show_in = self.maybe_parse_show_stmt_in()?; - } else { - show_in = self.maybe_parse_show_stmt_in()?; - if let Some(filter) = self.parse_show_statement_filter()? { - filter_position = Some(ShowStatementFilterPosition::Suffix(filter)); - } - } - let starts_with = self.maybe_parse_show_stmt_starts_with()?; - let limit = self.maybe_parse_show_stmt_limit()?; - let from = self.maybe_parse_show_stmt_from()?; - Ok(ShowStatementOptions { - filter_position, - show_in, - starts_with, - limit, - limit_from: from, - }) - } - fn maybe_parse_show_stmt_in( - &mut self, - ) -> Result, ParserError> { - let clause = match self.parse_one_of_keywords(&[Keyword::FROM, Keyword::IN]) - { - Some(Keyword::FROM) => ShowStatementInClause::FROM, - Some(Keyword::IN) => ShowStatementInClause::IN, - None => return Ok(None), - _ => return self.expected("FROM or IN", self.peek_token()), - }; - let (parent_type, parent_name) = match self - .parse_one_of_keywords( - &[ - Keyword::ACCOUNT, - Keyword::DATABASE, - Keyword::SCHEMA, - Keyword::TABLE, - Keyword::VIEW, - ], - ) - { - Some( - Keyword::DATABASE, - ) if self.peek_keywords(&[Keyword::STARTS, Keyword::WITH]) - | self.peek_keyword(Keyword::LIMIT) => { - (Some(ShowStatementInParentType::Database), None) - } - Some( - Keyword::SCHEMA, - ) if self.peek_keywords(&[Keyword::STARTS, Keyword::WITH]) - | self.peek_keyword(Keyword::LIMIT) => { - (Some(ShowStatementInParentType::Schema), None) - } - Some(parent_kw) => { - let parent_name = self.maybe_parse(|p| p.parse_object_name(false))?; - match parent_kw { - Keyword::ACCOUNT => { - (Some(ShowStatementInParentType::Account), parent_name) - } - Keyword::DATABASE => { - (Some(ShowStatementInParentType::Database), parent_name) - } - Keyword::SCHEMA => { - (Some(ShowStatementInParentType::Schema), parent_name) - } - Keyword::TABLE => { - (Some(ShowStatementInParentType::Table), parent_name) - } - Keyword::VIEW => { - (Some(ShowStatementInParentType::View), parent_name) - } - _ => { - return self - .expected( - "one of ACCOUNT, DATABASE, SCHEMA, TABLE or VIEW", - self.peek_token(), - ); - } - } - } - None => { - let mut parent_name = self.parse_object_name(false)?; - if self - .parse_one_of_keywords(&[Keyword::FROM, Keyword::IN]) - .is_some() - { - parent_name - .0 - .insert( - 0, - ObjectNamePart::Identifier(self.parse_identifier()?), - ); - } - (None, Some(parent_name)) - } - }; - Ok( - Some(ShowStatementIn { - clause, - parent_type, - parent_name, - }), - ) - } - fn maybe_parse_show_stmt_starts_with( - &mut self, - ) -> Result, ParserError> { - if self.parse_keywords(&[Keyword::STARTS, Keyword::WITH]) { - Ok(Some(self.parse_value()?)) - } else { - Ok(None) - } - } - fn maybe_parse_show_stmt_limit(&mut self) -> Result, ParserError> { - if self.parse_keyword(Keyword::LIMIT) { - Ok(self.parse_limit()?) - } else { - Ok(None) - } - } - fn maybe_parse_show_stmt_from(&mut self) -> Result, ParserError> { - if self.parse_keyword(Keyword::FROM) { - Ok(Some(self.parse_value()?)) - } else { - Ok(None) - } - } - } - impl Word { - #[deprecated(since = "0.54.0", note = "please use `into_ident` instead")] - pub fn to_ident(&self, span: Span) -> Ident { - Ident { - value: self.value.clone(), - quote_style: self.quote_style, - span, - } - } - /// Convert this word into an [`Ident`] identifier - pub fn into_ident(self, span: Span) -> Ident { - Ident { - value: self.value, - quote_style: self.quote_style, - span, - } - } - } -} -pub mod tokenizer { - //! SQL Tokenizer - //! - //! The tokenizer (a.k.a. lexer) converts a string into a sequence of tokens. - //! - //! The tokens then form the input for the parser, which outputs an Abstract Syntax Tree (AST). - use core::iter::Peekable; - use core::num::NonZeroU8; - use core::str::Chars; - use core::{cmp, fmt}; - use crate::dialect::Dialect; - use crate::dialect::{ - BigQueryDialect, DuckDbDialect, GenericDialect, MySqlDialect, PostgreSqlDialect, - SnowflakeDialect, - }; - use crate::keywords::{Keyword, ALL_KEYWORDS, ALL_KEYWORDS_INDEX}; - use crate::{ast::DollarQuotedString, dialect::HiveDialect}; - /// SQL Token enumeration - pub enum Token { - /// An end-of-file marker, not a real token - EOF, - /// A keyword (like SELECT) or an optionally quoted SQL identifier - Word(Word), - /// An unsigned numeric literal - Number(String, bool), - /// A character that could not be tokenized - Char(char), - /// Single quoted string: i.e: 'string' - SingleQuotedString(String), - /// Double quoted string: i.e: "string" - DoubleQuotedString(String), - /// Triple single quoted strings: Example '''abc''' - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - TripleSingleQuotedString(String), - /// Triple double quoted strings: Example """abc""" - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - TripleDoubleQuotedString(String), - /// Dollar quoted string: i.e: $$string$$ or $tag_name$string$tag_name$ - DollarQuotedString(DollarQuotedString), - /// Byte string literal: i.e: b'string' or B'string' (note that some backends, such as - /// PostgreSQL, may treat this syntax as a bit string literal instead, i.e: b'10010101') - SingleQuotedByteStringLiteral(String), - /// Byte string literal: i.e: b"string" or B"string" - DoubleQuotedByteStringLiteral(String), - /// Triple single quoted literal with byte string prefix. Example `B'''abc'''` - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - TripleSingleQuotedByteStringLiteral(String), - /// Triple double quoted literal with byte string prefix. Example `B"""abc"""` - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - TripleDoubleQuotedByteStringLiteral(String), - /// Single quoted literal with raw string prefix. Example `R'abc'` - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - SingleQuotedRawStringLiteral(String), - /// Double quoted literal with raw string prefix. Example `R"abc"` - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - DoubleQuotedRawStringLiteral(String), - /// Triple single quoted literal with raw string prefix. Example `R'''abc'''` - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - TripleSingleQuotedRawStringLiteral(String), - /// Triple double quoted literal with raw string prefix. Example `R"""abc"""` - /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#quoted_literals) - TripleDoubleQuotedRawStringLiteral(String), - /// "National" string literal: i.e: N'string' - NationalStringLiteral(String), - /// "escaped" string literal, which are an extension to the SQL standard: i.e: e'first \n second' or E 'first \n second' - EscapedStringLiteral(String), - /// Unicode string literal: i.e: U&'first \000A second' - UnicodeStringLiteral(String), - /// Hexadecimal string literal: i.e.: X'deadbeef' - HexStringLiteral(String), - /// Comma - Comma, - /// Whitespace (space, tab, etc) - Whitespace(Whitespace), - /// Double equals sign `==` - DoubleEq, - /// Equality operator `=` - Eq, - /// Not Equals operator `<>` (or `!=` in some dialects) - Neq, - /// Less Than operator `<` - Lt, - /// Greater Than operator `>` - Gt, - /// Less Than Or Equals operator `<=` - LtEq, - /// Greater Than Or Equals operator `>=` - GtEq, - /// Spaceship operator <=> - Spaceship, - /// Plus operator `+` - Plus, - /// Minus operator `-` - Minus, - /// Multiplication operator `*` - Mul, - /// Division operator `/` - Div, - /// Integer division operator `//` in DuckDB - DuckIntDiv, - /// Modulo Operator `%` - Mod, - /// String concatenation `||` - StringConcat, - /// Left parenthesis `(` - LParen, - /// Right parenthesis `)` - RParen, - /// Period (used for compound identifiers or projections into nested types) - Period, - /// Colon `:` - Colon, - /// DoubleColon `::` (used for casting in PostgreSQL) - DoubleColon, - /// Assignment `:=` (used for keyword argument in DuckDB macros and some functions, and for variable declarations in DuckDB and Snowflake) - Assignment, - /// SemiColon `;` used as separator for COPY and payload - SemiColon, - /// Backslash `\` used in terminating the COPY payload with `\.` - Backslash, - /// Left bracket `[` - LBracket, - /// Right bracket `]` - RBracket, - /// Ampersand `&` - Ampersand, - /// Pipe `|` - Pipe, - /// Caret `^` - Caret, - /// Left brace `{` - LBrace, - /// Right brace `}` - RBrace, - /// Right Arrow `=>` - RArrow, - /// Sharp `#` used for PostgreSQL Bitwise XOR operator - Sharp, - /// Tilde `~` used for PostgreSQL Bitwise NOT operator or case sensitive match regular expression operator - Tilde, - /// `~*` , a case insensitive match regular expression operator in PostgreSQL - TildeAsterisk, - /// `!~` , a case sensitive not match regular expression operator in PostgreSQL - ExclamationMarkTilde, - /// `!~*` , a case insensitive not match regular expression operator in PostgreSQL - ExclamationMarkTildeAsterisk, - /// `~~`, a case sensitive match pattern operator in PostgreSQL - DoubleTilde, - /// `~~*`, a case insensitive match pattern operator in PostgreSQL - DoubleTildeAsterisk, - /// `!~~`, a case sensitive not match pattern operator in PostgreSQL - ExclamationMarkDoubleTilde, - /// `!~~*`, a case insensitive not match pattern operator in PostgreSQL - ExclamationMarkDoubleTildeAsterisk, - /// `<<`, a bitwise shift left operator in PostgreSQL - ShiftLeft, - /// `>>`, a bitwise shift right operator in PostgreSQL - ShiftRight, - /// `&&`, an overlap operator in PostgreSQL - Overlap, - /// Exclamation Mark `!` used for PostgreSQL factorial operator - ExclamationMark, - /// Double Exclamation Mark `!!` used for PostgreSQL prefix factorial operator - DoubleExclamationMark, - /// AtSign `@` used for PostgreSQL abs operator - AtSign, - /// `^@`, a "starts with" string operator in PostgreSQL - CaretAt, - /// `|/`, a square root math operator in PostgreSQL - PGSquareRoot, - /// `||/`, a cube root math operator in PostgreSQL - PGCubeRoot, - /// `?` or `$` , a prepared statement arg placeholder - Placeholder(String), - /// `->`, used as a operator to extract json field in PostgreSQL - Arrow, - /// `->>`, used as a operator to extract json field as text in PostgreSQL - LongArrow, - /// `#>`, extracts JSON sub-object at the specified path - HashArrow, - /// `#>>`, extracts JSON sub-object at the specified path as text - HashLongArrow, - /// jsonb @> jsonb -> boolean: Test whether left json contains the right json - AtArrow, - /// jsonb <@ jsonb -> boolean: Test whether right json contains the left json - ArrowAt, - /// jsonb #- text[] -> jsonb: Deletes the field or array element at the specified - /// path, where path elements can be either field keys or array indexes. - HashMinus, - /// jsonb @? jsonpath -> boolean: Does JSON path return any item for the specified - /// JSON value? - AtQuestion, - /// jsonb @@ jsonpath → boolean: Returns the result of a JSON path predicate check - /// for the specified JSON value. Only the first item of the result is taken into - /// account. If the result is not Boolean, then NULL is returned. - AtAt, - /// jsonb ? text -> boolean: Checks whether the string exists as a top-level key within the - /// jsonb object - Question, - /// jsonb ?& text[] -> boolean: Check whether all members of the text array exist as top-level - /// keys within the jsonb object - QuestionAnd, - /// jsonb ?| text[] -> boolean: Check whether any member of the text array exists as top-level - /// keys within the jsonb object - QuestionPipe, - /// Custom binary operator - /// This is used to represent any custom binary operator that is not part of the SQL standard. - /// PostgreSQL allows defining custom binary operators using CREATE OPERATOR. - CustomBinaryOperator(String), - } - #[automatically_derived] - impl ::core::fmt::Debug for Token { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Token::EOF => ::core::fmt::Formatter::write_str(f, "EOF"), - Token::Word(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Word", - &__self_0, - ) - } - Token::Number(__self_0, __self_1) => { - ::core::fmt::Formatter::debug_tuple_field2_finish( - f, - "Number", - __self_0, - &__self_1, - ) - } - Token::Char(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Char", - &__self_0, - ) - } - Token::SingleQuotedString(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "SingleQuotedString", - &__self_0, - ) - } - Token::DoubleQuotedString(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "DoubleQuotedString", - &__self_0, - ) - } - Token::TripleSingleQuotedString(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TripleSingleQuotedString", - &__self_0, - ) - } - Token::TripleDoubleQuotedString(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TripleDoubleQuotedString", - &__self_0, - ) - } - Token::DollarQuotedString(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "DollarQuotedString", - &__self_0, - ) - } - Token::SingleQuotedByteStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "SingleQuotedByteStringLiteral", - &__self_0, - ) - } - Token::DoubleQuotedByteStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "DoubleQuotedByteStringLiteral", - &__self_0, - ) - } - Token::TripleSingleQuotedByteStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TripleSingleQuotedByteStringLiteral", - &__self_0, - ) - } - Token::TripleDoubleQuotedByteStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TripleDoubleQuotedByteStringLiteral", - &__self_0, - ) - } - Token::SingleQuotedRawStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "SingleQuotedRawStringLiteral", - &__self_0, - ) - } - Token::DoubleQuotedRawStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "DoubleQuotedRawStringLiteral", - &__self_0, - ) - } - Token::TripleSingleQuotedRawStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TripleSingleQuotedRawStringLiteral", - &__self_0, - ) - } - Token::TripleDoubleQuotedRawStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "TripleDoubleQuotedRawStringLiteral", - &__self_0, - ) - } - Token::NationalStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "NationalStringLiteral", - &__self_0, - ) - } - Token::EscapedStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "EscapedStringLiteral", - &__self_0, - ) - } - Token::UnicodeStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "UnicodeStringLiteral", - &__self_0, - ) - } - Token::HexStringLiteral(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "HexStringLiteral", - &__self_0, - ) - } - Token::Comma => ::core::fmt::Formatter::write_str(f, "Comma"), - Token::Whitespace(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Whitespace", - &__self_0, - ) - } - Token::DoubleEq => ::core::fmt::Formatter::write_str(f, "DoubleEq"), - Token::Eq => ::core::fmt::Formatter::write_str(f, "Eq"), - Token::Neq => ::core::fmt::Formatter::write_str(f, "Neq"), - Token::Lt => ::core::fmt::Formatter::write_str(f, "Lt"), - Token::Gt => ::core::fmt::Formatter::write_str(f, "Gt"), - Token::LtEq => ::core::fmt::Formatter::write_str(f, "LtEq"), - Token::GtEq => ::core::fmt::Formatter::write_str(f, "GtEq"), - Token::Spaceship => ::core::fmt::Formatter::write_str(f, "Spaceship"), - Token::Plus => ::core::fmt::Formatter::write_str(f, "Plus"), - Token::Minus => ::core::fmt::Formatter::write_str(f, "Minus"), - Token::Mul => ::core::fmt::Formatter::write_str(f, "Mul"), - Token::Div => ::core::fmt::Formatter::write_str(f, "Div"), - Token::DuckIntDiv => ::core::fmt::Formatter::write_str(f, "DuckIntDiv"), - Token::Mod => ::core::fmt::Formatter::write_str(f, "Mod"), - Token::StringConcat => { - ::core::fmt::Formatter::write_str(f, "StringConcat") - } - Token::LParen => ::core::fmt::Formatter::write_str(f, "LParen"), - Token::RParen => ::core::fmt::Formatter::write_str(f, "RParen"), - Token::Period => ::core::fmt::Formatter::write_str(f, "Period"), - Token::Colon => ::core::fmt::Formatter::write_str(f, "Colon"), - Token::DoubleColon => ::core::fmt::Formatter::write_str(f, "DoubleColon"), - Token::Assignment => ::core::fmt::Formatter::write_str(f, "Assignment"), - Token::SemiColon => ::core::fmt::Formatter::write_str(f, "SemiColon"), - Token::Backslash => ::core::fmt::Formatter::write_str(f, "Backslash"), - Token::LBracket => ::core::fmt::Formatter::write_str(f, "LBracket"), - Token::RBracket => ::core::fmt::Formatter::write_str(f, "RBracket"), - Token::Ampersand => ::core::fmt::Formatter::write_str(f, "Ampersand"), - Token::Pipe => ::core::fmt::Formatter::write_str(f, "Pipe"), - Token::Caret => ::core::fmt::Formatter::write_str(f, "Caret"), - Token::LBrace => ::core::fmt::Formatter::write_str(f, "LBrace"), - Token::RBrace => ::core::fmt::Formatter::write_str(f, "RBrace"), - Token::RArrow => ::core::fmt::Formatter::write_str(f, "RArrow"), - Token::Sharp => ::core::fmt::Formatter::write_str(f, "Sharp"), - Token::Tilde => ::core::fmt::Formatter::write_str(f, "Tilde"), - Token::TildeAsterisk => { - ::core::fmt::Formatter::write_str(f, "TildeAsterisk") - } - Token::ExclamationMarkTilde => { - ::core::fmt::Formatter::write_str(f, "ExclamationMarkTilde") - } - Token::ExclamationMarkTildeAsterisk => { - ::core::fmt::Formatter::write_str(f, "ExclamationMarkTildeAsterisk") - } - Token::DoubleTilde => ::core::fmt::Formatter::write_str(f, "DoubleTilde"), - Token::DoubleTildeAsterisk => { - ::core::fmt::Formatter::write_str(f, "DoubleTildeAsterisk") - } - Token::ExclamationMarkDoubleTilde => { - ::core::fmt::Formatter::write_str(f, "ExclamationMarkDoubleTilde") - } - Token::ExclamationMarkDoubleTildeAsterisk => { - ::core::fmt::Formatter::write_str( - f, - "ExclamationMarkDoubleTildeAsterisk", - ) - } - Token::ShiftLeft => ::core::fmt::Formatter::write_str(f, "ShiftLeft"), - Token::ShiftRight => ::core::fmt::Formatter::write_str(f, "ShiftRight"), - Token::Overlap => ::core::fmt::Formatter::write_str(f, "Overlap"), - Token::ExclamationMark => { - ::core::fmt::Formatter::write_str(f, "ExclamationMark") - } - Token::DoubleExclamationMark => { - ::core::fmt::Formatter::write_str(f, "DoubleExclamationMark") - } - Token::AtSign => ::core::fmt::Formatter::write_str(f, "AtSign"), - Token::CaretAt => ::core::fmt::Formatter::write_str(f, "CaretAt"), - Token::PGSquareRoot => { - ::core::fmt::Formatter::write_str(f, "PGSquareRoot") - } - Token::PGCubeRoot => ::core::fmt::Formatter::write_str(f, "PGCubeRoot"), - Token::Placeholder(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "Placeholder", - &__self_0, - ) - } - Token::Arrow => ::core::fmt::Formatter::write_str(f, "Arrow"), - Token::LongArrow => ::core::fmt::Formatter::write_str(f, "LongArrow"), - Token::HashArrow => ::core::fmt::Formatter::write_str(f, "HashArrow"), - Token::HashLongArrow => { - ::core::fmt::Formatter::write_str(f, "HashLongArrow") - } - Token::AtArrow => ::core::fmt::Formatter::write_str(f, "AtArrow"), - Token::ArrowAt => ::core::fmt::Formatter::write_str(f, "ArrowAt"), - Token::HashMinus => ::core::fmt::Formatter::write_str(f, "HashMinus"), - Token::AtQuestion => ::core::fmt::Formatter::write_str(f, "AtQuestion"), - Token::AtAt => ::core::fmt::Formatter::write_str(f, "AtAt"), - Token::Question => ::core::fmt::Formatter::write_str(f, "Question"), - Token::QuestionAnd => ::core::fmt::Formatter::write_str(f, "QuestionAnd"), - Token::QuestionPipe => { - ::core::fmt::Formatter::write_str(f, "QuestionPipe") - } - Token::CustomBinaryOperator(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "CustomBinaryOperator", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for Token { - #[inline] - fn clone(&self) -> Token { - match self { - Token::EOF => Token::EOF, - Token::Word(__self_0) => { - Token::Word(::core::clone::Clone::clone(__self_0)) - } - Token::Number(__self_0, __self_1) => { - Token::Number( - ::core::clone::Clone::clone(__self_0), - ::core::clone::Clone::clone(__self_1), - ) - } - Token::Char(__self_0) => { - Token::Char(::core::clone::Clone::clone(__self_0)) - } - Token::SingleQuotedString(__self_0) => { - Token::SingleQuotedString(::core::clone::Clone::clone(__self_0)) - } - Token::DoubleQuotedString(__self_0) => { - Token::DoubleQuotedString(::core::clone::Clone::clone(__self_0)) - } - Token::TripleSingleQuotedString(__self_0) => { - Token::TripleSingleQuotedString( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::TripleDoubleQuotedString(__self_0) => { - Token::TripleDoubleQuotedString( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::DollarQuotedString(__self_0) => { - Token::DollarQuotedString(::core::clone::Clone::clone(__self_0)) - } - Token::SingleQuotedByteStringLiteral(__self_0) => { - Token::SingleQuotedByteStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::DoubleQuotedByteStringLiteral(__self_0) => { - Token::DoubleQuotedByteStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::TripleSingleQuotedByteStringLiteral(__self_0) => { - Token::TripleSingleQuotedByteStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::TripleDoubleQuotedByteStringLiteral(__self_0) => { - Token::TripleDoubleQuotedByteStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::SingleQuotedRawStringLiteral(__self_0) => { - Token::SingleQuotedRawStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::DoubleQuotedRawStringLiteral(__self_0) => { - Token::DoubleQuotedRawStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::TripleSingleQuotedRawStringLiteral(__self_0) => { - Token::TripleSingleQuotedRawStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::TripleDoubleQuotedRawStringLiteral(__self_0) => { - Token::TripleDoubleQuotedRawStringLiteral( - ::core::clone::Clone::clone(__self_0), - ) - } - Token::NationalStringLiteral(__self_0) => { - Token::NationalStringLiteral(::core::clone::Clone::clone(__self_0)) - } - Token::EscapedStringLiteral(__self_0) => { - Token::EscapedStringLiteral(::core::clone::Clone::clone(__self_0)) - } - Token::UnicodeStringLiteral(__self_0) => { - Token::UnicodeStringLiteral(::core::clone::Clone::clone(__self_0)) - } - Token::HexStringLiteral(__self_0) => { - Token::HexStringLiteral(::core::clone::Clone::clone(__self_0)) - } - Token::Comma => Token::Comma, - Token::Whitespace(__self_0) => { - Token::Whitespace(::core::clone::Clone::clone(__self_0)) - } - Token::DoubleEq => Token::DoubleEq, - Token::Eq => Token::Eq, - Token::Neq => Token::Neq, - Token::Lt => Token::Lt, - Token::Gt => Token::Gt, - Token::LtEq => Token::LtEq, - Token::GtEq => Token::GtEq, - Token::Spaceship => Token::Spaceship, - Token::Plus => Token::Plus, - Token::Minus => Token::Minus, - Token::Mul => Token::Mul, - Token::Div => Token::Div, - Token::DuckIntDiv => Token::DuckIntDiv, - Token::Mod => Token::Mod, - Token::StringConcat => Token::StringConcat, - Token::LParen => Token::LParen, - Token::RParen => Token::RParen, - Token::Period => Token::Period, - Token::Colon => Token::Colon, - Token::DoubleColon => Token::DoubleColon, - Token::Assignment => Token::Assignment, - Token::SemiColon => Token::SemiColon, - Token::Backslash => Token::Backslash, - Token::LBracket => Token::LBracket, - Token::RBracket => Token::RBracket, - Token::Ampersand => Token::Ampersand, - Token::Pipe => Token::Pipe, - Token::Caret => Token::Caret, - Token::LBrace => Token::LBrace, - Token::RBrace => Token::RBrace, - Token::RArrow => Token::RArrow, - Token::Sharp => Token::Sharp, - Token::Tilde => Token::Tilde, - Token::TildeAsterisk => Token::TildeAsterisk, - Token::ExclamationMarkTilde => Token::ExclamationMarkTilde, - Token::ExclamationMarkTildeAsterisk => { - Token::ExclamationMarkTildeAsterisk - } - Token::DoubleTilde => Token::DoubleTilde, - Token::DoubleTildeAsterisk => Token::DoubleTildeAsterisk, - Token::ExclamationMarkDoubleTilde => Token::ExclamationMarkDoubleTilde, - Token::ExclamationMarkDoubleTildeAsterisk => { - Token::ExclamationMarkDoubleTildeAsterisk - } - Token::ShiftLeft => Token::ShiftLeft, - Token::ShiftRight => Token::ShiftRight, - Token::Overlap => Token::Overlap, - Token::ExclamationMark => Token::ExclamationMark, - Token::DoubleExclamationMark => Token::DoubleExclamationMark, - Token::AtSign => Token::AtSign, - Token::CaretAt => Token::CaretAt, - Token::PGSquareRoot => Token::PGSquareRoot, - Token::PGCubeRoot => Token::PGCubeRoot, - Token::Placeholder(__self_0) => { - Token::Placeholder(::core::clone::Clone::clone(__self_0)) - } - Token::Arrow => Token::Arrow, - Token::LongArrow => Token::LongArrow, - Token::HashArrow => Token::HashArrow, - Token::HashLongArrow => Token::HashLongArrow, - Token::AtArrow => Token::AtArrow, - Token::ArrowAt => Token::ArrowAt, - Token::HashMinus => Token::HashMinus, - Token::AtQuestion => Token::AtQuestion, - Token::AtAt => Token::AtAt, - Token::Question => Token::Question, - Token::QuestionAnd => Token::QuestionAnd, - Token::QuestionPipe => Token::QuestionPipe, - Token::CustomBinaryOperator(__self_0) => { - Token::CustomBinaryOperator(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Token {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Token { - #[inline] - fn eq(&self, other: &Token) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - (Token::Word(__self_0), Token::Word(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Token::Number(__self_0, __self_1), - Token::Number(__arg1_0, __arg1_1), - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - (Token::Char(__self_0), Token::Char(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Token::SingleQuotedString(__self_0), - Token::SingleQuotedString(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::DoubleQuotedString(__self_0), - Token::DoubleQuotedString(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::TripleSingleQuotedString(__self_0), - Token::TripleSingleQuotedString(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::TripleDoubleQuotedString(__self_0), - Token::TripleDoubleQuotedString(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::DollarQuotedString(__self_0), - Token::DollarQuotedString(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::SingleQuotedByteStringLiteral(__self_0), - Token::SingleQuotedByteStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::DoubleQuotedByteStringLiteral(__self_0), - Token::DoubleQuotedByteStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::TripleSingleQuotedByteStringLiteral(__self_0), - Token::TripleSingleQuotedByteStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::TripleDoubleQuotedByteStringLiteral(__self_0), - Token::TripleDoubleQuotedByteStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::SingleQuotedRawStringLiteral(__self_0), - Token::SingleQuotedRawStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::DoubleQuotedRawStringLiteral(__self_0), - Token::DoubleQuotedRawStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::TripleSingleQuotedRawStringLiteral(__self_0), - Token::TripleSingleQuotedRawStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::TripleDoubleQuotedRawStringLiteral(__self_0), - Token::TripleDoubleQuotedRawStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::NationalStringLiteral(__self_0), - Token::NationalStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::EscapedStringLiteral(__self_0), - Token::EscapedStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::UnicodeStringLiteral(__self_0), - Token::UnicodeStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - ( - Token::HexStringLiteral(__self_0), - Token::HexStringLiteral(__arg1_0), - ) => __self_0 == __arg1_0, - (Token::Whitespace(__self_0), Token::Whitespace(__arg1_0)) => { - __self_0 == __arg1_0 - } - (Token::Placeholder(__self_0), Token::Placeholder(__arg1_0)) => { - __self_0 == __arg1_0 - } - ( - Token::CustomBinaryOperator(__self_0), - Token::CustomBinaryOperator(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Token { - #[inline] - fn partial_cmp( - &self, - other: &Token, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match (self, other) { - (Token::Word(__self_0), Token::Word(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Token::Number(__self_0, __self_1), - Token::Number(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::PartialOrd::partial_cmp( - __self_0, - __arg1_0, - ) { - ::core::option::Option::Some( - ::core::cmp::Ordering::Equal, - ) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Token::Char(__self_0), Token::Char(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Token::SingleQuotedString(__self_0), - Token::SingleQuotedString(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::DoubleQuotedString(__self_0), - Token::DoubleQuotedString(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::TripleSingleQuotedString(__self_0), - Token::TripleSingleQuotedString(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::TripleDoubleQuotedString(__self_0), - Token::TripleDoubleQuotedString(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::DollarQuotedString(__self_0), - Token::DollarQuotedString(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::SingleQuotedByteStringLiteral(__self_0), - Token::SingleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::DoubleQuotedByteStringLiteral(__self_0), - Token::DoubleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::TripleSingleQuotedByteStringLiteral(__self_0), - Token::TripleSingleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::TripleDoubleQuotedByteStringLiteral(__self_0), - Token::TripleDoubleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::SingleQuotedRawStringLiteral(__self_0), - Token::SingleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::DoubleQuotedRawStringLiteral(__self_0), - Token::DoubleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::TripleSingleQuotedRawStringLiteral(__self_0), - Token::TripleSingleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::TripleDoubleQuotedRawStringLiteral(__self_0), - Token::TripleDoubleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::NationalStringLiteral(__self_0), - Token::NationalStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::EscapedStringLiteral(__self_0), - Token::EscapedStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::UnicodeStringLiteral(__self_0), - Token::UnicodeStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - ( - Token::HexStringLiteral(__self_0), - Token::HexStringLiteral(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - (Token::Whitespace(__self_0), Token::Whitespace(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - (Token::Placeholder(__self_0), Token::Placeholder(__arg1_0)) => { - ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) - } - ( - Token::CustomBinaryOperator(__self_0), - Token::CustomBinaryOperator(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::option::Option::Some(::core::cmp::Ordering::Equal), - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Token { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Token { - #[inline] - fn cmp(&self, other: &Token) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - (Token::Word(__self_0), Token::Word(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Token::Number(__self_0, __self_1), - Token::Number(__arg1_0, __arg1_1), - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - (Token::Char(__self_0), Token::Char(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Token::SingleQuotedString(__self_0), - Token::SingleQuotedString(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::DoubleQuotedString(__self_0), - Token::DoubleQuotedString(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::TripleSingleQuotedString(__self_0), - Token::TripleSingleQuotedString(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::TripleDoubleQuotedString(__self_0), - Token::TripleDoubleQuotedString(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::DollarQuotedString(__self_0), - Token::DollarQuotedString(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::SingleQuotedByteStringLiteral(__self_0), - Token::SingleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::DoubleQuotedByteStringLiteral(__self_0), - Token::DoubleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::TripleSingleQuotedByteStringLiteral(__self_0), - Token::TripleSingleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::TripleDoubleQuotedByteStringLiteral(__self_0), - Token::TripleDoubleQuotedByteStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::SingleQuotedRawStringLiteral(__self_0), - Token::SingleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::DoubleQuotedRawStringLiteral(__self_0), - Token::DoubleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::TripleSingleQuotedRawStringLiteral(__self_0), - Token::TripleSingleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::TripleDoubleQuotedRawStringLiteral(__self_0), - Token::TripleDoubleQuotedRawStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::NationalStringLiteral(__self_0), - Token::NationalStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::EscapedStringLiteral(__self_0), - Token::EscapedStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::UnicodeStringLiteral(__self_0), - Token::UnicodeStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - ( - Token::HexStringLiteral(__self_0), - Token::HexStringLiteral(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - (Token::Whitespace(__self_0), Token::Whitespace(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - (Token::Placeholder(__self_0), Token::Placeholder(__arg1_0)) => { - ::core::cmp::Ord::cmp(__self_0, __arg1_0) - } - ( - Token::CustomBinaryOperator(__self_0), - Token::CustomBinaryOperator(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Token { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Token::Word(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Token::Number(__self_0, __self_1) => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Token::Char(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Token::SingleQuotedString(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::DoubleQuotedString(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::TripleSingleQuotedString(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::TripleDoubleQuotedString(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::DollarQuotedString(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::SingleQuotedByteStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::DoubleQuotedByteStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::TripleSingleQuotedByteStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::TripleDoubleQuotedByteStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::SingleQuotedRawStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::DoubleQuotedRawStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::TripleSingleQuotedRawStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::TripleDoubleQuotedRawStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::NationalStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::EscapedStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::UnicodeStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::HexStringLiteral(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - Token::Whitespace(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Token::Placeholder(__self_0) => ::core::hash::Hash::hash(__self_0, state), - Token::CustomBinaryOperator(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for Token { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Token::EOF => f.write_str("EOF"), - Token::Word(ref w) => f.write_fmt(format_args!("{0}", w)), - Token::Number(ref n, l) => { - f.write_fmt(format_args!("{0}{1}", n, if *l { "L" } else { "" })) - } - Token::Char(ref c) => f.write_fmt(format_args!("{0}", c)), - Token::SingleQuotedString(ref s) => { - f.write_fmt(format_args!("\'{0}\'", s)) - } - Token::TripleSingleQuotedString(ref s) => { - f.write_fmt(format_args!("\'\'\'{0}\'\'\'", s)) - } - Token::DoubleQuotedString(ref s) => { - f.write_fmt(format_args!("\"{0}\"", s)) - } - Token::TripleDoubleQuotedString(ref s) => { - f.write_fmt(format_args!("\"\"\"{0}\"\"\"", s)) - } - Token::DollarQuotedString(ref s) => f.write_fmt(format_args!("{0}", s)), - Token::NationalStringLiteral(ref s) => { - f.write_fmt(format_args!("N\'{0}\'", s)) - } - Token::EscapedStringLiteral(ref s) => { - f.write_fmt(format_args!("E\'{0}\'", s)) - } - Token::UnicodeStringLiteral(ref s) => { - f.write_fmt(format_args!("U&\'{0}\'", s)) - } - Token::HexStringLiteral(ref s) => { - f.write_fmt(format_args!("X\'{0}\'", s)) - } - Token::SingleQuotedByteStringLiteral(ref s) => { - f.write_fmt(format_args!("B\'{0}\'", s)) - } - Token::TripleSingleQuotedByteStringLiteral(ref s) => { - f.write_fmt(format_args!("B\'\'\'{0}\'\'\'", s)) - } - Token::DoubleQuotedByteStringLiteral(ref s) => { - f.write_fmt(format_args!("B\"{0}\"", s)) - } - Token::TripleDoubleQuotedByteStringLiteral(ref s) => { - f.write_fmt(format_args!("B\"\"\"{0}\"\"\"", s)) - } - Token::SingleQuotedRawStringLiteral(ref s) => { - f.write_fmt(format_args!("R\'{0}\'", s)) - } - Token::DoubleQuotedRawStringLiteral(ref s) => { - f.write_fmt(format_args!("R\"{0}\"", s)) - } - Token::TripleSingleQuotedRawStringLiteral(ref s) => { - f.write_fmt(format_args!("R\'\'\'{0}\'\'\'", s)) - } - Token::TripleDoubleQuotedRawStringLiteral(ref s) => { - f.write_fmt(format_args!("R\"\"\"{0}\"\"\"", s)) - } - Token::Comma => f.write_str(","), - Token::Whitespace(ws) => f.write_fmt(format_args!("{0}", ws)), - Token::DoubleEq => f.write_str("=="), - Token::Spaceship => f.write_str("<=>"), - Token::Eq => f.write_str("="), - Token::Neq => f.write_str("<>"), - Token::Lt => f.write_str("<"), - Token::Gt => f.write_str(">"), - Token::LtEq => f.write_str("<="), - Token::GtEq => f.write_str(">="), - Token::Plus => f.write_str("+"), - Token::Minus => f.write_str("-"), - Token::Mul => f.write_str("*"), - Token::Div => f.write_str("/"), - Token::DuckIntDiv => f.write_str("//"), - Token::StringConcat => f.write_str("||"), - Token::Mod => f.write_str("%"), - Token::LParen => f.write_str("("), - Token::RParen => f.write_str(")"), - Token::Period => f.write_str("."), - Token::Colon => f.write_str(":"), - Token::DoubleColon => f.write_str("::"), - Token::Assignment => f.write_str(":="), - Token::SemiColon => f.write_str(";"), - Token::Backslash => f.write_str("\\"), - Token::LBracket => f.write_str("["), - Token::RBracket => f.write_str("]"), - Token::Ampersand => f.write_str("&"), - Token::Caret => f.write_str("^"), - Token::Pipe => f.write_str("|"), - Token::LBrace => f.write_str("{"), - Token::RBrace => f.write_str("}"), - Token::RArrow => f.write_str("=>"), - Token::Sharp => f.write_str("#"), - Token::ExclamationMark => f.write_str("!"), - Token::DoubleExclamationMark => f.write_str("!!"), - Token::Tilde => f.write_str("~"), - Token::TildeAsterisk => f.write_str("~*"), - Token::ExclamationMarkTilde => f.write_str("!~"), - Token::ExclamationMarkTildeAsterisk => f.write_str("!~*"), - Token::DoubleTilde => f.write_str("~~"), - Token::DoubleTildeAsterisk => f.write_str("~~*"), - Token::ExclamationMarkDoubleTilde => f.write_str("!~~"), - Token::ExclamationMarkDoubleTildeAsterisk => f.write_str("!~~*"), - Token::AtSign => f.write_str("@"), - Token::CaretAt => f.write_str("^@"), - Token::ShiftLeft => f.write_str("<<"), - Token::ShiftRight => f.write_str(">>"), - Token::Overlap => f.write_str("&&"), - Token::PGSquareRoot => f.write_str("|/"), - Token::PGCubeRoot => f.write_str("||/"), - Token::Placeholder(ref s) => f.write_fmt(format_args!("{0}", s)), - Token::Arrow => f.write_fmt(format_args!("->")), - Token::LongArrow => f.write_fmt(format_args!("->>")), - Token::HashArrow => f.write_fmt(format_args!("#>")), - Token::HashLongArrow => f.write_fmt(format_args!("#>>")), - Token::AtArrow => f.write_fmt(format_args!("@>")), - Token::ArrowAt => f.write_fmt(format_args!("<@")), - Token::HashMinus => f.write_fmt(format_args!("#-")), - Token::AtQuestion => f.write_fmt(format_args!("@?")), - Token::AtAt => f.write_fmt(format_args!("@@")), - Token::Question => f.write_fmt(format_args!("?")), - Token::QuestionAnd => f.write_fmt(format_args!("?&")), - Token::QuestionPipe => f.write_fmt(format_args!("?|")), - Token::CustomBinaryOperator(s) => f.write_str(s), - } - } - } - impl Token { - pub fn make_keyword(keyword: &str) -> Self { - Token::make_word(keyword, None) - } - pub fn make_word(word: &str, quote_style: Option) -> Self { - let word_uppercase = word.to_uppercase(); - Token::Word(Word { - value: word.to_string(), - quote_style, - keyword: if quote_style.is_none() { - let keyword = ALL_KEYWORDS.binary_search(&word_uppercase.as_str()); - keyword.map_or(Keyword::NoKeyword, |x| ALL_KEYWORDS_INDEX[x]) - } else { - Keyword::NoKeyword - }, - }) - } - } - /// A keyword (like SELECT) or an optionally quoted SQL identifier - pub struct Word { - /// The value of the token, without the enclosing quotes, and with the - /// escape sequences (if any) processed (TODO: escapes are not handled) - pub value: String, - /// An identifier can be "quoted" (<delimited identifier> in ANSI parlance). - /// The standard and most implementations allow using double quotes for this, - /// but some implementations support other quoting styles as well (e.g. \[MS SQL]) - pub quote_style: Option, - /// If the word was not quoted and it matched one of the known keywords, - /// this will have one of the values from dialect::keywords, otherwise empty - pub keyword: Keyword, - } - #[automatically_derived] - impl ::core::fmt::Debug for Word { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field3_finish( - f, - "Word", - "value", - &self.value, - "quote_style", - &self.quote_style, - "keyword", - &&self.keyword, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Word { - #[inline] - fn clone(&self) -> Word { - Word { - value: ::core::clone::Clone::clone(&self.value), - quote_style: ::core::clone::Clone::clone(&self.quote_style), - keyword: ::core::clone::Clone::clone(&self.keyword), - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Word {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Word { - #[inline] - fn eq(&self, other: &Word) -> bool { - self.value == other.value && self.quote_style == other.quote_style - && self.keyword == other.keyword - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Word { - #[inline] - fn partial_cmp( - &self, - other: &Word, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.value, &other.value) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - match ::core::cmp::PartialOrd::partial_cmp( - &self.quote_style, - &other.quote_style, - ) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp( - &self.keyword, - &other.keyword, - ) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Word { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq>; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Word { - #[inline] - fn cmp(&self, other: &Word) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.value, &other.value) { - ::core::cmp::Ordering::Equal => { - match ::core::cmp::Ord::cmp(&self.quote_style, &other.quote_style) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.keyword, &other.keyword) - } - cmp => cmp, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Word { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.value, state); - ::core::hash::Hash::hash(&self.quote_style, state); - ::core::hash::Hash::hash(&self.keyword, state) - } - } - impl fmt::Display for Word { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self.quote_style { - Some(s) if s == '"' || s == '[' || s == '`' => { - f.write_fmt( - format_args!( - "{0}{1}{2}", - s, - self.value, - Word::matching_end_quote(s), - ), - ) - } - None => f.write_str(&self.value), - _ => { - ::core::panicking::panic_fmt( - format_args!("Unexpected quote_style!"), - ); - } - } - } - } - impl Word { - fn matching_end_quote(ch: char) -> char { - match ch { - '"' => '"', - '[' => ']', - '`' => '`', - _ => { - ::core::panicking::panic_fmt( - format_args!("unexpected quoting style!"), - ); - } - } - } - } - pub enum Whitespace { - Space, - Newline, - Tab, - SingleLineComment { comment: String, prefix: String }, - MultiLineComment(String), - } - #[automatically_derived] - impl ::core::fmt::Debug for Whitespace { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - match self { - Whitespace::Space => ::core::fmt::Formatter::write_str(f, "Space"), - Whitespace::Newline => ::core::fmt::Formatter::write_str(f, "Newline"), - Whitespace::Tab => ::core::fmt::Formatter::write_str(f, "Tab"), - Whitespace::SingleLineComment { comment: __self_0, prefix: __self_1 } => { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "SingleLineComment", - "comment", - __self_0, - "prefix", - &__self_1, - ) - } - Whitespace::MultiLineComment(__self_0) => { - ::core::fmt::Formatter::debug_tuple_field1_finish( - f, - "MultiLineComment", - &__self_0, - ) - } - } - } - } - #[automatically_derived] - impl ::core::clone::Clone for Whitespace { - #[inline] - fn clone(&self) -> Whitespace { - match self { - Whitespace::Space => Whitespace::Space, - Whitespace::Newline => Whitespace::Newline, - Whitespace::Tab => Whitespace::Tab, - Whitespace::SingleLineComment { comment: __self_0, prefix: __self_1 } => { - Whitespace::SingleLineComment { - comment: ::core::clone::Clone::clone(__self_0), - prefix: ::core::clone::Clone::clone(__self_1), - } - } - Whitespace::MultiLineComment(__self_0) => { - Whitespace::MultiLineComment(::core::clone::Clone::clone(__self_0)) - } - } - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Whitespace {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Whitespace { - #[inline] - fn eq(&self, other: &Whitespace) -> bool { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - __self_discr == __arg1_discr - && match (self, other) { - ( - Whitespace::SingleLineComment { - comment: __self_0, - prefix: __self_1, - }, - Whitespace::SingleLineComment { - comment: __arg1_0, - prefix: __arg1_1, - }, - ) => __self_0 == __arg1_0 && __self_1 == __arg1_1, - ( - Whitespace::MultiLineComment(__self_0), - Whitespace::MultiLineComment(__arg1_0), - ) => __self_0 == __arg1_0, - _ => true, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Whitespace { - #[inline] - fn partial_cmp( - &self, - other: &Whitespace, - ) -> ::core::option::Option<::core::cmp::Ordering> { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match (self, other) { - ( - Whitespace::SingleLineComment { - comment: __self_0, - prefix: __self_1, - }, - Whitespace::SingleLineComment { comment: __arg1_0, prefix: __arg1_1 }, - ) => { - match ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Whitespace::MultiLineComment(__self_0), - Whitespace::MultiLineComment(__arg1_0), - ) => ::core::cmp::PartialOrd::partial_cmp(__self_0, __arg1_0), - _ => ::core::cmp::PartialOrd::partial_cmp(&__self_discr, &__arg1_discr), - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for Whitespace { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Whitespace { - #[inline] - fn cmp(&self, other: &Whitespace) -> ::core::cmp::Ordering { - let __self_discr = ::core::intrinsics::discriminant_value(self); - let __arg1_discr = ::core::intrinsics::discriminant_value(other); - match ::core::cmp::Ord::cmp(&__self_discr, &__arg1_discr) { - ::core::cmp::Ordering::Equal => { - match (self, other) { - ( - Whitespace::SingleLineComment { - comment: __self_0, - prefix: __self_1, - }, - Whitespace::SingleLineComment { - comment: __arg1_0, - prefix: __arg1_1, - }, - ) => { - match ::core::cmp::Ord::cmp(__self_0, __arg1_0) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(__self_1, __arg1_1) - } - cmp => cmp, - } - } - ( - Whitespace::MultiLineComment(__self_0), - Whitespace::MultiLineComment(__arg1_0), - ) => ::core::cmp::Ord::cmp(__self_0, __arg1_0), - _ => ::core::cmp::Ordering::Equal, - } - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for Whitespace { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - let __self_discr = ::core::intrinsics::discriminant_value(self); - ::core::hash::Hash::hash(&__self_discr, state); - match self { - Whitespace::SingleLineComment { - comment: __self_0, - prefix: __self_1, - } => { - ::core::hash::Hash::hash(__self_0, state); - ::core::hash::Hash::hash(__self_1, state) - } - Whitespace::MultiLineComment(__self_0) => { - ::core::hash::Hash::hash(__self_0, state) - } - _ => {} - } - } - } - impl fmt::Display for Whitespace { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - Whitespace::Space => f.write_str(" "), - Whitespace::Newline => f.write_str("\n"), - Whitespace::Tab => f.write_str("\t"), - Whitespace::SingleLineComment { prefix, comment } => { - f.write_fmt(format_args!("{0}{1}", prefix, comment)) - } - Whitespace::MultiLineComment(s) => { - f.write_fmt(format_args!("/*{0}*/", s)) - } - } - } - } - /// Location in input string - /// - /// # Create an "empty" (unknown) `Location` - /// ``` - /// # use sqlparser::tokenizer::Location; - /// let location = Location::empty(); - /// ``` - /// - /// # Create a `Location` from a line and column - /// ``` - /// # use sqlparser::tokenizer::Location; - /// let location = Location::new(1, 1); - /// ``` - /// - /// # Create a `Location` from a pair - /// ``` - /// # use sqlparser::tokenizer::Location; - /// let location = Location::from((1, 1)); - /// ``` - pub struct Location { - /// Line number, starting from 1. - /// - /// Note: Line 0 is used for empty spans - pub line: u64, - /// Line column, starting from 1. - /// - /// Note: Column 0 is used for empty spans - pub column: u64, - } - #[automatically_derived] - impl ::core::cmp::Eq for Location { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Location {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Location { - #[inline] - fn eq(&self, other: &Location) -> bool { - self.line == other.line && self.column == other.column - } - } - #[automatically_derived] - impl ::core::hash::Hash for Location { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.line, state); - ::core::hash::Hash::hash(&self.column, state) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Location { - #[inline] - fn clone(&self) -> Location { - let _: ::core::clone::AssertParamIsClone; - *self - } - } - #[automatically_derived] - impl ::core::marker::Copy for Location {} - #[automatically_derived] - impl ::core::cmp::Ord for Location { - #[inline] - fn cmp(&self, other: &Location) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.line, &other.line) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.column, &other.column) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Location { - #[inline] - fn partial_cmp( - &self, - other: &Location, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.line, &other.line) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.column, &other.column) - } - cmp => cmp, - } - } - } - impl fmt::Display for Location { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - if self.line == 0 { - return Ok(()); - } - f.write_fmt( - format_args!(" at Line: {0}, Column: {1}", self.line, self.column), - ) - } - } - impl fmt::Debug for Location { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("Location({0},{1})", self.line, self.column)) - } - } - impl Location { - /// Return an "empty" / unknown location - pub fn empty() -> Self { - Self { line: 0, column: 0 } - } - /// Create a new `Location` for a given line and column - pub fn new(line: u64, column: u64) -> Self { - Self { line, column } - } - /// Create a new location for a given line and column - /// - /// Alias for [`Self::new`] - pub fn of(line: u64, column: u64) -> Self { - Self::new(line, column) - } - /// Combine self and `end` into a new `Span` - pub fn span_to(self, end: Self) -> Span { - Span { start: self, end } - } - } - impl From<(u64, u64)> for Location { - fn from((line, column): (u64, u64)) -> Self { - Self { line, column } - } - } - /// A span represents a linear portion of the input string (start, end) - /// - /// See [Spanned](crate::ast::Spanned) for more information. - pub struct Span { - pub start: Location, - pub end: Location, - } - #[automatically_derived] - impl ::core::cmp::Eq for Span { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for Span {} - #[automatically_derived] - impl ::core::cmp::PartialEq for Span { - #[inline] - fn eq(&self, other: &Span) -> bool { - self.start == other.start && self.end == other.end - } - } - #[automatically_derived] - impl ::core::hash::Hash for Span { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.start, state); - ::core::hash::Hash::hash(&self.end, state) - } - } - #[automatically_derived] - impl ::core::clone::Clone for Span { - #[inline] - fn clone(&self) -> Span { - let _: ::core::clone::AssertParamIsClone; - *self - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for Span { - #[inline] - fn partial_cmp( - &self, - other: &Span, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.start, &other.start) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.end, &other.end) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Ord for Span { - #[inline] - fn cmp(&self, other: &Span) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.start, &other.start) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.end, &other.end) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::marker::Copy for Span {} - impl fmt::Debug for Span { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.write_fmt(format_args!("Span({0:?}..{1:?})", self.start, self.end)) - } - } - impl Span { - const EMPTY: Span = Self::empty(); - /// Create a new span from a start and end [`Location`] - pub fn new(start: Location, end: Location) -> Span { - Span { start, end } - } - /// Returns an empty span `(0, 0) -> (0, 0)` - /// - /// Empty spans represent no knowledge of source location - /// See [Spanned](crate::ast::Spanned) for more information. - pub const fn empty() -> Span { - Span { - start: Location { line: 0, column: 0 }, - end: Location { line: 0, column: 0 }, - } - } - /// Returns the smallest Span that contains both `self` and `other` - /// If either span is [Span::empty], the other span is returned - /// - /// # Examples - /// ``` - /// # use sqlparser::tokenizer::{Span, Location}; - /// // line 1, column1 -> line 2, column 5 - /// let span1 = Span::new(Location::new(1, 1), Location::new(2, 5)); - /// // line 2, column 3 -> line 3, column 7 - /// let span2 = Span::new(Location::new(2, 3), Location::new(3, 7)); - /// // Union of the two is the min/max of the two spans - /// // line 1, column 1 -> line 3, column 7 - /// let union = span1.union(&span2); - /// assert_eq!(union, Span::new(Location::new(1, 1), Location::new(3, 7))); - /// ``` - pub fn union(&self, other: &Span) -> Span { - match (self, other) { - (&Span::EMPTY, _) => *other, - (_, &Span::EMPTY) => *self, - _ => { - Span { - start: cmp::min(self.start, other.start), - end: cmp::max(self.end, other.end), - } - } - } - } - /// Same as [Span::union] for `Option` - /// - /// If `other` is `None`, `self` is returned - pub fn union_opt(&self, other: &Option) -> Span { - match other { - Some(other) => self.union(other), - None => *self, - } - } - /// Return the [Span::union] of all spans in the iterator - /// - /// If the iterator is empty, an empty span is returned - /// - /// # Example - /// ``` - /// # use sqlparser::tokenizer::{Span, Location}; - /// let spans = vec![ - /// Span::new(Location::new(1, 1), Location::new(2, 5)), - /// Span::new(Location::new(2, 3), Location::new(3, 7)), - /// Span::new(Location::new(3, 1), Location::new(4, 2)), - /// ]; - /// // line 1, column 1 -> line 4, column 2 - /// assert_eq!( - /// Span::union_iter(spans), - /// Span::new(Location::new(1, 1), Location::new(4, 2)) - /// ); - pub fn union_iter>(iter: I) -> Span { - iter.into_iter() - .reduce(|acc, item| acc.union(&item)) - .unwrap_or(Span::empty()) - } - } - /// Backwards compatibility struct for [`TokenWithSpan`] - #[deprecated(since = "0.53.0", note = "please use `TokenWithSpan` instead")] - pub type TokenWithLocation = TokenWithSpan; - /// A [Token] with [Span] attached to it - /// - /// This is used to track the location of a token in the input string - /// - /// # Examples - /// ``` - /// # use sqlparser::tokenizer::{Location, Span, Token, TokenWithSpan}; - /// // commas @ line 1, column 10 - /// let tok1 = TokenWithSpan::new( - /// Token::Comma, - /// Span::new(Location::new(1, 10), Location::new(1, 11)), - /// ); - /// assert_eq!(tok1, Token::Comma); // can compare the token - /// - /// // commas @ line 2, column 20 - /// let tok2 = TokenWithSpan::new( - /// Token::Comma, - /// Span::new(Location::new(2, 20), Location::new(2, 21)), - /// ); - /// // same token but different locations are not equal - /// assert_ne!(tok1, tok2); - /// ``` - pub struct TokenWithSpan { - pub token: Token, - pub span: Span, - } - #[automatically_derived] - impl ::core::fmt::Debug for TokenWithSpan { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "TokenWithSpan", - "token", - &self.token, - "span", - &&self.span, - ) - } - } - #[automatically_derived] - impl ::core::clone::Clone for TokenWithSpan { - #[inline] - fn clone(&self) -> TokenWithSpan { - TokenWithSpan { - token: ::core::clone::Clone::clone(&self.token), - span: ::core::clone::Clone::clone(&self.span), - } - } - } - #[automatically_derived] - impl ::core::hash::Hash for TokenWithSpan { - #[inline] - fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) -> () { - ::core::hash::Hash::hash(&self.token, state); - ::core::hash::Hash::hash(&self.span, state) - } - } - #[automatically_derived] - impl ::core::cmp::Ord for TokenWithSpan { - #[inline] - fn cmp(&self, other: &TokenWithSpan) -> ::core::cmp::Ordering { - match ::core::cmp::Ord::cmp(&self.token, &other.token) { - ::core::cmp::Ordering::Equal => { - ::core::cmp::Ord::cmp(&self.span, &other.span) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::PartialOrd for TokenWithSpan { - #[inline] - fn partial_cmp( - &self, - other: &TokenWithSpan, - ) -> ::core::option::Option<::core::cmp::Ordering> { - match ::core::cmp::PartialOrd::partial_cmp(&self.token, &other.token) { - ::core::option::Option::Some(::core::cmp::Ordering::Equal) => { - ::core::cmp::PartialOrd::partial_cmp(&self.span, &other.span) - } - cmp => cmp, - } - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TokenWithSpan { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TokenWithSpan {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TokenWithSpan { - #[inline] - fn eq(&self, other: &TokenWithSpan) -> bool { - self.token == other.token && self.span == other.span - } - } - impl TokenWithSpan { - /// Create a new [`TokenWithSpan`] from a [`Token`] and a [`Span`] - pub fn new(token: Token, span: Span) -> Self { - Self { token, span } - } - /// Wrap a token with an empty span - pub fn wrap(token: Token) -> Self { - Self::new(token, Span::empty()) - } - /// Wrap a token with a location from `start` to `end` - pub fn at(token: Token, start: Location, end: Location) -> Self { - Self::new(token, Span::new(start, end)) - } - /// Return an EOF token with no location - pub fn new_eof() -> Self { - Self::wrap(Token::EOF) - } - } - impl PartialEq for TokenWithSpan { - fn eq(&self, other: &Token) -> bool { - &self.token == other - } - } - impl PartialEq for Token { - fn eq(&self, other: &TokenWithSpan) -> bool { - self == &other.token - } - } - impl fmt::Display for TokenWithSpan { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.token.fmt(f) - } - } - /// Tokenizer error - pub struct TokenizerError { - pub message: String, - pub location: Location, - } - #[automatically_derived] - impl ::core::fmt::Debug for TokenizerError { - #[inline] - fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { - ::core::fmt::Formatter::debug_struct_field2_finish( - f, - "TokenizerError", - "message", - &self.message, - "location", - &&self.location, - ) - } - } - #[automatically_derived] - impl ::core::marker::StructuralPartialEq for TokenizerError {} - #[automatically_derived] - impl ::core::cmp::PartialEq for TokenizerError { - #[inline] - fn eq(&self, other: &TokenizerError) -> bool { - self.message == other.message && self.location == other.location - } - } - #[automatically_derived] - impl ::core::cmp::Eq for TokenizerError { - #[inline] - #[doc(hidden)] - #[coverage(off)] - fn assert_receiver_is_total_eq(&self) -> () { - let _: ::core::cmp::AssertParamIsEq; - let _: ::core::cmp::AssertParamIsEq; - } - } - impl fmt::Display for TokenizerError { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.write_fmt(format_args!("{0}{1}", self.message, self.location)) - } - } - #[cfg(feature = "std")] - impl std::error::Error for TokenizerError {} - struct State<'a> { - peekable: Peekable>, - pub line: u64, - pub col: u64, - } - impl State<'_> { - /// return the next character and advance the stream - pub fn next(&mut self) -> Option { - match self.peekable.next() { - None => None, - Some(s) => { - if s == '\n' { - self.line += 1; - self.col = 1; - } else { - self.col += 1; - } - Some(s) - } - } - } - /// return the next character but do not advance the stream - pub fn peek(&mut self) -> Option<&char> { - self.peekable.peek() - } - pub fn location(&self) -> Location { - Location { - line: self.line, - column: self.col, - } - } - } - /// Represents how many quote characters enclose a string literal. - enum NumStringQuoteChars { - /// e.g. `"abc"`, `'abc'`, `r'abc'` - One, - /// e.g. `"""abc"""`, `'''abc'''`, `r'''abc'''` - Many(NonZeroU8), - } - #[automatically_derived] - impl ::core::marker::Copy for NumStringQuoteChars {} - #[automatically_derived] - impl ::core::clone::Clone for NumStringQuoteChars { - #[inline] - fn clone(&self) -> NumStringQuoteChars { - let _: ::core::clone::AssertParamIsClone; - *self - } - } - /// Settings for tokenizing a quoted string literal. - struct TokenizeQuotedStringSettings { - /// The character used to quote the string. - quote_style: char, - /// Represents how many quotes characters enclose the string literal. - num_quote_chars: NumStringQuoteChars, - /// The number of opening quotes left to consume, before parsing - /// the remaining string literal. - /// For example: given initial string `"""abc"""`. If the caller has - /// already parsed the first quote for some reason, then this value - /// is set to 1, flagging to look to consume only 2 leading quotes. - num_opening_quotes_to_consume: u8, - /// True if the string uses backslash escaping of special characters - /// e.g `'abc\ndef\'ghi' - backslash_escape: bool, - } - /// SQL Tokenizer - pub struct Tokenizer<'a> { - dialect: &'a dyn Dialect, - query: &'a str, - /// If true (the default), the tokenizer will un-escape literal - /// SQL strings See [`Tokenizer::with_unescape`] for more details. - unescape: bool, - } - impl<'a> Tokenizer<'a> { - /// Create a new SQL tokenizer for the specified SQL statement - /// - /// ``` - /// # use sqlparser::tokenizer::{Token, Whitespace, Tokenizer}; - /// # use sqlparser::dialect::GenericDialect; - /// # let dialect = GenericDialect{}; - /// let query = r#"SELECT 'foo'"#; - /// - /// // Parsing the query - /// let tokens = Tokenizer::new(&dialect, &query).tokenize().unwrap(); - /// - /// assert_eq!(tokens, vec![ - /// Token::make_word("SELECT", None), - /// Token::Whitespace(Whitespace::Space), - /// Token::SingleQuotedString("foo".to_string()), - /// ]); - pub fn new(dialect: &'a dyn Dialect, query: &'a str) -> Self { - Self { - dialect, - query, - unescape: true, - } - } - /// Set unescape mode - /// - /// When true (default) the tokenizer unescapes literal values - /// (for example, `""` in SQL is unescaped to the literal `"`). - /// - /// When false, the tokenizer provides the raw strings as provided - /// in the query. This can be helpful for programs that wish to - /// recover the *exact* original query text without normalizing - /// the escaping - /// - /// # Example - /// - /// ``` - /// # use sqlparser::tokenizer::{Token, Tokenizer}; - /// # use sqlparser::dialect::GenericDialect; - /// # let dialect = GenericDialect{}; - /// let query = r#""Foo "" Bar""#; - /// let unescaped = Token::make_word(r#"Foo " Bar"#, Some('"')); - /// let original = Token::make_word(r#"Foo "" Bar"#, Some('"')); - /// - /// // Parsing with unescaping (default) - /// let tokens = Tokenizer::new(&dialect, &query).tokenize().unwrap(); - /// assert_eq!(tokens, vec![unescaped]); - /// - /// // Parsing with unescape = false - /// let tokens = Tokenizer::new(&dialect, &query) - /// .with_unescape(false) - /// .tokenize().unwrap(); - /// assert_eq!(tokens, vec![original]); - /// ``` - pub fn with_unescape(mut self, unescape: bool) -> Self { - self.unescape = unescape; - self - } - /// Tokenize the statement and produce a vector of tokens - pub fn tokenize(&mut self) -> Result, TokenizerError> { - let twl = self.tokenize_with_location()?; - Ok(twl.into_iter().map(|t| t.token).collect()) - } - /// Tokenize the statement and produce a vector of tokens with location information - pub fn tokenize_with_location( - &mut self, - ) -> Result, TokenizerError> { - let mut tokens: Vec = ::alloc::vec::Vec::new(); - self.tokenize_with_location_into_buf(&mut tokens).map(|_| tokens) - } - /// Tokenize the statement and append tokens with location information into the provided buffer. - /// If an error is thrown, the buffer will contain all tokens that were successfully parsed before the error. - pub fn tokenize_with_location_into_buf( - &mut self, - buf: &mut Vec, - ) -> Result<(), TokenizerError> { - let mut state = State { - peekable: self.query.chars().peekable(), - line: 1, - col: 1, - }; - let mut location = state.location(); - while let Some(token) = self.next_token(&mut state)? { - let span = location.span_to(state.location()); - buf.push(TokenWithSpan { token, span }); - location = state.location(); - } - Ok(()) - } - fn tokenize_identifier_or_keyword( - &self, - ch: impl IntoIterator, - chars: &mut State, - ) -> Result, TokenizerError> { - chars.next(); - let ch: String = ch.into_iter().collect(); - let word = self.tokenize_word(ch, chars); - if word.chars().all(|x| x.is_ascii_digit() || x == '.') { - let mut inner_state = State { - peekable: word.chars().peekable(), - line: 0, - col: 0, - }; - let mut s = peeking_take_while( - &mut inner_state, - |ch| match ch { - '0'..='9' | '.' => true, - _ => false, - }, - ); - let s2 = peeking_take_while( - chars, - |ch| match ch { - '0'..='9' | '.' => true, - _ => false, - }, - ); - s += s2.as_str(); - return Ok(Some(Token::Number(s, false))); - } - Ok(Some(Token::make_word(&word, None))) - } - /// Get the next token or return None - fn next_token( - &self, - chars: &mut State, - ) -> Result, TokenizerError> { - match chars.peek() { - Some(&ch) => { - match ch { - ' ' => { - self.consume_and_return( - chars, - Token::Whitespace(Whitespace::Space), - ) - } - '\t' => { - self.consume_and_return( - chars, - Token::Whitespace(Whitespace::Tab), - ) - } - '\n' => { - self.consume_and_return( - chars, - Token::Whitespace(Whitespace::Newline), - ) - } - '\r' => { - chars.next(); - if let Some('\n') = chars.peek() { - chars.next(); - } - Ok(Some(Token::Whitespace(Whitespace::Newline))) - } - b @ 'B' - | b @ 'b' if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) => { - chars.next(); - match chars.peek() { - Some('\'') => { - if self.dialect.supports_triple_quoted_string() { - return self - .tokenize_single_or_triple_quoted_string::< - fn(String) -> Token, - >( - chars, - '\'', - false, - Token::SingleQuotedByteStringLiteral, - Token::TripleSingleQuotedByteStringLiteral, - ); - } - let s = self - .tokenize_single_quoted_string(chars, '\'', false)?; - Ok(Some(Token::SingleQuotedByteStringLiteral(s))) - } - Some('\"') => { - if self.dialect.supports_triple_quoted_string() { - return self - .tokenize_single_or_triple_quoted_string::< - fn(String) -> Token, - >( - chars, - '"', - false, - Token::DoubleQuotedByteStringLiteral, - Token::TripleDoubleQuotedByteStringLiteral, - ); - } - let s = self - .tokenize_single_quoted_string(chars, '\"', false)?; - Ok(Some(Token::DoubleQuotedByteStringLiteral(s))) - } - _ => { - let s = self.tokenize_word(b, chars); - Ok(Some(Token::make_word(&s, None))) - } - } - } - b @ 'R' - | b @ 'r' if (self.dialect.is::() - || self.dialect.is::()) => { - chars.next(); - match chars.peek() { - Some('\'') => { - self.tokenize_single_or_triple_quoted_string::< - fn(String) -> Token, - >( - chars, - '\'', - false, - Token::SingleQuotedRawStringLiteral, - Token::TripleSingleQuotedRawStringLiteral, - ) - } - Some('\"') => { - self.tokenize_single_or_triple_quoted_string::< - fn(String) -> Token, - >( - chars, - '"', - false, - Token::DoubleQuotedRawStringLiteral, - Token::TripleDoubleQuotedRawStringLiteral, - ) - } - _ => { - let s = self.tokenize_word(b, chars); - Ok(Some(Token::make_word(&s, None))) - } - } - } - n @ 'N' | n @ 'n' => { - chars.next(); - match chars.peek() { - Some('\'') => { - let backslash_escape = self - .dialect - .supports_string_literal_backslash_escape(); - let s = self - .tokenize_single_quoted_string( - chars, - '\'', - backslash_escape, - )?; - Ok(Some(Token::NationalStringLiteral(s))) - } - _ => { - let s = self.tokenize_word(n, chars); - Ok(Some(Token::make_word(&s, None))) - } - } - } - x @ 'e' - | x @ 'E' if self.dialect.supports_string_escape_constant() => { - let starting_loc = chars.location(); - chars.next(); - match chars.peek() { - Some('\'') => { - let s = self - .tokenize_escaped_single_quoted_string( - starting_loc, - chars, - )?; - Ok(Some(Token::EscapedStringLiteral(s))) - } - _ => { - let s = self.tokenize_word(x, chars); - Ok(Some(Token::make_word(&s, None))) - } - } - } - x @ 'u' - | x @ 'U' if self.dialect.supports_unicode_string_literal() => { - chars.next(); - if chars.peek() == Some(&'&') { - let mut chars_clone = chars.peekable.clone(); - chars_clone.next(); - if chars_clone.peek() == Some(&'\'') { - chars.next(); - let s = unescape_unicode_single_quoted_string(chars)?; - return Ok(Some(Token::UnicodeStringLiteral(s))); - } - } - let s = self.tokenize_word(x, chars); - Ok(Some(Token::make_word(&s, None))) - } - x @ 'x' | x @ 'X' => { - chars.next(); - match chars.peek() { - Some('\'') => { - let s = self - .tokenize_single_quoted_string(chars, '\'', true)?; - Ok(Some(Token::HexStringLiteral(s))) - } - _ => { - let s = self.tokenize_word(x, chars); - Ok(Some(Token::make_word(&s, None))) - } - } - } - '\'' => { - if self.dialect.supports_triple_quoted_string() { - return self - .tokenize_single_or_triple_quoted_string::< - fn(String) -> Token, - >( - chars, - '\'', - self.dialect.supports_string_literal_backslash_escape(), - Token::SingleQuotedString, - Token::TripleSingleQuotedString, - ); - } - let s = self - .tokenize_single_quoted_string( - chars, - '\'', - self.dialect.supports_string_literal_backslash_escape(), - )?; - Ok(Some(Token::SingleQuotedString(s))) - } - '\"' if !self.dialect.is_delimited_identifier_start(ch) - && !self.dialect.is_identifier_start(ch) => { - if self.dialect.supports_triple_quoted_string() { - return self - .tokenize_single_or_triple_quoted_string::< - fn(String) -> Token, - >( - chars, - '"', - self.dialect.supports_string_literal_backslash_escape(), - Token::DoubleQuotedString, - Token::TripleDoubleQuotedString, - ); - } - let s = self - .tokenize_single_quoted_string( - chars, - '"', - self.dialect.supports_string_literal_backslash_escape(), - )?; - Ok(Some(Token::DoubleQuotedString(s))) - } - quote_start if self - .dialect - .is_delimited_identifier_start(ch) => { - let word = self - .tokenize_quoted_identifier(quote_start, chars)?; - Ok(Some(Token::make_word(&word, Some(quote_start)))) - } - quote_start if self - .dialect - .is_nested_delimited_identifier_start(quote_start) - && self - .dialect - .peek_nested_delimited_identifier_quotes( - chars.peekable.clone(), - ) - .is_some() => { - let Some((quote_start, nested_quote_start)) = self - .dialect - .peek_nested_delimited_identifier_quotes( - chars.peekable.clone(), - ) else { - return self - .tokenizer_error( - chars.location(), - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Expected nested delimiter \'{0}\' before EOF.", - quote_start, - ), - ); - res - }), - ); - }; - let Some(nested_quote_start) = nested_quote_start else { - let word = self - .tokenize_quoted_identifier(quote_start, chars)?; - return Ok(Some(Token::make_word(&word, Some(quote_start)))); - }; - let mut word = ::alloc::vec::Vec::new(); - let quote_end = Word::matching_end_quote(quote_start); - let nested_quote_end = Word::matching_end_quote( - nested_quote_start, - ); - let error_loc = chars.location(); - chars.next(); - peeking_take_while(chars, |ch| ch.is_whitespace()); - if chars.peek() != Some(&nested_quote_start) { - return self - .tokenizer_error( - error_loc, - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Expected nested delimiter \'{0}\' before EOF.", - nested_quote_start, - ), - ); - res - }), - ); - } - word.push(nested_quote_start.into()); - word.push( - self.tokenize_quoted_identifier(nested_quote_end, chars)?, - ); - word.push(nested_quote_end.into()); - peeking_take_while(chars, |ch| ch.is_whitespace()); - if chars.peek() != Some("e_end) { - return self - .tokenizer_error( - error_loc, - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Expected close delimiter \'{0}\' before EOF.", - quote_end, - ), - ); - res - }), - ); - } - chars.next(); - Ok(Some(Token::make_word(&word.concat(), Some(quote_start)))) - } - '0'..='9' | '.' => { - let is_number_separator = | - ch: char, - next_char: Option| - { - self.dialect.supports_numeric_literal_underscores() - && ch == '_' - && next_char - .is_some_and(|next_ch| next_ch.is_ascii_hexdigit()) - }; - let mut s = peeking_next_take_while( - chars, - |ch, next_ch| { - ch.is_ascii_digit() || is_number_separator(ch, next_ch) - }, - ); - if s == "0" && chars.peek() == Some(&'x') { - chars.next(); - let s2 = peeking_next_take_while( - chars, - |ch, next_ch| { - ch.is_ascii_hexdigit() || is_number_separator(ch, next_ch) - }, - ); - return Ok(Some(Token::HexStringLiteral(s2))); - } - if let Some('.') = chars.peek() { - s.push('.'); - chars.next(); - } - s - += &peeking_next_take_while( - chars, - |ch, next_ch| { - ch.is_ascii_digit() || is_number_separator(ch, next_ch) - }, - ); - if s == "." { - return Ok(Some(Token::Period)); - } - let mut exponent_part = String::new(); - if chars.peek() == Some(&'e') || chars.peek() == Some(&'E') { - let mut char_clone = chars.peekable.clone(); - exponent_part.push(char_clone.next().unwrap()); - match char_clone.peek() { - Some( - &c, - ) if match c { - '+' | '-' => true, - _ => false, - } => { - exponent_part.push(c); - char_clone.next(); - } - _ => {} - } - match char_clone.peek() { - Some(&c) if c.is_ascii_digit() => { - for _ in 0..exponent_part.len() { - chars.next(); - } - exponent_part - += &peeking_take_while(chars, |ch| ch.is_ascii_digit()); - s += exponent_part.as_str(); - } - _ => {} - } - } - if self.dialect.supports_numeric_prefix() - && exponent_part.is_empty() - { - let word = peeking_take_while( - chars, - |ch| self.dialect.is_identifier_part(ch), - ); - if !word.is_empty() { - s += word.as_str(); - return Ok(Some(Token::make_word(s.as_str(), None))); - } - } - let long = if chars.peek() == Some(&'L') { - chars.next(); - true - } else { - false - }; - Ok(Some(Token::Number(s, long))) - } - '(' => self.consume_and_return(chars, Token::LParen), - ')' => self.consume_and_return(chars, Token::RParen), - ',' => self.consume_and_return(chars, Token::Comma), - '-' => { - chars.next(); - match chars.peek() { - Some('-') => { - chars.next(); - let comment = self.tokenize_single_line_comment(chars); - Ok( - Some( - Token::Whitespace(Whitespace::SingleLineComment { - prefix: "--".to_owned(), - comment, - }), - ), - ) - } - Some('>') => { - chars.next(); - match chars.peek() { - Some('>') => { - self.consume_for_binop(chars, "->>", Token::LongArrow) - } - _ => self.start_binop(chars, "->", Token::Arrow), - } - } - _ => self.start_binop(chars, "-", Token::Minus), - } - } - '/' => { - chars.next(); - match chars.peek() { - Some('*') => { - chars.next(); - self.tokenize_multiline_comment(chars) - } - Some('/') if (self.dialect.is::()) => { - chars.next(); - let comment = self.tokenize_single_line_comment(chars); - Ok( - Some( - Token::Whitespace(Whitespace::SingleLineComment { - prefix: "//".to_owned(), - comment, - }), - ), - ) - } - Some( - '/', - ) if (self.dialect.is::() - || self.dialect.is::()) => { - self.consume_and_return(chars, Token::DuckIntDiv) - } - _ => Ok(Some(Token::Div)), - } - } - '+' => self.consume_and_return(chars, Token::Plus), - '*' => self.consume_and_return(chars, Token::Mul), - '%' => { - chars.next(); - match chars.peek() { - Some(s) if s.is_whitespace() => Ok(Some(Token::Mod)), - Some(sch) if self.dialect.is_identifier_start('%') => { - self.tokenize_identifier_or_keyword([ch, *sch], chars) - } - _ => self.start_binop(chars, "%", Token::Mod), - } - } - '|' => { - chars.next(); - match chars.peek() { - Some('/') => { - self.consume_for_binop(chars, "|/", Token::PGSquareRoot) - } - Some('|') => { - chars.next(); - match chars.peek() { - Some('/') => { - self.consume_for_binop(chars, "||/", Token::PGCubeRoot) - } - _ => self.start_binop(chars, "||", Token::StringConcat), - } - } - _ => self.start_binop(chars, "|", Token::Pipe), - } - } - '=' => { - chars.next(); - match chars.peek() { - Some('>') => self.consume_and_return(chars, Token::RArrow), - Some('=') => self.consume_and_return(chars, Token::DoubleEq), - _ => Ok(Some(Token::Eq)), - } - } - '!' => { - chars.next(); - match chars.peek() { - Some('=') => self.consume_and_return(chars, Token::Neq), - Some('!') => { - self.consume_and_return(chars, Token::DoubleExclamationMark) - } - Some('~') => { - chars.next(); - match chars.peek() { - Some('*') => { - self.consume_and_return( - chars, - Token::ExclamationMarkTildeAsterisk, - ) - } - Some('~') => { - chars.next(); - match chars.peek() { - Some('*') => { - self.consume_and_return( - chars, - Token::ExclamationMarkDoubleTildeAsterisk, - ) - } - _ => Ok(Some(Token::ExclamationMarkDoubleTilde)), - } - } - _ => Ok(Some(Token::ExclamationMarkTilde)), - } - } - _ => Ok(Some(Token::ExclamationMark)), - } - } - '<' => { - chars.next(); - match chars.peek() { - Some('=') => { - chars.next(); - match chars.peek() { - Some('>') => { - self.consume_for_binop(chars, "<=>", Token::Spaceship) - } - _ => self.start_binop(chars, "<=", Token::LtEq), - } - } - Some('>') => self.consume_for_binop(chars, "<>", Token::Neq), - Some('<') => { - self.consume_for_binop(chars, "<<", Token::ShiftLeft) - } - Some('@') => { - self.consume_for_binop(chars, "<@", Token::ArrowAt) - } - _ => self.start_binop(chars, "<", Token::Lt), - } - } - '>' => { - chars.next(); - match chars.peek() { - Some('=') => { - self.consume_for_binop(chars, ">=", Token::GtEq) - } - Some('>') => { - self.consume_for_binop(chars, ">>", Token::ShiftRight) - } - _ => self.start_binop(chars, ">", Token::Gt), - } - } - ':' => { - chars.next(); - match chars.peek() { - Some(':') => { - self.consume_and_return(chars, Token::DoubleColon) - } - Some('=') => { - self.consume_and_return(chars, Token::Assignment) - } - _ => Ok(Some(Token::Colon)), - } - } - ';' => self.consume_and_return(chars, Token::SemiColon), - '\\' => self.consume_and_return(chars, Token::Backslash), - '[' => self.consume_and_return(chars, Token::LBracket), - ']' => self.consume_and_return(chars, Token::RBracket), - '&' => { - chars.next(); - match chars.peek() { - Some('&') => { - chars.next(); - self.start_binop(chars, "&&", Token::Overlap) - } - _ => self.start_binop(chars, "&", Token::Ampersand), - } - } - '^' => { - chars.next(); - match chars.peek() { - Some('@') => self.consume_and_return(chars, Token::CaretAt), - _ => Ok(Some(Token::Caret)), - } - } - '{' => self.consume_and_return(chars, Token::LBrace), - '}' => self.consume_and_return(chars, Token::RBrace), - '#' if (self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::() - || self.dialect.is::()) => { - chars.next(); - let comment = self.tokenize_single_line_comment(chars); - Ok( - Some( - Token::Whitespace(Whitespace::SingleLineComment { - prefix: "#".to_owned(), - comment, - }), - ), - ) - } - '~' => { - chars.next(); - match chars.peek() { - Some('*') => { - self.consume_for_binop(chars, "~*", Token::TildeAsterisk) - } - Some('~') => { - chars.next(); - match chars.peek() { - Some('*') => { - self.consume_for_binop( - chars, - "~~*", - Token::DoubleTildeAsterisk, - ) - } - _ => self.start_binop(chars, "~~", Token::DoubleTilde), - } - } - _ => self.start_binop(chars, "~", Token::Tilde), - } - } - '#' => { - chars.next(); - match chars.peek() { - Some('-') => { - self.consume_for_binop(chars, "#-", Token::HashMinus) - } - Some('>') => { - chars.next(); - match chars.peek() { - Some('>') => { - self.consume_for_binop(chars, "#>>", Token::HashLongArrow) - } - _ => self.start_binop(chars, "#>", Token::HashArrow), - } - } - Some(' ') => Ok(Some(Token::Sharp)), - Some(sch) if self.dialect.is_identifier_start('#') => { - self.tokenize_identifier_or_keyword([ch, *sch], chars) - } - _ => self.start_binop(chars, "#", Token::Sharp), - } - } - '@' => { - chars.next(); - match chars.peek() { - Some('>') => self.consume_and_return(chars, Token::AtArrow), - Some('?') => { - self.consume_and_return(chars, Token::AtQuestion) - } - Some('@') => { - chars.next(); - match chars.peek() { - Some(' ') => Ok(Some(Token::AtAt)), - Some(tch) if self.dialect.is_identifier_start('@') => { - self.tokenize_identifier_or_keyword([ch, '@', *tch], chars) - } - _ => Ok(Some(Token::AtAt)), - } - } - Some(' ') => Ok(Some(Token::AtSign)), - Some('\'') => Ok(Some(Token::AtSign)), - Some('\"') => Ok(Some(Token::AtSign)), - Some('`') => Ok(Some(Token::AtSign)), - Some(sch) if self.dialect.is_identifier_start('@') => { - self.tokenize_identifier_or_keyword([ch, *sch], chars) - } - _ => Ok(Some(Token::AtSign)), - } - } - '?' if (self.dialect.is::()) => { - chars.next(); - match chars.peek() { - Some('|') => { - self.consume_and_return(chars, Token::QuestionPipe) - } - Some('&') => { - self.consume_and_return(chars, Token::QuestionAnd) - } - _ => self.consume_and_return(chars, Token::Question), - } - } - '?' => { - chars.next(); - let s = peeking_take_while(chars, |ch| ch.is_numeric()); - Ok(Some(Token::Placeholder(String::from("?") + &s))) - } - ch if self.dialect.is_identifier_start(ch) => { - self.tokenize_identifier_or_keyword([ch], chars) - } - '$' => Ok(Some(self.tokenize_dollar_preceded_value(chars)?)), - ch if ch.is_whitespace() => { - self.consume_and_return( - chars, - Token::Whitespace(Whitespace::Space), - ) - } - other => self.consume_and_return(chars, Token::Char(other)), - } - } - None => Ok(None), - } - } - /// Consume the next character, then parse a custom binary operator. The next character should be included in the prefix - fn consume_for_binop( - &self, - chars: &mut State, - prefix: &str, - default: Token, - ) -> Result, TokenizerError> { - chars.next(); - self.start_binop(chars, prefix, default) - } - /// parse a custom binary operator - fn start_binop( - &self, - chars: &mut State, - prefix: &str, - default: Token, - ) -> Result, TokenizerError> { - let mut custom = None; - while let Some(&ch) = chars.peek() { - if !self.dialect.is_custom_operator_part(ch) { - break; - } - custom.get_or_insert_with(|| prefix.to_string()).push(ch); - chars.next(); - } - Ok(Some(custom.map(Token::CustomBinaryOperator).unwrap_or(default))) - } - /// Tokenize dollar preceded value (i.e: a string/placeholder) - fn tokenize_dollar_preceded_value( - &self, - chars: &mut State, - ) -> Result { - let mut s = String::new(); - let mut value = String::new(); - chars.next(); - if match chars.peek() { - Some('$') => true, - _ => false, - } && !self.dialect.supports_dollar_placeholder() - { - chars.next(); - let mut is_terminated = false; - let mut prev: Option = None; - while let Some(&ch) = chars.peek() { - if prev == Some('$') { - if ch == '$' { - chars.next(); - is_terminated = true; - break; - } else { - s.push('$'); - s.push(ch); - } - } else if ch != '$' { - s.push(ch); - } - prev = Some(ch); - chars.next(); - } - return if chars.peek().is_none() && !is_terminated { - self.tokenizer_error( - chars.location(), - "Unterminated dollar-quoted string", - ) - } else { - Ok( - Token::DollarQuotedString(DollarQuotedString { - value: s, - tag: None, - }), - ) - }; - } else { - value - .push_str( - &peeking_take_while( - chars, - |ch| { - ch.is_alphanumeric() || ch == '_' - || match ch { - '$' if self.dialect.supports_dollar_placeholder() => true, - _ => false, - } - }, - ), - ); - if match chars.peek() { - Some('$') => true, - _ => false, - } && !self.dialect.supports_dollar_placeholder() - { - chars.next(); - let mut temp = String::new(); - let end_delimiter = ::alloc::__export::must_use({ - let res = ::alloc::fmt::format(format_args!("${0}$", value)); - res - }); - loop { - match chars.next() { - Some(ch) => { - temp.push(ch); - if temp.ends_with(&end_delimiter) { - if let Some(temp) = temp.strip_suffix(&end_delimiter) { - s.push_str(temp); - } - break; - } - } - None => { - if temp.ends_with(&end_delimiter) { - if let Some(temp) = temp.strip_suffix(&end_delimiter) { - s.push_str(temp); - } - break; - } - return self - .tokenizer_error( - chars.location(), - "Unterminated dollar-quoted, expected $", - ); - } - } - } - } else { - return Ok(Token::Placeholder(String::from("$") + &value)); - } - } - Ok( - Token::DollarQuotedString(DollarQuotedString { - value: s, - tag: if value.is_empty() { None } else { Some(value) }, - }), - ) - } - fn tokenizer_error( - &self, - loc: Location, - message: impl Into, - ) -> Result { - Err(TokenizerError { - message: message.into(), - location: loc, - }) - } - fn tokenize_single_line_comment(&self, chars: &mut State) -> String { - let mut comment = peeking_take_while( - chars, - |ch| match ch { - '\n' => false, - '\r' if (self.dialect.is::()) => false, - _ => true, - }, - ); - if let Some(ch) = chars.next() { - if !(ch == '\n' || ch == '\r') { - ::core::panicking::panic( - "assertion failed: ch == \'\\n\' || ch == \'\\r\'", - ) - } - comment.push(ch); - } - comment - } - /// Tokenize an identifier or keyword, after the first char is already consumed. - fn tokenize_word( - &self, - first_chars: impl Into, - chars: &mut State, - ) -> String { - let mut s = first_chars.into(); - s.push_str( - &peeking_take_while(chars, |ch| { self.dialect.is_identifier_part(ch) }), - ); - s - } - /// Read a quoted identifier - fn tokenize_quoted_identifier( - &self, - quote_start: char, - chars: &mut State, - ) -> Result { - let error_loc = chars.location(); - chars.next(); - let quote_end = Word::matching_end_quote(quote_start); - let (s, last_char) = self.parse_quoted_ident(chars, quote_end); - if last_char == Some(quote_end) { - Ok(s) - } else { - self.tokenizer_error( - error_loc, - ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Expected close delimiter \'{0}\' before EOF.", - quote_end, - ), - ); - res - }), - ) - } - } - /// Read a single quoted string, starting with the opening quote. - fn tokenize_escaped_single_quoted_string( - &self, - starting_loc: Location, - chars: &mut State, - ) -> Result { - if let Some(s) = unescape_single_quoted_string(chars) { - return Ok(s); - } - self.tokenizer_error(starting_loc, "Unterminated encoded string literal") - } - /// Reads a string literal quoted by a single or triple quote characters. - /// Examples: `'abc'`, `'''abc'''`, `"""abc"""`. - fn tokenize_single_or_triple_quoted_string( - &self, - chars: &mut State, - quote_style: char, - backslash_escape: bool, - single_quote_token: F, - triple_quote_token: F, - ) -> Result, TokenizerError> - where - F: Fn(String) -> Token, - { - let error_loc = chars.location(); - let mut num_opening_quotes = 0u8; - for _ in 0..3 { - if Some("e_style) == chars.peek() { - chars.next(); - num_opening_quotes += 1; - } else { - break; - } - } - let (token_fn, num_quote_chars) = match num_opening_quotes { - 1 => (single_quote_token, NumStringQuoteChars::One), - 2 => { - return Ok(Some(single_quote_token("".into()))); - } - 3 => { - let Some(num_quote_chars) = NonZeroU8::new(3) else { - return self - .tokenizer_error( - error_loc, - "invalid number of opening quotes", - ); - }; - (triple_quote_token, NumStringQuoteChars::Many(num_quote_chars)) - } - _ => { - return self - .tokenizer_error(error_loc, "invalid string literal opening"); - } - }; - let settings = TokenizeQuotedStringSettings { - quote_style, - num_quote_chars, - num_opening_quotes_to_consume: 0, - backslash_escape, - }; - self.tokenize_quoted_string(chars, settings).map(token_fn).map(Some) - } - /// Reads a string literal quoted by a single quote character. - fn tokenize_single_quoted_string( - &self, - chars: &mut State, - quote_style: char, - backslash_escape: bool, - ) -> Result { - self.tokenize_quoted_string( - chars, - TokenizeQuotedStringSettings { - quote_style, - num_quote_chars: NumStringQuoteChars::One, - num_opening_quotes_to_consume: 1, - backslash_escape, - }, - ) - } - /// Read a quoted string. - fn tokenize_quoted_string( - &self, - chars: &mut State, - settings: TokenizeQuotedStringSettings, - ) -> Result { - let mut s = String::new(); - let error_loc = chars.location(); - for _ in 0..settings.num_opening_quotes_to_consume { - if Some(settings.quote_style) != chars.next() { - return self - .tokenizer_error(error_loc, "invalid string literal opening"); - } - } - let mut num_consecutive_quotes = 0; - while let Some(&ch) = chars.peek() { - let pending_final_quote = match settings.num_quote_chars { - NumStringQuoteChars::One => Some(NumStringQuoteChars::One), - n @ NumStringQuoteChars::Many( - count, - ) if num_consecutive_quotes + 1 == count.get() => Some(n), - NumStringQuoteChars::Many(_) => None, - }; - match ch { - char if char == settings.quote_style - && pending_final_quote.is_some() => { - chars.next(); - if let Some(NumStringQuoteChars::Many(count)) = pending_final_quote { - let mut buf = s.chars(); - for _ in 1..count.get() { - buf.next_back(); - } - return Ok(buf.as_str().to_string()); - } else if chars - .peek() - .map(|c| *c == settings.quote_style) - .unwrap_or(false) - { - s.push(ch); - if !self.unescape { - s.push(ch); - } - chars.next(); - } else { - return Ok(s); - } - } - '\\' if settings.backslash_escape => { - chars.next(); - num_consecutive_quotes = 0; - if let Some(next) = chars.peek() { - if !self.unescape { - s.push(ch); - s.push(*next); - chars.next(); - } else { - let n = match next { - '0' => '\0', - 'a' => '\u{7}', - 'b' => '\u{8}', - 'f' => '\u{c}', - 'n' => '\n', - 'r' => '\r', - 't' => '\t', - 'Z' => '\u{1a}', - _ => *next, - }; - s.push(n); - chars.next(); - } - } - } - ch => { - chars.next(); - if ch == settings.quote_style { - num_consecutive_quotes += 1; - } else { - num_consecutive_quotes = 0; - } - s.push(ch); - } - } - } - self.tokenizer_error(error_loc, "Unterminated string literal") - } - fn tokenize_multiline_comment( - &self, - chars: &mut State, - ) -> Result, TokenizerError> { - let mut s = String::new(); - let mut nested = 1; - let supports_nested_comments = self.dialect.supports_nested_comments(); - loop { - match chars.next() { - Some( - '/', - ) if match chars.peek() { - Some('*') => true, - _ => false, - } && supports_nested_comments => { - chars.next(); - s.push('/'); - s.push('*'); - nested += 1; - } - Some( - '*', - ) if match chars.peek() { - Some('/') => true, - _ => false, - } => { - chars.next(); - nested -= 1; - if nested == 0 { - break Ok( - Some(Token::Whitespace(Whitespace::MultiLineComment(s))), - ); - } - s.push('*'); - s.push('/'); - } - Some(ch) => { - s.push(ch); - } - None => { - break self - .tokenizer_error( - chars.location(), - "Unexpected EOF while in a multi-line comment", - ); - } - } - } - } - fn parse_quoted_ident( - &self, - chars: &mut State, - quote_end: char, - ) -> (String, Option) { - let mut last_char = None; - let mut s = String::new(); - while let Some(ch) = chars.next() { - if ch == quote_end { - if chars.peek() == Some("e_end) { - chars.next(); - s.push(ch); - if !self.unescape { - s.push(ch); - } - } else { - last_char = Some(quote_end); - break; - } - } else { - s.push(ch); - } - } - (s, last_char) - } - #[allow(clippy::unnecessary_wraps)] - fn consume_and_return( - &self, - chars: &mut State, - t: Token, - ) -> Result, TokenizerError> { - chars.next(); - Ok(Some(t)) - } - } - /// Read from `chars` until `predicate` returns `false` or EOF is hit. - /// Return the characters read as String, and keep the first non-matching - /// char available as `chars.next()`. - fn peeking_take_while( - chars: &mut State, - mut predicate: impl FnMut(char) -> bool, - ) -> String { - let mut s = String::new(); - while let Some(&ch) = chars.peek() { - if predicate(ch) { - chars.next(); - s.push(ch); - } else { - break; - } - } - s - } - /// Same as peeking_take_while, but also passes the next character to the predicate. - fn peeking_next_take_while( - chars: &mut State, - mut predicate: impl FnMut(char, Option) -> bool, - ) -> String { - let mut s = String::new(); - while let Some(&ch) = chars.peek() { - let next_char = chars.peekable.clone().nth(1); - if predicate(ch, next_char) { - chars.next(); - s.push(ch); - } else { - break; - } - } - s - } - fn unescape_single_quoted_string(chars: &mut State<'_>) -> Option { - Unescape::new(chars).unescape() - } - struct Unescape<'a: 'b, 'b> { - chars: &'b mut State<'a>, - } - impl<'a: 'b, 'b> Unescape<'a, 'b> { - fn new(chars: &'b mut State<'a>) -> Self { - Self { chars } - } - fn unescape(mut self) -> Option { - let mut unescaped = String::new(); - self.chars.next(); - while let Some(c) = self.chars.next() { - if c == '\'' { - if self.chars.peek().map(|c| *c == '\'').unwrap_or(false) { - self.chars.next(); - unescaped.push('\''); - continue; - } - return Some(unescaped); - } - if c != '\\' { - unescaped.push(c); - continue; - } - let c = match self.chars.next()? { - 'b' => '\u{0008}', - 'f' => '\u{000C}', - 'n' => '\n', - 'r' => '\r', - 't' => '\t', - 'u' => self.unescape_unicode_16()?, - 'U' => self.unescape_unicode_32()?, - 'x' => self.unescape_hex()?, - c if c.is_digit(8) => self.unescape_octal(c)?, - c => c, - }; - unescaped.push(Self::check_null(c)?); - } - None - } - #[inline] - fn check_null(c: char) -> Option { - if c == '\0' { None } else { Some(c) } - } - #[inline] - fn byte_to_char(s: &str) -> Option { - match u32::from_str_radix(s, RADIX) { - Err(_) => None, - Ok(n) => { - let n = n & 0xFF; - if n <= 127 { char::from_u32(n) } else { None } - } - } - } - fn unescape_hex(&mut self) -> Option { - let mut s = String::new(); - for _ in 0..2 { - match self.next_hex_digit() { - Some(c) => s.push(c), - None => break, - } - } - if s.is_empty() { - return Some('x'); - } - Self::byte_to_char::<16>(&s) - } - #[inline] - fn next_hex_digit(&mut self) -> Option { - match self.chars.peek() { - Some(c) if c.is_ascii_hexdigit() => self.chars.next(), - _ => None, - } - } - fn unescape_octal(&mut self, c: char) -> Option { - let mut s = String::new(); - s.push(c); - for _ in 0..2 { - match self.next_octal_digest() { - Some(c) => s.push(c), - None => break, - } - } - Self::byte_to_char::<8>(&s) - } - #[inline] - fn next_octal_digest(&mut self) -> Option { - match self.chars.peek() { - Some(c) if c.is_digit(8) => self.chars.next(), - _ => None, - } - } - fn unescape_unicode_16(&mut self) -> Option { - self.unescape_unicode::<4>() - } - fn unescape_unicode_32(&mut self) -> Option { - self.unescape_unicode::<8>() - } - fn unescape_unicode(&mut self) -> Option { - let mut s = String::new(); - for _ in 0..NUM { - s.push(self.chars.next()?); - } - match u32::from_str_radix(&s, 16) { - Err(_) => None, - Ok(n) => char::from_u32(n), - } - } - } - fn unescape_unicode_single_quoted_string( - chars: &mut State<'_>, - ) -> Result { - let mut unescaped = String::new(); - chars.next(); - while let Some(c) = chars.next() { - match c { - '\'' => { - if chars.peek() == Some(&'\'') { - chars.next(); - unescaped.push('\''); - } else { - return Ok(unescaped); - } - } - '\\' => { - match chars.peek() { - Some('\\') => { - chars.next(); - unescaped.push('\\'); - } - Some('+') => { - chars.next(); - unescaped.push(take_char_from_hex_digits(chars, 6)?); - } - _ => unescaped.push(take_char_from_hex_digits(chars, 4)?), - } - } - _ => { - unescaped.push(c); - } - } - } - Err(TokenizerError { - message: "Unterminated unicode encoded string literal".to_string(), - location: chars.location(), - }) - } - fn take_char_from_hex_digits( - chars: &mut State<'_>, - max_digits: usize, - ) -> Result { - let mut result = 0u32; - for _ in 0..max_digits { - let next_char = chars - .next() - .ok_or_else(|| TokenizerError { - message: "Unexpected EOF while parsing hex digit in escaped unicode string." - .to_string(), - location: chars.location(), - })?; - let digit = next_char - .to_digit(16) - .ok_or_else(|| TokenizerError { - message: ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!( - "Invalid hex digit in escaped unicode string: {0}", - next_char, - ), - ); - res - }), - location: chars.location(), - })?; - result = result * 16 + digit; - } - char::from_u32(result) - .ok_or_else(|| TokenizerError { - message: ::alloc::__export::must_use({ - let res = ::alloc::fmt::format( - format_args!("Invalid unicode character: {0:x}", result), - ); - res - }), - location: chars.location(), - }) - } -} -#[doc(hidden)] -pub mod test_utils { - use core::fmt::Debug; - use crate::dialect::*; - use crate::parser::{Parser, ParserError}; - use crate::tokenizer::{Token, Tokenizer}; - use crate::{ast::*, parser::ParserOptions}; - /// Tests use the methods on this struct to invoke the parser on one or - /// multiple dialects. - pub struct TestedDialects { - pub dialects: Vec>, - pub options: Option, - pub recursion_limit: Option, - } - impl TestedDialects { - /// Create a TestedDialects with default options and the given dialects. - pub fn new(dialects: Vec>) -> Self { - Self { - dialects, - options: None, - recursion_limit: None, - } - } - pub fn new_with_options( - dialects: Vec>, - options: ParserOptions, - ) -> Self { - Self { - dialects, - options: Some(options), - recursion_limit: None, - } - } - pub fn with_recursion_limit(mut self, recursion_limit: usize) -> Self { - self.recursion_limit = Some(recursion_limit); - self - } - fn new_parser<'a>(&self, dialect: &'a dyn Dialect) -> Parser<'a> { - let parser = Parser::new(dialect); - let parser = if let Some(options) = &self.options { - parser.with_options(options.clone()) - } else { - parser - }; - let parser = if let Some(recursion_limit) = &self.recursion_limit { - parser.with_recursion_limit(*recursion_limit) - } else { - parser - }; - parser - } - /// Run the given function for all of `self.dialects`, assert that they - /// return the same result, and return that result. - pub fn one_of_identical_results(&self, f: F) -> T - where - F: Fn(&dyn Dialect) -> T, - { - let parse_results = self - .dialects - .iter() - .map(|dialect| (dialect, f(&**dialect))); - parse_results - .fold( - None, - |s, (dialect, parsed)| { - if let Some((prev_dialect, prev_parsed)) = s { - match (&prev_parsed, &parsed) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::Some( - format_args!( - "Parse results with {0:?} are different from {1:?}", - prev_dialect, - dialect, - ), - ), - ); - } - } - }; - } - Some((dialect, parsed)) - }, - ) - .expect("tested dialects cannot be empty") - .1 - } - pub fn run_parser_method(&self, sql: &str, f: F) -> T - where - F: Fn(&mut Parser) -> T, - { - self.one_of_identical_results(|dialect| { - let mut parser = self.new_parser(dialect).try_with_sql(sql).unwrap(); - f(&mut parser) - }) - } - /// Parses a single SQL string into multiple statements, ensuring - /// the result is the same for all tested dialects. - pub fn parse_sql_statements( - &self, - sql: &str, - ) -> Result, ParserError> { - self.one_of_identical_results(|dialect| { - let mut tokenizer = Tokenizer::new(dialect, sql); - if let Some(options) = &self.options { - tokenizer = tokenizer.with_unescape(options.unescape); - } - let tokens = tokenizer.tokenize()?; - self.new_parser(dialect).with_tokens(tokens).parse_statements() - }) - } - /// Ensures that `sql` parses as a single [Statement] for all tested - /// dialects. - /// - /// In general, the canonical SQL should be the same (see crate - /// documentation for rationale) and you should prefer the `verified_` - /// variants in testing, such as [`verified_statement`] or - /// [`verified_query`]. - /// - /// If `canonical` is non empty,this function additionally asserts - /// that: - /// - /// 1. parsing `sql` results in the same [`Statement`] as parsing - /// `canonical`. - /// - /// 2. re-serializing the result of parsing `sql` produces the same - /// `canonical` sql string - pub fn one_statement_parses_to(&self, sql: &str, canonical: &str) -> Statement { - let mut statements = self.parse_sql_statements(sql).expect(sql); - match (&statements.len(), &1) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::None, - ); - } - } - }; - if !canonical.is_empty() && sql != canonical { - match (&self.parse_sql_statements(canonical).unwrap(), &statements) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::None, - ); - } - } - }; - } - let only_statement = statements.pop().unwrap(); - if !canonical.is_empty() { - match (&canonical, &only_statement.to_string()) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::None, - ); - } - } - } - } - only_statement - } - /// Ensures that `sql` parses as an [`Expr`], and that - /// re-serializing the parse result produces canonical - pub fn expr_parses_to(&self, sql: &str, canonical: &str) -> Expr { - let ast = self.run_parser_method(sql, |parser| parser.parse_expr()).unwrap(); - match (&canonical, &&ast.to_string()) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::None, - ); - } - } - }; - ast - } - /// Ensures that `sql` parses as a single [Statement], and that - /// re-serializing the parse result produces the same `sql` - /// string (is not modified after a serialization round-trip). - pub fn verified_stmt(&self, sql: &str) -> Statement { - self.one_statement_parses_to(sql, sql) - } - /// Ensures that `sql` parses as a single [Query], and that - /// re-serializing the parse result produces the same `sql` - /// string (is not modified after a serialization round-trip). - pub fn verified_query(&self, sql: &str) -> Query { - match self.verified_stmt(sql) { - Statement::Query(query) => *query, - _ => { - ::core::panicking::panic_fmt(format_args!("Expected Query")); - } - } - } - /// Ensures that `sql` parses as a single [Query], and that - /// re-serializing the parse result matches the given canonical - /// sql string. - pub fn verified_query_with_canonical( - &self, - query: &str, - canonical: &str, - ) -> Query { - match self.one_statement_parses_to(query, canonical) { - Statement::Query(query) => *query, - _ => { - ::core::panicking::panic_fmt(format_args!("Expected Query")); - } - } - } - /// Ensures that `sql` parses as a single [Select], and that - /// re-serializing the parse result produces the same `sql` - /// string (is not modified after a serialization round-trip). - pub fn verified_only_select(&self, query: &str) -> Select { - match *self.verified_query(query).body { - SetExpr::Select(s) => *s, - _ => { - ::core::panicking::panic_fmt( - format_args!("Expected SetExpr::Select"), - ); - } - } - } - /// Ensures that `sql` parses as a single [`Select`], and that additionally: - /// - /// 1. parsing `sql` results in the same [`Statement`] as parsing - /// `canonical`. - /// - /// 2. re-serializing the result of parsing `sql` produces the same - /// `canonical` sql string - pub fn verified_only_select_with_canonical( - &self, - query: &str, - canonical: &str, - ) -> Select { - let q = match self.one_statement_parses_to(query, canonical) { - Statement::Query(query) => *query, - _ => { - ::core::panicking::panic_fmt(format_args!("Expected Query")); - } - }; - match *q.body { - SetExpr::Select(s) => *s, - _ => { - ::core::panicking::panic_fmt( - format_args!("Expected SetExpr::Select"), - ); - } - } - } - /// Ensures that `sql` parses as an [`Expr`], and that - /// re-serializing the parse result produces the same `sql` - /// string (is not modified after a serialization round-trip). - pub fn verified_expr(&self, sql: &str) -> Expr { - self.expr_parses_to(sql, sql) - } - /// Check that the tokenizer returns the expected tokens for the given SQL. - pub fn tokenizes_to(&self, sql: &str, expected: Vec) { - if self.dialects.is_empty() { - { - ::core::panicking::panic_fmt(format_args!("No dialects to test")); - }; - } - self.dialects - .iter() - .for_each(|dialect| { - let mut tokenizer = Tokenizer::new(&**dialect, sql); - if let Some(options) = &self.options { - tokenizer = tokenizer.with_unescape(options.unescape); - } - let tokens = tokenizer.tokenize().unwrap(); - match (&expected, &tokens) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::Some( - format_args!("Tokenized differently for {0:?}", dialect), - ), - ); - } - } - }; - }); - } - } - /// Returns all available dialects. - pub fn all_dialects() -> TestedDialects { - TestedDialects::new( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([ - Box::new(GenericDialect {}), - Box::new(PostgreSqlDialect {}), - Box::new(MsSqlDialect {}), - Box::new(AnsiDialect {}), - Box::new(SnowflakeDialect {}), - Box::new(HiveDialect {}), - Box::new(RedshiftSqlDialect {}), - Box::new(MySqlDialect {}), - Box::new(BigQueryDialect {}), - Box::new(SQLiteDialect {}), - Box::new(DuckDbDialect {}), - Box::new(DatabricksDialect {}), - Box::new(ClickHouseDialect {}), - ]), - ), - ) - } - /// Returns all dialects matching the given predicate. - pub fn all_dialects_where(predicate: F) -> TestedDialects - where - F: Fn(&dyn Dialect) -> bool, - { - let mut dialects = all_dialects(); - dialects.dialects.retain(|d| predicate(&**d)); - dialects - } - /// Returns available dialects. The `except` predicate is used - /// to filter out specific dialects. - pub fn all_dialects_except(except: F) -> TestedDialects - where - F: Fn(&dyn Dialect) -> bool, - { - all_dialects_where(|d| !except(d)) - } - pub fn assert_eq_vec(expected: &[&str], actual: &[T]) { - match (&expected, &actual.iter().map(ToString::to_string).collect::>()) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::None, - ); - } - } - }; - } - pub fn only(v: impl IntoIterator) -> T { - let mut iter = v.into_iter(); - if let (Some(item), None) = (iter.next(), iter.next()) { - item - } else { - { - ::core::panicking::panic_fmt( - format_args!("only called on collection without exactly one item"), - ); - } - } - } - pub fn expr_from_projection(item: &SelectItem) -> &Expr { - match item { - SelectItem::UnnamedExpr(expr) => expr, - _ => { - ::core::panicking::panic_fmt(format_args!("Expected UnnamedExpr")); - } - } - } - pub fn alter_table_op_with_name( - stmt: Statement, - expected_name: &str, - ) -> AlterTableOperation { - match stmt { - Statement::AlterTable { - name, - if_exists, - only: is_only, - operations, - on_cluster: _, - location: _, - } => { - match (&name.to_string(), &expected_name) { - (left_val, right_val) => { - if !(*left_val == *right_val) { - let kind = ::core::panicking::AssertKind::Eq; - ::core::panicking::assert_failed( - kind, - &*left_val, - &*right_val, - ::core::option::Option::None, - ); - } - } - }; - if !!if_exists { - ::core::panicking::panic("assertion failed: !if_exists") - } - if !!is_only { - ::core::panicking::panic("assertion failed: !is_only") - } - only(operations) - } - _ => { - ::core::panicking::panic_fmt( - format_args!("Expected ALTER TABLE statement"), - ); - } - } - } - pub fn alter_table_op(stmt: Statement) -> AlterTableOperation { - alter_table_op_with_name(stmt, "tab") - } - /// Creates a `Value::Number`, panic'ing if n is not a number - pub fn number(n: &str) -> Value { - Value::Number(n.parse().unwrap(), false) - } - pub fn table_alias(name: impl Into) -> Option { - Some(TableAlias { - name: Ident::new(name), - columns: ::alloc::vec::Vec::new(), - }) - } - pub fn table(name: impl Into) -> TableFactor { - TableFactor::Table { - name: ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Ident::new(name.into())]), - ), - ), - alias: None, - args: None, - with_hints: ::alloc::vec::Vec::new(), - version: None, - partitions: ::alloc::vec::Vec::new(), - with_ordinality: false, - json_path: None, - sample: None, - index_hints: ::alloc::vec::Vec::new(), - } - } - pub fn table_from_name(name: ObjectName) -> TableFactor { - TableFactor::Table { - name, - alias: None, - args: None, - with_hints: ::alloc::vec::Vec::new(), - version: None, - partitions: ::alloc::vec::Vec::new(), - with_ordinality: false, - json_path: None, - sample: None, - index_hints: ::alloc::vec::Vec::new(), - } - } - pub fn table_with_alias( - name: impl Into, - alias: impl Into, - ) -> TableFactor { - TableFactor::Table { - name: ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Ident::new(name)]), - ), - ), - alias: Some(TableAlias { - name: Ident::new(alias), - columns: ::alloc::vec::Vec::new(), - }), - args: None, - with_hints: ::alloc::vec::Vec::new(), - version: None, - partitions: ::alloc::vec::Vec::new(), - with_ordinality: false, - json_path: None, - sample: None, - index_hints: ::alloc::vec::Vec::new(), - } - } - pub fn join(relation: TableFactor) -> Join { - Join { - relation, - global: false, - join_operator: JoinOperator::Join(JoinConstraint::Natural), - } - } - pub fn call(function: &str, args: impl IntoIterator) -> Expr { - Expr::Function(Function { - name: ObjectName::from( - <[_]>::into_vec( - #[rustc_box] - ::alloc::boxed::Box::new([Ident::new(function)]), - ), - ), - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args: FunctionArguments::List(FunctionArgumentList { - duplicate_treatment: None, - args: args - .into_iter() - .map(|arg| FunctionArg::Unnamed(FunctionArgExpr::Expr(arg))) - .collect(), - clauses: ::alloc::vec::Vec::new(), - }), - filter: None, - null_treatment: None, - over: None, - within_group: ::alloc::vec::Vec::new(), - }) - } -} From 30c20f8522bb5ddce01909df0223cf4c06f43295 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Thu, 6 Feb 2025 16:38:21 +0100 Subject: [PATCH 04/23] Formatted code --- src/ast/ddl.rs | 2 +- src/ast/dml.rs | 7 ++++++- tests/sqlparser_common.rs | 15 ++++++++++----- tests/sqlparser_postgres.rs | 32 ++++++++++++++++---------------- 4 files changed, 33 insertions(+), 23 deletions(-) diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs index c47d922fc..07b51ffb9 100644 --- a/src/ast/ddl.rs +++ b/src/ast/ddl.rs @@ -1040,7 +1040,7 @@ pub enum IndexType { GiST, SPGiST, BRIN, - Bloom + Bloom, } impl fmt::Display for IndexType { diff --git a/src/ast/dml.rs b/src/ast/dml.rs index a08784125..e98677640 100644 --- a/src/ast/dml.rs +++ b/src/ast/dml.rs @@ -32,7 +32,12 @@ use sqlparser_derive::{Visit, VisitMut}; pub use super::ddl::{ColumnDef, TableConstraint}; use super::{ - display_comma_separated, display_separated, operator_classes::IndexOperatorClass, query::InputFormatClause, Assignment, ClusteredBy, CommentDef, Expr, FileFormat, FromTable, HiveDistributionStyle, HiveFormat, HiveIOFormat, HiveRowFormat, Ident, IndexType, InsertAliases, MysqlInsertPriority, ObjectName, OnCommit, OnInsert, OneOrManyWithParens, OrderByExpr, Query, RowAccessPolicy, SelectItem, Setting, SqlOption, SqliteOnConflict, StorageSerializationPolicy, TableEngine, TableObject, TableWithJoins, Tag, WrappedCollection + display_comma_separated, display_separated, operator_classes::IndexOperatorClass, + query::InputFormatClause, Assignment, ClusteredBy, CommentDef, Expr, FileFormat, FromTable, + HiveDistributionStyle, HiveFormat, HiveIOFormat, HiveRowFormat, Ident, IndexType, + InsertAliases, MysqlInsertPriority, ObjectName, OnCommit, OnInsert, OneOrManyWithParens, + OrderByExpr, Query, RowAccessPolicy, SelectItem, Setting, SqlOption, SqliteOnConflict, + StorageSerializationPolicy, TableEngine, TableObject, TableWithJoins, Tag, WrappedCollection, }; /// Index column type. diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs index 579f67a26..0e501cac4 100644 --- a/tests/sqlparser_common.rs +++ b/tests/sqlparser_common.rs @@ -8434,13 +8434,15 @@ fn parse_create_index() { asc: None, nulls_first: None, with_fill: None, - }.into(), + } + .into(), OrderByExpr { expr: Expr::Identifier(Ident::new("age")), asc: Some(false), nulls_first: None, with_fill: None, - }.into(), + } + .into(), ]; match verified_stmt(sql) { Statement::CreateIndex(CreateIndex { @@ -8470,13 +8472,15 @@ fn test_create_index_with_using_function() { asc: None, nulls_first: None, with_fill: None, - }.into(), + } + .into(), OrderByExpr { expr: Expr::Identifier(Ident::new("age")), asc: Some(false), nulls_first: None, with_fill: None, - }.into(), + } + .into(), ]; match verified_stmt(sql) { Statement::CreateIndex(CreateIndex { @@ -8514,7 +8518,8 @@ fn test_create_index_with_with_clause() { asc: None, nulls_first: None, with_fill: None, - }.into()]; + } + .into()]; let with_parameters = vec![ Expr::BinaryOp { left: Box::new(Expr::Identifier(Ident::new("fillfactor"))), diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index ed9543617..7d0953e4c 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -2511,20 +2511,20 @@ fn parse_create_users_name_trgm_index() { args: FunctionArguments::List(FunctionArgumentList { duplicate_treatment: None, args: vec![ - FunctionArg::Unnamed(FunctionArgExpr::Expr( - Expr::Identifier(Ident { + FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( + Ident { value: "first_name".to_owned(), quote_style: None, span: Span::empty() - }) - )), - FunctionArg::Unnamed(FunctionArgExpr::Expr( - Expr::Identifier(Ident { + } + ))), + FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( + Ident { value: "last_name".to_owned(), quote_style: None, span: Span::empty() - }) - )) + } + ))) ], clauses: vec![] }), @@ -2585,20 +2585,20 @@ fn parse_create_projects_name_description_trgm_index() { args: FunctionArguments::List(FunctionArgumentList { duplicate_treatment: None, args: vec![ - FunctionArg::Unnamed(FunctionArgExpr::Expr( - Expr::Identifier(Ident { + FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( + Ident { value: "name".to_owned(), quote_style: None, span: Span::empty() - }) - )), - FunctionArg::Unnamed(FunctionArgExpr::Expr( - Expr::Identifier(Ident { + } + ))), + FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( + Ident { value: "description".to_owned(), quote_style: None, span: Span::empty() - }) - )) + } + ))) ], clauses: vec![] }), From 47ea5d44b922529bb978f444fe1c14fa63b2be68 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Thu, 6 Feb 2025 16:46:41 +0100 Subject: [PATCH 05/23] Resolved issues regarding serde derive --- src/ast/operator_classes.rs | 10 ++++++++++ src/parser/mod.rs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/ast/operator_classes.rs b/src/ast/operator_classes.rs index 25b1f1fd0..3c946ab76 100644 --- a/src/ast/operator_classes.rs +++ b/src/ast/operator_classes.rs @@ -17,6 +17,11 @@ use core::fmt::{self, Display}; +#[cfg(feature = "serde")] +use serde::{Deserialize, Serialize}; +#[cfg(feature = "visitor")] +use sqlparser_derive::{Visit, VisitMut}; + use crate::keywords::Keyword; /// Trait characterizing the operator classes @@ -27,6 +32,7 @@ pub trait OperatorClass: From + Into { /// Bloom-index specific operator classes #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub enum BloomOperatorClass { Int4, @@ -58,6 +64,7 @@ impl Display for BloomOperatorClass { /// BTree GIN-based index operator class #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub enum GINOperatorClass { Int2, @@ -210,6 +217,7 @@ impl Display for GINOperatorClass { /// BTree GIST-based index operator class #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub enum GiSTOperatorClass { OID, @@ -365,6 +373,7 @@ impl Display for GiSTOperatorClass { /// BTree-index specific operator classes #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub enum BTreeOperatorClass { /// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html) @@ -444,6 +453,7 @@ impl Display for BTreeOperatorClass { /// Hash-index specific operator classes #[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub enum HashOperatorClass { /// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 5b311137d..61b921e92 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -274,7 +274,7 @@ enum ParserState { ConnectBy, } -#[derive(Debug)] +#[cfg_attr(feature = "std", derive(Debug))] /// A SQL Parser /// /// This struct is the main entry point for parsing SQL queries. From c30853df23adc163196f34a5a4c684ab38c532af Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Sat, 8 Feb 2025 10:25:45 +0100 Subject: [PATCH 06/23] Restored the derive for the `Copy` trait `Copy` trait derive was previously removed as a variant `Custom` with `Ident` data type was added to the enum. This variant has afterwards been removed as deemed, while necessary to fully capture custom indices, extremely rare (the Postgres documentation itself says that creating custom indices is a rather hard task) and it would be very hard to fully capture in a good manner all possible custom variants. --- src/ast/ddl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs index 07b51ffb9..b94527b6f 100644 --- a/src/ast/ddl.rs +++ b/src/ast/ddl.rs @@ -1030,7 +1030,7 @@ impl fmt::Display for KeyOrIndexDisplay { /// [1]: https://dev.mysql.com/doc/refman/8.0/en/create-table.html /// [2]: https://dev.mysql.com/doc/refman/8.0/en/create-index.html /// [3]: https://www.postgresql.org/docs/14/sql-createindex.html -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub enum IndexType { From 8e8608c6503a807c02c694b7e479e7fea54af8d7 Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Tue, 11 Feb 2025 10:33:06 +0100 Subject: [PATCH 07/23] Update src/ast/spans.rs Co-authored-by: Ifeanyi Ubah --- src/ast/spans.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ast/spans.rs b/src/ast/spans.rs index 31ef18812..9a13eb021 100644 --- a/src/ast/spans.rs +++ b/src/ast/spans.rs @@ -2204,7 +2204,6 @@ pub mod tests { "SELECT id, name FROM users LEFT JOIN companies ON users.company_id = companies.id", ); - println!("{:?}", test.0); let query = test.0.parse_select().unwrap(); let select_span = query.span(); From 7bcd499429ee0401d629bda045533976075227bd Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Tue, 25 Feb 2025 12:02:46 +0100 Subject: [PATCH 08/23] Removed operator classes and replaced it with a simpler Ident --- src/ast/ddl.rs | 6 +- src/ast/dml.rs | 23 +- src/ast/mod.rs | 6 - src/ast/operator_classes.rs | 581 ------------------------------------ src/keywords.rs | 77 ----- src/parser/mod.rs | 119 +++----- tests/sqlparser_common.rs | 80 ++--- tests/sqlparser_postgres.rs | 18 +- 8 files changed, 109 insertions(+), 801 deletions(-) delete mode 100644 src/ast/operator_classes.rs diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs index b94527b6f..efa584e53 100644 --- a/src/ast/ddl.rs +++ b/src/ast/ddl.rs @@ -1030,7 +1030,7 @@ impl fmt::Display for KeyOrIndexDisplay { /// [1]: https://dev.mysql.com/doc/refman/8.0/en/create-table.html /// [2]: https://dev.mysql.com/doc/refman/8.0/en/create-index.html /// [3]: https://www.postgresql.org/docs/14/sql-createindex.html -#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)] +#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub enum IndexType { @@ -1041,6 +1041,9 @@ pub enum IndexType { SPGiST, BRIN, Bloom, + /// Users may define their own index types, which would + /// not be covered by the above variants. + Custom(ObjectName), } impl fmt::Display for IndexType { @@ -1053,6 +1056,7 @@ impl fmt::Display for IndexType { Self::SPGiST => write!(f, "SPGIST"), Self::BRIN => write!(f, "BRIN"), Self::Bloom => write!(f, "BLOOM"), + Self::Custom(name) => write!(f, "{}", name), } } } diff --git a/src/ast/dml.rs b/src/ast/dml.rs index e98677640..ccea7fbcb 100644 --- a/src/ast/dml.rs +++ b/src/ast/dml.rs @@ -32,12 +32,12 @@ use sqlparser_derive::{Visit, VisitMut}; pub use super::ddl::{ColumnDef, TableConstraint}; use super::{ - display_comma_separated, display_separated, operator_classes::IndexOperatorClass, - query::InputFormatClause, Assignment, ClusteredBy, CommentDef, Expr, FileFormat, FromTable, - HiveDistributionStyle, HiveFormat, HiveIOFormat, HiveRowFormat, Ident, IndexType, - InsertAliases, MysqlInsertPriority, ObjectName, OnCommit, OnInsert, OneOrManyWithParens, - OrderByExpr, Query, RowAccessPolicy, SelectItem, Setting, SqlOption, SqliteOnConflict, - StorageSerializationPolicy, TableEngine, TableObject, TableWithJoins, Tag, WrappedCollection, + display_comma_separated, display_separated, query::InputFormatClause, Assignment, ClusteredBy, + CommentDef, Expr, FileFormat, FromTable, HiveDistributionStyle, HiveFormat, HiveIOFormat, + HiveRowFormat, Ident, IndexType, InsertAliases, MysqlInsertPriority, ObjectName, OnCommit, + OnInsert, OneOrManyWithParens, OrderByExpr, Query, RowAccessPolicy, SelectItem, Setting, + SqlOption, SqliteOnConflict, StorageSerializationPolicy, TableEngine, TableObject, + TableWithJoins, Tag, WrappedCollection, }; /// Index column type. @@ -46,16 +46,7 @@ use super::{ #[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] pub struct IndexColumn { pub column: OrderByExpr, - pub operator_class: Option, -} - -impl From for IndexColumn { - fn from(column: OrderByExpr) -> Self { - Self { - column, - operator_class: None, - } - } + pub operator_class: Option, } impl Display for IndexColumn { diff --git a/src/ast/mod.rs b/src/ast/mod.rs index 9af8f94a3..1f44890a1 100644 --- a/src/ast/mod.rs +++ b/src/ast/mod.rs @@ -87,11 +87,6 @@ pub use self::value::{ NormalizationForm, TrimWhereField, Value, }; -pub use self::operator_classes::{ - BTreeOperatorClass, BloomOperatorClass, GINOperatorClass, GiSTOperatorClass, HashOperatorClass, - OperatorClass, -}; - use crate::ast::helpers::stmt_data_loading::{ DataLoadingOptions, StageLoadSelectItem, StageParamsObject, }; @@ -105,7 +100,6 @@ mod ddl; mod dml; pub mod helpers; mod operator; -mod operator_classes; mod query; mod spans; pub use spans::Spanned; diff --git a/src/ast/operator_classes.rs b/src/ast/operator_classes.rs deleted file mode 100644 index 3c946ab76..000000000 --- a/src/ast/operator_classes.rs +++ /dev/null @@ -1,581 +0,0 @@ -// Licensed to the Apache Software Foundation (ASF) under one -// or more contributor license agreements. See the NOTICE file -// distributed with this work for additional information -// regarding copyright ownership. The ASF licenses this file -// to you under the Apache License, Version 2.0 (the -// "License"); you may not use this file except in compliance -// with the License. You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, -// software distributed under the License is distributed on an -// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -// KIND, either express or implied. See the License for the -// specific language governing permissions and limitations -// under the License. - -use core::fmt::{self, Display}; - -#[cfg(feature = "serde")] -use serde::{Deserialize, Serialize}; -#[cfg(feature = "visitor")] -use sqlparser_derive::{Visit, VisitMut}; - -use crate::keywords::Keyword; - -/// Trait characterizing the operator classes -pub trait OperatorClass: From + Into { - /// List of keywords associated to the operator class - const KEYWORDS: &'static [Keyword]; -} - -/// Bloom-index specific operator classes -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] -pub enum BloomOperatorClass { - Int4, - Text, -} - -impl OperatorClass for BloomOperatorClass { - const KEYWORDS: &'static [Keyword] = &[Keyword::INT4_OPS, Keyword::TEXT_OPS]; -} - -impl From for BloomOperatorClass { - fn from(keyword: Keyword) -> Self { - match keyword { - Keyword::INT4_OPS => BloomOperatorClass::Int4, - Keyword::TEXT_OPS => BloomOperatorClass::Text, - _ => unreachable!(), - } - } -} - -impl Display for BloomOperatorClass { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - BloomOperatorClass::Int4 => write!(f, "int4_ops"), - BloomOperatorClass::Text => write!(f, "text_ops"), - } - } -} - -/// BTree GIN-based index operator class -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] -pub enum GINOperatorClass { - Int2, - Int4, - Int8, - Float4, - Float8, - Money, - OID, - Timestamp, - TimestampTZ, - Time, - TimeTZ, - Date, - Interval, - MACAddr, - MACAddr8, - INET, - CIDR, - Text, - VARCHAR, - CHAR, - Bytea, - Bit, - Varbit, - Numeric, - Enum, - UUID, - Name, - Bool, - BPChar, - /// Support for similarity of text using trigram matching: [`pg_tgrm`](https://www.postgresql.org/docs/current/pgtrgm.html) - TRGM, - /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) - HStore, -} - -impl OperatorClass for GINOperatorClass { - const KEYWORDS: &'static [Keyword] = &[ - Keyword::INT2_OPS, - Keyword::INT4_OPS, - Keyword::INT8_OPS, - Keyword::FLOAT4_OPS, - Keyword::FLOAT8_OPS, - Keyword::MONEY_OPS, - Keyword::OID_OPS, - Keyword::TIMESTAMP_OPS, - Keyword::TIMESTAMPTZ_OPS, - Keyword::TIME_OPS, - Keyword::TIMETZ_OPS, - Keyword::DATE_OPS, - Keyword::INTERVAL_OPS, - Keyword::MACADDR_OPS, - Keyword::MACADDR8_OPS, - Keyword::INET_OPS, - Keyword::CIDR_OPS, - Keyword::TEXT_OPS, - Keyword::VARCHAR_OPS, - Keyword::CHAR_OPS, - Keyword::BYTEA_OPS, - Keyword::BIT_OPS, - Keyword::VARBIT_OPS, - Keyword::NUMERIC_OPS, - Keyword::ENUM_OPS, - Keyword::UUID_OPS, - Keyword::NAME_OPS, - Keyword::BOOL_OPS, - Keyword::BPCHAR_OPS, - Keyword::GIN_TRGM_OPS, - Keyword::GIN_HSTORE_OPS, - ]; -} - -impl From for GINOperatorClass { - fn from(keyword: Keyword) -> Self { - match keyword { - Keyword::INT2_OPS => GINOperatorClass::Int2, - Keyword::INT4_OPS => GINOperatorClass::Int4, - Keyword::INT8_OPS => GINOperatorClass::Int8, - Keyword::FLOAT4_OPS => GINOperatorClass::Float4, - Keyword::FLOAT8_OPS => GINOperatorClass::Float8, - Keyword::MONEY_OPS => GINOperatorClass::Money, - Keyword::OID_OPS => GINOperatorClass::OID, - Keyword::TIMESTAMP_OPS => GINOperatorClass::Timestamp, - Keyword::TIMESTAMPTZ_OPS => GINOperatorClass::TimestampTZ, - Keyword::TIME_OPS => GINOperatorClass::Time, - Keyword::TIMETZ_OPS => GINOperatorClass::TimeTZ, - Keyword::DATE_OPS => GINOperatorClass::Date, - Keyword::INTERVAL_OPS => GINOperatorClass::Interval, - Keyword::MACADDR_OPS => GINOperatorClass::MACAddr, - Keyword::MACADDR8_OPS => GINOperatorClass::MACAddr8, - Keyword::INET_OPS => GINOperatorClass::INET, - Keyword::CIDR_OPS => GINOperatorClass::CIDR, - Keyword::TEXT_OPS => GINOperatorClass::Text, - Keyword::VARCHAR_OPS => GINOperatorClass::VARCHAR, - Keyword::CHAR_OPS => GINOperatorClass::CHAR, - Keyword::BYTEA_OPS => GINOperatorClass::Bytea, - Keyword::BIT_OPS => GINOperatorClass::Bit, - Keyword::VARBIT_OPS => GINOperatorClass::Varbit, - Keyword::NUMERIC_OPS => GINOperatorClass::Numeric, - Keyword::ENUM_OPS => GINOperatorClass::Enum, - Keyword::UUID_OPS => GINOperatorClass::UUID, - Keyword::NAME_OPS => GINOperatorClass::Name, - Keyword::BOOL_OPS => GINOperatorClass::Bool, - Keyword::BPCHAR_OPS => GINOperatorClass::BPChar, - Keyword::GIN_TRGM_OPS => GINOperatorClass::TRGM, - Keyword::GIN_HSTORE_OPS => GINOperatorClass::HStore, - _ => unreachable!(), - } - } -} - -impl Display for GINOperatorClass { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - GINOperatorClass::Int2 => write!(f, "int2_ops"), - GINOperatorClass::Int4 => write!(f, "int4_ops"), - GINOperatorClass::Int8 => write!(f, "int8_ops"), - GINOperatorClass::Float4 => write!(f, "float4_ops"), - GINOperatorClass::Float8 => write!(f, "float8_ops"), - GINOperatorClass::Money => write!(f, "money_ops"), - GINOperatorClass::OID => write!(f, "oid_ops"), - GINOperatorClass::Timestamp => write!(f, "timestamp_ops"), - GINOperatorClass::TimestampTZ => write!(f, "timestamptz_ops"), - GINOperatorClass::Time => write!(f, "time_ops"), - GINOperatorClass::TimeTZ => write!(f, "timetz_ops"), - GINOperatorClass::Date => write!(f, "date_ops"), - GINOperatorClass::Interval => write!(f, "interval_ops"), - GINOperatorClass::MACAddr => write!(f, "macaddr_ops"), - GINOperatorClass::MACAddr8 => write!(f, "macaddr8_ops"), - GINOperatorClass::INET => write!(f, "inet_ops"), - GINOperatorClass::CIDR => write!(f, "cidr_ops"), - GINOperatorClass::Text => write!(f, "text_ops"), - GINOperatorClass::VARCHAR => write!(f, "varchar_ops"), - GINOperatorClass::CHAR => write!(f, "char_ops"), - GINOperatorClass::Bytea => write!(f, "bytea_ops"), - GINOperatorClass::Bit => write!(f, "bit_ops"), - GINOperatorClass::Varbit => write!(f, "varbit_ops"), - GINOperatorClass::Numeric => write!(f, "numeric_ops"), - GINOperatorClass::Enum => write!(f, "enum_ops"), - GINOperatorClass::UUID => write!(f, "uuid_ops"), - GINOperatorClass::Name => write!(f, "name_ops"), - GINOperatorClass::Bool => write!(f, "bool_ops"), - GINOperatorClass::BPChar => write!(f, "bpchar_ops"), - GINOperatorClass::TRGM => write!(f, "gin_trgm_ops"), - GINOperatorClass::HStore => write!(f, "gin_hstore_ops"), - } - } -} - -/// BTree GIST-based index operator class -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] -pub enum GiSTOperatorClass { - OID, - UUID, - Int2, - Int4, - Int8, - Float4, - Float8, - Timestamp, - TimestampTZ, - Time, - TimeTZ, - Date, - Interval, - Cash, - MACAddr, - MACAddr8, - Text, - BPChar, - Bytea, - Numeric, - Bit, - VBit, - INet, - CIDR, - Enum, - Bool, - /// Type for representing line segments, or floating point intervals: [`seg`](https://www.postgresql.org/docs/current/seg.html) - SEG, - /// Support for similarity of text using trigram matching: [`pg_tgrm`](https://www.postgresql.org/docs/current/pgtrgm.html) - TRGM, - /// Type for representing labels of data stored in a hierarchical tree-like structure: [`ltree`](https://www.postgresql.org/docs/current/ltree.html) - LTREE, - /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) - HStore, - /// Type cube for representing multidimensional cubes: [`cube`](https://www.postgresql.org/docs/current/cube.html) - Cube, -} - -impl OperatorClass for GiSTOperatorClass { - const KEYWORDS: &'static [Keyword] = &[ - Keyword::GIST_OID_OPS, - Keyword::GIST_UUID_OPS, - Keyword::GIST_INT2_OPS, - Keyword::GIST_INT4_OPS, - Keyword::GIST_INT8_OPS, - Keyword::GIST_FLOAT4_OPS, - Keyword::GIST_FLOAT8_OPS, - Keyword::GIST_TIMESTAMP_OPS, - Keyword::GIST_TIMESTAMPTZ_OPS, - Keyword::GIST_TIME_OPS, - Keyword::GIST_TIMETZ_OPS, - Keyword::GIST_DATE_OPS, - Keyword::GIST_INTERVAL_OPS, - Keyword::GIST_CASH_OPS, - Keyword::GIST_MACADDR_OPS, - Keyword::GIST_MACADDR8_OPS, - Keyword::GIST_TEXT_OPS, - Keyword::GIST_BPCHAR_OPS, - Keyword::GIST_BYTEA_OPS, - Keyword::GIST_NUMERIC_OPS, - Keyword::GIST_BIT_OPS, - Keyword::GIST_VBIT_OPS, - Keyword::GIST_INET_OPS, - Keyword::GIST_CIDR_OPS, - Keyword::GIST_ENUM_OPS, - Keyword::GIST_BOOL_OPS, - Keyword::GIST_SEG_OPS, - Keyword::GIST_TRGM_OPS, - Keyword::GIST_LTREE_OPS, - Keyword::GIST_HSTORE_OPS, - Keyword::GIST_CUBE_OPS, - ]; -} - -impl From for GiSTOperatorClass { - fn from(keyword: Keyword) -> Self { - match keyword { - Keyword::GIST_OID_OPS => GiSTOperatorClass::OID, - Keyword::GIST_UUID_OPS => GiSTOperatorClass::UUID, - Keyword::GIST_INT2_OPS => GiSTOperatorClass::Int2, - Keyword::GIST_INT4_OPS => GiSTOperatorClass::Int4, - Keyword::GIST_INT8_OPS => GiSTOperatorClass::Int8, - Keyword::GIST_FLOAT4_OPS => GiSTOperatorClass::Float4, - Keyword::GIST_FLOAT8_OPS => GiSTOperatorClass::Float8, - Keyword::GIST_TIMESTAMP_OPS => GiSTOperatorClass::Timestamp, - Keyword::GIST_TIMESTAMPTZ_OPS => GiSTOperatorClass::TimestampTZ, - Keyword::GIST_TIME_OPS => GiSTOperatorClass::Time, - Keyword::GIST_TIMETZ_OPS => GiSTOperatorClass::TimeTZ, - Keyword::GIST_DATE_OPS => GiSTOperatorClass::Date, - Keyword::GIST_INTERVAL_OPS => GiSTOperatorClass::Interval, - Keyword::GIST_CASH_OPS => GiSTOperatorClass::Cash, - Keyword::GIST_MACADDR_OPS => GiSTOperatorClass::MACAddr, - Keyword::GIST_MACADDR8_OPS => GiSTOperatorClass::MACAddr8, - Keyword::GIST_TEXT_OPS => GiSTOperatorClass::Text, - Keyword::GIST_BPCHAR_OPS => GiSTOperatorClass::BPChar, - Keyword::GIST_BYTEA_OPS => GiSTOperatorClass::Bytea, - Keyword::GIST_NUMERIC_OPS => GiSTOperatorClass::Numeric, - Keyword::GIST_BIT_OPS => GiSTOperatorClass::Bit, - Keyword::GIST_VBIT_OPS => GiSTOperatorClass::VBit, - Keyword::GIST_INET_OPS => GiSTOperatorClass::INet, - Keyword::GIST_CIDR_OPS => GiSTOperatorClass::CIDR, - Keyword::GIST_ENUM_OPS => GiSTOperatorClass::Enum, - Keyword::GIST_BOOL_OPS => GiSTOperatorClass::Bool, - Keyword::GIST_SEG_OPS => GiSTOperatorClass::SEG, - Keyword::GIST_TRGM_OPS => GiSTOperatorClass::TRGM, - Keyword::GIST_LTREE_OPS => GiSTOperatorClass::LTREE, - Keyword::GIST_HSTORE_OPS => GiSTOperatorClass::HStore, - Keyword::GIST_CUBE_OPS => GiSTOperatorClass::Cube, - _ => unreachable!(), - } - } -} - -impl Display for GiSTOperatorClass { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - GiSTOperatorClass::OID => write!(f, "gist_oid_ops"), - GiSTOperatorClass::UUID => write!(f, "gist_uuid_ops"), - GiSTOperatorClass::Int2 => write!(f, "gist_int2_ops"), - GiSTOperatorClass::Int4 => write!(f, "gist_int4_ops"), - GiSTOperatorClass::Int8 => write!(f, "gist_int8_ops"), - GiSTOperatorClass::Float4 => write!(f, "gist_float4_ops"), - GiSTOperatorClass::Float8 => write!(f, "gist_float8_ops"), - GiSTOperatorClass::Timestamp => write!(f, "gist_timestamp_ops"), - GiSTOperatorClass::TimestampTZ => write!(f, "gist_timestamptz_ops"), - GiSTOperatorClass::Time => write!(f, "gist_time_ops"), - GiSTOperatorClass::TimeTZ => write!(f, "gist_timetz_ops"), - GiSTOperatorClass::Date => write!(f, "gist_date_ops"), - GiSTOperatorClass::Interval => write!(f, "gist_interval_ops"), - GiSTOperatorClass::Cash => write!(f, "gist_cash_ops"), - GiSTOperatorClass::MACAddr => write!(f, "gist_macaddr_ops"), - GiSTOperatorClass::MACAddr8 => write!(f, "gist_macaddr8_ops"), - GiSTOperatorClass::Text => write!(f, "gist_text_ops"), - GiSTOperatorClass::BPChar => write!(f, "gist_bpchar_ops"), - GiSTOperatorClass::Bytea => write!(f, "gist_bytea_ops"), - GiSTOperatorClass::Numeric => write!(f, "gist_numeric_ops"), - GiSTOperatorClass::Bit => write!(f, "gist_bit_ops"), - GiSTOperatorClass::VBit => write!(f, "GIST_VBIT_OPS"), - GiSTOperatorClass::INet => write!(f, "gist_inet_ops"), - GiSTOperatorClass::CIDR => write!(f, "gist_cidr_ops"), - GiSTOperatorClass::Enum => write!(f, "gist_enum_ops"), - GiSTOperatorClass::Bool => write!(f, "gist_bool_ops"), - GiSTOperatorClass::SEG => write!(f, "gist_seg_ops"), - GiSTOperatorClass::TRGM => write!(f, "gist_trgm_ops"), - GiSTOperatorClass::LTREE => write!(f, "gist_ltree_ops"), - GiSTOperatorClass::HStore => write!(f, "gist_hstore_ops"), - GiSTOperatorClass::Cube => write!(f, "gist_cube_ops"), - } - } -} - -/// BTree-index specific operator classes -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] -pub enum BTreeOperatorClass { - /// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html) - EAN13, - ISBN, - ISBN13, - ISMN, - ISMN13, - ISSN, - ISSN13, - UPC, - /// Type for representing line segments, or floating point intervals: [`seg`](https://www.postgresql.org/docs/current/seg.html) - SEG, - /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) - HStore, - /// Type cube for representing multidimensional cubes: [`cube`](https://www.postgresql.org/docs/current/cube.html) - Cube, - /// Case-insensitive character string type: [`citext`](https://www.postgresql.org/docs/current/citext.html) - Citext, -} - -impl OperatorClass for BTreeOperatorClass { - const KEYWORDS: &'static [Keyword] = &[ - Keyword::EAN13_OPS, - Keyword::ISBN_OPS, - Keyword::ISBN13_OPS, - Keyword::ISMN_OPS, - Keyword::ISMN13_OPS, - Keyword::ISSN_OPS, - Keyword::ISSN13_OPS, - Keyword::UPC_OPS, - Keyword::SEG_OPS, - Keyword::BTREE_HSTORE_OPS, - Keyword::BTREE_CUBE_OPS, - Keyword::CITEXT_OPS, - ]; -} - -impl From for BTreeOperatorClass { - fn from(keyword: Keyword) -> Self { - match keyword { - Keyword::EAN13_OPS => BTreeOperatorClass::EAN13, - Keyword::ISBN_OPS => BTreeOperatorClass::ISBN, - Keyword::ISBN13_OPS => BTreeOperatorClass::ISBN13, - Keyword::ISMN_OPS => BTreeOperatorClass::ISMN, - Keyword::ISMN13_OPS => BTreeOperatorClass::ISMN13, - Keyword::ISSN_OPS => BTreeOperatorClass::ISSN, - Keyword::ISSN13_OPS => BTreeOperatorClass::ISSN13, - Keyword::UPC_OPS => BTreeOperatorClass::UPC, - Keyword::SEG_OPS => BTreeOperatorClass::SEG, - Keyword::BTREE_HSTORE_OPS => BTreeOperatorClass::HStore, - Keyword::BTREE_CUBE_OPS => BTreeOperatorClass::Cube, - Keyword::CITEXT_OPS => BTreeOperatorClass::Citext, - _ => unreachable!(), - } - } -} - -impl Display for BTreeOperatorClass { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - BTreeOperatorClass::EAN13 => write!(f, "ean13_ops"), - BTreeOperatorClass::ISBN => write!(f, "isbn_ops"), - BTreeOperatorClass::ISBN13 => write!(f, "isbn13_ops"), - BTreeOperatorClass::ISMN => write!(f, "ismn_ops"), - BTreeOperatorClass::ISMN13 => write!(f, "ismn13_ops"), - BTreeOperatorClass::ISSN => write!(f, "issn_ops"), - BTreeOperatorClass::ISSN13 => write!(f, "issn13_ops"), - BTreeOperatorClass::UPC => write!(f, "upc_ops"), - BTreeOperatorClass::SEG => write!(f, "seg_ops"), - BTreeOperatorClass::HStore => write!(f, "btree_hstore_ops"), - BTreeOperatorClass::Cube => write!(f, "btree_cube_ops"), - BTreeOperatorClass::Citext => write!(f, "citext_ops"), - } - } -} - -/// Hash-index specific operator classes -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] -pub enum HashOperatorClass { - /// The isn module provides data types for the following international product numbering standards: [`isn`](https://www.postgresql.org/docs/current/isn.html) - EAN13, - ISBN, - ISBN13, - ISMN, - ISMN13, - ISSN, - ISSN13, - UPC, - /// Type for representing labels of data stored in a hierarchical tree-like structure: [`ltree`](https://www.postgresql.org/docs/current/ltree.html) - LTREE, - /// Type for storing sets of key/value pairs within a single PostgreSQL value: [`hstore`](https://www.postgresql.org/docs/current/hstore.html) - HStore, - /// Case-insensitive character string type: [`citext`](https://www.postgresql.org/docs/current/citext.html) - Citext, -} - -impl OperatorClass for HashOperatorClass { - const KEYWORDS: &'static [Keyword] = &[ - Keyword::EAN13_OPS, - Keyword::ISBN_OPS, - Keyword::ISBN13_OPS, - Keyword::ISMN_OPS, - Keyword::ISMN13_OPS, - Keyword::ISSN_OPS, - Keyword::ISSN13_OPS, - Keyword::UPC_OPS, - Keyword::HASH_LTREE_OPS, - Keyword::HASH_HSTORE_OPS, - Keyword::CITEXT_OPS, - ]; -} - -impl From for HashOperatorClass { - fn from(keyword: Keyword) -> Self { - match keyword { - Keyword::EAN13_OPS => HashOperatorClass::EAN13, - Keyword::ISBN_OPS => HashOperatorClass::ISBN, - Keyword::ISBN13_OPS => HashOperatorClass::ISBN13, - Keyword::ISMN_OPS => HashOperatorClass::ISMN, - Keyword::ISMN13_OPS => HashOperatorClass::ISMN13, - Keyword::ISSN_OPS => HashOperatorClass::ISSN, - Keyword::ISSN13_OPS => HashOperatorClass::ISSN13, - Keyword::UPC_OPS => HashOperatorClass::UPC, - Keyword::HASH_LTREE_OPS => HashOperatorClass::LTREE, - Keyword::HASH_HSTORE_OPS => HashOperatorClass::HStore, - Keyword::CITEXT_OPS => HashOperatorClass::Citext, - _ => unreachable!(), - } - } -} - -impl Display for HashOperatorClass { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - HashOperatorClass::EAN13 => write!(f, "ean13_ops"), - HashOperatorClass::ISBN => write!(f, "isbn_ops"), - HashOperatorClass::ISBN13 => write!(f, "isbn13_ops"), - HashOperatorClass::ISMN => write!(f, "ismn_ops"), - HashOperatorClass::ISMN13 => write!(f, "ismn13_ops"), - HashOperatorClass::ISSN => write!(f, "issn_ops"), - HashOperatorClass::ISSN13 => write!(f, "issn13_ops"), - HashOperatorClass::UPC => write!(f, "upc_ops"), - HashOperatorClass::LTREE => write!(f, "hash_ltree_ops"), - HashOperatorClass::HStore => write!(f, "hash_hstore_ops"), - HashOperatorClass::Citext => write!(f, "citext_ops"), - } - } -} - -/// Index Operator Classes -#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] -#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] -#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] -pub enum IndexOperatorClass { - GIN(GINOperatorClass), - GIST(GiSTOperatorClass), - Bloom(BloomOperatorClass), - Hash(HashOperatorClass), - BTree(BTreeOperatorClass), -} - -impl Display for IndexOperatorClass { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - match self { - IndexOperatorClass::GIN(op) => write!(f, "{}", op), - IndexOperatorClass::GIST(op) => write!(f, "{}", op), - IndexOperatorClass::Bloom(op) => write!(f, "{}", op), - IndexOperatorClass::Hash(op) => write!(f, "{}", op), - IndexOperatorClass::BTree(op) => write!(f, "{}", op), - } - } -} - -impl From for IndexOperatorClass { - fn from(op: GINOperatorClass) -> Self { - IndexOperatorClass::GIN(op) - } -} - -impl From for IndexOperatorClass { - fn from(op: GiSTOperatorClass) -> Self { - IndexOperatorClass::GIST(op) - } -} - -impl From for IndexOperatorClass { - fn from(op: BloomOperatorClass) -> Self { - IndexOperatorClass::Bloom(op) - } -} - -impl From for IndexOperatorClass { - fn from(op: HashOperatorClass) -> Self { - IndexOperatorClass::Hash(op) - } -} - -impl From for IndexOperatorClass { - fn from(op: BTreeOperatorClass) -> Self { - IndexOperatorClass::BTree(op) - } -} diff --git a/src/keywords.rs b/src/keywords.rs index 116a7622d..a497fc052 100644 --- a/src/keywords.rs +++ b/src/keywords.rs @@ -135,27 +135,21 @@ define_keywords!( BIND, BINDING, BIT, - BIT_OPS, BLOB, BLOCK, BLOOM, BLOOMFILTER, BOOL, BOOLEAN, - BOOL_OPS, BOTH, - BPCHAR_OPS, BRIN, BROWSE, BTREE, - BTREE_CUBE_OPS, - BTREE_HSTORE_OPS, BUCKET, BUCKETS, BY, BYPASSRLS, BYTEA, - BYTEA_OPS, BYTES, CACHE, CALL, @@ -182,10 +176,7 @@ define_keywords!( CHARACTER_LENGTH, CHARSET, CHAR_LENGTH, - CHAR_OPS, CHECK, - CIDR_OPS, - CITEXT_OPS, CLEAR, CLOB, CLONE, @@ -254,7 +245,6 @@ define_keywords!( DATE32, DATETIME, DATETIME64, - DATE_OPS, DAY, DAYOFWEEK, DAYOFYEAR, @@ -301,7 +291,6 @@ define_keywords!( DUPLICATE, DYNAMIC, EACH, - EAN13_OPS, ELEMENT, ELEMENTS, ELSE, @@ -320,7 +309,6 @@ define_keywords!( ENUM, ENUM16, ENUM8, - ENUM_OPS, EPHEMERAL, EPOCH, EQUALS, @@ -367,10 +355,8 @@ define_keywords!( FLOAT, FLOAT32, FLOAT4, - FLOAT4_OPS, FLOAT64, FLOAT8, - FLOAT8_OPS, FLOOR, FLUSH, FN, @@ -401,40 +387,7 @@ define_keywords!( GEOGRAPHY, GET, GIN, - GIN_HSTORE_OPS, - GIN_TRGM_OPS, GIST, - GIST_BIT_OPS, - GIST_BOOL_OPS, - GIST_BPCHAR_OPS, - GIST_BYTEA_OPS, - GIST_CASH_OPS, - GIST_CIDR_OPS, - GIST_CUBE_OPS, - GIST_DATE_OPS, - GIST_ENUM_OPS, - GIST_FLOAT4_OPS, - GIST_FLOAT8_OPS, - GIST_HSTORE_OPS, - GIST_INET_OPS, - GIST_INT2_OPS, - GIST_INT4_OPS, - GIST_INT8_OPS, - GIST_INTERVAL_OPS, - GIST_LTREE_OPS, - GIST_MACADDR8_OPS, - GIST_MACADDR_OPS, - GIST_NUMERIC_OPS, - GIST_OID_OPS, - GIST_SEG_OPS, - GIST_TEXT_OPS, - GIST_TIMESTAMPTZ_OPS, - GIST_TIMESTAMP_OPS, - GIST_TIMETZ_OPS, - GIST_TIME_OPS, - GIST_TRGM_OPS, - GIST_UUID_OPS, - GIST_VBIT_OPS, GLOBAL, GRANT, GRANTED, @@ -444,8 +397,6 @@ define_keywords!( GROUPING, GROUPS, HASH, - HASH_HSTORE_OPS, - HASH_LTREE_OPS, HAVING, HEADER, HEAP, @@ -473,7 +424,6 @@ define_keywords!( INCREMENT, INDEX, INDICATOR, - INET_OPS, INHERIT, INITIALLY, INNER, @@ -490,34 +440,24 @@ define_keywords!( INT16, INT2, INT256, - INT2_OPS, INT32, INT4, - INT4_OPS, INT64, INT8, - INT8_OPS, INTEGER, INTEGRATION, INTERPOLATE, INTERSECT, INTERSECTION, INTERVAL, - INTERVAL_OPS, INTO, INVOKER, IO, IS, - ISBN13_OPS, - ISBN_OPS, - ISMN13_OPS, - ISMN_OPS, ISODOW, ISOLATION, ISOWEEK, ISOYEAR, - ISSN13_OPS, - ISSN_OPS, ITEMS, JAR, JOIN, @@ -563,9 +503,6 @@ define_keywords!( LOWER, LOW_PRIORITY, LS, - LTREE_OPS, - MACADDR8_OPS, - MACADDR_OPS, MACRO, MANAGE, MANAGED, @@ -607,7 +544,6 @@ define_keywords!( MODIFIES, MODIFY, MODULE, - MONEY_OPS, MONITOR, MONTH, MONTHS, @@ -615,7 +551,6 @@ define_keywords!( MULTISET, MUTATION, NAME, - NAME_OPS, NANOSECOND, NANOSECONDS, NATIONAL, @@ -655,7 +590,6 @@ define_keywords!( NULLIF, NULLS, NUMERIC, - NUMERIC_OPS, NVARCHAR, OBJECT, OBJECTS, @@ -666,7 +600,6 @@ define_keywords!( OFF, OFFSET, OFFSETS, - OID_OPS, OLD, OMIT, ON, @@ -835,7 +768,6 @@ define_keywords!( SECRET, SECURITY, SEED, - SEG_OPS, SELECT, SEMI, SENSITIVE, @@ -922,22 +854,17 @@ define_keywords!( TERSE, TEXT, TEXTFILE, - TEXT_OPS, THEN, TIES, TIME, TIMESTAMP, TIMESTAMPTZ, - TIMESTAMPTZ_OPS, - TIMESTAMP_OPS, TIMETZ, - TIMETZ_OPS, TIMEZONE, TIMEZONE_ABBR, TIMEZONE_HOUR, TIMEZONE_MINUTE, TIMEZONE_REGION, - TIME_OPS, TINYBLOB, TINYINT, TINYTEXT, @@ -987,7 +914,6 @@ define_keywords!( UNSAFE, UNSIGNED, UNTIL, - UPC_OPS, UPDATE, UPPER, URL, @@ -997,7 +923,6 @@ define_keywords!( USER_RESOURCES, USING, UUID, - UUID_OPS, VACUUM, VALID, VALIDATION_MODE, @@ -1006,9 +931,7 @@ define_keywords!( VALUE_OF, VARBINARY, VARBIT, - VARBIT_OPS, VARCHAR, - VARCHAR_OPS, VARIABLES, VARYING, VAR_POP, diff --git a/src/parser/mod.rs b/src/parser/mod.rs index e52c27f62..7e448affe 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -3824,6 +3824,18 @@ impl<'a> Parser<'a> { true } + /// If the current token is one of the given `keywords`, returns the keyword + /// that matches, without consuming the token. Otherwise, returns [`None`]. + #[must_use] + pub fn peek_one_of_keywords(&self, keywords: &[Keyword]) -> Option { + for keyword in keywords { + if self.peek_keyword(*keyword) { + return Some(*keyword); + } + } + None + } + /// 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`]. @@ -6255,32 +6267,10 @@ impl<'a> Parser<'a> { } else { None }; + self.expect_token(&Token::LParen)?; - let columns = if let Some(using) = &using { - match using { - IndexType::GIN => { - self.parse_comma_separated(Parser::parse_create_index_expr::)? - } - IndexType::GiST => self - .parse_comma_separated(Parser::parse_create_index_expr::)?, - IndexType::Hash => self - .parse_comma_separated(Parser::parse_create_index_expr::)?, - IndexType::Bloom => self - .parse_comma_separated(Parser::parse_create_index_expr::)?, - IndexType::BTree => self - .parse_comma_separated(Parser::parse_create_index_expr::)?, - IndexType::SPGiST | IndexType::BRIN => self - .parse_comma_separated(Parser::parse_order_by_expr)? - .into_iter() - .map(|expr| expr.into()) - .collect(), - } - } else { - self.parse_comma_separated(Parser::parse_order_by_expr)? - .into_iter() - .map(|expr| expr.into()) - .collect() - }; + let columns = self.parse_comma_separated(Parser::parse_create_index_expr::)?; + println!("columns: {:?}", columns.len()); self.expect_token(&Token::RParen)?; let include = if self.parse_keyword(Keyword::INCLUDE) { @@ -7504,37 +7494,34 @@ impl<'a> Parser<'a> { } pub fn parse_index_type(&mut self) -> Result { - if self.parse_keyword(Keyword::BTREE) { - Ok(IndexType::BTree) + Ok(if self.parse_keyword(Keyword::BTREE) { + IndexType::BTree } else if self.parse_keyword(Keyword::HASH) { - Ok(IndexType::Hash) + IndexType::Hash } else if self.parse_keyword(Keyword::GIN) { - Ok(IndexType::GIN) + IndexType::GIN } else if self.parse_keyword(Keyword::GIST) { - Ok(IndexType::GiST) + IndexType::GiST } else if self.parse_keyword(Keyword::SPGIST) { - Ok(IndexType::SPGiST) + IndexType::SPGiST } else if self.parse_keyword(Keyword::BRIN) { - Ok(IndexType::BRIN) + IndexType::BRIN } else if self.parse_keyword(Keyword::BLOOM) { - Ok(IndexType::Bloom) + IndexType::Bloom } else { - self.expected( - "index type {BTREE | HASH | GIN | GIST | SPGIST | BRIN | BLOOM}", - self.peek_token(), - ) - } + IndexType::Custom(self.parse_object_name(false)?) + }) } - /// Parse [USING {BTREE | HASH}] + /// Parse [USING {BTREE | HASH | GIN | GIST | SPGIST | BRIN | BLOOM | identifier}] pub fn parse_optional_using_then_index_type( &mut self, ) -> Result, ParserError> { - if self.parse_keyword(Keyword::USING) { - Ok(Some(self.parse_index_type()?)) + Ok(if self.parse_keyword(Keyword::USING) { + Some(self.parse_index_type()?) } else { - Ok(None) - } + None + }) } /// Parse `[ident]`, mostly `ident` is name, like: @@ -13348,41 +13335,31 @@ impl<'a> Parser<'a> { /// Parse an expression, optionally followed by ASC or DESC (used in ORDER BY) pub fn parse_order_by_expr(&mut self) -> Result { - let expr = self.parse_expr()?; - - let asc = self.parse_asc_desc(); - - let nulls_first = if self.parse_keywords(&[Keyword::NULLS, Keyword::FIRST]) { - Some(true) - } else if self.parse_keywords(&[Keyword::NULLS, Keyword::LAST]) { - Some(false) - } else { - None - }; - - let with_fill = if dialect_of!(self is ClickHouseDialect | GenericDialect) - && self.parse_keywords(&[Keyword::WITH, Keyword::FILL]) - { - Some(self.parse_with_fill()?) - } else { - None - }; - - Ok(OrderByExpr { - expr, - asc, - nulls_first, - with_fill, - }) + self.parse_create_index_expr::() + .map(|index_column| index_column.column) } /// Parse an expression, optionally followed by ASC or DESC (used in ORDER BY) - pub fn parse_create_index_expr( + pub fn parse_create_index_expr( &mut self, ) -> Result { let expr = self.parse_expr()?; - let operator_class: Option = self.parse_one_of_keywords(OPS::KEYWORDS).map(Into::into); + let operator_class: Option = if PARSE_OPERATOR_CLASS { + // We check that if non of the following keywords are present, then we parse an + // identifier as operator class. + if self + .peek_one_of_keywords(&[Keyword::ASC, Keyword::DESC, Keyword::NULLS, Keyword::WITH]) + .is_some() + { + None + } else { + self.maybe_parse(|parser| parser.parse_identifier())? + } + } else { + None + }; + let asc = self.parse_asc_desc(); let nulls_first = if self.parse_keywords(&[Keyword::NULLS, Keyword::FIRST]) { diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs index 0e501cac4..e76f17f56 100644 --- a/tests/sqlparser_common.rs +++ b/tests/sqlparser_common.rs @@ -8429,20 +8429,24 @@ fn ensure_multiple_dialects_are_tested() { fn parse_create_index() { let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test(name,age DESC)"; let indexed_columns: Vec = vec![ - OrderByExpr { - expr: Expr::Identifier(Ident::new("name")), - asc: None, - nulls_first: None, - with_fill: None, - } - .into(), - OrderByExpr { - expr: Expr::Identifier(Ident::new("age")), - asc: Some(false), - nulls_first: None, - with_fill: None, - } - .into(), + IndexColumn { + operator_class: None, + column: OrderByExpr { + expr: Expr::Identifier(Ident::new("name")), + asc: None, + nulls_first: None, + with_fill: None, + }, + }, + IndexColumn { + operator_class: None, + column: OrderByExpr { + expr: Expr::Identifier(Ident::new("age")), + asc: Some(false), + nulls_first: None, + with_fill: None, + }, + }, ]; match verified_stmt(sql) { Statement::CreateIndex(CreateIndex { @@ -8467,20 +8471,24 @@ fn parse_create_index() { fn test_create_index_with_using_function() { let sql = "CREATE UNIQUE INDEX IF NOT EXISTS idx_name ON test USING BTREE (name,age DESC)"; let indexed_columns: Vec = vec![ - OrderByExpr { - expr: Expr::Identifier(Ident::new("name")), - asc: None, - nulls_first: None, - with_fill: None, - } - .into(), - OrderByExpr { - expr: Expr::Identifier(Ident::new("age")), - asc: Some(false), - nulls_first: None, - with_fill: None, - } - .into(), + IndexColumn { + operator_class: None, + column: OrderByExpr { + expr: Expr::Identifier(Ident::new("name")), + asc: None, + nulls_first: None, + with_fill: None, + }, + }, + IndexColumn { + operator_class: None, + column: OrderByExpr { + expr: Expr::Identifier(Ident::new("age")), + asc: Some(false), + nulls_first: None, + with_fill: None, + }, + }, ]; match verified_stmt(sql) { Statement::CreateIndex(CreateIndex { @@ -8513,13 +8521,15 @@ fn test_create_index_with_using_function() { #[test] fn test_create_index_with_with_clause() { let sql = "CREATE UNIQUE INDEX title_idx ON films(title) WITH (fillfactor = 70, single_param)"; - let indexed_columns: Vec = vec![OrderByExpr { - expr: Expr::Identifier(Ident::new("title")), - asc: None, - nulls_first: None, - with_fill: None, - } - .into()]; + let indexed_columns: Vec = vec![IndexColumn { + column: OrderByExpr { + expr: Expr::Identifier(Ident::new("title")), + asc: None, + nulls_first: None, + with_fill: None, + }, + operator_class: None, + }]; let with_parameters = vec![ Expr::BinaryOp { left: Box::new(Expr::Identifier(Ident::new("fillfactor"))), diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index 14e21318c..157d94895 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -2537,7 +2537,7 @@ fn parse_create_users_name_trgm_index() { nulls_first: None, with_fill: None, }, - operator_class: Some(GINOperatorClass::TRGM.into()), + operator_class: Some(Ident::new("gin_trgm_ops")), }, columns[0], ); @@ -2611,7 +2611,7 @@ fn parse_create_projects_name_description_trgm_index() { nulls_first: None, with_fill: None, }, - operator_class: Some(GINOperatorClass::TRGM.into()), + operator_class: Some(Ident::new("gin_trgm_ops")), }, columns[0], ); @@ -2658,7 +2658,7 @@ fn parse_create_nameplates_barcode_trgm_index() { nulls_first: None, with_fill: None, }, - operator_class: Some(GINOperatorClass::TRGM.into()), + operator_class: Some(Ident::new("gin_trgm_ops")), }, columns[0], ); @@ -2704,7 +2704,7 @@ fn parse_create_sample_containers_barcode_trgm_index() { nulls_first: None, with_fill: None, }, - operator_class: Some(GiSTOperatorClass::TRGM.into()), + operator_class: Some(Ident::new("gist_trgm_ops")), }, columns[0], ); @@ -2718,16 +2718,6 @@ fn parse_create_sample_containers_barcode_trgm_index() { } } -#[test] -fn test_incompatible_index_and_operator_class() { - let sql = "CREATE INDEX teams_name_description_trgm_idx ON teams USING BTree (concat_teams_name_description(name, description) gin_trgm_ops)"; - let err = pg().parse_sql_statements(sql).unwrap_err(); - assert_eq!( - err.to_string(), - "sql parser error: Expected: ), found: gin_trgm_ops" - ); -} - #[test] fn parse_create_index_concurrently() { let sql = "CREATE INDEX CONCURRENTLY IF NOT EXISTS my_index ON my_table(col1,col2)"; From 1709649611d7ec24fe5dbdf61f65e344ddb3eb3e Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Tue, 25 Feb 2025 12:04:25 +0100 Subject: [PATCH 09/23] Replaced custom index object name with simpler "identifier" --- src/ast/ddl.rs | 2 +- src/parser/mod.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ast/ddl.rs b/src/ast/ddl.rs index efa584e53..57a279527 100644 --- a/src/ast/ddl.rs +++ b/src/ast/ddl.rs @@ -1043,7 +1043,7 @@ pub enum IndexType { Bloom, /// Users may define their own index types, which would /// not be covered by the above variants. - Custom(ObjectName), + Custom(Ident), } impl fmt::Display for IndexType { diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 7e448affe..d64a769ed 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -7509,7 +7509,7 @@ impl<'a> Parser<'a> { } else if self.parse_keyword(Keyword::BLOOM) { IndexType::Bloom } else { - IndexType::Custom(self.parse_object_name(false)?) + IndexType::Custom(self.parse_identifier()?) }) } From 1049bc00dbdca88dcddedfaafd2ecde065d10969 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Tue, 25 Feb 2025 12:19:46 +0100 Subject: [PATCH 10/23] Fixed errors relative to improper GitHub merge --- src/keywords.rs | 2 +- src/parser/mod.rs | 18 ++++-------------- tests/sqlparser_common.rs | 37 +++++++++++++++++++++++-------------- tests/sqlparser_postgres.rs | 24 ++++++++++++++++-------- 4 files changed, 44 insertions(+), 37 deletions(-) diff --git a/src/keywords.rs b/src/keywords.rs index a41c6aff1..cf7da2f34 100644 --- a/src/keywords.rs +++ b/src/keywords.rs @@ -142,8 +142,8 @@ define_keywords!( BOOL, BOOLEAN, BOTH, - BRIN, BOX, + BRIN, BROWSE, BTREE, BUCKET, diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 113a74b9b..f3a1ea895 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -13648,17 +13648,7 @@ impl<'a> Parser<'a> { None }; - let asc = self.parse_asc_desc(); - - let nulls_first = if self.parse_keywords(&[Keyword::NULLS, Keyword::FIRST]) { - Some(true) - } else if self.parse_keywords(&[Keyword::NULLS, Keyword::LAST]) { - Some(false) - } else { - None - }; - - let options = self.parse_order_by_options()?; + let options = self.parse_order_by_options()?; let with_fill = if dialect_of!(self is ClickHouseDialect | GenericDialect) && self.parse_keywords(&[Keyword::WITH, Keyword::FILL]) @@ -13671,11 +13661,11 @@ impl<'a> Parser<'a> { Ok(IndexColumn { column: OrderByExpr { expr, - asc, - nulls_first, + options, with_fill, }, - operator_class: operator_class.map(Into::into), }) + operator_class: operator_class.map(Into::into), + }) } fn parse_order_by_options(&mut self) -> Result { diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs index a76424771..a8e3fe9e6 100644 --- a/tests/sqlparser_common.rs +++ b/tests/sqlparser_common.rs @@ -8847,22 +8847,24 @@ fn parse_create_index() { operator_class: None, column: OrderByExpr { expr: Expr::Identifier(Ident::new("name")), + with_fill: None, options: OrderByOptions { - asc: None, - nulls_first: None, - }, + asc: None, + nulls_first: None, + }, }, }, IndexColumn { operator_class: None, column: OrderByExpr { expr: Expr::Identifier(Ident::new("age")), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, + with_fill: None, + options: OrderByOptions { + asc: Some(false), + nulls_first: None, + }, }, - } + }, ]; match verified_stmt(sql) { Statement::CreateIndex(CreateIndex { @@ -8891,19 +8893,24 @@ fn test_create_index_with_using_function() { operator_class: None, column: OrderByExpr { expr: Expr::Identifier(Ident::new("name")), - asc: None, - nulls_first: None, with_fill: None, + options: OrderByOptions { + asc: None, + nulls_first: None, + }, }, }, IndexColumn { operator_class: None, column: OrderByExpr { expr: Expr::Identifier(Ident::new("age")), - asc: Some(false), - nulls_first: None, with_fill: None, + options: OrderByOptions { + asc: Some(false), + nulls_first: None, + }, }, + }, ]; match verified_stmt(sql) { Statement::CreateIndex(CreateIndex { @@ -8939,8 +8946,10 @@ fn test_create_index_with_with_clause() { let indexed_columns: Vec = vec![IndexColumn { column: OrderByExpr { expr: Expr::Identifier(Ident::new("title")), - asc: None, - nulls_first: None, + options: OrderByOptions { + asc: None, + nulls_first: None, + }, with_fill: None, }, operator_class: None, diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index 3e31138f9..8e7133fa0 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -2565,8 +2565,10 @@ fn parse_create_users_name_trgm_index() { over: None, within_group: vec![] }), - asc: None, - nulls_first: None, + options: OrderByOptions { + asc: None, + nulls_first: None, + }, with_fill: None, }, operator_class: Some(Ident::new("gin_trgm_ops")), @@ -2639,8 +2641,10 @@ fn parse_create_projects_name_description_trgm_index() { over: None, within_group: vec![] }), - asc: None, - nulls_first: None, + options: OrderByOptions { + asc: None, + nulls_first: None, + }, with_fill: None, }, operator_class: Some(Ident::new("gin_trgm_ops")), @@ -2686,8 +2690,10 @@ fn parse_create_nameplates_barcode_trgm_index() { quote_style: None, span: Span::empty() }), - asc: None, - nulls_first: None, + options: OrderByOptions { + asc: None, + nulls_first: None, + }, with_fill: None, }, operator_class: Some(Ident::new("gin_trgm_ops")), @@ -2732,8 +2738,10 @@ fn parse_create_sample_containers_barcode_trgm_index() { quote_style: None, span: Span::empty() }), - asc: None, - nulls_first: None, + options: OrderByOptions { + asc: None, + nulls_first: None, + }, with_fill: None, }, operator_class: Some(Ident::new("gist_trgm_ops")), From db5c9e77afe2d40164d70010279e602d4cfc8119 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Tue, 25 Feb 2025 12:23:28 +0100 Subject: [PATCH 11/23] Fixe clippy code smell --- src/parser/mod.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index f3a1ea895..225495513 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -6427,7 +6427,6 @@ impl<'a> Parser<'a> { self.expect_token(&Token::LParen)?; let columns = self.parse_comma_separated(Parser::parse_create_index_expr::)?; - println!("columns: {:?}", columns.len()); self.expect_token(&Token::RParen)?; let include = if self.parse_keyword(Keyword::INCLUDE) { @@ -13664,7 +13663,7 @@ impl<'a> Parser<'a> { options, with_fill, }, - operator_class: operator_class.map(Into::into), + operator_class, }) } From 8d08bd55edde2aa15cca029cdc560aa59523efdd Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Tue, 25 Feb 2025 12:29:05 +0100 Subject: [PATCH 12/23] Removed #[cfg_attr(feature = "std", derive(Debug))] --- src/parser/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 225495513..948cfb7f0 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -274,7 +274,6 @@ enum ParserState { ConnectBy, } -#[cfg_attr(feature = "std", derive(Debug))] /// A SQL Parser /// /// This struct is the main entry point for parsing SQL queries. From bcdde9b0e11066cdc850d82c3781a58ca67776ba Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Tue, 25 Feb 2025 12:30:03 +0100 Subject: [PATCH 13/23] Updtaed the `parse_create_index_expr` index description --- src/parser/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 948cfb7f0..da11facc2 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -13619,13 +13619,13 @@ impl<'a> Parser<'a> { } } - /// Parse an expression, optionally followed by ASC or DESC (used in ORDER BY) + /// Parse an OrderByExpr expression, optionally followed by ASC or DESC (used in ORDER BY) pub fn parse_order_by_expr(&mut self) -> Result { self.parse_create_index_expr::() .map(|index_column| index_column.column) } - /// Parse an expression, optionally followed by ASC or DESC (used in ORDER BY) + /// Parse an IndexColumn expression (used in CREATE INDEX) pub fn parse_create_index_expr( &mut self, ) -> Result { From be9ec88fb1522af9aef8045a6f9f11918aa81813 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Tue, 25 Feb 2025 12:35:31 +0100 Subject: [PATCH 14/23] Added multi-column test --- tests/sqlparser_postgres.rs | 85 +++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index 8e7133fa0..b8d51412a 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -2710,6 +2710,91 @@ fn parse_create_nameplates_barcode_trgm_index() { } } +#[test] +fn parse_create_multicolumn_nameplates_barcode_trgm_index() { + let sql = + "CREATE INDEX nameplates_barcode_trgm_idx ON nameplates USING GIN (product,product_name gin_trgm_ops,barcode gin_trgm_ops)"; + match pg().verified_stmt(sql) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique, + concurrently, + if_not_exists, + include, + nulls_distinct: None, + with, + predicate: None, + }) => { + assert_eq_vec(&["nameplates_barcode_trgm_idx"], &name); + assert_eq_vec(&["nameplates"], &table_name); + assert_eq!(IndexType::GIN, using); + assert_eq!( + IndexColumn { + column: OrderByExpr { + expr: Expr::Identifier(Ident { + value: "product".to_owned(), + quote_style: None, + span: Span::empty() + }), + options: OrderByOptions { + asc: None, + nulls_first: None, + }, + with_fill: None, + }, + operator_class: None + }, + columns[0], + ); + assert_eq!( + IndexColumn { + column: OrderByExpr { + expr: Expr::Identifier(Ident { + value: "product_name".to_owned(), + quote_style: None, + span: Span::empty() + }), + options: OrderByOptions { + asc: None, + nulls_first: None, + }, + with_fill: None, + }, + operator_class: Some(Ident::new("gin_trgm_ops")), + }, + columns[1], + ); + assert_eq!( + IndexColumn { + column: OrderByExpr { + expr: Expr::Identifier(Ident { + value: "barcode".to_owned(), + quote_style: None, + span: Span::empty() + }), + options: OrderByOptions { + asc: None, + nulls_first: None, + }, + with_fill: None, + }, + operator_class: Some(Ident::new("gin_trgm_ops")), + }, + columns[2], + ); + assert!(!unique); + assert!(!concurrently); + assert!(!if_not_exists); + assert!(include.is_empty()); + assert!(with.is_empty()); + } + _ => unreachable!(), + } +} + #[test] fn parse_create_sample_containers_barcode_trgm_index() { let sql = "CREATE INDEX sample_containers_barcode_trgm_idx ON sample_containers USING GIST (barcode gist_trgm_ops)"; From 71d5bf1002e3cb3d0064da01e632819f959457c9 Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Thu, 27 Feb 2025 10:34:52 +0100 Subject: [PATCH 15/23] Update src/parser/mod.rs Co-authored-by: Ifeanyi Ubah --- src/parser/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index da11facc2..27a84fde8 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -63,7 +63,6 @@ mod recursion { use super::ParserError; - #[derive(Debug)] /// Tracks remaining recursion depth. This value is decremented on /// each call to [`RecursionCounter::try_decrease()`], when it reaches 0 an error will /// be returned. From c8e906c7a6c94f3d3ebc00fa4d99ccce0707aa19 Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Thu, 27 Feb 2025 10:35:01 +0100 Subject: [PATCH 16/23] Update src/parser/mod.rs Co-authored-by: Ifeanyi Ubah --- src/parser/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 27a84fde8..77cb40886 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -263,7 +263,7 @@ impl ParserOptions { } } -#[derive(Copy, Clone, Debug)] +#[derive(Copy, Clone)] enum ParserState { /// The default state of the parser. Normal, From 6aba4254ff9260259420dfa40e432ae1bccd1ab5 Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Thu, 27 Feb 2025 10:35:28 +0100 Subject: [PATCH 17/23] Update src/parser/mod.rs Co-authored-by: Ifeanyi Ubah --- src/parser/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 77cb40886..bdc807c5d 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -7661,7 +7661,11 @@ impl<'a> Parser<'a> { }) } - /// Parse [USING {BTREE | HASH | GIN | GIST | SPGIST | BRIN | BLOOM | identifier}] + /// Optionally parse the `USING` keyword, followed by an [IndexType] + /// Example: + /// ```sql + //// USING BTREE (name, age DESC) + /// ``` pub fn parse_optional_using_then_index_type( &mut self, ) -> Result, ParserError> { From 57e5c14f36aa4a4f387ccd80ecb852ed3c98f862 Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Thu, 27 Feb 2025 10:35:45 +0100 Subject: [PATCH 18/23] Update src/parser/mod.rs Co-authored-by: Ifeanyi Ubah --- src/parser/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index bdc807c5d..5837867f6 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -13628,7 +13628,7 @@ impl<'a> Parser<'a> { .map(|index_column| index_column.column) } - /// Parse an IndexColumn expression (used in CREATE INDEX) + /// Parse an [IndexColumn]. pub fn parse_create_index_expr( &mut self, ) -> Result { From e941cb0c165cfcd987ffa14966415cd6726a225c Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Thu, 27 Feb 2025 10:36:11 +0100 Subject: [PATCH 19/23] Update src/parser/mod.rs Co-authored-by: Ifeanyi Ubah --- src/parser/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 5837867f6..b532956ab 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -13622,7 +13622,7 @@ impl<'a> Parser<'a> { } } - /// Parse an OrderByExpr expression, optionally followed by ASC or DESC (used in ORDER BY) + /// Parse an [OrderByExpr] expression. pub fn parse_order_by_expr(&mut self) -> Result { self.parse_create_index_expr::() .map(|index_column| index_column.column) From 653dba070d1dbfe357580bfa2bb8d0c06fa9905d Mon Sep 17 00:00:00 2001 From: Luca Cappelletti Date: Thu, 27 Feb 2025 10:36:25 +0100 Subject: [PATCH 20/23] Update src/parser/mod.rs Co-authored-by: Ifeanyi Ubah --- src/parser/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index b532956ab..170206195 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -7669,8 +7669,8 @@ impl<'a> Parser<'a> { pub fn parse_optional_using_then_index_type( &mut self, ) -> Result, ParserError> { - Ok(if self.parse_keyword(Keyword::USING) { - Some(self.parse_index_type()?) + if self.parse_keyword(Keyword::USING) { + Ok(Some(self.parse_index_type()?)) } else { None }) From fd659ff5cc1186443a766b2a70dc8f5dbe1f1c00 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Thu, 27 Feb 2025 10:56:12 +0100 Subject: [PATCH 21/23] Replaced bool const for parameter as per issue request --- src/parser/mod.rs | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index 170206195..6ed4911cf 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -6424,7 +6424,7 @@ impl<'a> Parser<'a> { }; self.expect_token(&Token::LParen)?; - let columns = self.parse_comma_separated(Parser::parse_create_index_expr::)?; + let columns = self.parse_comma_separated(Parser::parse_create_index_expr)?; self.expect_token(&Token::RParen)?; let include = if self.parse_keyword(Keyword::INCLUDE) { @@ -7669,11 +7669,11 @@ impl<'a> Parser<'a> { pub fn parse_optional_using_then_index_type( &mut self, ) -> Result, ParserError> { - if self.parse_keyword(Keyword::USING) { + if self.parse_keyword(Keyword::USING) { Ok(Some(self.parse_index_type()?)) } else { - None - }) + Ok(None) + } } /// Parse `[ident]`, mostly `ident` is name, like: @@ -13624,17 +13624,26 @@ impl<'a> Parser<'a> { /// Parse an [OrderByExpr] expression. pub fn parse_order_by_expr(&mut self) -> Result { - self.parse_create_index_expr::() - .map(|index_column| index_column.column) + self.parse_order_by_expr_inner(false) + .map(|(order_by, _)| order_by) } /// Parse an [IndexColumn]. - pub fn parse_create_index_expr( + pub fn parse_create_index_expr(&mut self) -> Result { + self.parse_order_by_expr_inner(true) + .map(|(column, operator_class)| IndexColumn { + column, + operator_class, + }) + } + + fn parse_order_by_expr_inner( &mut self, - ) -> Result { + with_operator_class: bool, + ) -> Result<(OrderByExpr, Option), ParserError> { let expr = self.parse_expr()?; - let operator_class: Option = if PARSE_OPERATOR_CLASS { + let operator_class: Option = if with_operator_class { // We check that if non of the following keywords are present, then we parse an // identifier as operator class. if self @@ -13659,14 +13668,14 @@ impl<'a> Parser<'a> { None }; - Ok(IndexColumn { - column: OrderByExpr { + Ok(( + OrderByExpr { expr, options, with_fill, }, operator_class, - }) + )) } fn parse_order_by_options(&mut self) -> Result { From f11a614ed480ed88480328a8c19eea8997d00d74 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Sun, 2 Mar 2025 08:53:16 +0100 Subject: [PATCH 22/23] Extended operator class tests and added test for bloom index syntax --- tests/sqlparser_postgres.rs | 463 +++++++++++++----------------------- 1 file changed, 165 insertions(+), 298 deletions(-) diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index b8d51412a..7fd713acb 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -2510,334 +2510,201 @@ fn parse_create_anonymous_index() { } #[test] -fn parse_create_users_name_trgm_index() { - let sql = "CREATE INDEX users_name_trgm_idx ON users USING GIN (concat_users_name(first_name, last_name) gin_trgm_ops)"; - match pg().verified_stmt(sql) { - Statement::CreateIndex(CreateIndex { - name: Some(ObjectName(name)), - table_name: ObjectName(table_name), - using: Some(using), - columns, - unique, - concurrently, - if_not_exists, - include, - nulls_distinct: None, - with, - predicate: None, - }) => { - assert_eq_vec(&["users_name_trgm_idx"], &name); - assert_eq_vec(&["users"], &table_name); - assert_eq!(IndexType::GIN, using); - assert_eq!( - IndexColumn { - column: OrderByExpr { - expr: Expr::Function(Function { - name: ObjectName(vec![ObjectNamePart::Identifier(Ident { - value: "concat_users_name".to_owned(), - quote_style: None, - span: Span::empty() - })]), - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args: FunctionArguments::List(FunctionArgumentList { - duplicate_treatment: None, - args: vec![ - FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( - Ident { - value: "first_name".to_owned(), - quote_style: None, - span: Span::empty() - } - ))), - FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( - Ident { - value: "last_name".to_owned(), - quote_style: None, - span: Span::empty() - } - ))) - ], - clauses: vec![] - }), - filter: None, - null_treatment: None, - over: None, - within_group: vec![] - }), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, - with_fill: None, - }, - operator_class: Some(Ident::new("gin_trgm_ops")), - }, - columns[0], - ); - assert!(!unique); - assert!(!concurrently); - assert!(!if_not_exists); - assert!(include.is_empty()); - assert!(with.is_empty()); - } - _ => unreachable!(), - } -} +/// Test to verify the correctness of parsing the `CREATE INDEX` statement with optional operator classes. +/// +/// # Implementative details +/// +/// At this time, since the parser library is not intended to take care of the semantics of the SQL statements, +/// there is no way to verify the correctness of the operator classes, nor whether they are valid for the given +/// index type. This test is only intended to verify that the parser can correctly parse the statement. For this +/// reason, the test includes a `totally_not_valid` operator class. +fn parse_create_indices_with_operator_classes() { + let indices = [ + IndexType::GIN, + IndexType::GiST, + IndexType::Custom("CustomIndexType".into()), + ]; + let operator_classes: [Option; 4] = [ + None, + Some("gin_trgm_ops".into()), + Some("gist_trgm_ops".into()), + Some("totally_not_valid".into()), + ]; -#[test] -fn parse_create_projects_name_description_trgm_index() { - let sql = "CREATE INDEX projects_name_description_trgm_idx ON projects USING GIN (concat_projects_name_description(name, description) gin_trgm_ops)"; - match pg().verified_stmt(sql) { - Statement::CreateIndex(CreateIndex { - name: Some(ObjectName(name)), - table_name: ObjectName(table_name), - using: Some(using), - columns, - unique, - concurrently, - if_not_exists, - include, - nulls_distinct: None, - with, - predicate: None, - }) => { - assert_eq_vec(&["projects_name_description_trgm_idx"], &name); - assert_eq_vec(&["projects"], &table_name); - assert_eq!(IndexType::GIN, using); - assert_eq!( - IndexColumn { - column: OrderByExpr { - expr: Expr::Function(Function { - name: ObjectName(vec![ObjectNamePart::Identifier(Ident { - value: "concat_projects_name_description".to_owned(), - quote_style: None, - span: Span::empty() - })]), - uses_odbc_syntax: false, - parameters: FunctionArguments::None, - args: FunctionArguments::List(FunctionArgumentList { - duplicate_treatment: None, - args: vec![ - FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( - Ident { - value: "name".to_owned(), - quote_style: None, - span: Span::empty() - } - ))), - FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( - Ident { - value: "description".to_owned(), - quote_style: None, - span: Span::empty() - } - ))) - ], - clauses: vec![] - }), - filter: None, - null_treatment: None, - over: None, - within_group: vec![] - }), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, - with_fill: None, - }, - operator_class: Some(Ident::new("gin_trgm_ops")), - }, - columns[0], + for expected_index_type in indices { + for expected_operator_class in &operator_classes { + let single_column_sql_statement = format!( + "CREATE INDEX the_index_name ON users USING {expected_index_type} (concat_users_name(first_name, last_name){})", + expected_operator_class.as_ref().map(|oc| format!(" {}", oc)) + .unwrap_or_default() + ); + let multi_column_sql_statement = format!( + "CREATE INDEX the_index_name ON users USING {expected_index_type} (column_name,concat_users_name(first_name, last_name){})", + expected_operator_class.as_ref().map(|oc| format!(" {}", oc)) + .unwrap_or_default() ); - assert!(!unique); - assert!(!concurrently); - assert!(!if_not_exists); - assert!(include.is_empty()); - assert!(with.is_empty()); - } - _ => unreachable!(), - } -} -#[test] -fn parse_create_nameplates_barcode_trgm_index() { - let sql = - "CREATE INDEX nameplates_barcode_trgm_idx ON nameplates USING GIN (barcode gin_trgm_ops)"; - match pg().verified_stmt(sql) { - Statement::CreateIndex(CreateIndex { - name: Some(ObjectName(name)), - table_name: ObjectName(table_name), - using: Some(using), - columns, - unique, - concurrently, - if_not_exists, - include, - nulls_distinct: None, - with, - predicate: None, - }) => { - assert_eq_vec(&["nameplates_barcode_trgm_idx"], &name); - assert_eq_vec(&["nameplates"], &table_name); - assert_eq!(IndexType::GIN, using); - assert_eq!( - IndexColumn { - column: OrderByExpr { - expr: Expr::Identifier(Ident { - value: "barcode".to_owned(), + let expected_function_column = IndexColumn { + column: OrderByExpr { + expr: Expr::Function(Function { + name: ObjectName(vec![ObjectNamePart::Identifier(Ident { + value: "concat_users_name".to_owned(), quote_style: None, - span: Span::empty() + span: Span::empty(), + })]), + uses_odbc_syntax: false, + parameters: FunctionArguments::None, + args: FunctionArguments::List(FunctionArgumentList { + duplicate_treatment: None, + args: vec![ + FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( + Ident { + value: "first_name".to_owned(), + quote_style: None, + span: Span::empty(), + }, + ))), + FunctionArg::Unnamed(FunctionArgExpr::Expr(Expr::Identifier( + Ident { + value: "last_name".to_owned(), + quote_style: None, + span: Span::empty(), + }, + ))), + ], + clauses: vec![], }), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, - with_fill: None, + filter: None, + null_treatment: None, + over: None, + within_group: vec![], + }), + options: OrderByOptions { + asc: None, + nulls_first: None, }, - operator_class: Some(Ident::new("gin_trgm_ops")), + with_fill: None, }, - columns[0], - ); - assert!(!unique); - assert!(!concurrently); - assert!(!if_not_exists); - assert!(include.is_empty()); - assert!(with.is_empty()); + operator_class: expected_operator_class.clone(), + }; + + match pg().verified_stmt(&single_column_sql_statement) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique: false, + concurrently: false, + if_not_exists: false, + include, + nulls_distinct: None, + with, + predicate: None, + }) => { + assert_eq_vec(&["the_index_name"], &name); + assert_eq_vec(&["users"], &table_name); + assert_eq!(expected_index_type, using); + assert_eq!(expected_function_column, columns[0],); + assert!(include.is_empty()); + assert!(with.is_empty()); + } + _ => unreachable!(), + } + + match pg().verified_stmt(&multi_column_sql_statement) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique: false, + concurrently: false, + if_not_exists: false, + include, + nulls_distinct: None, + with, + predicate: None, + }) => { + assert_eq_vec(&["the_index_name"], &name); + assert_eq_vec(&["users"], &table_name); + assert_eq!(expected_index_type, using); + assert_eq!( + IndexColumn { + column: OrderByExpr { + expr: Expr::Identifier(Ident { + value: "column_name".to_owned(), + quote_style: None, + span: Span::empty() + }), + options: OrderByOptions { + asc: None, + nulls_first: None, + }, + with_fill: None, + }, + operator_class: None + }, + columns[0], + ); + assert_eq!(expected_function_column, columns[1],); + assert!(include.is_empty()); + assert!(with.is_empty()); + } + _ => unreachable!(), + } } - _ => unreachable!(), } } #[test] -fn parse_create_multicolumn_nameplates_barcode_trgm_index() { +fn parse_create_bloom() { let sql = - "CREATE INDEX nameplates_barcode_trgm_idx ON nameplates USING GIN (product,product_name gin_trgm_ops,barcode gin_trgm_ops)"; + "CREATE INDEX bloomidx ON tbloom USING BLOOM (i1,i2,i3) WITH (length = 80, col1 = 2, col2 = 2, col3 = 4)"; match pg().verified_stmt(sql) { Statement::CreateIndex(CreateIndex { name: Some(ObjectName(name)), table_name: ObjectName(table_name), using: Some(using), columns, - unique, - concurrently, - if_not_exists, + unique: false, + concurrently: false, + if_not_exists: false, include, nulls_distinct: None, with, predicate: None, }) => { - assert_eq_vec(&["nameplates_barcode_trgm_idx"], &name); - assert_eq_vec(&["nameplates"], &table_name); - assert_eq!(IndexType::GIN, using); + assert_eq_vec(&["bloomidx"], &name); + assert_eq_vec(&["tbloom"], &table_name); + assert_eq!(IndexType::Bloom, using); + assert_eq_vec(&["i1", "i2", "i3"], &columns); + assert!(include.is_empty()); assert_eq!( - IndexColumn { - column: OrderByExpr { - expr: Expr::Identifier(Ident { - value: "product".to_owned(), - quote_style: None, - span: Span::empty() - }), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, - with_fill: None, + vec![ + Expr::BinaryOp { + left: Box::new(Expr::Identifier(Ident::new("length"))), + op: BinaryOperator::Eq, + right: Box::new(Expr::Value(number("80").into())), }, - operator_class: None - }, - columns[0], - ); - assert_eq!( - IndexColumn { - column: OrderByExpr { - expr: Expr::Identifier(Ident { - value: "product_name".to_owned(), - quote_style: None, - span: Span::empty() - }), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, - with_fill: None, + Expr::BinaryOp { + left: Box::new(Expr::Identifier(Ident::new("col1"))), + op: BinaryOperator::Eq, + right: Box::new(Expr::Value(number("2").into())), }, - operator_class: Some(Ident::new("gin_trgm_ops")), - }, - columns[1], - ); - assert_eq!( - IndexColumn { - column: OrderByExpr { - expr: Expr::Identifier(Ident { - value: "barcode".to_owned(), - quote_style: None, - span: Span::empty() - }), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, - with_fill: None, + Expr::BinaryOp { + left: Box::new(Expr::Identifier(Ident::new("col2"))), + op: BinaryOperator::Eq, + right: Box::new(Expr::Value(number("2").into())), }, - operator_class: Some(Ident::new("gin_trgm_ops")), - }, - columns[2], - ); - assert!(!unique); - assert!(!concurrently); - assert!(!if_not_exists); - assert!(include.is_empty()); - assert!(with.is_empty()); - } - _ => unreachable!(), - } -} - -#[test] -fn parse_create_sample_containers_barcode_trgm_index() { - let sql = "CREATE INDEX sample_containers_barcode_trgm_idx ON sample_containers USING GIST (barcode gist_trgm_ops)"; - match pg().verified_stmt(sql) { - Statement::CreateIndex(CreateIndex { - name: Some(ObjectName(name)), - table_name: ObjectName(table_name), - using: Some(using), - columns, - unique, - concurrently, - if_not_exists, - include, - nulls_distinct: None, - with, - predicate: None, - }) => { - assert_eq_vec(&["sample_containers_barcode_trgm_idx"], &name); - assert_eq_vec(&["sample_containers"], &table_name); - assert_eq!(IndexType::GiST, using); - assert_eq!( - IndexColumn { - column: OrderByExpr { - expr: Expr::Identifier(Ident { - value: "barcode".to_owned(), - quote_style: None, - span: Span::empty() - }), - options: OrderByOptions { - asc: None, - nulls_first: None, - }, - with_fill: None, + Expr::BinaryOp { + left: Box::new(Expr::Identifier(Ident::new("col3"))), + op: BinaryOperator::Eq, + right: Box::new(Expr::Value(number("4").into())), }, - operator_class: Some(Ident::new("gist_trgm_ops")), - }, - columns[0], + ], + with ); - assert!(!unique); - assert!(!concurrently); - assert!(!if_not_exists); - assert!(include.is_empty()); - assert!(with.is_empty()); } _ => unreachable!(), } From 76517719cf0712113677f620980720632ef8ad75 Mon Sep 17 00:00:00 2001 From: LucaCappelletti94 Date: Sun, 2 Mar 2025 08:59:00 +0100 Subject: [PATCH 23/23] Added a test for the BRIN index type --- tests/sqlparser_postgres.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/tests/sqlparser_postgres.rs b/tests/sqlparser_postgres.rs index 7fd713acb..0dfcc24ea 100644 --- a/tests/sqlparser_postgres.rs +++ b/tests/sqlparser_postgres.rs @@ -2522,6 +2522,7 @@ fn parse_create_indices_with_operator_classes() { let indices = [ IndexType::GIN, IndexType::GiST, + IndexType::SPGiST, IndexType::Custom("CustomIndexType".into()), ]; let operator_classes: [Option; 4] = [ @@ -2710,6 +2711,34 @@ fn parse_create_bloom() { } } +#[test] +fn parse_create_brin() { + let sql = "CREATE INDEX brin_sensor_data_recorded_at ON sensor_data USING BRIN (recorded_at)"; + match pg().verified_stmt(sql) { + Statement::CreateIndex(CreateIndex { + name: Some(ObjectName(name)), + table_name: ObjectName(table_name), + using: Some(using), + columns, + unique: false, + concurrently: false, + if_not_exists: false, + include, + nulls_distinct: None, + with, + predicate: None, + }) => { + assert_eq_vec(&["brin_sensor_data_recorded_at"], &name); + assert_eq_vec(&["sensor_data"], &table_name); + assert_eq!(IndexType::BRIN, using); + assert_eq_vec(&["recorded_at"], &columns); + assert!(include.is_empty()); + assert!(with.is_empty()); + } + _ => unreachable!(), + } +} + #[test] fn parse_create_index_concurrently() { let sql = "CREATE INDEX CONCURRENTLY IF NOT EXISTS my_index ON my_table(col1,col2)";