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

From: Satoshi Nagayasu <snaga(at)uptime(dot)jp>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Fix pgstattuple/pgstatindex to use regclass-type as the argument
Date: 2013-03-03 06:33:59
Message-ID: 5132EED7.9060304@uptime.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

As I wrote before, I'd like to clean up pgstattuple functions to
allow the same expressions.

Re: [HACKERS] [RFC] pgstattuple/pgstatindex enhancement
http://www.postgresql.org/message-id/511EE19B.5010004@uptime.jp

My goal is to allow specifying a relation/index with several
expressions, 'relname', 'schemaname.relname' and oid in all
pgstattuple functions. pgstatindex() does not accept oid so far.

I have found that the backward-compatibility can be kept
when the arguments (text and/or oid) are replaced with regclass
type. regclass type seems to be more appropriate here.

So, I cleaned up those three functions, pgstattuple(), pgstatindex(),
pg_relpages(), to accept a regclass-type argument, instead of using
text and/or oid type, as the test cases show.

select * from pgstatindex('test_pkey');
select * from pgstatindex('public.test_pkey');
select * from pgstatindex('myschema.test_pkey');
select * from pgstatindex('myschema.test_pkey'::regclass::oid);

With attached patch, all functions in the pgstattuple module can
accept the same expression to specify the target relation/index.

Any comments or suggestions?

Regards,
--
Satoshi Nagayasu <snaga(at)uptime(dot)jp>
Uptime Technologies, LLC. http://www.uptime.jp

Attachment Content-Type Size
pgstattuple_regclass_v1.diff.gz application/gzip 3.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2013-03-03 08:48:03 Re: Materialized views WIP patch
Previous Message James Cloos 2013-03-02 23:11:31 Re: Floating point error