changeset 2332:fc34d7c084ba

plpgsql
author Oleksandr Gavenko <gavenkoa@gmail.com>
date Thu, 03 Jan 2019 22:03:33 +0200
parents 32dd4ce8e9b2
children 3a371f973644
files postgres.rst
diffstat 1 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/postgres.rst	Thu Jan 03 21:52:00 2019 +0200
+++ b/postgres.rst	Thu Jan 03 22:03:33 2019 +0200
@@ -347,3 +347,23 @@
 https://jdbc.postgresql.org/download.html
   Java/JDBC/Postgres compatibility table.
 
+plpgsql
+=======
+
+Simple function::
+
+  CREATE OR REPLACE FUNCTION incx(x INTEGER)
+  RETURNS INTEGER STABLE AS $$
+    BEGIN
+      RETURN x + 1;
+    END;
+  $$ LANGUAGE plpgsql;
+
+Support for procedures is added only in Postgres v11.
+
+https://www.postgresql.org/docs/current/sql-createfunction.html
+  ``CREATE FUNCTION``.
+https://www.postgresql.org/docs/current/plpgsql-control-structures.html
+  plpgsql control structures.
+https://www.postgresql.org/docs/current/errcodes-appendix.html
+  PostgreSQL Error Codes.
\ No newline at end of file