minor refactor on src/test/modules/test_ddl_deparse/sql/alter_table.sql

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2025-08-25T00:00:00Z
Lists: pgsql-hackers

Attachments

hi.

in src/test/modules/test_ddl_deparse/sql/alter_table.sql:
----------------------------
ALTER TABLE parent ADD CONSTRAINT a_pos CHECK (a > 0);
CREATE TABLE part (
    a int
) PARTITION BY RANGE (a);

CREATE TABLE part1 PARTITION OF part FOR VALUES FROM (1) to (100);
CREATE TABLE part2 (a int);
ALTER TABLE part ATTACH PARTITION part2 FOR VALUES FROM (101) to (200);
ALTER TABLE part DETACH PARTITION part2;
DROP TABLE part2;
ALTER TABLE part ADD PRIMARY KEY (a);
ALTER TABLE parent ALTER COLUMN a SET NOT NULL;

----
The test initially focuses on the "parent" table, then switches to the "part"
table, and goes back to the "parent" table.
This seems weird?  so I slightly adjusted the order to cover the "parent"
table first, followed by the "part" table.

src/test/modules/test_ddl_deparse/sql/alter_table.sql
don't have ALTER TABLE ALTER COLUMN SET EXPRESSION,
so I added a test on it.

Commits

  1. Improve DDL deparsing test