Skip to content

Add support for TABLE command in Postgresql#2364

Open
yanghykevin wants to merge 1 commit into
apache:mainfrom
yanghykevin:table-command
Open

Add support for TABLE command in Postgresql#2364
yanghykevin wants to merge 1 commit into
apache:mainfrom
yanghykevin:table-command

Conversation

@yanghykevin

@yanghykevin yanghykevin commented Jun 4, 2026

Copy link
Copy Markdown

Hi all. We're an AWS team using sqlparser-rs for MySQL/PG parsing and plan to contribute a series of dialect compatibility improvements. Happy to coordinate on approach.

Change Description:

This closes Issue: #742

Renamed Table struct → ExplicitTable. The original Table struct was created for only one specific use case: CREATE TABLE x AS TABLE y.
The new name matches is more precise and matches SQL:2016 terminology.

Grammar: https://www.postgresql.org/docs/current/sql-select.html#SQL-TABLE

);

for sql in [
"TABLE films WHERE x > 0",

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be interesting to test: TABLE db.schema.table is rejected.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently it is accepted. Based on the existing design philosophy I thought the parser should be permissive on this and relies on downstream semantic analyzer to do verification. But I want to get your opinion on this and will be happy to make the change rejecting this with a trait method

Comment thread tests/sqlparser_common.rs
dialects.verified_stmt("TABLE films");
// Schema-qualified.
dialects.verified_stmt("TABLE myschema.films");
// Database-qualified (three-part name).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is for MySQL, not PostgreSQL, right ? Maybe a subtle overlap with another PR to come for MySQL ?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, actually I will enable this command and add mysql testing in the next revision as well since this implementation works for both

@c2main

c2main commented Jun 6, 2026

Copy link
Copy Markdown

Hi all. We're an AWS team using sqlparser-rs for MySQL/PG parsing and plan to contribute a series of dialect compatibility improvements. Happy to coordinate on approach.

Hi. FYI, we have similar plan at Data Bene for Oracle/PG.

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.

2 participants