Skip to content

PostgreSQL UNLOGGED Table Support and ALTER TABLE ... SET LOGGED|UNLOGGED#2251

Open
LucaCappelletti94 wants to merge 5 commits intoapache:mainfrom
LucaCappelletti94:postgres-regression-6
Open

PostgreSQL UNLOGGED Table Support and ALTER TABLE ... SET LOGGED|UNLOGGED#2251
LucaCappelletti94 wants to merge 5 commits intoapache:mainfrom
LucaCappelletti94:postgres-regression-6

Conversation

@LucaCappelletti94
Copy link
Copy Markdown
Contributor

This change adds parser and AST support for PostgreSQL table logging controls:

  1. CREATE UNLOGGED TABLE ...
  2. ALTER TABLE ... SET LOGGED
  3. ALTER TABLE ... SET UNLOGGED

It also adds regression tests and updates cross-dialect test fixtures impacted by the AST shape change.

@LucaCappelletti94 LucaCappelletti94 marked this pull request as ready for review February 27, 2026 09:23
Comment thread src/parser/mod.rs
Add parser and AST support for PostgreSQL CREATE UNLOGGED TABLE and\nALTER TABLE ... SET LOGGED|UNLOGGED operations.\n\n- add LOGGED keyword\n- add CreateTable.unlogged and wire it through CreateTableBuilder\n- render UNLOGGED in CreateTable display\n- add AlterTableOperation::SetLogged and ::SetUnlogged display/spans\n- parse UNLOGGED only for PostgreSqlDialect|GenericDialect\n- parse ALTER TABLE SET LOGGED|UNLOGGED operations
Add PostgreSQL regression coverage for the new syntax support and\nupdate existing struct-literal CreateTable expectations with the\nnew unlogged field in cross-dialect tests.\n\n- add parse_create_unlogged_table\n- add parse_alter_table_set_logged_unlogged\n- set unlogged defaults in duckdb/mssql fixture assertions
@LucaCappelletti94 LucaCappelletti94 requested a review from iffyio April 1, 2026 19:54
Comment thread src/parser/mod.rs
Comment on lines +5121 to +5122
} else if unlogged {
self.expected_ref("TABLE after UNLOGGED", self.peek_token_ref())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this shouldn't be needed, the else branch covers the scenario where there is no match?

Comment thread src/parser/mod.rs
Comment on lines +5111 to +5112
let unlogged = dialect_of!(self is PostgreSqlDialect | GenericDialect)
&& self.parse_keyword(Keyword::UNLOGGED);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there a requirement to use a dialect guard? if not we can always accept the syntax

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