File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1006,7 +1006,12 @@ impl Parser {
10061006 let table_name = self . parse_object_name ( ) ?;
10071007 let ( columns, constraints) = self . parse_columns ( ) ?;
10081008 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 > ( ) ?;
10101015
10111016 self . expect_keyword ( Keyword :: LOCATION ) ?;
10121017 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() {
12891289 }
12901290}
12911291
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+
12921310#[ test]
12931311fn parse_create_table_empty ( ) {
12941312 // Zero-column tables are weird, but supported by at least PostgreSQL.
You can’t perform that action at this time.
0 commit comments