Commit Graph

279 Commits

Author SHA1 Message Date
Tom Lane 4107478d37 Improve plpgsql's RAISE command. It is now possible to attach DETAIL and
HINT fields to a user-thrown error message, and to specify the SQLSTATE
error code to use.  The syntax has also been tweaked so that the
Oracle-compatible case "RAISE exception_name" works (though you won't get a
very nice error message if you just write that much).  Lastly, support
the Oracle-compatible syntax "RAISE" with no parameters to re-throw
the current error from within an EXCEPTION block.

In passing, allow the syntax SQLSTATE 'nnnnn' within EXCEPTION lists,
so that there is a way to trap errors with custom SQLSTATE codes.

Pavel Stehule and Tom Lane
2008-05-13 22:10:30 +00:00
Tom Lane 47391591ba Support RETURN QUERY EXECUTE in plpgsql.
Pavel Stehule
2008-05-03 00:11:36 +00:00
Tom Lane 347dd6a1cf Make plpgsql support FOR over a query specified by a cursor declaration,
for improved compatibility with Oracle.

Pavel Stehule, with some fixes by me.
2008-04-06 23:43:29 +00:00
Tom Lane e2a8804330 Support EXECUTE USING in plpgsql.
Pavel Stehule, with some improvements by myself.
2008-04-01 03:51:09 +00:00
Tom Lane 7692d8d5b7 Support statement-level ON TRUNCATE triggers. Simon Riggs 2008-03-28 00:21:56 +00:00
Tom Lane 7de81124d5 Create a function quote_nullable(), which works the same as quote_literal()
except that it returns the string 'NULL', rather than a SQL null, when called
with a null argument.  This is often a much more useful behavior for
constructing dynamic queries.  Add more discussion to the documentation
about how to use these functions.

Brendan Jurd
2008-03-23 00:24:20 +00:00
Tom Lane 6a7a63d3a3 Reference pgAdmin as a typical client-side tool, rather than the
no-longer-maintained PgAccess.  Per Erik Rijkers.
2008-01-23 02:04:47 +00:00
Tom Lane 4c128303e0 Entity-ify a passel of & < > characters. Per gripe from Devrim. 2007-12-03 23:49:51 +00:00
Bruce Momjian 664782ee74 RETURN NEXT doc improvement, per Alvaro. 2007-11-28 21:47:39 +00:00
Bruce Momjian 5cbf206c79 Update RETURN NEXT documentation for plpgsql. 2007-11-28 20:56:35 +00:00
Bruce Momjian 62312ce36d Plpgsql doc cleanup.
Guillaume Lelarge
2007-11-28 20:13:06 +00:00
Peter Eisentraut 9293425819 spell checker run 2007-11-28 15:42:31 +00:00
Bruce Momjian fa9eb3152e Add plpgsql doc example of RETURN NEXT.
Ulrich Kroener
2007-10-26 01:11:09 +00:00
Neil Conway b2b9b4d59c Implement RETURN QUERY for PL/PgSQL. This provides some convenient syntax
sugar for PL/PgSQL set-returning functions that want to return the result
of evaluating a query; it should also be more efficient than repeated
RETURN NEXT statements. Based on an earlier patch from Pavel Stehule.
2007-07-25 04:19:09 +00:00
Tom Lane ae1b7e298c Allow plpgsql function parameter names to be qualified with the function's
name.  With this patch, it is always possible for the user to qualify a
plpgsql variable name if needed to avoid ambiguity.  While there is much more
work to be done in this area, this simple change removes one unnecessary
incompatibility with Oracle.  Per discussion.
2007-07-16 17:01:11 +00:00
Tom Lane a69f9028b5 Note incompatibility with Oracle's version of FOR ... REVERSE, per
Andrew Dunstan.  Minor other improvements in documentation of integer
FOR loops.
2007-07-15 00:45:16 +00:00
Tom Lane d849c5d182 Editorial overhaul of plpgsql documentation. Provide detailed documentation
of variable substitution and plan caching behavior in dedicated sections.
(A lot of this material existed already, but was scattered in various places
in the chapter.)  Reorganize material a little bit, mostly to try to avoid
diving into deep details in the first introductory sections.  Document some
fine points that had escaped treatment before, notably the ability to qualify
plpgsql variable names with block labels.  Some minor wordsmithing here and
there.
2007-07-14 23:02:25 +00:00
Tom Lane a9545b3aef Improve UPDATE/DELETE WHERE CURRENT OF so that they can be used from plpgsql
with a plpgsql-defined cursor.  The underlying mechanism for this is that the
main SQL engine will now take "WHERE CURRENT OF $n" where $n is a refcursor
parameter.  Not sure if we should document that fact or consider it an
implementation detail.  Per discussion with Pavel Stehule.
2007-06-11 22:22:42 +00:00
Tom Lane bdc71c2cb1 Minor wording improvement. 2007-06-11 15:08:32 +00:00
Tom Lane 2d4db3675f Fix up text concatenation so that it accepts all the reasonable cases that
were accepted by prior Postgres releases.  This takes care of the loose end
left by the preceding patch to downgrade implicit casts-to-text.  To avoid
breaking desirable behavior for array concatenation, introduce a new
polymorphic pseudo-type "anynonarray" --- the added concatenation operators
are actually text || anynonarray and anynonarray || text.
2007-06-06 23:00:50 +00:00
Neil Conway 8690ebc26f Support for MOVE in PL/PgSQL. Initial patch from Magnus, some improvements
by Pavel Stehule, and reviewed by Neil Conway.
2007-04-29 01:21:09 +00:00
Neil Conway f2321a3f37 Add support for IN as alternative to FROM in PL/PgSQL's FETCH statement,
for consistency with the backend's FETCH command. Patch from Pavel
Stehule, reviewed by Neil Conway.
2007-04-28 23:54:59 +00:00
Tom Lane f01b196597 Support scrollable cursors (ie, 'direction' clause in FETCH) in plpgsql.
Pavel Stehule, reworked a bit by Tom.
2007-04-16 17:21:24 +00:00
Tom Lane 57690c6803 Support enum data types. Along the way, use macros for the values of
pg_type.typtype whereever practical.  Tom Dunstan, with some kibitzing
from Tom Lane.
2007-04-02 03:49:42 +00:00
Bruce Momjian 09a9f10e7f Consistenly use colons before '<programlisting>' blocks, where
appropriate.
2007-02-01 00:28:19 +00:00
Bruce Momjian a134ee3379 Update documentation on may/can/might:
Standard English uses "may", "can", and "might" in different ways:

        may - permission, "You may borrow my rake."

        can - ability, "I can lift that log."

        might - possibility, "It might rain today."

Unfortunately, in conversational English, their use is often mixed, as
in, "You may use this variable to do X", when in fact, "can" is a better
choice.  Similarly, "It may crash" is better stated, "It might crash".

Also update two error messages mentioned in the documenation to match.
2007-01-31 20:56:20 +00:00
Bruce Momjian 4ed9f1d9b7 Update documentation for backslashes to mention escape string syntax
more, and standard_conforming_strings less, because in the future non-E
strings will not treat backslashes specially.

Also use E'' strings where backslashes are used in examples. (The
existing examples would have drawn warnings.)

Backpatch to 8.2.X.
2007-01-30 22:29:23 +00:00
Tom Lane 4a836bad3a Remove incorrect semicolon in example. Joachim Wieland 2006-12-26 16:14:58 +00:00
Peter Eisentraut 0f763503ff Spellchecking and such 2006-10-23 18:10:32 +00:00
Bruce Momjian 32cebaecff Remove emacs info from footer of SGML files. 2006-09-16 00:30:20 +00:00
Tom Lane 3d1e01caa4 Support INSERT/UPDATE/DELETE RETURNING in plpgsql, with rowcount checking
as per yesterday's proposal.  Also make things a tad more orthogonal by
adding the recent STRICT addition to EXECUTE INTO.
Jonah Harris and Tom Lane
2006-08-14 21:14:42 +00:00
Tom Lane 3f8db37c2f Tweak SPI_cursor_open to allow INSERT/UPDATE/DELETE RETURNING; this was
merely a matter of fixing the error check, since the underlying Portal
infrastructure already handles it.  This in turn allows these statements
to be used in some existing plpgsql and plperl contexts, such as a
plpgsql FOR loop.  Also, do some marginal code cleanup in places that
were being sloppy about distinguishing SELECT from SELECT INTO.
2006-08-12 20:05:56 +00:00
Tom Lane c892643a3c Code review for SELECT INTO STRICT patch: use saner choices of error
SQLSTATEs, fix some documentation problems.
2006-06-16 23:29:27 +00:00
Bruce Momjian a584c12426 Add STRICT to PL/pgSQL SELECT INTO, so exceptions are thrown if more or
less than one row is returned by the SELECT, for Oracle PL/SQL
compatibility.

Improve SELECT INTO documentation.

Matt Miller
2006-06-15 18:02:22 +00:00
Bruce Momjian 07c25723da Add BY clause to PL/PgSQL FOR loop, to control the iteration increment.
Jaime Casanova
2006-06-12 16:45:30 +00:00
Bruce Momjian 4d06e86d04 Revert patch, needs more work:
---------------------------------------------------------------------------

Add dynamic record inspection to PL/PgSQL, useful for generic triggers:

  tval2 := r.(cname);

or

  columns := r.(*);

Titus von Boxberg
2006-05-30 13:40:56 +00:00
Bruce Momjian 38c7700f56 Add dynamic record inspection to PL/PgSQL, useful for generic triggers:
tval2 := r.(cname);

or

  columns := r.(*);

Titus von Boxberg
2006-05-30 12:03:13 +00:00
Bruce Momjian 88ba64d396 Back out patch, wrong previous commit message. 2006-05-30 11:58:05 +00:00
Bruce Momjian b6477c6295 Add regexp_replace() to string functions section.
Joachim Wieland
2006-05-30 11:54:51 +00:00
Bruce Momjian fcc02c20fc Update PL documentation:
An article at WebProNews quoted from the PG docs as to the merits of
stored procedures.  I have added a bit more material on their merits,
as well as making a few changes to improve the introductions to
PL/Perl and PL/Tcl.

Chris Browne
2006-05-30 11:40:21 +00:00
Andrew Dunstan 3a9ae3d206 TG_table_name and TG_table_schema for plpgsql, plus docs and regression. 2006-05-28 03:03:17 +00:00
Bruce Momjian 497b5ad928 Make $PostgreSQL CVS tags consistent for SGML files. 2006-03-10 19:10:50 +00:00
Neil Conway 8c5dfbabff Minor SGML style police work. 2006-02-18 23:14:45 +00:00
Tom Lane 15c72174f3 Apply code-reviewed version of for-scalar-list patch: mostly, fixing
it to report reasonable errors in error cases.
2006-02-12 06:37:05 +00:00
Bruce Momjian 025ffe586f Allow PL/pgSQL FOR statement to return values to scalars as well as
records and row types.

Pavel Stehule
2006-02-12 06:03:38 +00:00
Bruce Momjian 354213c7f4 Update PL/pgSQL trigger example to be clearer about how to "merge" data
into a table.

Jim C. Nasby
2006-02-05 02:47:53 +00:00
Bruce Momjian be6187e1c2 Remove a space that incorrectly precedes a comma in the PL/pgSQL
documentation.

Michael Fuhr
2005-12-29 04:02:32 +00:00
Bruce Momjian dc1cb4ceb9 Add documentation about the inability of plpsql to use parameter names
that are the same as column names used in the function.
2005-12-08 18:02:04 +00:00
Neil Conway cab40818ea Fix typo in PL/PgSQL documentation, per Chris KL. 2005-12-01 10:36:57 +00:00
Peter Eisentraut 39dfbe5791 Spellchecking run, final cleanups 2005-11-04 23:14:02 +00:00
Neil Conway d6707cb66e Minor PL/PgSQL doc tweak: use current_timestamp rather than now() in
an example function.
2005-10-21 05:11:23 +00:00
Neil Conway 1d2e0e6d3e Merge some user-submitted suggestions for improvement into the
documentation. Mostly add some <xref>s, fix a few typos, and
document that zlib is required in the installation docs.
2005-10-15 01:47:12 +00:00
Neil Conway 663476919c Minor tweaks for PL/PgSQL documentation. 2005-10-06 20:51:20 +00:00
Neil Conway 3b0453b24f Various documentation improvements. Add a lot of index entries for
the builtin functions (although some more entries are still needed),
and remove the duplicate index entries that have been causing
collateindex.pl warnings. Consistently use "int" and "bigint", rather
than a mix of "int", "integer", "int4", "bigint", and "int8". Make
parenthesis style in syntax examples more consistent. Various
copy-editing for newly-added documentation and SGML markup fixes.
2005-09-14 21:14:26 +00:00
Neil Conway c425dcb4ec In PL/PgSQL, allow a block's label to be optionally specified at the
end of the block:

<<label>>
begin
    ...
end label;

Similarly for loops. This is per PL/SQL. Update the documentation and
add regression tests. Patch from Pavel Stehule, code review by Neil
Conway.
2005-07-02 08:59:48 +00:00
Neil Conway ebcb4c931d Add a CONTINUE statement to PL/PgSQL, which can be used to begin the
next iteration of a loop. Update documentation and add regression tests.
Patch from Pavel Stehule, reviewed by Neil Conway.
2005-06-22 01:35:03 +00:00
Neil Conway 577247b023 Minor documentation update for RAISE expression patch. 2005-06-19 23:39:05 +00:00
Neil Conway d6636543c4 Allow the parameters to PL/PgSQL's RAISE statement to be expressions,
instead of just scalar variables. Add regression tests and update the
documentation. Along the way, remove some redundant error checking
code from exec_stmt_perform().

Original patch from Pavel Stehule, reworked by Neil Conway.
2005-06-14 06:43:15 +00:00
Neil Conway d46bc444ac Implement two new special variables in PL/PgSQL: SQLSTATE and SQLERRM.
These contain the SQLSTATE and error message of the current exception,
respectively. They are scope-local variables that are only defined
in exception handlers (so attempting to reference them outside an
exception handler is an error). Update the regression tests and the
documentation.

Also, do some minor related cleanup: export an unpack_sql_state()
function from the backend and use it to unpack a SQLSTATE into a
string, and add a free_var() function to pl_exec.c

Original patch from Pavel Stehule, review by Neil Conway.
2005-06-10 16:23:11 +00:00
Neil Conway c59887f916 Add support for an optional INTO clause to PL/PgSQL's EXECUTE command.
This allows the result of executing a SELECT to be assigned to a row
variable, record variable, or list of scalars. Docs and regression tests
updated. Per Pavel Stehule, improvements and cleanup by Neil Conway.
2005-06-07 02:47:23 +00:00
Bruce Momjian dabde323b2 Back out SQLSTATE and SQLERRM support. 2005-05-26 04:08:32 +00:00
Bruce Momjian 38af680ad5 Add PL/pgSQL SQLSTATE and SQLERRM support which sets these values on
error.

Pavel Stehule
2005-05-26 00:16:31 +00:00
Bruce Momjian fa66de98a9 >>>>Luckily, PG 8 is available for this. Do you have a short example?
>>>
>>>No, and I think it should be in the manual as an example.
>>>
>>>You will need to enter a loop that uses exception handling to detect
>>>unique_violation.
>>
>>Pursuant to an IRC discussion to which Dennis Bjorklund and
>>Christopher Kings-Lynne made most of the contributions, please find
>>enclosed an example patch demonstrating an UPSERT-like capability.
>>

David Fetter
2005-04-19 03:55:43 +00:00
Bruce Momjian bd32a25598 > >Luckily, PG 8 is available for this. Do you have a short example?
>
> No, and I think it should be in the manual as an example.
>
> You will need to enter a loop that uses exception handling to detect
> unique_violation.

Pursuant to an IRC discussion to which Dennis Bjorklund and
Christopher Kings-Lynne made most of the contributions, please find
enclosed an example patch demonstrating an UPSERT-like capability.

David Fetter
2005-04-19 03:37:20 +00:00
Tom Lane e00ee88761 Allow plpgsql functions to omit RETURN command when the function returns
output parameters or VOID or a set.  There seems no particular reason to
insist on a RETURN in these cases, since the function return value is
determined by other elements anyway.  Per recent discussion.
2005-04-07 14:53:04 +00:00
Tom Lane 726220fb9f Adjust grammar for plpgsql's OPEN command so that a cursor can be
OPENed on non-SELECT commands such as EXPLAIN or SHOW (anything that
returns tuples is allowed).  This flexibility already existed for
bound cursors, but OPEN was artificially restricting what it would
take.  Per a gripe some months back.
2005-04-05 18:05:46 +00:00
Tom Lane fd97cf4df0 plpgsql does OUT parameters, as per my proposal a few weeks ago. 2005-04-05 06:22:17 +00:00
Neil Conway ff02d0a052 Make default_with_oids default to false -- user-created tables will now
no longer include OIDs, unless WITH OIDS is specified or the
default_with_oids configuration parameter is enabled. Update the docs
accordingly.
2005-03-13 09:36:31 +00:00
Neil Conway 73f5c9d90e Minor consistency improvement. 2005-02-14 00:54:26 +00:00
Neil Conway 35878b9bc6 Add some index entries for RAISE and exception handling in PL/PgSQL. Per
suggestion from Rainer Brandt.
2005-02-10 06:08:22 +00:00
Neil Conway 280cae35aa Use now() rather than 'now' in an example in the PL/PgSQL docs. From David
Fetter and Ben Calvert.
2005-02-10 05:01:07 +00:00
Bruce Momjian 1ced129aa3 More < and > cleanups converted to ampersands. 2005-01-22 22:56:36 +00:00
Tom Lane 893c66de69 Simplify trigger example, per Mark Kirkwood. 2005-01-15 03:38:44 +00:00
Tom Lane a294726bc1 Incorporate examples and doc patches from Mark Kirkwood and David Fetter. 2005-01-14 01:16:52 +00:00
Tom Lane b5adf46cbd Some more small improvements in response to 7.4 interactive docs comments. 2005-01-08 22:13:38 +00:00
Tom Lane 883ac5ca7a More minor updates and copy-editing. 2004-12-30 21:45:37 +00:00
Tom Lane 8562b032d8 Fix broken markup. 2004-12-19 22:10:41 +00:00
Neil Conway 480777e56c Allow 'ELSEIF' as an alternative to 'ELSIF' in PL/PgSQL. There have been
several reports of users being confused when they attempt to use ELSEIF
and run into trouble due to PL/PgSQL's lax parser. The parser will be
improved for 8.1, but we can fix most of the problem by allowing ELSEIF
for now.
2004-12-17 03:51:36 +00:00
Peter Eisentraut 5ec30faee6 Spell checker run 2004-12-13 18:05:10 +00:00
Bruce Momjian c1233c849b >>This patch adds another plpgsql trigger example to the chapter. It uses
>>the emp table again, but shows how to audit changes into another table
>>(emp_audit).

Mark Kirkwood
2004-12-03 17:12:09 +00:00
Neil Conway ec7a6bd9a2 Replace "--" and "---" with "&mdash;" as appropriate, for better-looking
output.
2004-11-15 06:32:15 +00:00
Neil Conway e374dfc119 Document that the semicolon following the final "END" in a function body
is optional.
2004-10-04 05:42:18 +00:00
Tom Lane 12a2121c75 Fix slightly misleading description of PERFORM syntax. 2004-09-24 18:54:14 +00:00
Tom Lane 64410289f8 Add trivial NULL statement to plpgsql, for Oracle compatibility. 2004-08-16 17:52:06 +00:00
Tom Lane 82fde1aaa8 Add note pointing out the difference in semantics between Oracle and
plpgsql EXCEPTION blocks.
2004-08-08 22:40:46 +00:00
Tom Lane 9b3caebb0a Update plpgsql documentation for 8.0 (mostly, make use of named
function parameters and dollar quoting in examples; do some polishing
of the existing dollar-quoting docs).  The 'how to port from Oracle'
section is looking pretty respectable these days ...
2004-08-08 00:50:58 +00:00
Tom Lane 9c8d0850c3 Support "OR condition ..." in plpgsql EXCEPTION clauses to make the syntax
more nearly Oracle-equivalent.  Allow matching by category as well as
specific error code.  Document the set of available condition names
(or more accurately, synchronize it with the existing documentation).  In
passing, update errcodes.sgml to include codes added during 7.5 development.
2004-07-31 23:04:58 +00:00
Tom Lane beda4814c1 plpgsql does exceptions.
There are still some things that need refinement; in particular I fear
that the recognized set of error condition names probably has little in
common with what Oracle recognizes.  But it's a start.
2004-07-31 07:39:21 +00:00
Bruce Momjian 8dbd10d96d This patch fixes a small error in the Porting PL/SQL to PL/pgSQL
section where a instr function parameter is mistyped as varchar. It
works properly when changed to integer.

Michael Glaesemann
2004-07-11 23:26:51 +00:00
Bruce Momjian 5ff9566686 Remove postgresql.conf of 'info' as a valid client_min_messages level. 2004-07-11 21:48:25 +00:00
Tom Lane a72dd7a9e4 Okay, I've had it with answering newbie questions about why plpgsql
FOR loops are giving weird syntax errors.  Restructure parsing of FOR
loops so that the integer-loop-vs-query-loop decision is driven off
the presence of '..' between IN and LOOP, rather than the presence
of a matching record/row variable name.  Hopefully this will make the
behavior a bit more transparent.
2004-07-04 02:49:04 +00:00
Neil Conway 8295c27c89 Add documentation for the new "dollar quoting" feature, and update existing
examples to use dollar quoting when appropriate. Original patch from David
Fetter, additional work and editorializing by Neil Conway.
2004-05-16 23:22:08 +00:00
Neil Conway 1090aa8cc7 More cross-reference work, other minor SGML fixes and improvements. 2004-03-26 03:18:28 +00:00
Neil Conway f46a80c362 Fix a few omissions in the initcap() documentation & source code
comments, make some unrelated improvements to the functions
documentation, and perform some minor consistency cleanup
elsewhere. Original initcap() change from Dennis B., additional
changes by Neil C.
2004-02-27 03:59:23 +00:00
Tom Lane 391c3811a2 Rename SortMem and VacuumMem to work_mem and maintenance_work_mem.
Make btree index creation and initial validation of foreign-key constraints
use maintenance_work_mem rather than work_mem as their memory limit.
Add some code to guc.c to allow these variables to be referenced by their
old names in SHOW and SET commands, for backwards compatibility.
2004-02-03 17:34:04 +00:00
Tom Lane 0152f14812 Example of a function taking a composite type should show how to call it. 2004-01-24 22:05:08 +00:00
Neil Conway 58ae3cf12c Minor improvements to the trigger documentation, and a few SGML fixes. 2004-01-22 19:50:21 +00:00
Bruce Momjian 09ab9b5915 Remove INTO recommendation for plpgsql language. 2003-11-30 05:45:22 +00:00
Bruce Momjian 1a7c373d18 There is an unused variable in an example function in the PL/PgSQL
documentation; this patch removes it.

Neil Conway
2003-11-30 04:47:37 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Peter Eisentraut 934c21344c Documentation cleanup 2003-11-12 22:47:47 +00:00
Peter Eisentraut 8442a92e5a Spell checking, consistent terminology. 2003-11-01 01:56:29 +00:00
Tom Lane aefc08e4eb Minor copy-editing for plpgsql chapter. 2003-09-23 19:58:50 +00:00
Tom Lane 6e59122490 Update obsolete examples of error messages; various other minor editing. 2003-09-12 22:17:24 +00:00
Bruce Momjian 2a5b6a7c9b This patch fixes a few missed GUC variables that were still upper case,
makes a few more small improvements to runtime.sgml, and makes some SGML
conventions more consistent.

Neil Conway
2003-09-11 21:42:20 +00:00
Bruce Momjian 188eda0df2 Consistenly lowercase GUC variable names, in docs and error messages. 2003-09-11 18:30:39 +00:00
Bruce Momjian 8e27be4310 This patch makes a few minor improvements to the docs: make the
<varname> conventions more consistent, and improve the ANALYZE ref page.

Neil Conway
2003-09-11 17:31:45 +00:00
Peter Eisentraut ee4ae6ceb2 Add note that a for loop where the lower bound is greater than the upper
bound is valid but does nothing.

suggested by Richard Huxton <dev@archonet.com>
2003-09-03 22:17:07 +00:00
Peter Eisentraut c326d8f4f2 Add/edit index entries. 2003-08-31 17:32:24 +00:00
Tom Lane 5bfb0540b0 Update docs for 7.4 array features and polymorphic functions.
This is Joe Conway's patch of 7-Aug plus further editorializing
of my own.
2003-08-09 22:50:22 +00:00
Tom Lane fc8d970cbc Replace functional-index facility with expressional indexes. Any column
of an index can now be a computed expression instead of a simple variable.
Restrictions on expressions are the same as for predicates (only immutable
functions, no sub-selects).  This fixes problems recently introduced with
inlining SQL functions, because the inlining transformation is applied to
both expression trees so the planner can still match them up.  Along the
way, improve efficiency of handling index predicates (both predicates and
index expressions are now cached by the relcache) and fix 7.3 oversight
that didn't record dependencies of predicate expressions.
2003-05-28 16:04:02 +00:00
Tom Lane 4089d25175 Fix plpgsql so that variables of composite types (rowtypes) can be
declared without having to write %ROWTYPE.  If the declared type of
a variable is a composite type, it'll be taken to be a row variable
automatically.
2003-04-27 22:21:22 +00:00
Peter Eisentraut a8cb3368db General editing 2003-04-07 01:29:26 +00:00
Peter Eisentraut 5e5c5cd31a Merge documentation into one book. (Build with "make html".) Replace
vague cross-references with real links.
2003-03-25 16:15:44 +00:00
Bruce Momjian cde8bbc413 This patch makes the following changes to the documentation:
- more work from the SGML police

- some grammar improvements: rewriting a paragraph or two, replacing
contractions where (IMHO) appropriate

- fix missing utility commands in lock mode docs

- improve CLUSTER, REINDEX, SET SESSION AUTHORIZATION ref pages

Neil Conway
2003-02-19 04:06:28 +00:00
Bruce Momjian be2b660ecd This patch includes a lot of minor cleanups to the SGML documentation,
including:

- replacing all the appropriate usages of <citetitle>PostgreSQL
...</citetitle> with &cite-user;, &cite-admin;, and so on

- fix an omission in the EXECUTE documentation

- add some more text to the EXPLAIN documentation

- improve the PL/PgSQL RETURN NEXT documentation (more work to do here)

- minor markup fixes


Neil Conway
2003-01-19 00:13:31 +00:00
Bruce Momjian 3b6ca54cda This patch includes some minor fixes and improvements to the SGML docs
for PL/PgSQL.

Neil Conway
2003-01-15 16:40:24 +00:00
Bruce Momjian 1b7f3cc02d This patch implements FOR EACH STATEMENT triggers, per my email to
-hackers a couple days ago.

Notes/caveats:

        - added regression tests for the new functionality, all
          regression tests pass on my machine

        - added pg_dump support

        - updated PL/PgSQL to support per-statement triggers; didn't
          look at the other procedural languages.

        - there's (even) more code duplication in trigger.c than there
          was previously. Any suggestions on how to refactor the
          ExecXXXTriggers() functions to reuse more code would be
          welcome -- I took a brief look at it, but couldn't see an
          easy way to do it (there are several subtly-different
          versions of the code in question)

        - updated the documentation. I also took the liberty of
          removing a big chunk of duplicated syntax documentation in
          the Programmer's Guide on triggers, and moving that
          information to the CREATE TRIGGER reference page.

        - I also included some spelling fixes and similar small
          cleanups I noticed while making the changes. If you'd like
          me to split those into a separate patch, let me know.

Neil Conway
2002-11-23 03:59:09 +00:00
Bruce Momjian 9249bdaabd SGML markup fixes. 2002-11-15 03:22:30 +00:00
Bruce Momjian 001d5a7aa5 Rename server_min_messages to log_min_messages. Part of consolidation
of log_ settings.
2002-11-14 23:53:27 +00:00
Bruce Momjian cfd2728100 This patch makes a minor cleanup to the implementation of PERFORM in
PL/PgSQL. Previously, it had been bundled together with the assign
statement implementation, for some reason that wasn't clear to me
(they certainly don't share any code with one another). So I separated
them and made PERFORM a statement like any other. No changes in
functionality.

Along the way, I added some regression tests for PERFORM, added a
bunch more SGML tags to the PL/PgSQL docs, and removed an obsolete
comment relating to the implementation of RETURN NEXT.

Neil Conway
2002-11-10 00:35:58 +00:00
Peter Eisentraut bc49968764 Add more appropriate markup. 2002-09-21 18:32:54 +00:00
Tom Lane 1b69b122bb Some PL/PgSQL documentation improvements from Neil Conway. 2002-09-14 20:11:16 +00:00
Tom Lane 470a1048ec plpgsql functions can return RECORD, per Neil Conway. 2002-09-01 16:28:06 +00:00
Tom Lane e107f3a7e3 PL/pgSQL functions can return sets. Neil Conway's patch, modified so
that the functionality is available to anyone via ReturnSetInfo, rather
than hard-wiring it to PL/pgSQL.
2002-08-30 00:28:41 +00:00
Tom Lane 99fd5cbd41 FOUND patch was a bit over-enthusiastic: SQL commands that are not
INSERT, UPDATE, or DELETE shouldn't change FOUND.  IMHO anyway.
Also, try to make documentation a little clearer.
2002-08-29 04:12:03 +00:00
Tom Lane b663f3443b Add a bunch of pseudo-types to replace the behavior formerly associated
with OPAQUE, as per recent pghackers discussion.  I still want to do some
more work on the 'cstring' pseudo-type, but I'm going to commit the bulk
of the changes now before the tree starts shifting under me ...
2002-08-22 00:01:51 +00:00
Bruce Momjian ebe1be1321 This patch improves the behavior of FOUND in PL/PgSQL. In Oracle,
FOUND is set whenever a SELECT INTO returns > 0 rows, *or* when an
INSERT, UPDATE, or DELETE affects > 0 rows. We implemented the first
part of this behavior, but not the second.

I also improved the documentation on the various situations in which
FOUND can be set (excluding inside FOR loops, which I still need to
think about), and added some regression tests for this behavior.

Neil Conway
2002-08-20 05:28:24 +00:00
Bruce Momjian f514bb3e25 Would it be wise to have the plsql.sgml file renamed to plpgsql.sgml?
All of the internal tags are of the latter.

The other thing I noticed is that most of the quick examples in the file
use a para and synopsis.  Is there a reason we're not using <example/> ?

Rod Taylor
2002-07-30 19:36:13 +00:00