@@ -457,6 +457,12 @@ pub enum AlterTableOperation {
457457 } ,
458458 /// Remove the clustering key from the table.
459459 DropClusteringKey ,
460+ /// Redshift `ALTER SORTKEY (column_list)`
461+ /// <https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html>
462+ AlterSortKey {
463+ /// Column references in the sort key.
464+ columns : Vec < Expr > ,
465+ } ,
460466 /// Suspend background reclustering operations.
461467 SuspendRecluster ,
462468 /// Resume background reclustering operations.
@@ -993,6 +999,14 @@ impl fmt::Display for AlterTableOperation {
993999 write ! ( f, "DROP CLUSTERING KEY" ) ?;
9941000 Ok ( ( ) )
9951001 }
1002+ AlterTableOperation :: AlterSortKey { columns } => {
1003+ write ! (
1004+ f,
1005+ "ALTER SORTKEY({})" ,
1006+ display_comma_separated( columns)
1007+ ) ?;
1008+ Ok ( ( ) )
1009+ }
9961010 AlterTableOperation :: SuspendRecluster => {
9971011 write ! ( f, "SUSPEND RECLUSTER" ) ?;
9981012 Ok ( ( ) )
@@ -3037,7 +3051,10 @@ pub struct CreateTable {
30373051 pub diststyle : Option < DistStyle > ,
30383052 /// Redshift `DISTKEY` option
30393053 /// <https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html>
3040- pub distkey : Option < Ident > ,
3054+ pub distkey : Option < Expr > ,
3055+ /// Redshift `SORTKEY` option
3056+ /// <https://docs.aws.amazon.com/redshift/latest/dg/r_CREATE_TABLE_NEW.html>
3057+ pub sortkey : Option < Vec < Expr > > ,
30413058}
30423059
30433060impl fmt:: Display for CreateTable {
@@ -3342,6 +3359,9 @@ impl fmt::Display for CreateTable {
33423359 if let Some ( distkey) = & self . distkey {
33433360 write ! ( f, " DISTKEY({distkey})" ) ?;
33443361 }
3362+ if let Some ( sortkey) = & self . sortkey {
3363+ write ! ( f, " SORTKEY({})" , display_comma_separated( sortkey) ) ?;
3364+ }
33453365 if let Some ( query) = & self . query {
33463366 write ! ( f, " AS {query}" ) ?;
33473367 }
0 commit comments