Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTE optional columns #301

Merged
merged 1 commit into from
Apr 13, 2022
Merged

CTE optional columns #301

merged 1 commit into from
Apr 13, 2022

Conversation

npapapietro
Copy link
Contributor

PR Info

The definition of Common Table Expressions (CTE) allow for optional column definition, allowing for using the table
name as the identifier for columns.:

-- Should be equal
-- Case 1
WITH "cte" ("id") AS (SELECT "tbl"."id" FROM "tbl")
SELECT "cte"."id" FROM "cte";
-- Case 2
WITH "cte" AS (SELECT "tbl"."id" FROM "tbl")
SELECT "cte"."id" FROM "cte";

Fixes

Currently, the query building will squish the cte name against the AS keyword like:

WITH "cte"AS (Select ...

so I added a simple fix to add a space:

WITH "cte" AS (Select ...

Additionally I added simple unit test to illustrate.

Changes

@ikrivosheev
Copy link
Member

@npapapietro thank you for the PR! LGTM!

@tyt2y3 tyt2y3 merged commit 525a534 into SeaQL:master Apr 13, 2022
@tyt2y3
Copy link
Member

tyt2y3 commented Apr 13, 2022

Thank you all

@tyt2y3
Copy link
Member

tyt2y3 commented Apr 15, 2022

0.24.1

@npapapietro npapapietro deleted the cte-no-cols branch April 17, 2022 00:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants