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

From: Philip Alger <paalger0(at)gmail(dot)com>
To: Josef Šimánek <retro(at)ballgag(dot)cz>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>, Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Cary Huang <cary(dot)huang(at)highgo(dot)ca>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, josef(dot)simanek(at)gmail(dot)com
Subject: Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date: 2025-11-03 01:22:26
Message-ID: CAPXBC8JqaqFb7cwPibJkdORDPSSYBuxBbthgfqWPK2Jr=_8omQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

> > I think it’s better to pfree(res).
>
> Would you mind to share why pfree is needed? I tried to trace this
> with Valgrind, but even pfree(res) was present or not, there was no
> leak detected and both compiles without additional warnings. Wouldn't
> be res "trashed" at the end of the function (after next line) anyway?

The wrapper function string_to_text, which is a wrapper for
cstring_to_text, includes pfree.

see ruleutils.c

static text *
string_to_text(char *str)
{
text *result;

result = cstring_to_text(str);
pfree(str);
return result;
}

--
Best,
Phil Alger

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Josef Šimánek 2025-11-03 01:30:55 Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Previous Message Philip Alger 2025-11-03 01:18:44 Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement