From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | Bruno Boettcher <bboett(at)erm1(dot)u-strasbg(dot)fr> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: HELP: what's wrong with my PL/PSQL function?? |
Date: | 2001-05-19 12:07:08 |
Message-ID: | 3B0661ED.B43C0DC6@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Bruno Boettcher wrote:
>
> and i get an error:
> ERROR: parser: parse error at or near "$1"
> (BTW would be helpful if the thing could spit out also the line
> number....)
You can get syntax error line-numbers by editing the function in a
text-file and \i file to import it. Otherwise, plpgsql's error reporting
is a bit weak.
> isolated the prob to this line:
> FOR arow IN SELECT * FROM "jrlname" WHERE plus=sumup LOOP
> in fact it doesn't seem to like the fact that i use a dynamic table
> name??
> i remind vaguely that pl/psql had indeed this sort of problem... but
> this was years ago.... is there any workaround? even using perl?
Still there - plpgsql script is pre-compiled so there's no easy way
around it. There is a new EXECUTE command available which takes a string
and runs it as a query, but I don't think it'll help you here (could be
wrong, check the archives there was a discussion about a similar problem
some time ago IIRC).
> The whole prog is a bookkeeping program... and i want it now really able
> to work with several sets of tables.... without duplicating also the
> functions i wrote associated to the tables....
You could use the EXECUTE system to generate one function for each
table. See the auto-timestamp generator in Roberto Mello's plpgsql
cookbook at http://techdocs.postgresql.org/ for an example.
Otherwise tcl/perl scripting should help you since these aren't
pre-compiled. Can't comment further since I don't use them.
HTH
- Richard Huxton
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2001-05-19 14:58:48 | Re: HELP: what's wrong with my PL/PSQL function?? |
Previous Message | Richard Huxton | 2001-05-19 11:59:49 | Re: Help! Record logging |