File tree 5 files changed +21
-0
lines changed
5 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -1758,6 +1758,13 @@ pub enum ColumnOption {
1758
1758
/// ```
1759
1759
/// [Snowflake]: https://docs.snowflake.com/en/sql-reference/sql/create-table
1760
1760
Tags ( TagsColumnOption ) ,
1761
+ /// MySQL specific: Spatial reference identifier
1762
+ /// Syntax:
1763
+ /// ```sql
1764
+ /// CREATE TABLE geom (g GEOMETRY NOT NULL SRID 4326);
1765
+ /// ```
1766
+ /// [MySQL]: https://dev.mysql.com/doc/refman/8.4/en/creating-spatial-indexes.html
1767
+ Srid ( Box < Expr > ) ,
1761
1768
}
1762
1769
1763
1770
impl fmt:: Display for ColumnOption {
@@ -1873,6 +1880,9 @@ impl fmt::Display for ColumnOption {
1873
1880
Tags ( tags) => {
1874
1881
write ! ( f, "{tags}" )
1875
1882
}
1883
+ Srid ( srid) => {
1884
+ write ! ( f, "SRID {srid}" )
1885
+ }
1876
1886
}
1877
1887
}
1878
1888
}
Original file line number Diff line number Diff line change @@ -871,6 +871,7 @@ impl Spanned for ColumnOption {
871
871
ColumnOption :: OnConflict ( ..) => Span :: empty ( ) ,
872
872
ColumnOption :: Policy ( ..) => Span :: empty ( ) ,
873
873
ColumnOption :: Tags ( ..) => Span :: empty ( ) ,
874
+ ColumnOption :: Srid ( ..) => Span :: empty ( ) ,
874
875
}
875
876
}
876
877
}
Original file line number Diff line number Diff line change @@ -844,6 +844,7 @@ define_keywords!(
844
844
SQLSTATE ,
845
845
SQLWARNING ,
846
846
SQRT ,
847
+ SRID ,
847
848
STABLE ,
848
849
STAGE ,
849
850
START ,
Original file line number Diff line number Diff line change @@ -7754,6 +7754,10 @@ impl<'a> Parser<'a> {
7754
7754
&& dialect_of!(self is MySqlDialect | SQLiteDialect | DuckDbDialect | GenericDialect)
7755
7755
{
7756
7756
self.parse_optional_column_option_as()
7757
+ } else if self.parse_keyword(Keyword::SRID)
7758
+ && dialect_of!(self is MySqlDialect | GenericDialect)
7759
+ {
7760
+ Ok(Some(ColumnOption::Srid(Box::new(self.parse_expr()?))))
7757
7761
} else if self.parse_keyword(Keyword::IDENTITY)
7758
7762
&& dialect_of!(self is MsSqlDialect | GenericDialect)
7759
7763
{
Original file line number Diff line number Diff line change @@ -3745,6 +3745,11 @@ fn parse_begin_without_transaction() {
3745
3745
mysql ( ) . verified_stmt ( "BEGIN" ) ;
3746
3746
}
3747
3747
3748
+ #[ test]
3749
+ fn parse_geometric_types_srid_option ( ) {
3750
+ mysql_and_generic ( ) . verified_stmt ( "CREATE TABLE t (a geometry SRID 4326)" ) ;
3751
+ }
3752
+
3748
3753
#[ test]
3749
3754
fn parse_double_precision ( ) {
3750
3755
mysql ( ) . verified_stmt ( "CREATE TABLE foo (bar DOUBLE)" ) ;
You can’t perform that action at this time.
0 commit comments