@@ -8759,41 +8759,81 @@ impl fmt::Display for CopyOption {
87598759
87608760/// An option in `COPY` statement before PostgreSQL version 9.0.
87618761///
8762- /// <https://www.postgresql.org/docs/8.4/sql-copy.html>
8762+ /// [PostgreSQL](https://www.postgresql.org/docs/8.4/sql-copy.html)
8763+ /// [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_COPY-alphabetical-parm-list.html)
87638764#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
87648765#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
87658766#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
87668767pub enum CopyLegacyOption {
8768+ /// ACCEPTANYDATE
8769+ AcceptAnyDate ,
8770+ /// ACCEPTINVCHARS
8771+ AcceptInvChars ( Option < String > ) ,
87678772 /// BINARY
87688773 Binary ,
8769- /// DELIMITER \[ AS \] 'delimiter_character'
8770- Delimiter ( char ) ,
8771- /// NULL \[ AS \] 'null_string'
8772- Null ( String ) ,
8774+ /// BLANKSASNULL
8775+ BlankAsNull ,
87738776 /// CSV ...
87748777 Csv ( Vec < CopyLegacyCsvOption > ) ,
8778+ /// DATEFORMAT \[ AS \] {'dateformat_string' | 'auto' }
8779+ DateFormat ( Option < String > ) ,
8780+ /// DELIMITER \[ AS \] 'delimiter_character'
8781+ Delimiter ( char ) ,
8782+ /// EMPTYASNULL
8783+ EmptyAsNull ,
87758784 /// IAM_ROLE { DEFAULT | 'arn:aws:iam::123456789:role/role1' }
87768785 IamRole ( IamRoleKind ) ,
87778786 /// IGNOREHEADER \[ AS \] number_rows
87788787 IgnoreHeader ( u64 ) ,
8788+ /// NULL \[ AS \] 'null_string'
8789+ Null ( String ) ,
8790+ /// TIMEFORMAT \[ AS \] {'timeformat_string' | 'auto' | 'epochsecs' | 'epochmillisecs' }
8791+ TimeFormat ( Option < String > ) ,
8792+ /// TRUNCATECOLUMNS
8793+ TruncateColumns ,
87798794}
87808795
87818796impl fmt:: Display for CopyLegacyOption {
87828797 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
87838798 use CopyLegacyOption :: * ;
87848799 match self {
8800+ AcceptAnyDate => write ! ( f, "ACCEPTANYDATE" ) ,
8801+ AcceptInvChars ( ch) => {
8802+ write ! ( f, "ACCEPTINVCHARS" ) ?;
8803+ if let Some ( ch) = ch {
8804+ write ! ( f, " '{}'" , value:: escape_single_quote_string( ch) ) ?;
8805+ }
8806+ Ok ( ( ) )
8807+ }
87858808 Binary => write ! ( f, "BINARY" ) ,
8786- Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
8787- Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8809+ BlankAsNull => write ! ( f, "BLANKSASNULL" ) ,
87888810 Csv ( opts) => {
87898811 write ! ( f, "CSV" ) ?;
87908812 if !opts. is_empty ( ) {
87918813 write ! ( f, " {}" , display_separated( opts, " " ) ) ?;
87928814 }
87938815 Ok ( ( ) )
87948816 }
8817+ DateFormat ( fmt) => {
8818+ write ! ( f, "DATEFORMAT" ) ?;
8819+ if let Some ( fmt) = fmt {
8820+ write ! ( f, " '{}'" , value:: escape_single_quote_string( fmt) ) ?;
8821+ }
8822+ Ok ( ( ) )
8823+ }
8824+ Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
8825+ EmptyAsNull => write ! ( f, "EMPTYASNULL" ) ,
87958826 IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
87968827 IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
8828+ Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8829+ TimeFormat ( fmt) => {
8830+ write ! ( f, "TIMEFORMAT" ) ?;
8831+ if let Some ( fmt) = fmt {
8832+ write ! ( f, " '{}'" , value:: escape_single_quote_string( fmt) ) ?;
8833+ }
8834+ Ok ( ( ) )
8835+ }
8836+ TruncateColumns => write ! ( f, "TRUNCATECOLUMNS" ) ,
87978837 }
87988838 }
87998839}
0 commit comments