Re: PL/pgSQL examples NOT involving functions

From: Jan Wieck <janwieck(at)yahoo(dot)com>
To: Aasmund Midttun Godal <postgresql(at)envisity(dot)com>
Cc: josh(at)agliodbs(dot)com, pgsql-sql(at)postgresql(dot)org
Subject: Re: PL/pgSQL examples NOT involving functions
Date: 2001-12-05 21:26:47
Message-ID: 200112052126.fB5LQlp01967@saturn.jw.home
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-sql

Aasmund Midttun Godal wrote:
> Erm, sorry about the multiple postings, I just discovered a couple of interesting tidbits after I posted first...
>
> http://www.postgresql.org/idocs/index.php?plpgsql.html :
>
> "The PL/pgSQL call handler parses the function's source text and produces an internal binary instruction tree the first time the function is called."

And that is still not entirely accurate. At the first
function call the control language (IF, WHEN, etc.) is
parsed. All expressions and queries are just remembered as
strings with variables replaced by $n parameters. Now every
statement will prepare a saved plan the first time it is hit.

So when you have a function with conditional code and a
specific branch of that code is never called, the statements
in there will never be prepared.

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#================================================== JanWieck(at)Yahoo(dot)com #

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

In response to

Browse pgsql-docs by date

  From Date Subject
Next Message Jan Wieck 2001-12-05 21:29:04 Re: PL/pgSQL examples NOT involving functions
Previous Message Peter Eisentraut 2001-12-01 14:03:25 Re: <application> vs <command>

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 2001-12-05 21:29:04 Re: PL/pgSQL examples NOT involving functions
Previous Message Martín Marqués 2001-12-05 21:19:11 Re: INT OR VARCHAR