table name as variable within Function - Mailing list pgsql-general

From Clark Allan
Subject table name as variable within Function
Date
Msg-id 4a7a732105070711222daafaf4@mail.gmail.com
Whole thread Raw
Responses Re: table name as variable within Function
List pgsql-general
Here is an example of what i would like to do...
---------------------------------------
CREATE FUNCTION fun_totalrecords(varchar) RETURNS int8 AS'
DECLARE
theTable ALIAS FOR $1;
result int := 0;
BEGIN
result = COUNT(*) FROM theTable; -- this is where i need help
 
RETURN result;

END; 'LANGUAGE 'plpgsql';
---------------------------------------
Thanks for the help....
Clark
 

pgsql-general by date:

Previous
From: Christopher Browne
Date:
Subject: Re: How to force Postgres to calculate MAX(boolean)
Next
From: Ying Lu
Date:
Subject: find objects under a specific tablespace