File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,21 @@ SELECT clean_emp();
143
143
</screen>
144
144
</para>
145
145
146
+ <note>
147
+ <para>
148
+ The entire body of a SQL function is parsed before any of it is
149
+ executed. While a SQL function can contain commands that alter
150
+ the system catalogs (e.g., <command>CREATE TABLE</>), the effects
151
+ of such commands will not be visible during parse analysis of
152
+ later commands in the function. Thus, for example,
153
+ <literal>CREATE TABLE foo (...); INSERT INTO foo VALUES(...);</literal>
154
+ will not work as desired if packaged up into a single SQL function,
155
+ since <structname>foo</> won't exist yet when the <command>INSERT</>
156
+ command is parsed. It's recommended to use <application>PL/PgSQL</>
157
+ instead of a SQL function in this type of situation.
158
+ </para>
159
+ </note>
160
+
146
161
<para>
147
162
The syntax of the <command>CREATE FUNCTION</command> command requires
148
163
the function body to be written as a string constant. It is usually
You can’t perform that action at this time.
0 commit comments