
create or replace function
   nTuples(tableName text) return integer
as $$
declare
	ntups integer;
	qry text;
begin
	qry := 'select count(*) from '||quote_ident(tableName);
	execute qry into ntups;
	return ntups;
end;
$$ language plpgsql;
