Re: Pass ParseState as down to utility functions.
jian he <jian.universality@gmail.com>
From: jian he <jian.universality@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Kirill Reshke <reshkekirill@gmail.com>,
Michael Paquier <michael@paquier.xyz>, Alvaro Herrera <alvherre@alvh.no-ip.org>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2024-12-12T02:08:04Z
Lists: pgsql-hackers
On Thu, Dec 12, 2024 at 4:48 AM Tom Lane <tgl@sss.pgh.pa.us> wrote: > > jian he <jian.universality@gmail.com> writes: > > add parser_errposition to some places in > > transformTableConstraint, transformColumnDefinition > > where v8 didn't. > > I'm not loving the idea of cons'ing up ParseStates in random places in > tablecmds.c. I think we ought to fix things so that the one made in > standard_ProcessUtility is passed down to all these places, replacing > ad-hoc queryString and queryEnv parameters. > the main code change is within DefineDomain. AlterTableUtilityContext comments says: /* Info needed when recursing from ALTER TABLE */ so we cannot pass DefineDomain with AlterTableUtilityContext. -DefineDomain(CreateDomainStmt *stmt) +DefineDomain(ParseState *pstate, CreateDomainStmt *stmt) we have to pass either ParseState or queryString to DefineDomain. -extern ObjectAddress AlterType(AlterTypeStmt *stmt); +extern ObjectAddress AlterType(ParseState *pstate, AlterTypeStmt *stmt); this change not necessary, we can remove it. but other places (listed in below), we are passing (AlterTableUtilityContext *context) which seems ok? -ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode) +ATExecAddOf(Relation rel, const TypeName *ofTypename, LOCKMODE lockmode, + AlterTableUtilityContext *context) static ObjectAddress ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, - AlterTableCmd *cmd, LOCKMODE lockmode); + AlterTableCmd *cmd, LOCKMODE lockmode, + AlterTableUtilityContext *context); static ObjectAddress ATExecAlterColumnType(AlteredTableInfo *tab, Relation rel, - AlterTableCmd *cmd, LOCKMODE lockmode) + AlterTableCmd *cmd, LOCKMODE lockmode, + AlterTableUtilityContext *context)
Commits
-
Print out error position for some ALTER TABLE ALTER COLUMN type
- 65281391a937 18.0 landed
-
Print out error position for some more DDLs
- 0f23dedc9176 18.0 landed
-
Print out error position for CREATE DOMAIN
- 39240bcad56d 18.0 landed
-
Add some regression tests for missing DDL patterns
- 0172b4c9449e 18.0 landed
-
Re-implement the ereport() macro using __VA_ARGS__.
- e3a87b4991cc 13.0 cited