Commit Graph

123 Commits

Author SHA1 Message Date
Andrew Dunstan 05672e5045 Add utility functions to PLPerl:
quote_literal, quote_nullable, quote_ident,
    encode_bytea, decode_bytea, looks_like_number,
    encode_array_literal, encode_array_constructor.
Split SPI.xs into two - SPI.xs now contains only SPI functions. Remainder
are in new Util.xs.
Some more code and documentation cleanup along the way, as well as
adding some CVS markers to files missing them.

Original patch from Tim Bunce, with a little editing from me.
2010-01-20 01:08:21 +00:00
Andrew Dunstan a2b34b16be Tidy up and refactor plperl.c.
- Changed MULTIPLICITY check from runtime to compiletime.
    No loads the large Config module.
- Changed plperl_init_interp() to return new interp
    and not alter the global interp_state
- Moved plperl_safe_init() call into check_interp().
- Removed plperl_safe_init_done state variable
    as interp_state now covers that role.
- Changed plperl_create_sub() to take a plperl_proc_desc argument.
- Simplified return value handling in plperl_create_sub.
- Changed perl.com link in the docs to perl.org and tweaked
    wording to clarify that require, not use, is what's blocked.
- Moved perl code in large multi-line C string literal macros
    out to plc_*.pl files.
- Added a test2macro.pl utility to convert the plc_*.pl files to
    macros in a perlchunks.h file which is #included
- Simplifed plperl_safe_init() slightly
- Optimized pg_verifymbstr calls to avoid unneeded strlen()s.

Patch from Tim Bunce, with minor editing from me.
2010-01-09 02:40:50 +00:00
Tom Lane 42b2907d12 Add support for anonymous code blocks (DO blocks) to PL/Perl.
Joshua Tolley, reviewed by Brendan Jurd and Tim Bunce
2009-11-29 03:02:27 +00:00
Peter Eisentraut 1a6d678f00 Clarify the documentation about PL/Perl nested subroutines, per Josh
Berkus.
2009-08-15 00:33:12 +00:00
Alvaro Herrera e863951a59 Remove mention of DBD::PgSPI, which is unmaintained and generally unnecessary. 2008-04-10 15:16:46 +00:00
Tom Lane 7692d8d5b7 Support statement-level ON TRUNCATE triggers. Simon Riggs 2008-03-28 00:21:56 +00:00
Andrew Dunstan a794b99a31 Fix example of de-escaping bytea argument, per Florian Weimer. Also fix example
of escaping bytea return value. Both cases did not handle backslash values properly.
2008-01-25 15:28:35 +00:00
Andrew Dunstan 774de1d90a Make clearer how arguments and return values in pl/perl are escaped. This is to clarify the situation that Theo Schlossnagle recently reported on -bugs. 2007-05-04 14:55:32 +00:00
Neil Conway 75b4ee1cd1 Fix some typos in the documentation. Patch from Brian Gough. Backport
the relevant fixes to 8.2 as well.
2007-05-03 15:05:56 +00:00
Bruce Momjian 4ab7ea5ace Remove tabs from SGML files to help tag alingment and improve
detection of tabs are added in the future.
2007-02-16 03:50:29 +00:00
Bruce Momjian 8b4ff8b6a1 Wording cleanup for error messages. Also change can't -> cannot.
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".
2007-02-01 19:10:30 +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
Andrew Dunstan 751e3e6bd8 Force plperl and plperlu to run in separate interpreters. Create an error
on an attempt to create the second interpreter if this is not supported by
the perl installation. Per recent -hackers discussion.
2006-11-13 17:13:57 +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 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
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 21e343da35 Make plperl's $_TD trigger data a global rather than a lexical variable,
with a fresh local value for each invocation, to avoid unexpected sharing
violations. Per recent -hackers discussion.
2006-05-29 13:51:23 +00:00
Andrew Dunstan 777f72cd37 Add table_name and table_schema to plperl trigger data. relname is
kept but now deprecated. Patch from Adam Sjøgren. Add regression test to
show plperl trigger data (Andrew).
TBD: apply similar changes to plpgsql, plpython and pltcl.
2006-05-26 17:34:16 +00:00
Bruce Momjian 497b5ad928 Make $PostgreSQL CVS tags consistent for SGML files. 2006-03-10 19:10:50 +00:00
Andrew Dunstan 5d723d05c0 Prepared queries for PLPerl, plus fixing a small plperl memory leak. Patch
and docs from Dmitry Karasik, slightly editorialised.
2006-03-05 16:40:51 +00:00
Neil Conway 8e5a10d46c This patch makes the error message strings throughout the backend
more compliant with the error message style guide. In particular,
errdetail should begin with a capital letter and end with a period,
whereas errmsg should not. I also fixed a few related issues in
passing, such as fixing the repeated misspelling of "lexeme" in
contrib/tsearch2 (per Tom's suggestion).
2006-03-01 06:30:32 +00:00
Peter Eisentraut 39dfbe5791 Spellchecking run, final cleanups 2005-11-04 23:14:02 +00:00
Andrew Dunstan 24fa8746ae Fix incorrect wording about function failure time on unsafe ops - these
are now caught by the validator. And a small visit from the perl style police:
check the return value from open().
2005-10-24 15:39:50 +00:00
Andrew Dunstan 48f3d77858 replace use of predefined perl vars $a and $b with $x and $y - per Greg Sabino Mullane 2005-10-18 22:53:54 +00:00
Bruce Momjian 6b97e437ca Add warning about plperl nested named subroutines
Andrew Dunstan
2005-10-12 14:28:33 +00:00
Tom Lane 9005b757f5 Mention BEGIN { strict->import(); } as a substitute for 'use strict'
in plperl functions.
2005-08-24 19:16:49 +00:00
Tom Lane 95f202c021 Adjust description of use_strict parameter. Some other minor editorial
cleanup.
2005-08-24 18:56:07 +00:00
Bruce Momjian fab177e64f Improve documention on loading large data sets into plperl.
David Fetter
2005-08-12 21:42:53 +00:00
Neil Conway d6375d6109 Documentation for some new PL/Perl features. Patch from David Fetter,
various editorialization from Neil Conway.
2005-07-13 02:10:42 +00:00
Bruce Momjian bebe7c5600 Here's a patch to do the following:
1. Rename spi_return_next to return_next.
2. Add a new test for return_next.
3. Update the expected output.
4. Update the documentation.

Abhijit Menon-Sen
2005-06-05 03:16:42 +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
Bruce Momjian be105bd789 Please find enclosed another patch that now (I hope) really is
correct.  It's in addition to the previous patch.

David Fetter
2005-01-17 17:29:49 +00:00
Bruce Momjian 6ea9da1ee0 Please find enclosed a patch to the pl/perl documents that correctly
tells what arguments go to pl/perl triggers.

David Fetter
2005-01-17 03:04:17 +00:00
Tom Lane 883ac5ca7a More minor updates and copy-editing. 2004-12-30 21:45:37 +00:00
Peter Eisentraut 5ec30faee6 Spell checker run 2004-12-13 18:05:10 +00:00
Peter Eisentraut d89042b443 Patch to the pl/perl documents that clarifies the scope of global data and
gives an example of storing a code reference

by David Fetter
2004-12-11 20:03:37 +00:00
Tom Lane 35f4994133 Fix plperl and pltcl error handling per my previous proposal. SPI
operations are now run as subtransactions, so that errors in them
can be reported as ordinary Perl or Tcl errors and caught by the
normal error handling convention of those languages.  Also do some
minor code cleanup in pltcl.c: extract a large chunk of duplicated
code in pltcl_SPI_execute and pltcl_SPI_execute_plan into a shared
subroutine.
2004-11-21 21:17:07 +00:00
Tom Lane 88969ea11a Fix incorrect documentation of plperl's method for accessing the number
of rows processed by a SPI query (David Fetter); also some other minor
editorial cleanup (Tom Lane).
2004-11-19 23:22:54 +00:00
Peter Eisentraut a981b02336 Reduce formatting entropy 2004-11-06 14:32:10 +00:00
Bruce Momjian bdb8b394c4 This patch clarifies the usage of references in PL/Perl :)
David Fetter
2004-10-15 16:51:48 +00:00
Tom Lane 2f48836b1f Some editorializing on the docs for the dollar-quoting feature: fix
grammar, don't drop discussions into the middle of unrelated discussions,
etc.
2004-09-20 22:48:29 +00:00
Bruce Momjian 1f0a19c263 The enclose patch clarifies and makes a more useful example for the
Global Values in PL/Perl section of the documents.

David Fetter
2004-08-18 03:37:56 +00:00
Bruce Momjian 8eeae3e11c Please find enclosed a patch that matches the PL/Perl documentation
(fairly closely, I hope) to the current PL/Perl implementation.

David Fetter
2004-07-21 20:44:52 +00:00
Bruce Momjian 7a55ba7615 Back out pg_autovacuum commit after cvs clean failure causes commit. 2004-07-21 20:34:50 +00:00
Bruce Momjian 8dec0c1bf2 lease find enclosed a patch that matches the PL/Perl documentation
(fairly closely, I hope) to the current PL/Perl implementation.

David Fetter
2004-07-21 20:23:05 +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 0b52062265 This patch makes some improvements and adds some additional detail
to the documentation on routine database maintainence activities.
I also corrected a bunch of SGML markup.
2003-12-14 00:10:32 +00:00
PostgreSQL Daemon 969685ad44 $Header: -> $PostgreSQL Changes ... 2003-11-29 19:52:15 +00:00
Peter Eisentraut c326d8f4f2 Add/edit index entries. 2003-08-31 17:32:24 +00:00
Peter Eisentraut a8cb3368db General editing 2003-04-07 01:29:26 +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
Bruce Momjian ade0fe5cb4 Update docs for new stored procedure error levels. 2002-03-06 19:05:58 +00:00
Tom Lane c4bab5f29b Overhaul plperl documentation. 2002-01-25 19:13:15 +00:00
Peter Eisentraut f8728467ff Point to main CPAN site, and reword a little. 2002-01-08 16:13:41 +00:00
Bruce Momjian cc9ae0b63c Update bad URL's with good ones. 2002-01-08 05:39:26 +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
Peter Eisentraut a457d33516 Markup and spell-check run over Programmer's Guide (rather incomplete still). 2001-09-10 21:58:47 +00:00
Bruce Momjian 9e39ffe4cd Attached is documentation describing plperlu differences from plperl.
Alex Pilosov
2001-06-22 21:37:14 +00:00
Peter Eisentraut 01839df6dd Add index. Only some parts of the manual set have index entries so far... 2001-05-12 22:51:36 +00:00
Peter Eisentraut 1b555ce791 Replace incorrect uses of 'which' with 'that'. (so-called "wicked which") 2000-12-22 18:57:50 +00:00
Peter Eisentraut f824d4a363 Polish PL/Perl documentation. The README file got shrunk to being a
pointer into the real documentation.
2000-12-19 18:16:26 +00:00
Peter Eisentraut 72ad5fe15c Add `id' attributes to all `chapter' and `sect1' tags, to generate useful
names for the HTML files (e.g., not x4856.htm).
2000-09-29 20:21:34 +00:00
Bruce Momjian 3b5338da25 More single-quote fixes. 2000-05-09 18:30:43 +00:00
Thomas G. Lockhart fb43d74762 Use a uniform chapter title for all of the procedural languages. 2000-03-31 06:17:21 +00:00
Thomas G. Lockhart 73d8bbc2ac Minor markup changes. Refer to (".../catalog") in the emacs hints. 2000-03-31 03:27:42 +00:00
Thomas G. Lockhart a1c89ea15d Split off language-specific docs to their own chapters.
Add PL/perl docs from Mark Hollomon.
Put language-specific docs into the User's Guide, and move the rest
 to the Programmer's Guide.
2000-03-30 22:13:30 +00:00