Skip to content

Commit

Permalink
Merge pull request #2085 from taozhi8833998/fix-bugs
Browse files Browse the repository at this point in the history
refactor: fix location different for same sql in different dialect
  • Loading branch information
taozhi8833998 authored Aug 28, 2024
2 parents 1936591 + 1339522 commit 7b38b2b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions pegjs/mysql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -2274,12 +2274,13 @@ column_list_item
...getLocationObject(),
};
}
/ table:(ident __ DOT)? __ STAR {
/ tbl:(ident __ DOT)? __ STAR {
const table = tbl && tbl[0] || null
columnList.add(`select::${table}::(.*)`);
return {
expr: {
type: 'column_ref',
table: table && table[0] || null,
table,
column: '*'
},
as: null,
Expand Down Expand Up @@ -3119,6 +3120,19 @@ column_ref
...getLocationObject(),
};
}
/ tbl:(ident __ DOT)? __ STAR {
const table = tbl && tbl[0] || null
columnList.add(`select::${table}::(.*)`);
return {
expr: {
type: 'column_ref',
table,
column: '*'
},
as: null,
...getLocationObject(),
};
}
/ col:column {
columnList.add(`select::null::${col}`);
return {
Expand Down
2 changes: 1 addition & 1 deletion pegjs/trino.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -4027,7 +4027,7 @@ cast_expr
...c,
}
}
/ e:(func_call/ aggr_func / window_func / case_expr / interval_expr / literal / column_ref_array_index / param) __ c:cast_double_colon? {
/ e:(func_call/ aggr_func / window_func / case_expr / interval_expr / literal / column_ref_array_index / param) __ c:cast_double_colon? {
/* => {
type: 'cast';
expr: literal | aggr_func | func_call | case_expr | interval_expr | column_ref | param
Expand Down

0 comments on commit 7b38b2b

Please sign in to comment.