aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-07-17 16:43:03 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-07-17 16:43:35 -0400
commit0873092dd3aa37f8fef7d9e60292b1893d8efce1 (patch)
tree64b3d9c8e609ea8616ba29489dd410e12cd33dbd
parenta6de8d009b336ae003485562148ab7f78fa53c64 (diff)
downloadpostgresql-0873092dd3aa37f8fef7d9e60292b1893d8efce1.tar.gz
postgresql-0873092dd3aa37f8fef7d9e60292b1893d8efce1.zip
Doc: explain dollar quoting in the intro part of the pl/pgsql chapter.
We're throwing people into the guts of the syntax with not much context; let's back up one step and point out that this goes inside a literal in a CREATE FUNCTION command. Per suggestion from Kurt Kartaltepe. Discussion: https://postgr.es/m/CACawnnyWAmH+au8nfZhLiFfWKjXy4d0kY+eZWfcxPRnjVfaa_Q@mail.gmail.com
-rw-r--r--doc/src/sgml/plpgsql.sgml20
1 files changed, 19 insertions, 1 deletions
diff --git a/doc/src/sgml/plpgsql.sgml b/doc/src/sgml/plpgsql.sgml
index d6ed051a857..50d334f93ed 100644
--- a/doc/src/sgml/plpgsql.sgml
+++ b/doc/src/sgml/plpgsql.sgml
@@ -180,8 +180,26 @@
<title>Structure of <application>PL/pgSQL</application></title>
<para>
+ Functions written in <application>PL/pgSQL</application> are defined
+ to the server by executing <xref linkend="sql-createfunction"> commands.
+ Such a command would normally look like, say,
+<programlisting>
+CREATE FUNCTION somefunc(integer, text) RETURNS integer
+AS '<replaceable>function body text</>'
+LANGUAGE plpgsql;
+</programlisting>
+ The function body is simply a string literal so far as <command>CREATE
+ FUNCTION</> is concerned. It is often helpful to use dollar quoting
+ (see <xref linkend="sql-syntax-dollar-quoting">) to write the function
+ body, rather than the normal single quote syntax. Without dollar quoting,
+ any single quotes or backslashes in the function body must be escaped by
+ doubling them. Almost all the examples in this chapter use dollar-quoted
+ literals for their function bodies.
+ </para>
+
+ <para>
<application>PL/pgSQL</application> is a block-structured language.
- The complete text of a function definition must be a
+ The complete text of a function body must be a
<firstterm>block</>. A block is defined as:
<synopsis>