File tree 2 files changed +24
-1
lines changed 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -1006,7 +1006,12 @@ impl Parser {
1006
1006
let table_name = self . parse_object_name ( ) ?;
1007
1007
let ( columns, constraints) = self . parse_columns ( ) ?;
1008
1008
self . expect_keywords ( & [ Keyword :: STORED , Keyword :: AS ] ) ?;
1009
- let file_format = self . parse_identifier ( ) ?. value . parse :: < FileFormat > ( ) ?;
1009
+ // We probably shouldn't parse the file format as an identifier..
1010
+ let file_format = self
1011
+ . parse_identifier ( ) ?
1012
+ . value
1013
+ . to_ascii_uppercase ( )
1014
+ . parse :: < FileFormat > ( ) ?;
1010
1015
1011
1016
self . expect_keyword ( Keyword :: LOCATION ) ?;
1012
1017
let location = self . parse_literal_string ( ) ?;
Original file line number Diff line number Diff line change @@ -1289,6 +1289,24 @@ fn parse_create_external_table() {
1289
1289
}
1290
1290
}
1291
1291
1292
+ #[ test]
1293
+ fn parse_create_external_table_lowercase ( ) {
1294
+ let sql = "create external table uk_cities (\
1295
+ name varchar(100) not null,\
1296
+ lat double null,\
1297
+ lng double)\
1298
+ stored as parquet location '/tmp/example.csv'";
1299
+ let ast = one_statement_parses_to (
1300
+ sql,
1301
+ "CREATE EXTERNAL TABLE uk_cities (\
1302
+ name character varying(100) NOT NULL, \
1303
+ lat double NULL, \
1304
+ lng double) \
1305
+ STORED AS PARQUET LOCATION '/tmp/example.csv'",
1306
+ ) ;
1307
+ assert_matches ! ( ast, Statement :: CreateTable { ..} ) ;
1308
+ }
1309
+
1292
1310
#[ test]
1293
1311
fn parse_create_table_empty ( ) {
1294
1312
// Zero-column tables are weird, but supported by at least PostgreSQL.
You can’t perform that action at this time.
0 commit comments