@@ -2504,6 +2504,19 @@ func TestCreateTable(t *testing.T) {
25042504 }
25052505 }
25062506
2507+ validSpatialSRIDDDL := []string {
2508+ "create table tbl_geo_a (col_a point srid 4326 not null, spatial index idx_geo_a (col_a))" ,
2509+ "create table tbl_geo_b (col_a geometry srid 0, col_b linestring srid 3857, col_c multipolygon)" ,
2510+ "alter table tbl_geo_c add column col_a point srid 4326" ,
2511+ "alter table tbl_geo_d modify column col_a multipoint srid 4326 not null" ,
2512+ }
2513+ for _ , sql := range validSpatialSRIDDDL {
2514+ tree , err := Parse (sql )
2515+ if tree == nil || err != nil {
2516+ t .Errorf ("Parse unexpectedly rejected spatial SRID DDL %s: %v" , sql , err )
2517+ }
2518+ }
2519+
25072520 sql := "create table t garbage"
25082521 if _ , err := Parse (sql ); err == nil {
25092522 t .Errorf ("Parse unexpectedly accepted input %s" , sql )
@@ -2853,6 +2866,19 @@ func TestCreateTable(t *testing.T) {
28532866 }
28542867 }
28552868
2869+ invalidSpatialSRIDSQL := []string {
2870+ "create table tbl_geo_bad1 (col_a point srid)" ,
2871+ "create table tbl_geo_bad2 (col_a point srid '4326')" ,
2872+ "alter table tbl_geo_bad3 add column col_a linestring srid" ,
2873+ "alter table tbl_geo_bad4 modify column col_a geometry srid ident_srid" ,
2874+ }
2875+ for _ , sql := range invalidSpatialSRIDSQL {
2876+ tree , err := Parse (sql )
2877+ if tree != nil || err == nil {
2878+ t .Errorf ("Parse unexpectedly accepted input %s" , sql )
2879+ }
2880+ }
2881+
28562882 invalidColumnAttributeDupSQL := []string {
28572883 "alter table tbl_attr_bad1 add column col_a int default 1 default 2" ,
28582884 "alter table tbl_attr_bad2 add column col_a int null not null" ,
0 commit comments