Re: Pass ParseState as down to utility functions.

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: jian he <jian.universality@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>, Kirill Reshke <reshkekirill@gmail.com>, Alvaro Herrera <alvherre@alvh.no-ip.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-01-27T04:57:23Z
Lists: pgsql-hackers
On Fri, Dec 27, 2024 at 03:01:58PM +0800, jian he wrote:
> please check attached for changes within ATPrepAlterColumnType

Sorry for the late reply.  This is more complete.  Two strings are
more complex after doing the coerce_to_target_type(), but honestly I
am not these are worth having a parser_errposition() as they also have
an errhint().

> Maybe we can change to
> errmsg("conflicting NO INHERIT declarations for not-null constraints
> on column \"%s\"", column->colname),
> errhint("specified primary key or identity sequence imply an inherited
> not-null constraint will be created")
> 
> what do you think?

Hmm.  Not sure that this is an improvement.  Will think a bit more
about it.
--
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__.