Skip to content

Postgres: Parse trailing asterisk after table name in FROM clause - #2525

Open
BenSatori wants to merge 1 commit into
apache:mainfrom
BenSatori:postgres-tbl-name-trailing-asterisk
Open

BenSatori wants to merge 1 commit into
apache:mainfrom
BenSatori:postgres-tbl-name-trailing-asterisk

Conversation

@BenSatori

Copy link
Copy Markdown
Contributor

Before this PR, PostgreSQL's FROM tbl_name* syntax (asterisk explicitly indicating that descendant tables should be included) failed to parse:

SELECT * FROM tbl_name*

This was already supported for TRUNCATE TABLE name* and LOCK TABLE name*, but not for regular FROM items.

Docs: https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM

Fix

  • Added a has_trailing_asterisk field to TableFactor::Table, parsed the same way as the existing asterisk handling in TRUNCATE/LOCK TABLE.
  • Renamed the pre-existing has_asterisk fields on TruncateTableTarget and LockTableTarget to has_trailing_asterisk for naming consistency.

This PR was created with AI assistance.

PostgreSQL allows an explicit trailing '*' after a table name in FROM
to indicate that descendant tables should be included, e.g.
SELECT * FROM tbl_name*. This was previously only supported for
TRUNCATE and LOCK TABLE targets, not for FROM items.

Also renamed the existing has_asterisk fields on TruncateTableTarget
and LockTableTarget to has_trailing_asterisk for consistency and
clarity.

https://www.postgresql.org/docs/current/sql-select.html#SQL-FROM
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.

1 participant