@@ -32,8 +32,9 @@ use crate::ast::value::escape_single_quote_string;
3232use crate :: ast:: {
3333 display_comma_separated, display_separated, CommentDef , CreateFunctionBody ,
3434 CreateFunctionUsing , DataType , Expr , FunctionBehavior , FunctionCalledOnNull ,
35- FunctionDeterminismSpecifier , FunctionParallel , Ident , MySQLColumnPosition , ObjectName ,
36- OperateFunctionArg , OrderByExpr , ProjectionSelect , SequenceOptions , SqlOption , Tag , Value ,
35+ FunctionDeterminismSpecifier , FunctionParallel , Ident , IndexField , MySQLColumnPosition ,
36+ ObjectName , OperateFunctionArg , OrderByExpr , ProjectionSelect , SequenceOptions , SqlOption , Tag ,
37+ Value ,
3738} ;
3839use crate :: keywords:: Keyword ;
3940use crate :: tokenizer:: Token ;
@@ -832,8 +833,8 @@ pub enum TableConstraint {
832833 ///
833834 /// [1]: IndexType
834835 index_type : Option < IndexType > ,
835- /// Identifiers of the columns that are unique .
836- columns : Vec < Ident > ,
836+ /// Index field list .
837+ index_fields : Vec < IndexField > ,
837838 index_options : Vec < IndexOption > ,
838839 characteristics : Option < ConstraintCharacteristics > ,
839840 /// Optional Postgres nulls handling: `[ NULLS [ NOT ] DISTINCT ]`
@@ -868,8 +869,8 @@ pub enum TableConstraint {
868869 ///
869870 /// [1]: IndexType
870871 index_type : Option < IndexType > ,
871- /// Identifiers of the columns that form the primary key.
872- columns : Vec < Ident > ,
872+ /// Index field list that form the primary key.
873+ index_fields : Vec < IndexField > ,
873874 index_options : Vec < IndexOption > ,
874875 characteristics : Option < ConstraintCharacteristics > ,
875876 } ,
@@ -907,8 +908,10 @@ pub enum TableConstraint {
907908 ///
908909 /// [1]: IndexType
909910 index_type : Option < IndexType > ,
910- /// Referred column identifier list.
911- columns : Vec < Ident > ,
911+ /// [Index field list][1].
912+ ///
913+ /// [1]: IndexField
914+ index_fields : Vec < IndexField > ,
912915 } ,
913916 /// MySQLs [fulltext][1] definition. Since the [`SPATIAL`][2] definition is exactly the same,
914917 /// and MySQL displays both the same way, it is part of this definition as well.
@@ -930,8 +933,8 @@ pub enum TableConstraint {
930933 index_type_display : KeyOrIndexDisplay ,
931934 /// Optional index name.
932935 opt_index_name : Option < Ident > ,
933- /// Referred column identifier list.
934- columns : Vec < Ident > ,
936+ /// Index field list.
937+ index_fields : Vec < IndexField > ,
935938 } ,
936939}
937940
@@ -943,7 +946,7 @@ impl fmt::Display for TableConstraint {
943946 index_name,
944947 index_type_display,
945948 index_type,
946- columns ,
949+ index_fields ,
947950 index_options,
948951 characteristics,
949952 nulls_distinct,
@@ -954,7 +957,7 @@ impl fmt::Display for TableConstraint {
954957 display_constraint_name( name) ,
955958 display_option_spaced( index_name) ,
956959 display_option( " USING " , "" , index_type) ,
957- display_comma_separated( columns ) ,
960+ display_comma_separated( index_fields ) ,
958961 ) ?;
959962
960963 if !index_options. is_empty ( ) {
@@ -968,7 +971,7 @@ impl fmt::Display for TableConstraint {
968971 name,
969972 index_name,
970973 index_type,
971- columns ,
974+ index_fields ,
972975 index_options,
973976 characteristics,
974977 } => {
@@ -978,7 +981,7 @@ impl fmt::Display for TableConstraint {
978981 display_constraint_name( name) ,
979982 display_option_spaced( index_name) ,
980983 display_option( " USING " , "" , index_type) ,
981- display_comma_separated( columns ) ,
984+ display_comma_separated( index_fields ) ,
982985 ) ?;
983986
984987 if !index_options. is_empty ( ) {
@@ -1025,7 +1028,7 @@ impl fmt::Display for TableConstraint {
10251028 display_as_key,
10261029 name,
10271030 index_type,
1028- columns ,
1031+ index_fields ,
10291032 } => {
10301033 write ! ( f, "{}" , if * display_as_key { "KEY" } else { "INDEX" } ) ?;
10311034 if let Some ( name) = name {
@@ -1034,15 +1037,16 @@ impl fmt::Display for TableConstraint {
10341037 if let Some ( index_type) = index_type {
10351038 write ! ( f, " USING {index_type}" ) ?;
10361039 }
1037- write ! ( f, " ({})" , display_comma_separated( columns) ) ?;
1040+
1041+ write ! ( f, " ({})" , display_comma_separated( index_fields) ) ?;
10381042
10391043 Ok ( ( ) )
10401044 }
10411045 Self :: FulltextOrSpatial {
10421046 fulltext,
10431047 index_type_display,
10441048 opt_index_name,
1045- columns ,
1049+ index_fields ,
10461050 } => {
10471051 if * fulltext {
10481052 write ! ( f, "FULLTEXT" ) ?;
@@ -1056,7 +1060,7 @@ impl fmt::Display for TableConstraint {
10561060 write ! ( f, " {name}" ) ?;
10571061 }
10581062
1059- write ! ( f, " ({})" , display_comma_separated( columns ) ) ?;
1063+ write ! ( f, " ({})" , display_comma_separated( index_fields ) ) ?;
10601064
10611065 Ok ( ( ) )
10621066 }
0 commit comments