Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement - Mailing list pgsql-hackers

From Josef Šimánek
Subject Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Date
Msg-id CAFp7Qwo=Gmz11QRu+x_9wkPVCfwR_btY0XYnH1LE+cZzjUDP0A@mail.gmail.com
Whole thread Raw
In response to Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement  (Philip Alger <paalger0@gmail.com>)
List pgsql-hackers
po 3. 11. 2025 v 2:22 odesílatel Philip Alger <paalger0@gmail.com> napsal:
>
> 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;
> }

Indeed, IMHO pfree is not needed and the current patch is good as is.

>
> --
> Best,
> Phil Alger



pgsql-hackers by date:

Previous
From: Josef Šimánek
Date:
Subject: Re: [PATCH] Add pg_get_trigger_ddl() to retrieve the CREATE TRIGGER statement
Next
From: Thomas Munro
Date:
Subject: Re: meson's in-tree libpq header search order vs -Dextra_include_dirs