From 863a62064cfc2b706dd6ab45487d15cc33cedb35 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Sat, 22 Aug 1998 12:38:39 +0000 Subject: [PATCH] As proposed, here is the current version of PL/pgSQL. The test isn't that complete up to now, but I think it shows enough of the capabilities of the module. The Makefile assumes it is located in a directory under pgsql/src/pl. Since it includes Makefile.global and Makefile.port and doesn't use any own compiler/linker calls, it should build on most of our supported platforms (I only tested under Linux up to now). It requires flex and bison I think. Maybe we should ship prepared gram.c etc. like for the main parser too? Jan --- contrib/README | 4 + contrib/plpgsql/doc/plpgsql.txt | 448 ++++ contrib/plpgsql/src/INSTALL | 22 + contrib/plpgsql/src/gram.y | 1460 +++++++++++++ contrib/plpgsql/src/mklang.sql | 14 + contrib/plpgsql/src/pl_comp.c | 1313 ++++++++++++ contrib/plpgsql/src/pl_exec.c | 2241 ++++++++++++++++++++ contrib/plpgsql/src/pl_funcs.c | 675 ++++++ contrib/plpgsql/src/pl_handler.c | 193 ++ contrib/plpgsql/src/plpgsql.h | 475 +++++ contrib/plpgsql/src/scan.l | 227 ++ contrib/plpgsql/test/README | 22 + contrib/plpgsql/test/expected/tables.out | 63 + contrib/plpgsql/test/expected/test.out | 473 +++++ contrib/plpgsql/test/expected/triggers.out | 680 ++++++ contrib/plpgsql/test/expected/views.out | 120 ++ contrib/plpgsql/test/mklang.sql | 14 + contrib/plpgsql/test/runtest | 49 + contrib/plpgsql/test/tables.sql | 101 + contrib/plpgsql/test/test.sql | 272 +++ contrib/plpgsql/test/triggers.sql | 892 ++++++++ contrib/plpgsql/test/views.sql | 141 ++ 22 files changed, 9899 insertions(+) create mode 100644 contrib/plpgsql/doc/plpgsql.txt create mode 100644 contrib/plpgsql/src/INSTALL create mode 100644 contrib/plpgsql/src/gram.y create mode 100644 contrib/plpgsql/src/mklang.sql create mode 100644 contrib/plpgsql/src/pl_comp.c create mode 100644 contrib/plpgsql/src/pl_exec.c create mode 100644 contrib/plpgsql/src/pl_funcs.c create mode 100644 contrib/plpgsql/src/pl_handler.c create mode 100644 contrib/plpgsql/src/plpgsql.h create mode 100644 contrib/plpgsql/src/scan.l create mode 100644 contrib/plpgsql/test/README create mode 100644 contrib/plpgsql/test/expected/tables.out create mode 100644 contrib/plpgsql/test/expected/test.out create mode 100644 contrib/plpgsql/test/expected/triggers.out create mode 100644 contrib/plpgsql/test/expected/views.out create mode 100644 contrib/plpgsql/test/mklang.sql create mode 100755 contrib/plpgsql/test/runtest create mode 100644 contrib/plpgsql/test/tables.sql create mode 100644 contrib/plpgsql/test/test.sql create mode 100644 contrib/plpgsql/test/triggers.sql create mode 100644 contrib/plpgsql/test/views.sql diff --git a/contrib/README b/contrib/README index 800c9344a6..6601f02fe6 100644 --- a/contrib/README +++ b/contrib/README @@ -58,6 +58,10 @@ mSQL-interface - noupdate - trigger to prevent updates on single columns +plpgsql - + Postgres procedural language + by Jan Wieck + pginterface - A crude C/4GL by Bruce Momjian diff --git a/contrib/plpgsql/doc/plpgsql.txt b/contrib/plpgsql/doc/plpgsql.txt new file mode 100644 index 0000000000..d309955100 --- /dev/null +++ b/contrib/plpgsql/doc/plpgsql.txt @@ -0,0 +1,448 @@ + PL/pgSQL + A procedural language for the PostgreSQL RDBMS + + Jan Wieck + + + + Preface + + PL/pgSQL is a procedural language based on SQL designed for + the PostgreSQL database system. + + The extensibility features of PostgreSQL are mostly based on + the ability to define functions for various operations. + Functions could have been written in PostgreSQL's SQL dialect + or in the C programming language. Functions written in C are + compiled into a shared object and loaded by the database + backend process on demand. Also the trigger features of + PostgreSQL are based on functions but required the use of the + C language. + + Since version 6.3 PostgreSQL supports the definition of + procedural languages. In the case of a function or trigger + procedure defined in a procedural language, the database has + no builtin knowlege how to interpret the functions source + text. Instead, the function and trigger calls are passed into + a handler that knows the details of the language. The + handler itself is a function compiled into a shared object + and loaded on demand. + + + Overview + + The PL/pgSQL language is case insensitive. All keywords and + identifiers can be used in upper-/lowercase mixed. + + PL/pgSQL is a block oriented language. A block is defined as + + [<