From: | Julie Hunt <jhunt(at)chac(dot)qld(dot)edu(dot)au> |
---|---|
To: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Create function problem with passing name variable |
Date: | 2000-05-02 02:17:07 |
Message-ID: | B53477C3.43C%jhunt@chac.qld.edu.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Anand Raman | 2000-05-02 12:23:10 | postgresql7.0 jdbc driver |
Previous Message | Tom Cook | 2000-05-02 00:03:25 | Re: PostGres 7.0 RC2 |