Re: [PATCH] Add function to_oct

Поиск
Список
Период
Сортировка
От John Naylor
Тема Re: [PATCH] Add function to_oct
Дата
Msg-id CAFBsxsEVR_M4_eGgP_zdugerq8iTUHeVJP-DBRj7yPh2xcuh4g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: [PATCH] Add function to_oct  (Nathan Bossart <nathandbossart@gmail.com>)
Ответы Re: [PATCH] Add function to_oct
Список pgsql-hackers

On Wed, Aug 16, 2023 at 9:24 PM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> On Wed, Aug 16, 2023 at 10:35:27AM +0700, John Naylor wrote:

> > Now I'm struggling to understand why each and every instance has its own
> > nominal buffer, passed down to the implementation. All we care about is the
> > result -- is there some reason not to confine the buffer declaration to the
> > general implementation?
>
> We can do that if we use a static variable, which is what I've done in v6.

That makes it a lexically-scoped global variable, which we don't need either. Can we have the internal function allocate on the stack, then call cstring_to_text() on that, returning the text result? That does its own palloc.

Or maybe better, save the starting pointer, compute the length at the end, and call cstring_to_text_with_len()?  (It seems we wouldn't need the nul-terminator then, either.)

--
John Naylor
EDB: http://www.enterprisedb.com

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: New WAL record to detect the checkpoint redo location
Следующее
От: Pavel Luzanov
Дата:
Сообщение: Re: PG 16 draft release notes ready