@@ -60,24 +60,24 @@ pub use self::dcl::{
6060} ;
6161pub use self :: ddl:: {
6262 Alignment , AlterColumnOperation , AlterConnectorOwner , AlterIndexOperation , AlterOperator ,
63- AlterOperatorClass , AlterOperatorClassOperation , AlterOperatorFamily ,
64- AlterOperatorFamilyOperation , AlterOperatorOperation , AlterPolicyOperation , AlterSchema ,
65- AlterSchemaOperation , AlterTable , AlterTableAlgorithm , AlterTableLock , AlterTableOperation ,
66- AlterTableType , AlterType , AlterTypeAddValue , AlterTypeAddValuePosition , AlterTypeOperation ,
67- AlterTypeRename , AlterTypeRenameValue , ClusteredBy , ColumnDef , ColumnOption , ColumnOptionDef ,
68- ColumnOptions , ColumnPolicy , ColumnPolicyProperty , ConstraintCharacteristics , CreateConnector ,
69- CreateDomain , CreateExtension , CreateFunction , CreateIndex , CreateOperator ,
70- CreateOperatorClass , CreateOperatorFamily , CreateTable , CreateTrigger , CreateView , Deduplicate ,
71- DeferrableInitial , DropBehavior , DropExtension , DropFunction , DropOperator , DropOperatorClass ,
72- DropOperatorFamily , DropOperatorSignature , DropTrigger , GeneratedAs , GeneratedExpressionMode ,
63+ AlterOperatorClass , AlterOperatorClassOperation , AlterOperatorFamily , AlterOperatorFamilyOperation , AlterOperatorOperation ,
64+ AlterPolicyOperation , AlterSchema , AlterSchemaOperation , AlterTable , AlterTableAlgorithm ,
65+ AlterTableLock , AlterTableOperation , AlterTableType , AlterType , AlterTypeAddValue ,
66+ AlterTypeAddValuePosition , AlterTypeOperation , AlterTypeRename , AlterTypeRenameValue ,
67+ ClusteredBy , ColumnDef , ColumnOption , ColumnOptionDef , ColumnOptions , ColumnPolicy ,
68+ ColumnPolicyProperty , ConstraintCharacteristics , CreateConnector , CreateDomain ,
69+ CreateExtension , CreateFunction , CreateIndex , CreateOperator , CreateOperatorClass ,
70+ CreateOperatorFamily , CreateTable , CreateTrigger , CreateView , Deduplicate , DeferrableInitial ,
71+ DropBehavior , DropExtension , DropFunction , DropOperator , DropOperatorClass , DropOperatorFamily ,
72+ DropOperatorSignature , DropTrigger , ForValues , GeneratedAs , GeneratedExpressionMode ,
7373 IdentityParameters , IdentityProperty , IdentityPropertyFormatKind , IdentityPropertyKind ,
7474 IdentityPropertyOrder , IndexColumn , IndexOption , IndexType , KeyOrIndexDisplay , Msck ,
7575 NullsDistinctOption , OperatorArgTypes , OperatorClassItem , OperatorFamilyDropItem ,
76- OperatorFamilyItem , OperatorOption , OperatorPurpose , Owner , Partition , ProcedureParam ,
77- ReferentialAction , RenameTableNameKind , ReplicaIdentity , TagsColumnOption , TriggerObjectKind ,
78- Truncate , UserDefinedTypeCompositeAttributeDef , UserDefinedTypeInternalLength ,
79- UserDefinedTypeRangeOption , UserDefinedTypeRepresentation , UserDefinedTypeSqlDefinitionOption ,
80- UserDefinedTypeStorage , ViewColumnDef ,
76+ OperatorFamilyItem , OperatorOption , OperatorPurpose , Owner , Partition , PartitionBoundValue ,
77+ ProcedureParam , ReferentialAction , RenameTableNameKind , ReplicaIdentity , TagsColumnOption ,
78+ TriggerObjectKind , Truncate , UserDefinedTypeCompositeAttributeDef ,
79+ UserDefinedTypeInternalLength , UserDefinedTypeRangeOption , UserDefinedTypeRepresentation ,
80+ UserDefinedTypeSqlDefinitionOption , UserDefinedTypeStorage , ViewColumnDef ,
8181} ;
8282pub use self :: dml:: {
8383 Delete , Insert , Merge , MergeAction , MergeClause , MergeClauseKind , MergeInsertExpr ,
@@ -9173,14 +9173,14 @@ pub enum CopyLegacyOption {
91739173 IamRole ( IamRoleKind ) ,
91749174 /// IGNOREHEADER \[ AS \] number_rows
91759175 IgnoreHeader ( u64 ) ,
9176- /// JSON
9177- Json ,
9178- /// ` MANIFEST \[ VERBOSE \]`
9176+ /// JSON \[ AS \] 'json_option'
9177+ Json ( Option < String > ) ,
9178+ /// MANIFEST \[ VERBOSE \]
91799179 Manifest {
9180- /// Whether the MANIFEST is verbose.
9181- verbose : bool ,
9180+ /// Whether the MANIFEST is verbose.
9181+ verbose : bool
91829182 } ,
9183- /// ` MAXFILESIZE \[ AS \] max-size \[ MB | GB \]`
9183+ /// MAXFILESIZE \[ AS \] max-size \[ MB | GB \]
91849184 MaxFileSize ( FileSize ) ,
91859185 /// `NULL \[ AS \] 'null_string'`
91869186 Null ( String ) ,
@@ -9268,7 +9268,13 @@ impl fmt::Display for CopyLegacyOption {
92689268 Header => write ! ( f, "HEADER" ) ,
92699269 IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
92709270 IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
9271- Json => write ! ( f, "JSON" ) ,
9271+ Json ( opt) => {
9272+ write ! ( f, "JSON" ) ?;
9273+ if let Some ( opt) = opt {
9274+ write ! ( f, " AS '{}'" , value:: escape_single_quote_string( opt) ) ?;
9275+ }
9276+ Ok ( ( ) )
9277+ }
92729278 Manifest { verbose } => write ! ( f, "MANIFEST{}" , if * verbose { " VERBOSE" } else { "" } ) ,
92739279 MaxFileSize ( file_size) => write ! ( f, "MAXFILESIZE {file_size}" ) ,
92749280 Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
@@ -9704,6 +9710,62 @@ impl fmt::Display for FunctionBehavior {
97049710 }
97059711}
97069712
9713+ /// Security attribute for functions: SECURITY DEFINER or SECURITY INVOKER.
9714+ ///
9715+ /// [PostgreSQL](https://www.postgresql.org/docs/current/sql-createfunction.html)
9716+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
9717+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
9718+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
9719+ pub enum FunctionSecurity {
9720+ Definer ,
9721+ Invoker ,
9722+ }
9723+
9724+ impl fmt:: Display for FunctionSecurity {
9725+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
9726+ match self {
9727+ FunctionSecurity :: Definer => write ! ( f, "SECURITY DEFINER" ) ,
9728+ FunctionSecurity :: Invoker => write ! ( f, "SECURITY INVOKER" ) ,
9729+ }
9730+ }
9731+ }
9732+
9733+ /// Value for a SET configuration parameter in a CREATE FUNCTION statement.
9734+ ///
9735+ /// [PostgreSQL](https://www.postgresql.org/docs/current/sql-createfunction.html)
9736+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
9737+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
9738+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
9739+ pub enum FunctionSetValue {
9740+ /// SET param = value1, value2, ...
9741+ Values ( Vec < Expr > ) ,
9742+ /// SET param FROM CURRENT
9743+ FromCurrent ,
9744+ }
9745+
9746+ /// A SET configuration_parameter clause in a CREATE FUNCTION statement.
9747+ ///
9748+ /// [PostgreSQL](https://www.postgresql.org/docs/current/sql-createfunction.html)
9749+ #[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
9750+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
9751+ #[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
9752+ pub struct FunctionDefinitionSetParam {
9753+ pub name : Ident ,
9754+ pub value : FunctionSetValue ,
9755+ }
9756+
9757+ impl fmt:: Display for FunctionDefinitionSetParam {
9758+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
9759+ write ! ( f, "SET {} " , self . name) ?;
9760+ match & self . value {
9761+ FunctionSetValue :: Values ( values) => {
9762+ write ! ( f, "= {}" , display_comma_separated( values) )
9763+ }
9764+ FunctionSetValue :: FromCurrent => write ! ( f, "FROM CURRENT" ) ,
9765+ }
9766+ }
9767+ }
9768+
97079769/// These attributes describe the behavior of the function when called with a null argument.
97089770#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
97099771#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
0 commit comments