[prev] 36 [next]

Exercise 4: Table Statistics

Using the PostgreSQL catalog, write a PLpgSQL function
  • to return table name and #tuples in table
  • for all tables in the public schema

create type TableInfo as (table text, ntuples int);
create function pop() returns setof TableInfo ...

Hints:

  • table is a reserved word
  • you will need to use dynamically-generated queries.