*** plsql.sgml	Sat Jan  6 04:04:57 2001
--- plsql.sgml.modi	Sat Jan  6 04:01:44 2001
***************
*** 333,339 ****
       identifiers are substituted by parameters and the actual values from
       the variables are passed to the executor in the parameter array. All
       expressions used in a PL/pgSQL function are only prepared and
!      saved once.
      </para>
      <para>
       The type checking done by the <productname>Postgres</productname>
--- 333,340 ----
       identifiers are substituted by parameters and the actual values from
       the variables are passed to the executor in the parameter array. All
       expressions used in a PL/pgSQL function are only prepared and
!      saved once.  The only exception to this rule is an EXECUTE statement
!      if parsing of a query is needed each time it is encountered.
      </para>
      <para>
       The type checking done by the <productname>Postgres</productname>
***************
*** 481,486 ****
--- 482,529 ----
         </para>
        </listitem>
       </varlistentry>
+ 
+ 	<varlistentry>
+ 		<term>Executing dynamic queries</term>
+ 		<listitem>
+ 			<cmdsynopsis>
+ 				<command>EXECUTE</command>
+ 				<arg choice="req"><replaceable class="command">query</replaceable></arg>
+ 			</cmdsynopsis>
+ 
+ 			<para>
+ 			Unlike all other queries in PL/pgSQL, a
+ 			<replaceable>query</replaceable> run by an EXECUTE
+ 			statement is not prepared and saved just once during
+ 			the life of the backend.  Instead, the
+ 			<replaceable>query</replaceable> is prepared each time
+ 			the statement is run. This allows the
+ 			<replaceable>query</replaceable> to be dynamically
+ 			created within the procedure to perform actions
+ 			on variable tables and fields.
+ 			</para>
+ 
+ 			<para>USAGE</para>
+ 			<programlisting>
+ EXECUTE ''UPDATE tbl SET ''
+ 	|| quote_ident(fieldname)
+ 	|| '' = ''
+ 	|| quote_literal(newvalue)
+ 	|| '' WHERE ...'';
+ 			</programlisting>
+ 			
+ 			<para>
+ 			This example shows use of the functions quote_ident(TEXT)
+ 			and quote_literal(TEXT).  Variables containing
+ 			field and table identifiers should be passed to
+ 			function quote_ident().  Variables containing literal
+ 			elements of the dynamic query string should be passed
+ 			to quote_literal().  Both take the appropriate steps
+ 			to return the input text enclosed in single or double
+ 			quotes and with any embedded special characters intact.
+ 			</para>
+    		</listitem>
+ 	</varlistentry>
  
       <varlistentry>
        <term>Returning from the function</term>
