On Sun, 2005-08-14 at 20:53 -0400, Tom Lane wrote: > regression=# create type table_count_result as (table_name text, count bigint); > CREATE TYPE > regression=# create or replace function generate_table_count () > regression-# returns setof table_count_result as $$ > regression$# declare > regression$# tname record; > regression$# count table_count_result; > regression$# begin > regression$# for tname in select table_name from information_schema.tables > regression$# where table_schema = 'public' loop > regression$# for count in execute 'select ' || quote_literal(tname.table_name) || ', count(*) from ' || quote_ident(tname.table_name) loop > regression$# return next count; > regression$# end loop; > regression$# end loop; > regression$# return; > regression$# end$$ language plpgsql; > CREATE FUNCTION > regression=# select * from generate_table_count(); Sweet mercy...success. Thanks...my forehead was a bit bloody from all the head bashing going on over here... I have much to learn about pl/pgsql programming! Thanks again! John ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match