Doc: explain dollar quoting in the intro part of the pl/pgsql chapter.
authorTom Lane
Mon, 17 Jul 2017 20:43:03 +0000 (16:43 -0400)
committerTom Lane
Mon, 17 Jul 2017 20:43:40 +0000 (16:43 -0400)
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

doc/src/sgml/plpgsql.sgml

index 2abc4f724bdf711c9bb16a37cd27e72945f37021..c0d81d9b7742d092a87b6b7842d5e5baaa70b31e 100644 (file)
  
   Structure of <application>PL/pgSQL</application>
 
+  
+   Functions written in PL/pgSQL are defined
+   to the server by executing  commands.
+   Such a command would normally look like, say,
+
+CREATE FUNCTION somefunc(integer, text) RETURNS integer
+AS 'function body text'
+LANGUAGE plpgsql;
+
+   The function body is simply a string literal so far as CREATE
+   FUNCTION is concerned.  It is often helpful to use dollar quoting
+   (see ) 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.
+  
+
   
    PL/pgSQL 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
    block. A block is defined as: