Re: Pass ParseState as down to utility functions.

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Kirill Reshke <reshkekirill@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>, jian he <jian.universality@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-12-10T03:28:41Z
Lists: pgsql-hackers
On Mon, Dec 09, 2024 at 12:50:20PM +0500, Kirill Reshke wrote:
> Should be fixed in v7.

+create domain d_fail as int4 constraint cc check(values > 1) deferrable;
+ERROR:  specifying constraint deferrability not supported for domains
+LINE 1: ...in d_fail as int4 constraint cc check(values > 1) deferrable...

I would suggest to split the patch into two pieces for clarity, based
on the fact that your v7 patch is doing more than one thing at the
same time:
- Introduce new tests for the new coverage (domain, CREATE TABLE OF,
ALTER TABLE flavors) in a first patch.
- Introduce the ParseStates in these new code paths in a second patch.

By structuring things this way, it is possible to see what kind of
difference related to the new ParseStates is introduced, based on the
new test coverage introduced in the first patch.

This makes also the whole review easier.

+ALTER TABLE itest4 ALTER COLUMN c ADD GENERATED ALWAYS AS IDENTITY;
-- error, column c does not exists

Typo here: s/exists/exist/.
--
Michael

Commits

  1. Print out error position for some ALTER TABLE ALTER COLUMN type

  2. Print out error position for some more DDLs

  3. Print out error position for CREATE DOMAIN

  4. Add some regression tests for missing DDL patterns

  5. Re-implement the ereport() macro using __VA_ARGS__.