fmguerreiro opened a new pull request, #2317: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2317
## Summary Adds PostgreSQL grammar for the two FDW-setup DDL statements used to define foreign data sources: - \`CREATE FOREIGN DATA WRAPPER name [HANDLER fn | NO HANDLER] [VALIDATOR fn | NO VALIDATOR] [OPTIONS (...)]\` — https://www.postgresql.org/docs/current/sql-createforeigndatawrapper.html - \`CREATE FOREIGN TABLE [IF NOT EXISTS] name (columns) SERVER server_name [OPTIONS (...)]\` — https://www.postgresql.org/docs/current/sql-createforeigntable.html ## Changes - \`CreateForeignDataWrapper\`, \`CreateForeignTable\`, and \`FdwRoutineClause\` types in \`src/ast/ddl.rs\` with \`fmt::Display\` + \`From<_> for Statement\`. - Two new \`Statement\` variants and re-exports. - \`Spanned\` arms (\`Span::empty()\` stubs — happy to extend if reviewers prefer). - Dispatcher in \`parse_create\`: \`CREATE FOREIGN DATA WRAPPER ...\` and \`CREATE FOREIGN TABLE ...\`. - Round-trip tests in \`tests/sqlparser_postgres.rs\`: FDW with/without handlers, \`NO HANDLER\` / \`NO VALIDATOR\`, options list, foreign table with columns + SERVER + optional \`IF NOT EXISTS\` and table-level \`OPTIONS\`. ## Out of scope \`ALTER FOREIGN TABLE\`, \`ALTER FOREIGN DATA WRAPPER\`, \`CREATE SERVER\`, \`CREATE USER MAPPING\` are not in this PR. \`CREATE SERVER\` actually landed in an earlier PR on the \`pgmold-sqlparser\` fork; happy to upstream that as a follow-up if this PR merges. ## Notes Originally shipped via the \`pgmold-sqlparser\` fork; tested against real PostgreSQL 13–17 schemas in [pgmold](https://github.com/fmguerreiro/pgmold). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
