Skip to content

Commit 52b388d

Browse files
committed
fix: add literal string column to columnList in all db
1 parent fed8bb4 commit 52b388d

15 files changed

Lines changed: 54 additions & 1 deletion

pegjs/athena.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,9 @@ column_list_item
10891089
};
10901090
}
10911091
/ e:expr_item __ alias:alias_clause? {
1092+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
1093+
columnList.add(`select::null::${e.value}`)
1094+
}
10921095
return { type: 'expr', expr: e, as: alias };
10931096
}
10941097

pegjs/bigquery.pegjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,12 @@ column_list_item
18061806
...getLocationObject()
18071807
}
18081808
}
1809-
/ expr_alias
1809+
/ e:expr_alias {
1810+
if (e.expr.type === 'double_quote_string' || e.expr.type === 'single_quote_string') {
1811+
columnList.add(`select::null::${e.expr.value}`)
1812+
}
1813+
return e
1814+
}
18101815

18111816
alias_clause
18121817
= KW_AS __ i:alias_ident { return i; }

pegjs/db2.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,9 @@ column_list_item
11171117
};
11181118
}
11191119
/ e:binary_column_expr __ alias:alias_clause? {
1120+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
1121+
columnList.add(`select::null::${e.value}`)
1122+
}
11201123
return { expr: e, as: alias };
11211124
}
11221125

pegjs/flinksql.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1771,6 +1771,9 @@ column_list_item
17711771
}
17721772
/ e:binary_column_expr __ alias:alias_clause? {
17731773
// => { type: 'expr'; expr: expr; as?: alias_clause; }
1774+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
1775+
columnList.add(`select::null::${e.value}`)
1776+
}
17741777
return { type: 'expr', expr: e, as: alias };
17751778
}
17761779

pegjs/hive.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,6 +1072,9 @@ column_list_item
10721072
};
10731073
}
10741074
/ e:expr_item __ alias:alias_clause? {
1075+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
1076+
columnList.add(`select::null::${e.value}`)
1077+
}
10751078
return { type: 'expr', expr: e, as: alias };
10761079
}
10771080

pegjs/mariadb.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2235,6 +2235,9 @@ column_list_item
22352235
return { expr: a, as: alias }
22362236
}
22372237
/ e:binary_column_expr __ alias:alias_clause? {
2238+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
2239+
columnList.add(`select::null::${e.value}`)
2240+
}
22382241
return { expr: e, as: alias };
22392242
}
22402243

pegjs/mysql.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2498,6 +2498,9 @@ column_list_item
24982498
return { expr: a, as: alias }
24992499
}
25002500
/ e:binary_column_expr __ alias:alias_clause? {
2501+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
2502+
columnList.add(`select::null::${e.value}`)
2503+
}
25012504
return { expr: e, as: alias };
25022505
}
25032506

pegjs/noql.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2874,6 +2874,9 @@ column_list_item
28742874
}
28752875
/ e:expr_item __ alias:alias_clause? {
28762876
// => { type: 'expr'; expr: expr; as?: alias_clause; }
2877+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
2878+
columnList.add(`select::null::${e.value}`)
2879+
}
28772880
return { type: 'expr', expr: e, as: alias };
28782881
}
28792882

pegjs/postgresql.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3521,6 +3521,9 @@ column_list_item
35213521
}
35223522
/ e:expr_item __ alias:alias_clause? {
35233523
// => { type: 'expr'; expr: expr; as?: alias_clause; }
3524+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
3525+
columnList.add(`select::null::${e.value}`)
3526+
}
35243527
return { type: 'expr', expr: e, as: alias };
35253528
}
35263529

pegjs/redshift.pegjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2900,6 +2900,9 @@ column_list_item
29002900
}
29012901
/ e:expr_item __ alias:alias_clause? {
29022902
// => { type: 'expr'; expr: expr; as?: alias_clause; }
2903+
if (e.type === 'double_quote_string' || e.type === 'single_quote_string') {
2904+
columnList.add(`select::null::${e.value}`)
2905+
}
29032906
return { type: 'expr', expr: e, as: alias };
29042907
}
29052908

0 commit comments

Comments
 (0)