Re: HELP: what's wrong with my PL/PSQL function??
От | Richard Huxton |
---|---|
Тема | Re: HELP: what's wrong with my PL/PSQL function?? |
Дата | |
Msg-id | 3B0661ED.B43C0DC6@archonet.com обсуждение исходный текст |
Ответ на | HELP: what's wrong with my PL/PSQL function?? (bboett@erm1.u-strasbg.fr (Bruno Boettcher)) |
Ответы |
Re: HELP: what's wrong with my PL/PSQL function??
|
Список | 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
В списке pgsql-sql по дате отправления: