@@ -8774,41 +8774,81 @@ impl fmt::Display for CopyOption {
87748774
87758775/// An option in `COPY` statement before PostgreSQL version 9.0.
87768776///
8777- /// <https://www.postgresql.org/docs/8.4/sql-copy.html>
8777+ /// [PostgreSQL](https://www.postgresql.org/docs/8.4/sql-copy.html)
8778+ /// [Redshift](https://docs.aws.amazon.com/redshift/latest/dg/r_COPY-alphabetical-parm-list.html)
87788779#[ derive( Debug , Clone , PartialEq , PartialOrd , Eq , Ord , Hash ) ]
87798780#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
87808781#[ cfg_attr( feature = "visitor" , derive( Visit , VisitMut ) ) ]
87818782pub enum CopyLegacyOption {
8783+ /// ACCEPTANYDATE
8784+ AcceptAnyDate ,
8785+ /// ACCEPTINVCHARS
8786+ AcceptInvChars ( Option < String > ) ,
87828787 /// BINARY
87838788 Binary ,
8784- /// DELIMITER \[ AS \] 'delimiter_character'
8785- Delimiter ( char ) ,
8786- /// NULL \[ AS \] 'null_string'
8787- Null ( String ) ,
8789+ /// BLANKSASNULL
8790+ BlankAsNull ,
87888791 /// CSV ...
87898792 Csv ( Vec < CopyLegacyCsvOption > ) ,
8793+ /// DATEFORMAT \[ AS \] {'dateformat_string' | 'auto' }
8794+ DateFormat ( Option < String > ) ,
8795+ /// DELIMITER \[ AS \] 'delimiter_character'
8796+ Delimiter ( char ) ,
8797+ /// EMPTYASNULL
8798+ EmptyAsNull ,
87908799 /// IAM_ROLE { DEFAULT | 'arn:aws:iam::123456789:role/role1' }
87918800 IamRole ( IamRoleKind ) ,
87928801 /// IGNOREHEADER \[ AS \] number_rows
87938802 IgnoreHeader ( u64 ) ,
8803+ /// NULL \[ AS \] 'null_string'
8804+ Null ( String ) ,
8805+ /// TIMEFORMAT \[ AS \] {'timeformat_string' | 'auto' | 'epochsecs' | 'epochmillisecs' }
8806+ TimeFormat ( Option < String > ) ,
8807+ /// TRUNCATECOLUMNS
8808+ TruncateColumns ,
87948809}
87958810
87968811impl fmt:: Display for CopyLegacyOption {
87978812 fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
87988813 use CopyLegacyOption :: * ;
87998814 match self {
8815+ AcceptAnyDate => write ! ( f, "ACCEPTANYDATE" ) ,
8816+ AcceptInvChars ( ch) => {
8817+ write ! ( f, "ACCEPTINVCHARS" ) ?;
8818+ if let Some ( ch) = ch {
8819+ write ! ( f, " '{}'" , value:: escape_single_quote_string( ch) ) ?;
8820+ }
8821+ Ok ( ( ) )
8822+ }
88008823 Binary => write ! ( f, "BINARY" ) ,
8801- Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
8802- Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8824+ BlankAsNull => write ! ( f, "BLANKSASNULL" ) ,
88038825 Csv ( opts) => {
88048826 write ! ( f, "CSV" ) ?;
88058827 if !opts. is_empty ( ) {
88068828 write ! ( f, " {}" , display_separated( opts, " " ) ) ?;
88078829 }
88088830 Ok ( ( ) )
88098831 }
8832+ DateFormat ( fmt) => {
8833+ write ! ( f, "DATEFORMAT" ) ?;
8834+ if let Some ( fmt) = fmt {
8835+ write ! ( f, " '{}'" , value:: escape_single_quote_string( fmt) ) ?;
8836+ }
8837+ Ok ( ( ) )
8838+ }
8839+ Delimiter ( char) => write ! ( f, "DELIMITER '{char}'" ) ,
8840+ EmptyAsNull => write ! ( f, "EMPTYASNULL" ) ,
88108841 IamRole ( role) => write ! ( f, "IAM_ROLE {role}" ) ,
88118842 IgnoreHeader ( num_rows) => write ! ( f, "IGNOREHEADER {num_rows}" ) ,
8843+ Null ( string) => write ! ( f, "NULL '{}'" , value:: escape_single_quote_string( string) ) ,
8844+ TimeFormat ( fmt) => {
8845+ write ! ( f, "TIMEFORMAT" ) ?;
8846+ if let Some ( fmt) = fmt {
8847+ write ! ( f, " '{}'" , value:: escape_single_quote_string( fmt) ) ?;
8848+ }
8849+ Ok ( ( ) )
8850+ }
8851+ TruncateColumns => write ! ( f, "TRUNCATECOLUMNS" ) ,
88128852 }
88138853 }
88148854}
0 commit comments