Create function problem with passing name variable
Hi
I've sent an email about this problem before but the suggestion of using
name as the data type for a table did not work.
I'm creating a function that passes a table name as a variable but the error
message ERROR: parser: parse error at or near "$2" appears.
This is the function I am trying to create:
CREATE FUNCTION get_max_id (int4, name) RETURNS int4
AS 'SELECT max($1) FROM $2'
LANGUAGE 'sql';
I need a generic function to retrieve the maximum serial number from any
table so I can update the serial number when copying records between another
database and postgresql.
Could someone help me by either telling me a data type that works with
passing tables as variables or if name is correct then how I can check or
correct my postgresql database so that it works.
Thanks
Julie Hunt