Skip to content

Commit

Permalink
Merge pull request #2255 from taozhi8833998/fix-column-list
Browse files Browse the repository at this point in the history
fix: column list include function name
  • Loading branch information
taozhi8833998 authored Dec 7, 2024
2 parents dbe81e6 + fd0ab2b commit 6f4b18f
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 6f4b18f

Please sign in to comment.