Re: Allow pageinspect's bt_page_stats function to return a set of rows instead of a single row

From: Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Allow pageinspect's bt_page_stats function to return a set of rows instead of a single row
Date: 2022-07-31 13:18:16
Message-ID: CANugjhufKQCS95DwTToEkMEdk3U+XqFQGAamDseV+_ARb4fCpA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, 31 Jul 2022 at 18:00, Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com> wrote:

>
>
> On Thu, 28 Jul 2022 at 00:36, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
>> Hamid Akhtar <hamid(dot)akhtar(at)gmail(dot)com> writes:
>> > That attached patch is based on the master branch. It makes the
>> following
>> > changes to the pageinspect contrib module:
>> > - Updates bt_page_stats_internal function to accept 3 arguments instead
>> of
>> > 2.
>> > - The function now uses SRF macros to return a set rather than a single
>> > row. The function call now requires specifying column names.
>>
>> FWIW, I think you'd be way better off changing the function name, say
>> to bt_multi_page_stats(). Overloading the name this way is going to
>> lead to great confusion, e.g. somebody who fat-fingers the number of
>> output arguments in a JDBC call could see confusing results due to
>> invoking the wrong one of the two functions. Also, I'm not quite sure
>> what you mean by "The function call now requires specifying column
>> names", but it doesn't sound like an acceptable restriction from a
>> compatibility standpoint. If a different name dodges that issue then
>> it's clearly a better way.
>>
>> regards, tom lane
>>
>
> Attached please find the latest version of the patch;
> pageinspect_btree_multipagestats_02.patch.
>
> It no longer modifies the existing bt_page_stats function. Instead, it
> introduces a new function bt_multi_page_stats as you had suggested. The
> function expects three arguments where the first argument is the index name
> followed by block number and number of blocks to be returned.
>
> Please ignore this statement. It was a typo.
> "The function call now requires specifying column names"
>

Attached is the rebased version of the patch
(pageinspect_btree_multipagestats_03.patch) for the master branch.

>
>

Attachment Content-Type Size
pageinspect_btree_multipagestats_03.patch application/x-patch 16.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Justin Pryzby 2022-07-31 13:41:35 pg_upgrade errno
Previous Message Hamid Akhtar 2022-07-31 13:00:53 Re: Allow pageinspect's bt_page_stats function to return a set of rows instead of a single row