Skip to content

PostgreSQL: Support CREATE FOREIGN TABLE - #2515

Open
fmguerreiro wants to merge 5 commits into
apache:mainfrom
fmguerreiro:upstream/create-foreign-table
Open

fmguerreiro wants to merge 5 commits into
apache:mainfrom
fmguerreiro:upstream/create-foreign-table

Conversation

@fmguerreiro

@fmguerreiro fmguerreiro commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Parses CREATE FOREIGN TABLE [IF NOT EXISTS] name (columns) SERVER server [OPTIONS (...)] (docs).

Split out of #2317 at @LucaCappelletti94's request. That PR now carries CREATE FOREIGN DATA WRAPPER only.

Table-level OPTIONS reuses the list parser pulled out of parse_pg_create_server, which #2317 also moves; whichever lands second needs a rebase there.

Per-column OPTIONS (...), INHERITS, PARTITION OF and ALTER FOREIGN TABLE are out of scope; the rustdoc notes that.

Ported from the pgmold-sqlparser fork.

Table-level OPTIONS reuses the list parser lifted out of CREATE SERVER.
Without parens Display emitted a () the input never had, and a persistence modifier was accepted then dropped. Also covers OPTIONS in the span.
OR ALTER, MULTISET, PERSISTENT and the view params were still accepted and then dropped. The error now points at the modifier rather than the table name.
@fmguerreiro
fmguerreiro marked this pull request as ready for review September 16, 2026 06:12
Matching any ParserError would also pass if the guard stopped being reached. LOCAL, SET and the view params were never exercised.
Also says why the or_replace disjunct is kept despite being unreachable today.
@fmguerreiro fmguerreiro changed the title PostgreSQL: add support for CREATE FOREIGN TABLE PostgreSQL: Support CREATE FOREIGN TABLE Sep 16, 2026
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