Commit Graph

109 Commits

Author SHA1 Message Date
Peter Eisentraut 1c51c7d5ff Add PL/Python functions for quoting strings
Add functions plpy.quote_ident, plpy.quote_literal,
plpy.quote_nullable, which wrap the equivalent SQL functions.

To be able to propagate char * constness properly, make the argument
of quote_literal_cstr() const char *.  This also makes it more
consistent with quote_identifier().

Jan Urbański, reviewed by Hitoshi Harada, some refinements by Peter
Eisentraut
2011-02-22 23:41:23 +02:00
Peter Eisentraut 0c5933d010 Wrap PL/Python SPI calls into subtransactions
This allows the language-specific try/catch construct to catch and
handle exceptions arising from SPI calls, matching the behavior of
other PLs.

As an additional bonus you no longer get all the ugly "unrecognized
error in PLy_spi_execute_query" errors.

Jan Urbański, reviewed by Steve Singer
2011-02-02 22:06:10 +02:00
Bruce Momjian d56d246e70 Properly capitalize hyphenated words in documentation titles. 2011-02-01 17:00:26 -05:00
Alvaro Herrera 73bc5218df plpython has plpy.Error instead of plpy.ERROR
Author: Marti Raudsepp <marti@juffo.org>
2010-11-09 11:02:17 -03:00
Tom Lane 2ec993a7cb Support triggers on views.
This patch adds the SQL-standard concept of an INSTEAD OF trigger, which
is fired instead of performing a physical insert/update/delete.  The
trigger function is passed the entire old and/or new rows of the view,
and must figure out what to do to the underlying tables to implement
the update.  So this feature can be used to implement updatable views
using trigger programming style rather than rule hacking.

In passing, this patch corrects the names of some columns in the
information_schema.triggers view.  It seems the SQL committee renamed
them somewhere between SQL:99 and SQL:2003.

Dean Rasheed, reviewed by Bernd Helmle; some additional hacking by me.
2010-10-10 13:45:07 -04:00
Magnus Hagander 9f2e211386 Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00
Peter Eisentraut 8586306048 Add tip about building plpython 2 and 3. Fix link to Python docs. 2010-09-08 20:35:51 +00:00
Peter Eisentraut 2e6dc5328c Document which Python environment variables affect PL/Python 2010-08-05 18:36:33 +00:00
Peter Eisentraut 803716013d Install safeguard against running PL/Python 2 and 3 in the same session 2010-07-08 18:42:12 +00:00
Peter Eisentraut 46ee42b816 Add note that using PL/Python 2 and 3 in the same session will probably crash 2010-07-06 21:37:31 +00:00
Peter Eisentraut 1e24678349 Add some information about what it means for PL/Python to be untrusted.
Similar information already appears in the PL/Perl and PL/Tcl chapters.
2010-03-29 21:35:59 +00:00
Peter Eisentraut 51d2c9b0bb Add some documentation about PL/Python limitations
suggested by Steve White (bug #5272)
2010-03-29 21:20:58 +00:00
Bruce Momjian 6ad4249b5c Add more 9.0 release note documentation links. 2010-03-21 02:24:29 +00:00
Peter Eisentraut a401226bd8 Prevent the injection of invalidly encoded strings by PL/Python into PostgreSQL
with a few strategically placed pg_verifymbstr calls.
2010-03-18 19:43:03 +00:00
Peter Eisentraut 66cac8feab Add some more structure and bits of information to PL/Python documentation 2010-03-13 20:55:05 +00:00
Peter Eisentraut adb7764030 PL/Python DO handler
Also cleaned up some redundancies between the primary error messages and the
error context in PL/Python.

Hannu Valtonen
2010-01-22 15:45:15 +00:00
Peter Eisentraut 8f649c9ac4 Add documentation why reassigning PL/Python function parameters in the
function body can have undesirable outcomes. (bug #5232)
2009-12-19 22:23:21 +00:00
Peter Eisentraut dd4cd55c15 Python 3 support in PL/Python
Behaves more or less unchanged compared to Python 2, but the new language
variant is called plpython3u.  Documentation describing the naming scheme
is included.
2009-12-15 22:59:55 +00:00
Peter Eisentraut db7386187f PL/Python array support
Support arrays as parameters and return values of PL/Python functions.
2009-12-10 20:43:40 +00:00
Alvaro Herrera 3fe3b81183 Update URL to Python bug tracker. Backpatch to 8.3; doesn't seem worthy of
further backpatch.
2009-03-30 16:15:43 +00:00
Tom Lane 7692d8d5b7 Support statement-level ON TRUNCATE triggers. Simon Riggs 2008-03-28 00:21:56 +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
Peter Eisentraut 0f763503ff Spellchecking and such 2006-10-23 18:10:32 +00:00
Tom Lane 425417d498 Editorial improvements for recent plpython doc updates. 2006-10-21 18:33:05 +00:00
Bruce Momjian 389fad1e6b Remove use of '<' and '>' in SGML, use '&' escapes.
Update find_gt_lt to allow grep parameters to be passed into it.
2006-10-16 17:28:03 +00:00
Tom Lane 676d1b4e67 Remove duplicated index entry. 2006-09-03 22:23:58 +00:00
Tom Lane 4ae15f29f7 Fix broken markup. 2006-09-03 22:15:32 +00:00
Bruce Momjian 819f22a302 Allow PL/python to return composite types and result sets
Sven Suursoho
2006-09-02 12:30:01 +00:00
Andrew Dunstan 0a269db9cf Add table_name and table_schema to plpython trigger data, plus docs and regression test. 2006-05-26 19:23:09 +00:00
Neil Conway 4de23092d0 Add some links to the CREATE FUNCTION reference page when describing
function definition for particular PLs. Original patch from David
Fetter, editorializing by Neil Conway.
2005-05-20 01:52:25 +00:00
Bruce Momjian 0e2f88a6d5 We don't put URL's in ulink's because the URL is always generated, but
we can put words in ulink and the URL will still be printed.

per Peter
2005-04-09 03:52:43 +00:00
Bruce Momjian fd977434b3 Adjust SGML ulink tags to the URL is always displayed in our printed docs. 2005-03-31 03:54:38 +00:00
Tom Lane 883ac5ca7a More minor updates and copy-editing. 2004-12-30 21:45:37 +00:00
Tom Lane dfdae5d63c Hook up the plpython result-object nrows and status methods correctly.
Adjust documentation to match current reality.
2004-12-17 02:14:48 +00:00
Tom Lane b2c4071299 Redesign query-snapshot timing so that volatile functions in READ COMMITTED
mode see a fresh snapshot for each command in the function, rather than
using the latest interactive command's snapshot.  Also, suppress fresh
snapshots as well as CommandCounterIncrement inside STABLE and IMMUTABLE
functions, instead using the snapshot taken for the most closely nested
regular query.  (This behavior is only sane for read-only functions, so
the patch also enforces that such functions contain only SELECT commands.)
As per my proposal of 6-Sep-2004; I note that I floated essentially the
same proposal on 19-Jun-2002, but that discussion tailed off without any
action.  Since 8.0 seems like the right place to be taking possibly
nontrivial backwards compatibility hits, let's get it done now.
2004-09-13 20:10:13 +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
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
Tom Lane 6e59122490 Update obsolete examples of error messages; various other minor editing. 2003-09-12 22:17:24 +00:00
Peter Eisentraut c326d8f4f2 Add/edit index entries. 2003-08-31 17:32:24 +00:00
Tom Lane dc8dec6a70 Fix documentation comment about restricted environments, per Kevin Jacobs. 2003-07-01 13:52:29 +00:00
Tom Lane 6115224448 Rename plpython to plpythonu, and update documentation to reflect its
now-untrusted status.
2003-06-30 18:31:42 +00:00
Peter Eisentraut a8cb3368db General editing 2003-04-07 01:29:26 +00:00
Bruce Momjian b6f0c50232 Small update for the removal of some memory leaks in plpython SGML example.
Nigel J. Andrews
2002-10-21 20:34:09 +00:00
Bruce Momjian 909a8377db The valid return value should be MODIFY instead of MODIFIED.
The error message said so :-)

In 25.3. Using PL/Python

        If the trigger "when" is BEFORE, you may return None or "OK"
        from the Python function to indicate the tuple is unmodified, "SKIP"
        to abort the event, or "MODIFIED" to indicate you've modified the tuple.

should read
        If the trigger "when" is BEFORE, you may return None or "OK"
        from the Python function to indicate the tuple is unmodified, "SKIP"
        to abort the event, or "MODIFY" to indicate you've modified the tuple.

elein
2002-09-23 01:51:02 +00:00
Tom Lane 634e440b58 Fix busted markup. 2002-09-22 18:47:24 +00:00
Peter Eisentraut bc49968764 Add more appropriate markup. 2002-09-21 18:32:54 +00:00
Peter Eisentraut da123b7c58 Update installation instructions and put mostly everything in one place.
Also, some editing in PL/Perl and PL/Python chapters.
2002-09-18 20:09:32 +00:00
Peter Eisentraut b6ea172ace Spell checking and markup additions 2002-03-22 19:20:45 +00:00
Bruce Momjian ade0fe5cb4 Update docs for new stored procedure error levels. 2002-03-06 19:05:58 +00:00
Peter Eisentraut 731204e090 Editorial review 2002-01-07 02:29:15 +00:00
Thomas G. Lockhart 2475e87481 Deprecate 'current' for date/time input.
Fix up references to "PostgreSQL" rather than "Postgres". Was roughly
 evenly split between the two before. ref/ files not yet done.
2001-11-21 05:53:41 +00:00
Bruce Momjian 05979312ed Added a few paragraphs to explain current restricted execution environment,
and error handling behavior.

Bradley McLean
2001-11-20 21:09:53 +00:00
Peter Eisentraut 3c879e3738 Add some more index entries. 2001-11-12 19:19:39 +00:00
Peter Eisentraut 351a0c1736 Replace ASCII-quotes with proper markup. 2001-09-13 15:55:24 +00:00
Bruce Momjian 33a82e7fd8 Here's some matching documentation, including some other
undocumented items in TD.

Should doc patches alse be sent to pgsql-patches, or do I
have to subscribe to pgsql-docs?

The archive link for pgsql-patches is broken, and I don't
see any patches in spot checking the archive for pgsql-docs.

-Brad McLean.
2001-09-12 03:58:15 +00:00
Peter Eisentraut a457d33516 Markup and spell-check run over Programmer's Guide (rather incomplete still). 2001-09-10 21:58:47 +00:00
Peter Eisentraut bbc3920fe9 PL/Python should build portably now, if you can get over the fact that
there's no shared libpython.  Test suite works as well. Also, add some
documentation.
2001-05-12 17:49:32 +00:00