Re: Pass ParseState as down to utility functions.

Поиск
Список
Период
Сортировка
От jian he
Тема Re: Pass ParseState as down to utility functions.
Дата
Msg-id CACJufxGy2g+EXzXBm4zL9beg4OvEVjXg=R+PNH8phOdWkD=g4A@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Pass ParseState as down to utility functions.  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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)



В списке pgsql-hackers по дате отправления: