@@ -8803,41 +8803,81 @@ impl fmt::Display for CopyOption {
88038803
88048804/// An option in `COPY` statement before PostgreSQL version 9.0.
88058805///
8806- /// <https://www.postgresql.org/docs/8.4/sql-copy.html>
8806+ /// [PostgreSQL](https://www.postgresql.org/docs/8.4/sql-copy.html)
8807+ /// [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_COPY-alphabetical-parm-list.html)
88078808#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
88088809#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
88098810#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
88108811pub enum CopyLegacyOption {
8812+ /// ACCEPTANYDATE
8813+ AcceptAnyDate ,
8814+ /// ACCEPTINVCHARS
8815+ AcceptInvChars ( Option < String > ) ,
88118816 /// BINARY
88128817 Binary ,
8813- /// DELIMITER \[ AS \] 'delimiter_character'
8814- Delimiter ( char ) ,
8815- /// NULL \[ AS \] 'null_string'
8816- Null ( String ) ,
8818+ /// BLANKSASNULL
8819+ BlankAsNull ,
88178820 /// CSV ...
88188821 Csv ( Vec < CopyLegacyCsvOption > ) ,
8822+ /// DATEFORMAT \[ AS \] {'dateformat_string' | 'auto' }
8823+ DateFormat ( Option < String > ) ,
8824+ /// DELIMITER \[ AS \] 'delimiter_character'
8825+ Delimiter ( char ) ,
8826+ /// EMPTYASNULL
8827+ EmptyAsNull ,
88198828 /// IAM_ROLE { DEFAULT | 'arn:aws:iam::123456789:role/role1' }
88208829 IamRole ( IamRoleKind ) ,
88218830 /// IGNOREHEADER \[ AS \] number_rows
88228831 IgnoreHeader ( u64 ) ,
8832+ /// NULL \[ AS \] 'null_string'
8833+ Null ( String ) ,
8834+ /// TIMEFORMAT \[ AS \] {'timeformat_string' | 'auto' | 'epochsecs' | 'epochmillisecs' }
8835+ TimeFormat ( Option < String > ) ,
8836+ /// TRUNCATECOLUMNS
8837+ TruncateColumns ,
88238838}
88248839
88258840impl fmt:: Display for CopyLegacyOption {
88268841 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
88278842 use CopyLegacyOption :: * ;
88288843 match self {
8844+ AcceptAnyDate => write ! ( f, "ACCEPTANYDATE" ) ,
8845+ AcceptInvChars ( ch) => {
8846+ write ! ( f, "ACCEPTINVCHARS" ) ?;
8847+ if let Some ( ch) = ch {
8848+ write ! ( f, " '{}'" , value:: escape_single_quote_string( ch) ) ?;
8849+ }
8850+ Ok ( ( ) )
8851+ }
88298852 Binary => write ! ( f, "BINARY" ) ,
8830- Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
8831- Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8853+ BlankAsNull => write ! ( f, "BLANKSASNULL" ) ,
88328854 Csv ( opts) => {
88338855 write ! ( f, "CSV" ) ?;
88348856 if !opts. is_empty ( ) {
88358857 write ! ( f, " {}" , display_separated( opts, " " ) ) ?;
88368858 }
88378859 Ok ( ( ) )
88388860 }
8861+ DateFormat ( fmt) => {
8862+ write ! ( f, "DATEFORMAT" ) ?;
8863+ if let Some ( fmt) = fmt {
8864+ write ! ( f, " '{}'" , value:: escape_single_quote_string( fmt) ) ?;
8865+ }
8866+ Ok ( ( ) )
8867+ }
8868+ Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
8869+ EmptyAsNull => write ! ( f, "EMPTYASNULL" ) ,
88398870 IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
88408871 IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
8872+ Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8873+ TimeFormat ( fmt) => {
8874+ write ! ( f, "TIMEFORMAT" ) ?;
8875+ if let Some ( fmt) = fmt {
8876+ write ! ( f, " '{}'" , value:: escape_single_quote_string( fmt) ) ?;
8877+ }
8878+ Ok ( ( ) )
8879+ }
8880+ TruncateColumns => write ! ( f, "TRUNCATECOLUMNS" ) ,
88418881 }
88428882 }
88438883}
0 commit comments