1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Fix pgstattuple functions to use regclass-type as the argument.

This allows us to specify the target relation with several expressions,
'relname', 'schemaname.relname' and OID in all pgstattuple functions.
pgstatindex() and pg_relpages() could not accept OID as the argument
so far.

Per discussion on -hackers, we decided to keep two types of interfaces,
with regclass-type and TEXT-type argument, for each pgstattuple
function because of the backward-compatibility issue. The functions
which have TEXT-type argument will be deprecated in the future release.

Patch by Satoshi Nagayasu, reviewed by Rushabh Lathia and Fujii Masao.
This commit is contained in:
Fujii Masao
2013-07-19 03:50:20 +09:00
parent d26888bc4d
commit 1dc118660b
8 changed files with 280 additions and 29 deletions

View File

@ -8,13 +8,27 @@ CREATE EXTENSION pgstattuple;
create table test (a int primary key, b int[]);
select * from pgstattuple('test');
select * from pgstattuple('test'::text);
select * from pgstattuple('test'::name);
select * from pgstattuple('test'::regclass);
select pgstattuple(oid) from pg_class where relname = 'test';
select pgstattuple(relname) from pg_class where relname = 'test';
select * from pgstatindex('test_pkey');
select * from pgstatindex('test_pkey'::text);
select * from pgstatindex('test_pkey'::name);
select * from pgstatindex('test_pkey'::regclass);
select pgstatindex(oid) from pg_class where relname = 'test_pkey';
select pgstatindex(relname) from pg_class where relname = 'test_pkey';
select pg_relpages('test');
select pg_relpages('test_pkey');
select pg_relpages('test_pkey'::text);
select pg_relpages('test_pkey'::name);
select pg_relpages('test_pkey'::regclass);
select pg_relpages(oid) from pg_class where relname = 'test_pkey';
select pg_relpages(relname) from pg_class where relname = 'test_pkey';
create index test_ginidx on test using gin (b);