Skip to main content

sqlparser/ast/
dcl.rs

1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements.  See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership.  The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License.  You may obtain a copy of the License at
8//
9//   http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied.  See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18//! AST types specific to GRANT/REVOKE/ROLE variants of [`Statement`](crate::ast::Statement)
19//! (commonly referred to as Data Control Language, or DCL)
20
21#[cfg(not(feature = "std"))]
22use alloc::vec::Vec;
23use core::fmt;
24
25#[cfg(feature = "serde")]
26use serde::{Deserialize, Serialize};
27
28#[cfg(feature = "visitor")]
29use sqlparser_derive::{Visit, VisitMut};
30
31use super::{display_comma_separated, Expr, Ident, Password, Spanned};
32use crate::ast::{
33    display_separated, CascadeOption, CurrentGrantsKind, GrantObjects, Grantee, ObjectName,
34    Privileges,
35};
36use crate::tokenizer::Span;
37
38/// An option in `ROLE` statement.
39///
40/// <https://www.postgresql.org/docs/current/sql-createrole.html>
41#[derive(#[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),
        }
    }
}Debug, #[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)),
        }
    }
}Clone, #[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() }
            }
    }
}PartialEq, #[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),
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for RoleOption {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<Expr>;
        let _: ::core::cmp::AssertParamIsEq<Password>;
    }
}Eq, #[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,
        }
    }
}Ord, #[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),
        }
    }
}Hash)]
42#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
43#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for RoleOption {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::BypassRLS(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::ConnectionLimit(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::CreateDB(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::CreateRole(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Inherit(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Login(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Password(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Replication(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::SuperUser(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::ValidUntil(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for RoleOption {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::BypassRLS(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::ConnectionLimit(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::CreateDB(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::CreateRole(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Inherit(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Login(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Password(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Replication(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::SuperUser(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::ValidUntil(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
44pub enum RoleOption {
45    /// Enable or disable BYPASSRLS.
46    BypassRLS(bool),
47    /// Connection limit expression.
48    ConnectionLimit(Expr),
49    /// CREATEDB flag.
50    CreateDB(bool),
51    /// CREATEROLE flag.
52    CreateRole(bool),
53    /// INHERIT flag.
54    Inherit(bool),
55    /// LOGIN flag.
56    Login(bool),
57    /// Password value or NULL password.
58    Password(Password),
59    /// Replication privilege flag.
60    Replication(bool),
61    /// SUPERUSER flag.
62    SuperUser(bool),
63    /// `VALID UNTIL` expression.
64    ValidUntil(Expr),
65}
66
67impl fmt::Display for RoleOption {
68    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
69        match self {
70            RoleOption::BypassRLS(value) => {
71                f.write_fmt(format_args!("{0}",
        if *value { "BYPASSRLS" } else { "NOBYPASSRLS" }))write!(f, "{}", if *value { "BYPASSRLS" } else { "NOBYPASSRLS" })
72            }
73            RoleOption::ConnectionLimit(expr) => {
74                f.write_fmt(format_args!("CONNECTION LIMIT {0}", expr))write!(f, "CONNECTION LIMIT {expr}")
75            }
76            RoleOption::CreateDB(value) => {
77                f.write_fmt(format_args!("{0}",
        if *value { "CREATEDB" } else { "NOCREATEDB" }))write!(f, "{}", if *value { "CREATEDB" } else { "NOCREATEDB" })
78            }
79            RoleOption::CreateRole(value) => {
80                f.write_fmt(format_args!("{0}",
        if *value { "CREATEROLE" } else { "NOCREATEROLE" }))write!(f, "{}", if *value { "CREATEROLE" } else { "NOCREATEROLE" })
81            }
82            RoleOption::Inherit(value) => {
83                f.write_fmt(format_args!("{0}", if *value { "INHERIT" } else { "NOINHERIT" }))write!(f, "{}", if *value { "INHERIT" } else { "NOINHERIT" })
84            }
85            RoleOption::Login(value) => {
86                f.write_fmt(format_args!("{0}", if *value { "LOGIN" } else { "NOLOGIN" }))write!(f, "{}", if *value { "LOGIN" } else { "NOLOGIN" })
87            }
88            RoleOption::Password(password) => match password {
89                Password::Password(expr) => f.write_fmt(format_args!("PASSWORD {0}", expr))write!(f, "PASSWORD {expr}"),
90                Password::NullPassword => f.write_fmt(format_args!("PASSWORD NULL"))write!(f, "PASSWORD NULL"),
91            },
92            RoleOption::Replication(value) => {
93                f.write_fmt(format_args!("{0}",
        if *value { "REPLICATION" } else { "NOREPLICATION" }))write!(
94                    f,
95                    "{}",
96                    if *value {
97                        "REPLICATION"
98                    } else {
99                        "NOREPLICATION"
100                    }
101                )
102            }
103            RoleOption::SuperUser(value) => {
104                f.write_fmt(format_args!("{0}",
        if *value { "SUPERUSER" } else { "NOSUPERUSER" }))write!(f, "{}", if *value { "SUPERUSER" } else { "NOSUPERUSER" })
105            }
106            RoleOption::ValidUntil(expr) => {
107                f.write_fmt(format_args!("VALID UNTIL {0}", expr))write!(f, "VALID UNTIL {expr}")
108            }
109        }
110    }
111}
112
113/// SET config value option:
114/// * SET `configuration_parameter` { TO | = } { `value` | DEFAULT }
115/// * SET `configuration_parameter` FROM CURRENT
116#[derive(#[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),
        }
    }
}Debug, #[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)),
        }
    }
}Clone, #[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,
            }
    }
}PartialEq, #[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),
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for SetConfigValue {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Expr>;
    }
}Eq, #[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,
        }
    }
}Ord, #[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),
            _ => {}
        }
    }
}Hash)]
117#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
118#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for SetConfigValue {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::Default => {}
                            Self::FromCurrent => {}
                            Self::Value(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for SetConfigValue {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::Default => {}
                            Self::FromCurrent => {}
                            Self::Value(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
119pub enum SetConfigValue {
120    /// Use the default value.
121    Default,
122    /// Use the current value (`FROM CURRENT`).
123    FromCurrent,
124    /// Set to the provided expression value.
125    Value(Expr),
126}
127
128/// RESET config option:
129/// * RESET `configuration_parameter`
130/// * RESET ALL
131#[derive(#[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),
        }
    }
}Debug, #[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)),
        }
    }
}Clone, #[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,
            }
    }
}PartialEq, #[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),
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for ResetConfig {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<ObjectName>;
    }
}Eq, #[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,
        }
    }
}Ord, #[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),
            _ => {}
        }
    }
}Hash)]
132#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
133#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for ResetConfig {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::ALL => {}
                            Self::ConfigName(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for ResetConfig {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::ALL => {}
                            Self::ConfigName(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
134pub enum ResetConfig {
135    /// Reset all configuration parameters.
136    ALL,
137    /// Reset the named configuration parameter.
138    ConfigName(ObjectName),
139}
140
141/// An `ALTER ROLE` (`Statement::AlterRole`) operation
142#[derive(#[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),
        }
    }
}Debug, #[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),
                },
        }
    }
}Clone, #[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() }
            }
    }
}PartialEq, #[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),
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for AlterRoleOperation {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Ident>;
        let _: ::core::cmp::AssertParamIsEq<Vec<RoleOption>>;
        let _: ::core::cmp::AssertParamIsEq<ObjectName>;
        let _: ::core::cmp::AssertParamIsEq<SetConfigValue>;
        let _: ::core::cmp::AssertParamIsEq<Option<ObjectName>>;
        let _: ::core::cmp::AssertParamIsEq<ResetConfig>;
        let _: ::core::cmp::AssertParamIsEq<Option<ObjectName>>;
    }
}Eq, #[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,
        }
    }
}Ord, #[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)
            }
        }
    }
}Hash)]
143#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
144#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for AlterRoleOperation {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::RenameRole { role_name } => {
                                sqlparser::ast::Visit::visit(role_name, visitor)?;
                            }
                            Self::AddMember { member_name } => {
                                sqlparser::ast::Visit::visit(member_name, visitor)?;
                            }
                            Self::DropMember { member_name } => {
                                sqlparser::ast::Visit::visit(member_name, visitor)?;
                            }
                            Self::WithOptions { options } => {
                                sqlparser::ast::Visit::visit(options, visitor)?;
                            }
                            Self::Set { config_name, config_value, in_database } => {
                                sqlparser::ast::Visit::visit(config_name, visitor)?;
                                sqlparser::ast::Visit::visit(config_value, visitor)?;
                                sqlparser::ast::Visit::visit(in_database, visitor)?;
                            }
                            Self::Reset { config_name, in_database } => {
                                sqlparser::ast::Visit::visit(config_name, visitor)?;
                                sqlparser::ast::Visit::visit(in_database, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for AlterRoleOperation {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::RenameRole { role_name } => {
                                sqlparser::ast::VisitMut::visit(role_name, visitor)?;
                            }
                            Self::AddMember { member_name } => {
                                sqlparser::ast::VisitMut::visit(member_name, visitor)?;
                            }
                            Self::DropMember { member_name } => {
                                sqlparser::ast::VisitMut::visit(member_name, visitor)?;
                            }
                            Self::WithOptions { options } => {
                                sqlparser::ast::VisitMut::visit(options, visitor)?;
                            }
                            Self::Set { config_name, config_value, in_database } => {
                                sqlparser::ast::VisitMut::visit(config_name, visitor)?;
                                sqlparser::ast::VisitMut::visit(config_value, visitor)?;
                                sqlparser::ast::VisitMut::visit(in_database, visitor)?;
                            }
                            Self::Reset { config_name, in_database } => {
                                sqlparser::ast::VisitMut::visit(config_name, visitor)?;
                                sqlparser::ast::VisitMut::visit(in_database, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
145pub enum AlterRoleOperation {
146    /// Generic
147    RenameRole {
148        /// Role name to rename.
149        role_name: Ident,
150    },
151    /// MS SQL Server
152    /// <https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-role-transact-sql>
153    AddMember {
154        /// Member name to add to the role.
155        member_name: Ident,
156    },
157    /// MS SQL Server
158    ///
159    /// <https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-role-transact-sql>
160    DropMember {
161        /// Member name to remove from the role.
162        member_name: Ident,
163    },
164    /// PostgreSQL
165    /// <https://www.postgresql.org/docs/current/sql-alterrole.html>
166    WithOptions {
167        /// Role options to apply.
168        options: Vec<RoleOption>,
169    },
170    /// PostgreSQL
171    /// <https://www.postgresql.org/docs/current/sql-alterrole.html>
172    ///
173    /// `SET configuration_parameter { TO | = } { value | DEFAULT }`
174    Set {
175        /// Configuration name to set.
176        config_name: ObjectName,
177        /// Value to assign to the configuration.
178        config_value: SetConfigValue,
179        /// Optional database scope for the setting.
180        in_database: Option<ObjectName>,
181    },
182    /// PostgreSQL
183    /// <https://www.postgresql.org/docs/current/sql-alterrole.html>
184    ///
185    /// `RESET configuration_parameter` | `RESET ALL`
186    Reset {
187        /// Configuration to reset.
188        config_name: ResetConfig,
189        /// Optional database scope for the reset.
190        in_database: Option<ObjectName>,
191    },
192}
193
194impl fmt::Display for AlterRoleOperation {
195    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
196        match self {
197            AlterRoleOperation::RenameRole { role_name } => {
198                f.write_fmt(format_args!("RENAME TO {0}", role_name))write!(f, "RENAME TO {role_name}")
199            }
200            AlterRoleOperation::AddMember { member_name } => {
201                f.write_fmt(format_args!("ADD MEMBER {0}", member_name))write!(f, "ADD MEMBER {member_name}")
202            }
203            AlterRoleOperation::DropMember { member_name } => {
204                f.write_fmt(format_args!("DROP MEMBER {0}", member_name))write!(f, "DROP MEMBER {member_name}")
205            }
206            AlterRoleOperation::WithOptions { options } => {
207                f.write_fmt(format_args!("WITH {0}", display_separated(options, " ")))write!(f, "WITH {}", display_separated(options, " "))
208            }
209            AlterRoleOperation::Set {
210                config_name,
211                config_value,
212                in_database,
213            } => {
214                if let Some(database_name) = in_database {
215                    f.write_fmt(format_args!("IN DATABASE {0} ", database_name))write!(f, "IN DATABASE {database_name} ")?;
216                }
217
218                match config_value {
219                    SetConfigValue::Default => f.write_fmt(format_args!("SET {0} TO DEFAULT", config_name))write!(f, "SET {config_name} TO DEFAULT"),
220                    SetConfigValue::FromCurrent => f.write_fmt(format_args!("SET {0} FROM CURRENT", config_name))write!(f, "SET {config_name} FROM CURRENT"),
221                    SetConfigValue::Value(expr) => f.write_fmt(format_args!("SET {0} TO {1}", config_name, expr))write!(f, "SET {config_name} TO {expr}"),
222                }
223            }
224            AlterRoleOperation::Reset {
225                config_name,
226                in_database,
227            } => {
228                if let Some(database_name) = in_database {
229                    f.write_fmt(format_args!("IN DATABASE {0} ", database_name))write!(f, "IN DATABASE {database_name} ")?;
230                }
231
232                match config_name {
233                    ResetConfig::ALL => f.write_fmt(format_args!("RESET ALL"))write!(f, "RESET ALL"),
234                    ResetConfig::ConfigName(name) => f.write_fmt(format_args!("RESET {0}", name))write!(f, "RESET {name}"),
235                }
236            }
237        }
238    }
239}
240
241/// A `USE` (`Statement::Use`) operation
242#[derive(#[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"),
        }
    }
}Debug, #[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,
        }
    }
}Clone, #[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,
            }
    }
}PartialEq, #[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),
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for Use {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<ObjectName>;
        let _: ::core::cmp::AssertParamIsEq<SecondaryRoles>;
    }
}Eq, #[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,
        }
    }
}Ord, #[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),
            _ => {}
        }
    }
}Hash)]
243#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
244#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for Use {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::Catalog(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Schema(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Database(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Warehouse(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Role(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::SecondaryRoles(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Object(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                            Self::Default => {}
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for Use {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::Catalog(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Schema(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Database(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Warehouse(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Role(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::SecondaryRoles(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Object(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                            Self::Default => {}
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
245pub enum Use {
246    /// Switch to the given catalog (e.g. `USE CATALOG ...`).
247    Catalog(ObjectName),
248    /// Switch to the given schema (e.g. `USE SCHEMA ...`).
249    Schema(ObjectName),
250    /// Switch to the given database (e.g. `USE DATABASE ...`).
251    Database(ObjectName),
252    /// Switch to the given warehouse (e.g. `USE WAREHOUSE ...`).
253    Warehouse(ObjectName),
254    /// Switch to the given role (e.g. `USE ROLE ...`).
255    Role(ObjectName),
256    /// Use secondary roles specification (e.g. `USE SECONDARY ROLES ...`).
257    SecondaryRoles(SecondaryRoles),
258    /// Use the specified object (e.g. `USE foo.bar`).
259    Object(ObjectName),
260    /// Reset to default (e.g. `USE DEFAULT`).
261    Default,
262}
263
264impl fmt::Display for Use {
265    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
266        f.write_str("USE ")?;
267        match self {
268            Use::Catalog(name) => f.write_fmt(format_args!("CATALOG {0}", name))write!(f, "CATALOG {name}"),
269            Use::Schema(name) => f.write_fmt(format_args!("SCHEMA {0}", name))write!(f, "SCHEMA {name}"),
270            Use::Database(name) => f.write_fmt(format_args!("DATABASE {0}", name))write!(f, "DATABASE {name}"),
271            Use::Warehouse(name) => f.write_fmt(format_args!("WAREHOUSE {0}", name))write!(f, "WAREHOUSE {name}"),
272            Use::Role(name) => f.write_fmt(format_args!("ROLE {0}", name))write!(f, "ROLE {name}"),
273            Use::SecondaryRoles(secondary_roles) => {
274                f.write_fmt(format_args!("SECONDARY ROLES {0}", secondary_roles))write!(f, "SECONDARY ROLES {secondary_roles}")
275            }
276            Use::Object(name) => f.write_fmt(format_args!("{0}", name))write!(f, "{name}"),
277            Use::Default => f.write_fmt(format_args!("DEFAULT"))write!(f, "DEFAULT"),
278        }
279    }
280}
281
282/// Snowflake `SECONDARY ROLES` USE variant
283/// See: <https://docs.snowflake.com/en/sql-reference/sql/use-secondary-roles>
284#[derive(#[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),
        }
    }
}Debug, #[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)),
        }
    }
}Clone, #[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,
            }
    }
}PartialEq, #[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),
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for SecondaryRoles {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Vec<Ident>>;
    }
}Eq, #[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,
        }
    }
}Ord, #[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),
            _ => {}
        }
    }
}Hash)]
285#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
286#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for SecondaryRoles {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::All => {}
                            Self::None => {}
                            Self::List(_0) => {
                                sqlparser::ast::Visit::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for SecondaryRoles {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        match self {
                            Self::All => {}
                            Self::None => {}
                            Self::List(_0) => {
                                sqlparser::ast::VisitMut::visit(_0, visitor)?;
                            }
                        }
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
287pub enum SecondaryRoles {
288    /// Use all secondary roles.
289    All,
290    /// Use no secondary roles.
291    None,
292    /// Explicit list of secondary roles.
293    List(Vec<Ident>),
294}
295
296impl fmt::Display for SecondaryRoles {
297    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
298        match self {
299            SecondaryRoles::All => f.write_fmt(format_args!("ALL"))write!(f, "ALL"),
300            SecondaryRoles::None => f.write_fmt(format_args!("NONE"))write!(f, "NONE"),
301            SecondaryRoles::List(roles) => f.write_fmt(format_args!("{0}", display_comma_separated(roles)))write!(f, "{}", display_comma_separated(roles)),
302        }
303    }
304}
305
306/// CREATE ROLE statement
307/// See [PostgreSQL](https://www.postgresql.org/docs/current/sql-createrole.html)
308#[derive(#[automatically_derived]
impl ::core::fmt::Debug for CreateRole {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        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.names, &self.if_not_exists, &self.login, &self.inherit,
                        &self.bypassrls, &self.password, &self.superuser,
                        &self.create_db, &self.create_role, &self.replication,
                        &self.connection_limit, &self.valid_until, &self.in_role,
                        &self.in_group, &self.role, &self.user, &self.admin,
                        &&self.authorization_owner];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "CreateRole",
            names, values)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for CreateRole {
    #[inline]
    fn clone(&self) -> CreateRole {
        CreateRole {
            names: ::core::clone::Clone::clone(&self.names),
            if_not_exists: ::core::clone::Clone::clone(&self.if_not_exists),
            login: ::core::clone::Clone::clone(&self.login),
            inherit: ::core::clone::Clone::clone(&self.inherit),
            bypassrls: ::core::clone::Clone::clone(&self.bypassrls),
            password: ::core::clone::Clone::clone(&self.password),
            superuser: ::core::clone::Clone::clone(&self.superuser),
            create_db: ::core::clone::Clone::clone(&self.create_db),
            create_role: ::core::clone::Clone::clone(&self.create_role),
            replication: ::core::clone::Clone::clone(&self.replication),
            connection_limit: ::core::clone::Clone::clone(&self.connection_limit),
            valid_until: ::core::clone::Clone::clone(&self.valid_until),
            in_role: ::core::clone::Clone::clone(&self.in_role),
            in_group: ::core::clone::Clone::clone(&self.in_group),
            role: ::core::clone::Clone::clone(&self.role),
            user: ::core::clone::Clone::clone(&self.user),
            admin: ::core::clone::Clone::clone(&self.admin),
            authorization_owner: ::core::clone::Clone::clone(&self.authorization_owner),
        }
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for CreateRole {
    #[inline]
    fn eq(&self, other: &CreateRole) -> bool {
        self.if_not_exists == other.if_not_exists && self.names == other.names
                                                                        && self.login == other.login &&
                                                                    self.inherit == other.inherit &&
                                                                self.bypassrls == other.bypassrls &&
                                                            self.password == other.password &&
                                                        self.superuser == other.superuser &&
                                                    self.create_db == other.create_db &&
                                                self.create_role == other.create_role &&
                                            self.replication == other.replication &&
                                        self.connection_limit == other.connection_limit &&
                                    self.valid_until == other.valid_until &&
                                self.in_role == other.in_role &&
                            self.in_group == other.in_group && self.role == other.role
                    && self.user == other.user && self.admin == other.admin &&
            self.authorization_owner == other.authorization_owner
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::PartialOrd for CreateRole {
    #[inline]
    fn partial_cmp(&self, other: &CreateRole)
        -> ::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.if_not_exists,
                        &other.if_not_exists) {
                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                        =>
                        match ::core::cmp::PartialOrd::partial_cmp(&self.login,
                                &other.login) {
                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                =>
                                match ::core::cmp::PartialOrd::partial_cmp(&self.inherit,
                                        &other.inherit) {
                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                        =>
                                        match ::core::cmp::PartialOrd::partial_cmp(&self.bypassrls,
                                                &other.bypassrls) {
                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                =>
                                                match ::core::cmp::PartialOrd::partial_cmp(&self.password,
                                                        &other.password) {
                                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                        =>
                                                        match ::core::cmp::PartialOrd::partial_cmp(&self.superuser,
                                                                &other.superuser) {
                                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                =>
                                                                match ::core::cmp::PartialOrd::partial_cmp(&self.create_db,
                                                                        &other.create_db) {
                                                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                        =>
                                                                        match ::core::cmp::PartialOrd::partial_cmp(&self.create_role,
                                                                                &other.create_role) {
                                                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                =>
                                                                                match ::core::cmp::PartialOrd::partial_cmp(&self.replication,
                                                                                        &other.replication) {
                                                                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                        =>
                                                                                        match ::core::cmp::PartialOrd::partial_cmp(&self.connection_limit,
                                                                                                &other.connection_limit) {
                                                                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                                =>
                                                                                                match ::core::cmp::PartialOrd::partial_cmp(&self.valid_until,
                                                                                                        &other.valid_until) {
                                                                                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                                        =>
                                                                                                        match ::core::cmp::PartialOrd::partial_cmp(&self.in_role,
                                                                                                                &other.in_role) {
                                                                                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                                                =>
                                                                                                                match ::core::cmp::PartialOrd::partial_cmp(&self.in_group,
                                                                                                                        &other.in_group) {
                                                                                                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                                                        =>
                                                                                                                        match ::core::cmp::PartialOrd::partial_cmp(&self.role,
                                                                                                                                &other.role) {
                                                                                                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                                                                =>
                                                                                                                                match ::core::cmp::PartialOrd::partial_cmp(&self.user,
                                                                                                                                        &other.user) {
                                                                                                                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                                                                        =>
                                                                                                                                        match ::core::cmp::PartialOrd::partial_cmp(&self.admin,
                                                                                                                                                &other.admin) {
                                                                                                                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                                                                                                                =>
                                                                                                                                                ::core::cmp::PartialOrd::partial_cmp(&self.authorization_owner,
                                                                                                                                                    &other.authorization_owner),
                                                                                                                                            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,
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for CreateRole {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Vec<ObjectName>>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<Option<bool>>;
        let _: ::core::cmp::AssertParamIsEq<Option<bool>>;
        let _: ::core::cmp::AssertParamIsEq<Option<bool>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Password>>;
        let _: ::core::cmp::AssertParamIsEq<Option<bool>>;
        let _: ::core::cmp::AssertParamIsEq<Option<bool>>;
        let _: ::core::cmp::AssertParamIsEq<Option<bool>>;
        let _: ::core::cmp::AssertParamIsEq<Option<bool>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Expr>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Expr>>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Option<ObjectName>>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::Ord for CreateRole {
    #[inline]
    fn cmp(&self, other: &CreateRole) -> ::core::cmp::Ordering {
        match ::core::cmp::Ord::cmp(&self.names, &other.names) {
            ::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.login, &other.login) {
                            ::core::cmp::Ordering::Equal =>
                                match ::core::cmp::Ord::cmp(&self.inherit, &other.inherit) {
                                    ::core::cmp::Ordering::Equal =>
                                        match ::core::cmp::Ord::cmp(&self.bypassrls,
                                                &other.bypassrls) {
                                            ::core::cmp::Ordering::Equal =>
                                                match ::core::cmp::Ord::cmp(&self.password, &other.password)
                                                    {
                                                    ::core::cmp::Ordering::Equal =>
                                                        match ::core::cmp::Ord::cmp(&self.superuser,
                                                                &other.superuser) {
                                                            ::core::cmp::Ordering::Equal =>
                                                                match ::core::cmp::Ord::cmp(&self.create_db,
                                                                        &other.create_db) {
                                                                    ::core::cmp::Ordering::Equal =>
                                                                        match ::core::cmp::Ord::cmp(&self.create_role,
                                                                                &other.create_role) {
                                                                            ::core::cmp::Ordering::Equal =>
                                                                                match ::core::cmp::Ord::cmp(&self.replication,
                                                                                        &other.replication) {
                                                                                    ::core::cmp::Ordering::Equal =>
                                                                                        match ::core::cmp::Ord::cmp(&self.connection_limit,
                                                                                                &other.connection_limit) {
                                                                                            ::core::cmp::Ordering::Equal =>
                                                                                                match ::core::cmp::Ord::cmp(&self.valid_until,
                                                                                                        &other.valid_until) {
                                                                                                    ::core::cmp::Ordering::Equal =>
                                                                                                        match ::core::cmp::Ord::cmp(&self.in_role, &other.in_role) {
                                                                                                            ::core::cmp::Ordering::Equal =>
                                                                                                                match ::core::cmp::Ord::cmp(&self.in_group, &other.in_group)
                                                                                                                    {
                                                                                                                    ::core::cmp::Ordering::Equal =>
                                                                                                                        match ::core::cmp::Ord::cmp(&self.role, &other.role) {
                                                                                                                            ::core::cmp::Ordering::Equal =>
                                                                                                                                match ::core::cmp::Ord::cmp(&self.user, &other.user) {
                                                                                                                                    ::core::cmp::Ordering::Equal =>
                                                                                                                                        match ::core::cmp::Ord::cmp(&self.admin, &other.admin) {
                                                                                                                                            ::core::cmp::Ordering::Equal =>
                                                                                                                                                ::core::cmp::Ord::cmp(&self.authorization_owner,
                                                                                                                                                    &other.authorization_owner),
                                                                                                                                            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,
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for CreateRole {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.names, state);
        ::core::hash::Hash::hash(&self.if_not_exists, state);
        ::core::hash::Hash::hash(&self.login, state);
        ::core::hash::Hash::hash(&self.inherit, state);
        ::core::hash::Hash::hash(&self.bypassrls, state);
        ::core::hash::Hash::hash(&self.password, state);
        ::core::hash::Hash::hash(&self.superuser, state);
        ::core::hash::Hash::hash(&self.create_db, state);
        ::core::hash::Hash::hash(&self.create_role, state);
        ::core::hash::Hash::hash(&self.replication, state);
        ::core::hash::Hash::hash(&self.connection_limit, state);
        ::core::hash::Hash::hash(&self.valid_until, state);
        ::core::hash::Hash::hash(&self.in_role, state);
        ::core::hash::Hash::hash(&self.in_group, state);
        ::core::hash::Hash::hash(&self.role, state);
        ::core::hash::Hash::hash(&self.user, state);
        ::core::hash::Hash::hash(&self.admin, state);
        ::core::hash::Hash::hash(&self.authorization_owner, state)
    }
}Hash)]
309#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
310#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for CreateRole {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        sqlparser::ast::Visit::visit(&self.names, visitor)?;
                        sqlparser::ast::Visit::visit(&self.if_not_exists, visitor)?;
                        sqlparser::ast::Visit::visit(&self.login, visitor)?;
                        sqlparser::ast::Visit::visit(&self.inherit, visitor)?;
                        sqlparser::ast::Visit::visit(&self.bypassrls, visitor)?;
                        sqlparser::ast::Visit::visit(&self.password, visitor)?;
                        sqlparser::ast::Visit::visit(&self.superuser, visitor)?;
                        sqlparser::ast::Visit::visit(&self.create_db, visitor)?;
                        sqlparser::ast::Visit::visit(&self.create_role, visitor)?;
                        sqlparser::ast::Visit::visit(&self.replication, visitor)?;
                        sqlparser::ast::Visit::visit(&self.connection_limit,
                                visitor)?;
                        sqlparser::ast::Visit::visit(&self.valid_until, visitor)?;
                        sqlparser::ast::Visit::visit(&self.in_role, visitor)?;
                        sqlparser::ast::Visit::visit(&self.in_group, visitor)?;
                        sqlparser::ast::Visit::visit(&self.role, visitor)?;
                        sqlparser::ast::Visit::visit(&self.user, visitor)?;
                        sqlparser::ast::Visit::visit(&self.admin, visitor)?;
                        sqlparser::ast::Visit::visit(&self.authorization_owner,
                                visitor)?;
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for CreateRole {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        sqlparser::ast::VisitMut::visit(&mut self.names, visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.if_not_exists,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.login, visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.inherit,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.bypassrls,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.password,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.superuser,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.create_db,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.create_role,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.replication,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.connection_limit,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.valid_until,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.in_role,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.in_group,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.role, visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.user, visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.admin, visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.authorization_owner,
                                visitor)?;
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
311pub struct CreateRole {
312    /// Role names to create.
313    pub names: Vec<ObjectName>,
314    /// Whether `IF NOT EXISTS` was specified.
315    pub if_not_exists: bool,
316    // Postgres
317    /// Whether `LOGIN` was specified.
318    pub login: Option<bool>,
319    /// Whether `INHERIT` was specified.
320    pub inherit: Option<bool>,
321    /// Whether `BYPASSRLS` was specified.
322    pub bypassrls: Option<bool>,
323    /// Optional password for the role.
324    pub password: Option<Password>,
325    /// Whether `SUPERUSER` was specified.
326    pub superuser: Option<bool>,
327    /// Whether `CREATEDB` was specified.
328    pub create_db: Option<bool>,
329    /// Whether `CREATEROLE` was specified.
330    pub create_role: Option<bool>,
331    /// Whether `REPLICATION` privilege was specified.
332    pub replication: Option<bool>,
333    /// Optional connection limit expression.
334    pub connection_limit: Option<Expr>,
335    /// Optional account validity expression.
336    pub valid_until: Option<Expr>,
337    /// Members of `IN ROLE` clause.
338    pub in_role: Vec<Ident>,
339    /// Members of `IN GROUP` clause.
340    pub in_group: Vec<Ident>,
341    /// Roles listed in `ROLE` clause.
342    pub role: Vec<Ident>,
343    /// Users listed in `USER` clause.
344    pub user: Vec<Ident>,
345    /// Admin users listed in `ADMIN` clause.
346    pub admin: Vec<Ident>,
347    // MSSQL
348    /// Optional authorization owner.
349    pub authorization_owner: Option<ObjectName>,
350}
351
352impl fmt::Display for CreateRole {
353    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
354        f.write_fmt(format_args!("CREATE ROLE {0}{1}{2}{3}{4}{5}{6}{7}{8}",
        if self.if_not_exists { "IF NOT EXISTS " } else { "" },
        display_separated(&self.names, ", "),
        match self.superuser {
            Some(true) => " SUPERUSER",
            Some(false) => " NOSUPERUSER",
            None => "",
        },
        match self.create_db {
            Some(true) => " CREATEDB",
            Some(false) => " NOCREATEDB",
            None => "",
        },
        match self.create_role {
            Some(true) => " CREATEROLE",
            Some(false) => " NOCREATEROLE",
            None => "",
        },
        match self.inherit {
            Some(true) => " INHERIT",
            Some(false) => " NOINHERIT",
            None => "",
        },
        match self.login {
            Some(true) => " LOGIN",
            Some(false) => " NOLOGIN",
            None => "",
        },
        match self.replication {
            Some(true) => " REPLICATION",
            Some(false) => " NOREPLICATION",
            None => "",
        },
        match self.bypassrls {
            Some(true) => " BYPASSRLS",
            Some(false) => " NOBYPASSRLS",
            None => "",
        }))write!(
355            f,
356            "CREATE ROLE {if_not_exists}{names}{superuser}{create_db}{create_role}{inherit}{login}{replication}{bypassrls}",
357            if_not_exists = if self.if_not_exists { "IF NOT EXISTS " } else { "" },
358            names = display_separated(&self.names, ", "),
359            superuser = match self.superuser {
360                Some(true) => " SUPERUSER",
361                Some(false) => " NOSUPERUSER",
362                None => ""
363            },
364            create_db = match self.create_db {
365                Some(true) => " CREATEDB",
366                Some(false) => " NOCREATEDB",
367                None => ""
368            },
369            create_role = match self.create_role {
370                Some(true) => " CREATEROLE",
371                Some(false) => " NOCREATEROLE",
372                None => ""
373            },
374            inherit = match self.inherit {
375                Some(true) => " INHERIT",
376                Some(false) => " NOINHERIT",
377                None => ""
378            },
379            login = match self.login {
380                Some(true) => " LOGIN",
381                Some(false) => " NOLOGIN",
382                None => ""
383            },
384            replication = match self.replication {
385                Some(true) => " REPLICATION",
386                Some(false) => " NOREPLICATION",
387                None => ""
388            },
389            bypassrls = match self.bypassrls {
390                Some(true) => " BYPASSRLS",
391                Some(false) => " NOBYPASSRLS",
392                None => ""
393            }
394        )?;
395        if let Some(limit) = &self.connection_limit {
396            f.write_fmt(format_args!(" CONNECTION LIMIT {0}", limit))write!(f, " CONNECTION LIMIT {limit}")?;
397        }
398        match &self.password {
399            Some(Password::Password(pass)) => f.write_fmt(format_args!(" PASSWORD {0}", pass))write!(f, " PASSWORD {pass}")?,
400            Some(Password::NullPassword) => f.write_fmt(format_args!(" PASSWORD NULL"))write!(f, " PASSWORD NULL")?,
401            None => {}
402        };
403        if let Some(until) = &self.valid_until {
404            f.write_fmt(format_args!(" VALID UNTIL {0}", until))write!(f, " VALID UNTIL {until}")?;
405        }
406        if !self.in_role.is_empty() {
407            f.write_fmt(format_args!(" IN ROLE {0}",
        display_comma_separated(&self.in_role)))write!(f, " IN ROLE {}", display_comma_separated(&self.in_role))?;
408        }
409        if !self.in_group.is_empty() {
410            f.write_fmt(format_args!(" IN GROUP {0}",
        display_comma_separated(&self.in_group)))write!(f, " IN GROUP {}", display_comma_separated(&self.in_group))?;
411        }
412        if !self.role.is_empty() {
413            f.write_fmt(format_args!(" ROLE {0}", display_comma_separated(&self.role)))write!(f, " ROLE {}", display_comma_separated(&self.role))?;
414        }
415        if !self.user.is_empty() {
416            f.write_fmt(format_args!(" USER {0}", display_comma_separated(&self.user)))write!(f, " USER {}", display_comma_separated(&self.user))?;
417        }
418        if !self.admin.is_empty() {
419            f.write_fmt(format_args!(" ADMIN {0}", display_comma_separated(&self.admin)))write!(f, " ADMIN {}", display_comma_separated(&self.admin))?;
420        }
421        if let Some(owner) = &self.authorization_owner {
422            f.write_fmt(format_args!(" AUTHORIZATION {0}", owner))write!(f, " AUTHORIZATION {owner}")?;
423        }
424        Ok(())
425    }
426}
427
428impl Spanned for CreateRole {
429    fn span(&self) -> Span {
430        Span::empty()
431    }
432}
433
434/// GRANT privileges ON objects TO grantees
435#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Grant {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        let names: &'static _ =
            &["privileges", "objects", "grantees", "with_grant_option",
                        "as_grantor", "granted_by", "current_grants"];
        let values: &[&dyn ::core::fmt::Debug] =
            &[&self.privileges, &self.objects, &self.grantees,
                        &self.with_grant_option, &self.as_grantor, &self.granted_by,
                        &&self.current_grants];
        ::core::fmt::Formatter::debug_struct_fields_finish(f, "Grant", names,
            values)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Grant {
    #[inline]
    fn clone(&self) -> Grant {
        Grant {
            privileges: ::core::clone::Clone::clone(&self.privileges),
            objects: ::core::clone::Clone::clone(&self.objects),
            grantees: ::core::clone::Clone::clone(&self.grantees),
            with_grant_option: ::core::clone::Clone::clone(&self.with_grant_option),
            as_grantor: ::core::clone::Clone::clone(&self.as_grantor),
            granted_by: ::core::clone::Clone::clone(&self.granted_by),
            current_grants: ::core::clone::Clone::clone(&self.current_grants),
        }
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Grant {
    #[inline]
    fn eq(&self, other: &Grant) -> bool {
        self.with_grant_option == other.with_grant_option &&
                                self.privileges == other.privileges &&
                            self.objects == other.objects &&
                        self.grantees == other.grantees &&
                    self.as_grantor == other.as_grantor &&
                self.granted_by == other.granted_by &&
            self.current_grants == other.current_grants
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Grant {
    #[inline]
    fn partial_cmp(&self, other: &Grant)
        -> ::core::option::Option<::core::cmp::Ordering> {
        match ::core::cmp::PartialOrd::partial_cmp(&self.privileges,
                &other.privileges) {
            ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
                match ::core::cmp::PartialOrd::partial_cmp(&self.objects,
                        &other.objects) {
                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                        =>
                        match ::core::cmp::PartialOrd::partial_cmp(&self.grantees,
                                &other.grantees) {
                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                =>
                                match ::core::cmp::PartialOrd::partial_cmp(&self.with_grant_option,
                                        &other.with_grant_option) {
                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                        =>
                                        match ::core::cmp::PartialOrd::partial_cmp(&self.as_grantor,
                                                &other.as_grantor) {
                                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                =>
                                                match ::core::cmp::PartialOrd::partial_cmp(&self.granted_by,
                                                        &other.granted_by) {
                                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                                        =>
                                                        ::core::cmp::PartialOrd::partial_cmp(&self.current_grants,
                                                            &other.current_grants),
                                                    cmp => cmp,
                                                },
                                            cmp => cmp,
                                        },
                                    cmp => cmp,
                                },
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for Grant {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Privileges>;
        let _: ::core::cmp::AssertParamIsEq<Option<GrantObjects>>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Grantee>>;
        let _: ::core::cmp::AssertParamIsEq<bool>;
        let _: ::core::cmp::AssertParamIsEq<Option<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Option<CurrentGrantsKind>>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::Ord for Grant {
    #[inline]
    fn cmp(&self, other: &Grant) -> ::core::cmp::Ordering {
        match ::core::cmp::Ord::cmp(&self.privileges, &other.privileges) {
            ::core::cmp::Ordering::Equal =>
                match ::core::cmp::Ord::cmp(&self.objects, &other.objects) {
                    ::core::cmp::Ordering::Equal =>
                        match ::core::cmp::Ord::cmp(&self.grantees, &other.grantees)
                            {
                            ::core::cmp::Ordering::Equal =>
                                match ::core::cmp::Ord::cmp(&self.with_grant_option,
                                        &other.with_grant_option) {
                                    ::core::cmp::Ordering::Equal =>
                                        match ::core::cmp::Ord::cmp(&self.as_grantor,
                                                &other.as_grantor) {
                                            ::core::cmp::Ordering::Equal =>
                                                match ::core::cmp::Ord::cmp(&self.granted_by,
                                                        &other.granted_by) {
                                                    ::core::cmp::Ordering::Equal =>
                                                        ::core::cmp::Ord::cmp(&self.current_grants,
                                                            &other.current_grants),
                                                    cmp => cmp,
                                                },
                                            cmp => cmp,
                                        },
                                    cmp => cmp,
                                },
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for Grant {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.privileges, state);
        ::core::hash::Hash::hash(&self.objects, state);
        ::core::hash::Hash::hash(&self.grantees, state);
        ::core::hash::Hash::hash(&self.with_grant_option, state);
        ::core::hash::Hash::hash(&self.as_grantor, state);
        ::core::hash::Hash::hash(&self.granted_by, state);
        ::core::hash::Hash::hash(&self.current_grants, state)
    }
}Hash)]
436#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
437#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for Grant {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        sqlparser::ast::Visit::visit(&self.privileges, visitor)?;
                        sqlparser::ast::Visit::visit(&self.objects, visitor)?;
                        sqlparser::ast::Visit::visit(&self.grantees, visitor)?;
                        sqlparser::ast::Visit::visit(&self.with_grant_option,
                                visitor)?;
                        sqlparser::ast::Visit::visit(&self.as_grantor, visitor)?;
                        sqlparser::ast::Visit::visit(&self.granted_by, visitor)?;
                        sqlparser::ast::Visit::visit(&self.current_grants,
                                visitor)?;
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for Grant {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        sqlparser::ast::VisitMut::visit(&mut self.privileges,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.objects,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.grantees,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.with_grant_option,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.as_grantor,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.granted_by,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.current_grants,
                                visitor)?;
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
438pub struct Grant {
439    /// Privileges being granted.
440    pub privileges: Privileges,
441    /// Optional objects the privileges apply to.
442    pub objects: Option<GrantObjects>,
443    /// List of grantees receiving the privileges.
444    pub grantees: Vec<Grantee>,
445    /// Whether `WITH GRANT OPTION` is present.
446    pub with_grant_option: bool,
447    /// Optional `AS GRANTOR` identifier.
448    pub as_grantor: Option<Ident>,
449    /// Optional `GRANTED BY` identifier.
450    ///
451    /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dcl-statements)
452    pub granted_by: Option<Ident>,
453    /// Optional `CURRENT GRANTS` modifier.
454    ///
455    /// [Snowflake](https://docs.snowflake.com/en/sql-reference/sql/grant-privilege)
456    pub current_grants: Option<CurrentGrantsKind>,
457}
458
459impl fmt::Display for Grant {
460    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
461        f.write_fmt(format_args!("GRANT {0}", self.privileges))write!(f, "GRANT {privileges}", privileges = self.privileges)?;
462        if let Some(ref objects) = self.objects {
463            f.write_fmt(format_args!(" ON {0}", objects))write!(f, " ON {objects}")?;
464        }
465        f.write_fmt(format_args!(" TO {0}", display_comma_separated(&self.grantees)))write!(f, " TO {}", display_comma_separated(&self.grantees))?;
466        if let Some(ref current_grants) = self.current_grants {
467            f.write_fmt(format_args!(" {0}", current_grants))write!(f, " {current_grants}")?;
468        }
469        if self.with_grant_option {
470            f.write_fmt(format_args!(" WITH GRANT OPTION"))write!(f, " WITH GRANT OPTION")?;
471        }
472        if let Some(ref as_grantor) = self.as_grantor {
473            f.write_fmt(format_args!(" AS {0}", as_grantor))write!(f, " AS {as_grantor}")?;
474        }
475        if let Some(ref granted_by) = self.granted_by {
476            f.write_fmt(format_args!(" GRANTED BY {0}", granted_by))write!(f, " GRANTED BY {granted_by}")?;
477        }
478        Ok(())
479    }
480}
481
482impl From<Grant> for crate::ast::Statement {
483    fn from(v: Grant) -> Self {
484        crate::ast::Statement::Grant(v)
485    }
486}
487
488/// REVOKE privileges ON objects FROM grantees
489#[derive(#[automatically_derived]
impl ::core::fmt::Debug for Revoke {
    #[inline]
    fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
        ::core::fmt::Formatter::debug_struct_field5_finish(f, "Revoke",
            "privileges", &self.privileges, "objects", &self.objects,
            "grantees", &self.grantees, "granted_by", &self.granted_by,
            "cascade", &&self.cascade)
    }
}Debug, #[automatically_derived]
impl ::core::clone::Clone for Revoke {
    #[inline]
    fn clone(&self) -> Revoke {
        Revoke {
            privileges: ::core::clone::Clone::clone(&self.privileges),
            objects: ::core::clone::Clone::clone(&self.objects),
            grantees: ::core::clone::Clone::clone(&self.grantees),
            granted_by: ::core::clone::Clone::clone(&self.granted_by),
            cascade: ::core::clone::Clone::clone(&self.cascade),
        }
    }
}Clone, #[automatically_derived]
impl ::core::cmp::PartialEq for Revoke {
    #[inline]
    fn eq(&self, other: &Revoke) -> bool {
        self.privileges == other.privileges && self.objects == other.objects
                    && self.grantees == other.grantees &&
                self.granted_by == other.granted_by &&
            self.cascade == other.cascade
    }
}PartialEq, #[automatically_derived]
impl ::core::cmp::PartialOrd for Revoke {
    #[inline]
    fn partial_cmp(&self, other: &Revoke)
        -> ::core::option::Option<::core::cmp::Ordering> {
        match ::core::cmp::PartialOrd::partial_cmp(&self.privileges,
                &other.privileges) {
            ::core::option::Option::Some(::core::cmp::Ordering::Equal) =>
                match ::core::cmp::PartialOrd::partial_cmp(&self.objects,
                        &other.objects) {
                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                        =>
                        match ::core::cmp::PartialOrd::partial_cmp(&self.grantees,
                                &other.grantees) {
                            ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                =>
                                match ::core::cmp::PartialOrd::partial_cmp(&self.granted_by,
                                        &other.granted_by) {
                                    ::core::option::Option::Some(::core::cmp::Ordering::Equal)
                                        =>
                                        ::core::cmp::PartialOrd::partial_cmp(&self.cascade,
                                            &other.cascade),
                                    cmp => cmp,
                                },
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}PartialOrd, #[automatically_derived]
impl ::core::cmp::Eq for Revoke {
    #[inline]
    #[doc(hidden)]
    #[coverage(off)]
    fn assert_fields_are_eq(&self) {
        let _: ::core::cmp::AssertParamIsEq<Privileges>;
        let _: ::core::cmp::AssertParamIsEq<Option<GrantObjects>>;
        let _: ::core::cmp::AssertParamIsEq<Vec<Grantee>>;
        let _: ::core::cmp::AssertParamIsEq<Option<Ident>>;
        let _: ::core::cmp::AssertParamIsEq<Option<CascadeOption>>;
    }
}Eq, #[automatically_derived]
impl ::core::cmp::Ord for Revoke {
    #[inline]
    fn cmp(&self, other: &Revoke) -> ::core::cmp::Ordering {
        match ::core::cmp::Ord::cmp(&self.privileges, &other.privileges) {
            ::core::cmp::Ordering::Equal =>
                match ::core::cmp::Ord::cmp(&self.objects, &other.objects) {
                    ::core::cmp::Ordering::Equal =>
                        match ::core::cmp::Ord::cmp(&self.grantees, &other.grantees)
                            {
                            ::core::cmp::Ordering::Equal =>
                                match ::core::cmp::Ord::cmp(&self.granted_by,
                                        &other.granted_by) {
                                    ::core::cmp::Ordering::Equal =>
                                        ::core::cmp::Ord::cmp(&self.cascade, &other.cascade),
                                    cmp => cmp,
                                },
                            cmp => cmp,
                        },
                    cmp => cmp,
                },
            cmp => cmp,
        }
    }
}Ord, #[automatically_derived]
impl ::core::hash::Hash for Revoke {
    #[inline]
    fn hash<__H: ::core::hash::Hasher>(&self, state: &mut __H) {
        ::core::hash::Hash::hash(&self.privileges, state);
        ::core::hash::Hash::hash(&self.objects, state);
        ::core::hash::Hash::hash(&self.grantees, state);
        ::core::hash::Hash::hash(&self.granted_by, state);
        ::core::hash::Hash::hash(&self.cascade, state)
    }
}Hash)]
490#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
491#[cfg_attr(feature = "visitor", derive(impl sqlparser::ast::Visit for Revoke {
    fn visit<V: sqlparser::ast::Visitor>(&self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        sqlparser::ast::Visit::visit(&self.privileges, visitor)?;
                        sqlparser::ast::Visit::visit(&self.objects, visitor)?;
                        sqlparser::ast::Visit::visit(&self.grantees, visitor)?;
                        sqlparser::ast::Visit::visit(&self.granted_by, visitor)?;
                        sqlparser::ast::Visit::visit(&self.cascade, visitor)?;
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}Visit, impl sqlparser::ast::VisitMut for Revoke {
    fn visit<V: sqlparser::ast::VisitorMut>(&mut self, visitor: &mut V)
        -> ::std::ops::ControlFlow<V::Break> {
        ::recursive::__impl::stacker::maybe_grow(::recursive::get_minimum_stack_size(),
            ::recursive::get_stack_allocation_size(),
            move || -> ::std::ops::ControlFlow<V::Break>
                {
                    {
                        sqlparser::ast::VisitMut::visit(&mut self.privileges,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.objects,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.grantees,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.granted_by,
                                visitor)?;
                        sqlparser::ast::VisitMut::visit(&mut self.cascade,
                                visitor)?;
                        ::std::ops::ControlFlow::Continue(())
                    }
                })
    }
}VisitMut))]
492pub struct Revoke {
493    /// Privileges to revoke.
494    pub privileges: Privileges,
495    /// Optional objects from which to revoke.
496    pub objects: Option<GrantObjects>,
497    /// Grantees affected by the revoke.
498    pub grantees: Vec<Grantee>,
499    /// Optional `GRANTED BY` identifier.
500    ///
501    /// [BigQuery](https://cloud.google.com/bigquery/docs/reference/standard-sql/dcl-statements)
502    pub granted_by: Option<Ident>,
503    /// Optional `CASCADE`/`RESTRICT` behavior.
504    pub cascade: Option<CascadeOption>,
505}
506
507impl fmt::Display for Revoke {
508    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
509        f.write_fmt(format_args!("REVOKE {0}", self.privileges))write!(f, "REVOKE {privileges}", privileges = self.privileges)?;
510        if let Some(ref objects) = self.objects {
511            f.write_fmt(format_args!(" ON {0}", objects))write!(f, " ON {objects}")?;
512        }
513        f.write_fmt(format_args!(" FROM {0}",
        display_comma_separated(&self.grantees)))write!(f, " FROM {}", display_comma_separated(&self.grantees))?;
514        if let Some(ref granted_by) = self.granted_by {
515            f.write_fmt(format_args!(" GRANTED BY {0}", granted_by))write!(f, " GRANTED BY {granted_by}")?;
516        }
517        if let Some(ref cascade) = self.cascade {
518            f.write_fmt(format_args!(" {0}", cascade))write!(f, " {cascade}")?;
519        }
520        Ok(())
521    }
522}
523
524impl From<Revoke> for crate::ast::Statement {
525    fn from(v: Revoke) -> Self {
526        crate::ast::Statement::Revoke(v)
527    }
528}