*** a/doc/src/sgml/xfunc.sgml --- b/doc/src/sgml/xfunc.sgml *************** *** 153,159 **** SELECT clean_emp(); --- 153,186 ---- (\) (assuming escape string syntax) in the body of the function (see ). + + + Parsing mechanism of a function + + function + parsing mechanism + + + + The body of an SQL function is parsed as if it were a single - multi-part + statement and thus uses a constant snapshot of the system catalogs for + every sub-statement therein. Commands that alter the catalog will likely not + work as expected. + + + + For example: Issuing "CREATE TEMP TABLE" within an SQL function will add + the table to the catalog but subsequent statements in the same function will + not see those additions and thus the temporary table will be invisible to them. + + + + Thus it is generally advised that PL/pgSQL be used, instead of + SQL, when any catalog visibilities are required in the same function. + + + Arguments for <acronym>SQL</acronym> Functions