Hi,

In [1], we discussed adding some lines regarding the fact that SQL
functions always use generic plan. Here is the suggested patch. I've
tested on V17 and V12. It does not concern V18.

Regards,
Renan

[1] 
https://www.postgresql.org/message-id/CAApHDvp3EDrVhGjmb21bceJ5-Y7iXKOn2UGG3-ngp_9ob_mpLw%40mail.gmail.com
From ea969fa15edec0bb9e8726860be5660b129ed993 Mon Sep 17 00:00:00 2001
From: "Renan A. Fonseca" <renanfons...@gmail.com>
Date: Tue, 1 Apr 2025 15:53:34 +0200
Subject: [PATCH] Document SQL functions' behavior regarding custom/generic
 plan

---
 doc/src/sgml/xfunc.sgml | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/doc/src/sgml/xfunc.sgml b/doc/src/sgml/xfunc.sgml
index f3a3e4e2f8f..f8058d78fe6 100644
--- a/doc/src/sgml/xfunc.sgml
+++ b/doc/src/sgml/xfunc.sgml
@@ -249,6 +249,13 @@ CALL clean_emp();
      </para>
    </note>
 
+    <note>
+     <para>
+       Except when inlined, an SQL function is always executed with a
+       generic plan. This behavior may not be desired in some situations.
+     </para>
+    </note>
+
    <para>
     The syntax of the <command>CREATE FUNCTION</command> command requires
     the function body to be written as a string constant.  It is usually
-- 
2.47.0

Reply via email to