Michael Paesold wrote:
>
> Michael Meskes wrote:
>
> > Hi,
> >
> > is a pl/pgSQL function completely parsed once? Or is only the next
> > statement parsed as with many interpreters? If it's the latter it would
> > mean one has to run each branch just to see if the syntax is correct. Is
> > that true?
> >
> > Michael
>
> If the docs are true, than the plain PL/pgSQL code is parsed at once,
> but SQL expressions and queries are not prepared until the branch is
> used. But read for yourself.
That's the way I implemented it. Unless someone changed it, the
documentation is correct.
Someone might think now it'd be at least handy to have a mechanism to
enforce parsing of all expressions and queries for debugging purposes.
But that's not that easy. As soon as you use for example a record
variable, each reference to one of the result row columns is of unknown
datatype until that query is actually executed. You cannot parse an SQL
query with unknown parameters via SPI.
Jan
--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck@Yahoo.com #