aboutsummaryrefslogtreecommitdiff
path: root/doc/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-04-15 17:17:20 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-04-15 17:17:20 -0400
commit1111b2668d89bfcb6f502789158b1233ab4217a6 (patch)
tree38e331ef19b32e276c231ad91fc4ae07327d6ceb /doc/src
parent3157cbe974846729d49a1ee081944eee1839bdd8 (diff)
downloadpostgresql-1111b2668d89bfcb6f502789158b1233ab4217a6.tar.gz
postgresql-1111b2668d89bfcb6f502789158b1233ab4217a6.zip
Undo decision to allow pg_proc.prosrc to be NULL.
Commit e717a9a18 changed the longstanding rule that prosrc is NOT NULL because when a SQL-language function is written in SQL-standard style, we don't currently have anything useful to put there. This seems a poor decision though, as it could easily have negative impacts on external PLs (opening them to crashes they didn't use to have, for instance). SQL-function-related code can just as easily test "is prosqlbody not null" as "is prosrc null", so there's no real gain there either. Hence, revert the NOT NULL marking removal and adjust related logic. For now, we just put an empty string into prosrc for SQL-standard functions. Maybe we'll have a better idea later, although the history of things like pg_attrdef.adsrc suggests that it's not easy to maintain a string equivalent of a node tree. This also adds an assertion that queryDesc->sourceText != NULL to standard_ExecutorStart. We'd been silently relying on that for awhile, so let's make it less silent. Also fix some overlooked documentation and test cases. Discussion: https://postgr.es/m/2197698.1617984583@sss.pgh.pa.us
Diffstat (limited to 'doc/src')
-rw-r--r--doc/src/sgml/catalogs.sgml16
1 files changed, 12 insertions, 4 deletions
diff --git a/doc/src/sgml/catalogs.sgml b/doc/src/sgml/catalogs.sgml
index 2656786d1e6..1345791e963 100644
--- a/doc/src/sgml/catalogs.sgml
+++ b/doc/src/sgml/catalogs.sgml
@@ -6007,8 +6007,9 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
<structfield>prosqlbody</structfield> <type>pg_node_tree</type>
</para>
<para>
- Pre-parsed SQL function body. This will be used for language SQL
- functions if the body is not specified as a string constant.
+ Pre-parsed SQL function body. This is used for SQL-language
+ functions when the body is given in SQL-standard notation
+ rather than as a string literal. It's null in other cases.
</para></entry>
</row>
@@ -6036,9 +6037,16 @@ SCRAM-SHA-256$<replaceable>&lt;iteration count&gt;</replaceable>:<replaceable>&l
<para>
For compiled functions, both built-in and dynamically loaded,
<structfield>prosrc</structfield> contains the function's C-language
- name (link symbol). For all other currently-known language types,
+ name (link symbol).
+ For SQL-language functions, <structfield>prosrc</structfield> contains
+ the function's source text if that is specified as a string literal;
+ but if the function body is specified in SQL-standard style,
+ <structfield>prosrc</structfield> is unused (typically it's an empty
+ string) and <structfield>prosqlbody</structfield> contains the
+ pre-parsed definition.
+ For all other currently-known language types,
<structfield>prosrc</structfield> contains the function's source
- text. <structfield>probin</structfield> is unused except for
+ text. <structfield>probin</structfield> is null except for
dynamically-loaded C functions, for which it gives the name of the
shared library file containing the function.
</para>