Fix pgstattuple/pgstatindex to use regclass-type as the argument - Mailing list pgsql-hackers

From Satoshi Nagayasu
Subject Fix pgstattuple/pgstatindex to use regclass-type as the argument
Date
Msg-id 5132EED7.9060304@uptime.jp
Whole thread Raw
Responses Re: Fix pgstattuple/pgstatindex to use regclass-type as the argument  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@uptime.jp>
Uptime Technologies, LLC. http://www.uptime.jp

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: scanner/parser minimization
Next
From: Dean Rasheed
Date:
Subject: Re: Materialized views WIP patch