Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement

Поиск
Список
Период
Сортировка
От Jim Jones
Тема Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Дата
Msg-id 9ce36292-7b03-448c-9afd-f55af05bb51c@uni-muenster.de
обсуждение исходный текст
Ответ на Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement  (Philip Alger <paalger0@gmail.com>)
Ответы Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Список pgsql-hackers

On 10/18/25 06:08, Philip Alger wrote:
> 
>  Yes, you're correct. I've added that in v6 attached.

Nice. The code now checks res for NULL, which aligns with other similar
functions, e.g. pg_get_indexdef.

if (res == NULL)
  PG_RETURN_NULL();

One nitpick:

You're probably initialising the buffer a bit too early:

...

/* Validate that the relation exists */
if (!OidIsValid(relid) || get_rel_name(relid) == NULL)
    PG_RETURN_NULL();

initStringInfo(&buf);

...

If the function is going to return NULL, there is no need to allocate
memory for buf. I guess you could place it right before the
appendStringInfo call:

initStringInfo(&buf);
appendStringInfo(&buf, "%s;", res);

Other than that, the patch LGTM. If the other reviewers have no
objections, I'll mark it as ready for committer.

Thanks for the patch.

Best, Jim





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