From: Richard Huxton <dev@archonet.com>
To: Bruno Boettcher <bboett@erm1.u-strasbg.fr>
Cc: pgsql-sql@postgresql.org
Subject: Re: HELP: what's wrong with my PL/PSQL function??
Date: Sat, 19 May 2001 13:07:08 +0100
Message-ID: <3B0661ED.B43C0DC6@archonet.com> (raw)
References: <20010518112136.A468@erm1.u-strasbg.fr>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, bboett@erm1.u-strasbg.fr
Subject: Re: HELP: what's wrong with my PL/PSQL function??
In-Reply-To: <3B0661ED.B43C0DC6@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox