Skip to content

Commit

Permalink
fix: column list include function name
Browse files Browse the repository at this point in the history
  • Loading branch information
taozhi8833998 committed Dec 5, 2024
1 parent 7912fd5 commit fd0ab2b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pegjs/postgresql.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -4547,7 +4547,7 @@ column_ref
column: { expr: col }
};
}
/ col:column_type {
/ col:column_type !LPAREN {
// => IGNORE
columnList.add(`select::null::${col.value}`);
return {
Expand Down
2 changes: 1 addition & 1 deletion pegjs/redshift.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -4025,7 +4025,7 @@ column_ref
column: { expr: col }
};
}
/ col:column_type {
/ col:column_type !LPAREN {
// => IGNORE
columnList.add(`select::null::${col.value}`);
return {
Expand Down
2 changes: 1 addition & 1 deletion pegjs/trino.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -3442,7 +3442,7 @@ column_ref
...getLocationObject()
};
}
/ col:column_type {
/ col:column_type !LPAREN {
// => IGNORE
columnList.add(`select::null::${col.value}`);
return {
Expand Down
3 changes: 3 additions & 0 deletions test/postgres.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2116,6 +2116,9 @@ describe('Postgres', () => {
}
})
expect(parser.sqlify(ast.ast, opt)).to.be.equals('SELECT "col1" + "col2" FROM "t1"')
sql = 'SELECT SUM("source"."point" + "other_source"."other_point") FROM foo';
ast = parser.parse(sql, opt)
expect(ast.columnList).to.be.eql(['select::source::point', 'select::other_source::other_point'])
})

it('should support conflict be empty', () => {
Expand Down

0 comments on commit fd0ab2b

Please sign in to comment.