GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||
GeezerVison is showing github.com — DuckDB: support * RENAME, unparenthesized star modifiers and a trailing comma by guizmaii · Pull Request #2801 · JSQLParser/JSqlParser Conversation
|
| Input | Before | After |
|---|---|---|
* RENAME (i AS x, j AS y), * RENAME i AS x |
error | ColumnsTransformer of the new type RENAME |
* EXCLUDE i, * EXCLUDE t.i |
error | EXCLUDE with one column, printed without parentheses |
* REPLACE i + 1 AS i |
error | REPLACE with one item, printed without parentheses |
SELECT a, b, FROM t, SELECT 1, LIMIT 1, (SELECT 1,) |
error | the comma is dropped |
ColumnsTransformer gains getRenameItems() and isParenthesized(). The unparenthesized forms are only recognised after * / t.*, as in DuckDB. REPLACE item needs an AS at its top level and RENAME needs column AS name for every column, so * rename / * replace stay aliases of the star and ClickHouse's REPLACE STRICT checks are unchanged.* REPLACE (a + 1) AS a is now DuckDB's single item (a + 1) AS a; it used to be an unaliased REPLACE(a + 1) with the star aliased a, which no dialect accepts.), FROM, WHERE, HAVING, WINDOW, INTO, a set operator, GROUP BY/ORDER BY with an expression, and LIMIT/OFFSET followed by a number or ?. Columns and functions named after keywords keep parsing: SELECT a, limit FROM t, SELECT a, limit(1) FROM t, SELECT a, group by FROM t. A comma at the end of the input stays an error, and SELECT 1, LIMIT ALL is still a column. It applies wherever a select item list is parsed (RETURNING, PIVOT ... IN, DISTINCT ON, ...).checkGrammarAmbiguity: no conflicts. ./gradlew check: 10,118 tests, 0 failures.test/sql, 70,729 statements): 146 more parse, none less.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
12ff9c7 to
a80100c
Compare
|
sorry, conflicts from overlapping PRs. Please resolve. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ng comma - `* RENAME (i AS x, j AS y)` and `* RENAME i AS x` are the new RENAME `ColumnsTransformer`. - After `*`, `EXCLUDE i`, `REPLACE i + 1 AS i` and `RENAME i AS x` may name a single column or item without parentheses, and print back that way. Unparenthesized REPLACE and RENAME require the `AS name`. - A select list may end with a comma before a clause such as FROM, WHERE or `ORDER BY`, or before `)`. Keywords that may name a column, as in `SELECT a, limit FROM t`, still do. The comma is not printed.
- Unparenthesized REPLACE needs an AS at the top level of its item, and RENAME needs `column AS name` for each item, so `* rename` and `* replace` stay aliases of the star. - `REPLACE (a + 1) AS a` is a single item, as in DuckDB, not a list without an alias. - A comma before `limit(` or `offset(` starts a select item again, and `group by` / `order by` right before FROM or the end are a column and its alias. - A transformer with more than one item or column prints parentheses.
a80100c to
8353381
Compare
There was an error while loading. Please reload this page.
|
Thank you! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Rebased on master, conflicts resolved. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.