Re: Fix pgstattuple/pgstatindex to use regclass-type as the argument

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Rushabh Lathia <rushabh(dot)lathia(at)gmail(dot)com>
Cc: Satoshi Nagayasu <snaga(at)uptime(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix pgstattuple/pgstatindex to use regclass-type as the argument
Date: 2013-07-18 18:59:02
Message-ID: CAHGQGwFRp1HT5j6xQ9BUx8q1K=_Z1fsWkYK1BXOoJ9HoaRd7pw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jul 18, 2013 at 1:49 PM, Rushabh Lathia
<rushabh(dot)lathia(at)gmail(dot)com> wrote:
>
>
>
> On Thu, Jul 18, 2013 at 9:40 AM, Satoshi Nagayasu <snaga(at)uptime(dot)jp> wrote:
>>
>> (2013/07/18 2:31), Fujii Masao wrote:
>>>
>>> On Tue, Jul 16, 2013 at 3:00 PM, Satoshi Nagayasu <snaga(at)uptime(dot)jp>
>>> wrote:
>>>>
>>>> (2013/07/04 3:58), Fujii Masao wrote:
>>>>>
>>>>> For the test, I just implemented the regclass-version of pg_relpages()
>>>>> (patch attached) and tested some cases. But I could not get that
>>>>> problem.
>>>>>
>>>>> SELECT pg_relpages('hoge'); -- OK
>>>>> SELECT pg_relpages(oid) FROM pg_class WHERE relname = 'hoge';
>>>>> -- OK
>>>>> SELECT pg_relpages(relname) FROM pg_class WHERE relname = 'hoge';
>>>>> -- OK
>>>>
>>>>
>>>> In the attached patch, I cleaned up three functions to have
>>>> two types of arguments for each, text and regclass.
>>>>
>>>> pgstattuple(text)
>>>> pgstattuple(regclass)
>>>> pgstatindex(text)
>>>> pgstatindex(regclass)
>>>> pg_relpages(text)
>>>> pg_relpages(regclass)
>>>>
>>>> I still think a regclass argument is more appropriate for passing
>>>> relation/index name to a function than text-type, but having both
>>>> arguments in each function seems to be a good choice at this moment,
>>>> in terms of backward-compatibility.
>>>>
>>>> Docs needs to be updated if this change going to be applied.
>>>
>>>
>>> Yes, please.
>>
>>
>> Updated docs and code comments, etc. PFA.

Thanks for updating the patch. Committed.

>>> 'make installcheck' failed in my machine.
>>
>>
>> Hmm, it works on my box...
>
>
> Works for me too.

Hmm... make installcheck still failed on my box. That's because
you added several SELECT queries into sql/pgstattuple.sql, but
you just added only two results into expected/pgstattuple.out.
I corrected the regression test code of pgstattuple.

Regards,

--
Fujii Masao

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2013-07-18 19:21:15 Re: Fatal error after starting postgres : sys identifiers must be different
Previous Message David Christensen 2013-07-18 18:53:27 Simple documentation typo patch