function with tablename parameter - Mailing list pgsql-general

From Miso Hlavac
Subject function with tablename parameter
Date
Msg-id 835065354.20031027122832@medium13.sk
Whole thread Raw
Responses Re: function with tablename parameter
Re: function with tablename parameter
List pgsql-general
hello,

it is possible to write something similar???

create function get_count(varchar(32)) RETURNS int4 AS '
DECLARE
  tmp int4;
BEGIN
  SELECT COUNT(*) INTO tmp FROM $1;
  RETURN tmp;
END;' LANGUAGE 'plpgsql';


SELECT get_count('k_part');
SQL error:
ERROR:  parser: parse error at or near "$1" at character 24

thanx, miso


pgsql-general by date:

Previous
From: Adam Witney
Date:
Subject: Re: shared memory on OS X - 7.4beta4
Next
From: "Ben-Nes Michael"
Date:
Subject: Re: Recomended FS