]> granicus.if.org Git - postgresql/commit
SQL procedures
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 30 Nov 2017 13:46:13 +0000 (08:46 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 30 Nov 2017 16:03:20 +0000 (11:03 -0500)
commite4128ee767df3c8c715eb08f8977647ae49dfb59
tree6513b824fd69b982057f5fe2742039597ce6cea4
parent1761653bbb17447906c812c347b3fe284ce699cf
SQL procedures

This adds a new object type "procedure" that is similar to a function
but does not have a return type and is invoked by the new CALL statement
instead of SELECT or similar.  This implementation is aligned with the
SQL standard and compatible with or similar to other SQL implementations.

This commit adds new commands CALL, CREATE/ALTER/DROP PROCEDURE, as well
as ALTER/DROP ROUTINE that can refer to either a function or a
procedure (or an aggregate function, as an extension to SQL).  There is
also support for procedures in various utility commands such as COMMENT
and GRANT, as well as support in pg_dump and psql.  Support for defining
procedures is available in all the languages supplied by the core
distribution.

While this commit is mainly syntax sugar around existing functionality,
future features will rely on having procedures as a separate object
type.

Reviewed-by: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
92 files changed:
doc/src/sgml/catalogs.sgml
doc/src/sgml/ddl.sgml
doc/src/sgml/ecpg.sgml
doc/src/sgml/information_schema.sgml
doc/src/sgml/plperl.sgml
doc/src/sgml/plpgsql.sgml
doc/src/sgml/plpython.sgml
doc/src/sgml/pltcl.sgml
doc/src/sgml/ref/allfiles.sgml
doc/src/sgml/ref/alter_default_privileges.sgml
doc/src/sgml/ref/alter_extension.sgml
doc/src/sgml/ref/alter_function.sgml
doc/src/sgml/ref/alter_procedure.sgml [new file with mode: 0644]
doc/src/sgml/ref/alter_routine.sgml [new file with mode: 0644]
doc/src/sgml/ref/call.sgml [new file with mode: 0644]
doc/src/sgml/ref/comment.sgml
doc/src/sgml/ref/create_function.sgml
doc/src/sgml/ref/create_procedure.sgml [new file with mode: 0644]
doc/src/sgml/ref/drop_function.sgml
doc/src/sgml/ref/drop_procedure.sgml [new file with mode: 0644]
doc/src/sgml/ref/drop_routine.sgml [new file with mode: 0644]
doc/src/sgml/ref/grant.sgml
doc/src/sgml/ref/revoke.sgml
doc/src/sgml/ref/security_label.sgml
doc/src/sgml/reference.sgml
doc/src/sgml/xfunc.sgml
src/backend/catalog/aclchk.c
src/backend/catalog/information_schema.sql
src/backend/catalog/objectaddress.c
src/backend/catalog/pg_proc.c
src/backend/commands/aggregatecmds.c
src/backend/commands/alter.c
src/backend/commands/dropcmds.c
src/backend/commands/event_trigger.c
src/backend/commands/functioncmds.c
src/backend/commands/opclasscmds.c
src/backend/executor/functions.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/equalfuncs.c
src/backend/optimizer/util/clauses.c
src/backend/parser/gram.y
src/backend/parser/parse_agg.c
src/backend/parser/parse_expr.c
src/backend/parser/parse_func.c
src/backend/tcop/utility.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/cache/lsyscache.c
src/bin/pg_dump/dumputils.c
src/bin/pg_dump/pg_backup_archiver.c
src/bin/pg_dump/pg_dump.c
src/bin/pg_dump/t/002_pg_dump.pl
src/bin/psql/describe.c
src/bin/psql/tab-complete.c
src/include/catalog/catversion.h
src/include/commands/defrem.h
src/include/nodes/nodes.h
src/include/nodes/parsenodes.h
src/include/parser/kwlist.h
src/include/parser/parse_func.h
src/include/parser/parse_node.h
src/include/utils/lsyscache.h
src/interfaces/ecpg/preproc/ecpg.tokens
src/interfaces/ecpg/preproc/ecpg.trailer
src/interfaces/ecpg/preproc/ecpg_keywords.c
src/pl/plperl/GNUmakefile
src/pl/plperl/expected/plperl_call.out [new file with mode: 0644]
src/pl/plperl/plperl.c
src/pl/plperl/sql/plperl_call.sql [new file with mode: 0644]
src/pl/plpgsql/src/pl_comp.c
src/pl/plpgsql/src/pl_exec.c
src/pl/plpython/Makefile
src/pl/plpython/expected/plpython_call.out [new file with mode: 0644]
src/pl/plpython/plpy_exec.c
src/pl/plpython/plpy_main.c
src/pl/plpython/plpy_procedure.c
src/pl/plpython/plpy_procedure.h
src/pl/plpython/sql/plpython_call.sql [new file with mode: 0644]
src/pl/tcl/Makefile
src/pl/tcl/expected/pltcl_call.out [new file with mode: 0644]
src/pl/tcl/pltcl.c
src/pl/tcl/sql/pltcl_call.sql [new file with mode: 0644]
src/test/regress/expected/create_procedure.out [new file with mode: 0644]
src/test/regress/expected/object_address.out
src/test/regress/expected/plpgsql.out
src/test/regress/expected/polymorphism.out
src/test/regress/expected/privileges.out
src/test/regress/parallel_schedule
src/test/regress/serial_schedule
src/test/regress/sql/create_procedure.sql [new file with mode: 0644]
src/test/regress/sql/object_address.sql
src/test/regress/sql/plpgsql.sql
src/test/regress/sql/privileges.sql