summaryrefslogtreecommitdiff
path: root/src/pl/plpython
AgeCommit message (Collapse)Author
2011-11-09Only install the extension files for the current Python major versionPeter Eisentraut
2011-09-16Redesign the plancache mechanism for more flexibility and efficiency.Tom Lane
Rewrite plancache.c so that a "cached plan" (which is rather a misnomer at this point) can support generation of custom, parameter-value-dependent plans, and can make an intelligent choice between using custom plans and the traditional generic-plan approach. The specific choice algorithm implemented here can probably be improved in future, but this commit is all about getting the mechanism in place, not the policy. In addition, restructure the API to greatly reduce the amount of extraneous data copying needed. The main compromise needed to make that possible was to split the initial creation of a CachedPlanSource into two steps. It's worth noting in particular that SPI_saveplan is now deprecated in favor of SPI_keepplan, which accomplishes the same end result with zero data copying, and no need to then spend even more cycles throwing away the original SPIPlan. The risk of long-term memory leaks while manipulating SPIPlans has also been greatly reduced. Most of this improvement is based on use of the recently-added MemoryContextSetParent primitive.
2011-08-18Change PyInit_plpy to external linkagePeter Eisentraut
Module initialization functions in Python 3 must have external linkage, because PyMODINIT_FUNC does dllexport on Windows-like platforms. Without this change, the build with Python 3 fails on Windows.
2011-08-18Hide unused variable warnings under Python 3Peter Eisentraut
2011-08-17Fix two issues in plpython's handling of composite results.Tom Lane
Dropped columns within a composite type were not handled correctly. Also, we did not check for whether a composite result type had changed since we cached the information about it. Jan Urbański, per a bug report from Jean-Baptiste Quenot
2011-08-17Translation updatesPeter Eisentraut
2011-08-04Restore the primacy of postgres.h in plpython.c.Andrew Dunstan
To avoid having the python headers hijack various definitions, we now include them after all the system headers we want, having first undefined some of the things they want to define. After that's done we restore the things they scribbled on that matter, namely our snprintf and vsnprintf macros, if we're using them.
2011-07-16Replace errdetail("%s", ...) with errdetail_internal("%s", ...).Tom Lane
There may be some other places where we should use errdetail_internal, but they'll have to be evaluated case-by-case. This commit just hits a bunch of places where invoking gettext is obviously a waste of cycles.
2011-07-04Move Trigger and TriggerDesc structs out of rel.h into a new reltrigger.hAlvaro Herrera
This lets us stop including rel.h into execnodes.h, which is a widely used header.
2011-07-03Put comments on the installable procedural languages.Tom Lane
Per suggestion from Josh Kupershmidt.
2011-07-03Make distprep and *clean build targets recurse into all subdirectories.Tom Lane
Certain subdirectories do not get built if corresponding options are not selected at configure time. However, "make distprep" should visit such directories anyway, so that constructing derived files to be included in the tarball happens without requiring all configure options to be given in the tarball build script. Likewise, it's better if cleanup actions unconditionally visit all directories (for example, this ensures proper cleanup if someone has done a manual make in such a subdirectory). To handle this, set up a convention that subdirectories that are conditionally included in SUBDIRS should be added to ALWAYS_SUBDIRS instead when they are excluded. Back-patch to 9.1, so that plpython's spiexceptions.h will get provided in 9.1 tarballs. There don't appear to be any instances where distprep actions got missed in previous releases, and anyway this fix requires gmake 3.80 so we don't want to apply it before 9.1.
2011-06-27Add the possibility to pass --flag arguments to xgettext callsPeter Eisentraut
The --flag argument can be used to tell xgettext the arguments of which functions should be flagged with c-format in the PO files, instead of guessing based on the presence of format specifiers, which fails if no format specifiers are present but the translation accidentally introduces one. Appropriate flag settings have been added for each message catalog. based on a patch by Christoph Berg for bug #6066
2011-06-27Refactor common gettext triggersPeter Eisentraut
Put gettext trigger words that are common to the backend and backend modules into a makefile variable to include everywhere, to avoid error-prone repetitions.
2011-06-26Replace := by = in nls.mk filesPeter Eisentraut
It currently doesn't make a difference, but it's inconsistent with most other usage, and it might interfere with a future patch, so I'll change it all in a separate commit. Also, replace tabs with spaces for alignment.
2011-06-09Translation updates for 9.1beta2Peter Eisentraut
2011-06-09Pgindent run before 9.1 beta2.Bruce Momjian
2011-05-21Message style improvementsPeter Eisentraut
2011-05-02Catch errors in for loop in makefilePeter Eisentraut
Add "|| exit" so that the rule aborts when a command fails.
2011-05-02Rewrite installation makefile rules without for loopsPeter Eisentraut
install-sh can install multiple files at once, so for loops are not necessary. This was already changed for the rest of the code some time ago, but pgxs.mk was apparently forgotten, and the obsolete coding style has now been copied to the PLs as well. This also fixes the problem that the for loops in question did not catch errors.
2011-04-28Use a macro variable PG_PRINTF_ATTRIBUTE for the style used for checking ↵Andrew Dunstan
printf type functions. The style is set to "printf" for backwards compatibility everywhere except on Windows, where it is set to "gnu_printf", which eliminates hundreds of false error messages from modern versions of gcc arising from %m and %ll{d,u} formats.
2011-04-20Fix PL/Python traceback for error in separate filePeter Eisentraut
It assumed that the lineno from the traceback always refers to the PL/Python function. If you created a PL/Python function that imports some code, runs it, and that code raises an exception, PLy_traceback would get utterly confused. Now we look at the file name reported with the traceback and only print the source line if it came from the PL/Python function. Jan Urbański
2011-04-16Set client encoding explicitly in plpython_unicode testPeter Eisentraut
This will (hopefully) eliminate the need for the plpython_unicode_0.out expected file.
2011-04-10pgindent run before PG 9.1 beta 1.Bruce Momjian
2011-04-08Fix some sloppiness in new PL/python get_source_line() function.Robert Haas
Jan Urbański
2011-04-06Update regression test files for PL/Python traceback patchPeter Eisentraut
2011-04-06Add traceback information to PL/Python errorsPeter Eisentraut
This mimics the traceback information the Python interpreter prints with exceptions. Jan Urbański
2011-03-31Don't leak the temporary PLyProcedure struct we create for inline plpythonHeikki Linnakangas
blocks. Investigation by Jan Urbański, though I didn't use his patch.
2011-03-17Fix PL/Python memory leak involving array slicesAlvaro Herrera
Report and patch from Daniel Popowich, bug #5842 (with some debugging help from Alex Hunsaker)
2011-03-07Fix behavior when raising plpy.Fatal()Peter Eisentraut
It should cause a elog(FATAL) error, and it fact it was simply causing a elog(ERROR). Jan Urbański
2011-03-07Report Python errors from iterators with PLy_elogPeter Eisentraut
This improves reporting, as the error string now includes the actual Python exception. As a side effect, this no longer sets the errcode to ERRCODE_DATA_EXCEPTION, which might be considered a feature, as it's not documented and not clear why iterator errors should be treated differently. Jan Urbański
2011-03-06Suppress some "variable might be clobbered by longjmp" warnings.Tom Lane
Seen with an older gcc version. I'm not sure these represent any real risk factor, but still a bit scary. Anyway we have lots of other volatile-marked variables in this code, so a couple more won't hurt.
2011-03-05Fix parallel gmake for extension directory addition in PL languages.Bruce Momjian
2011-03-05Make plpythonu language use plpython2 shared library directly.Tom Lane
The original scheme for this was to symlink plpython.$DLSUFFIX to plpython2.$DLSUFFIX, but that doesn't work on Windows, and only accidentally failed to fail because of the way that CREATE LANGUAGE created or didn't create new C functions. My changes of yesterday exposed the weakness of that approach. To fix, get rid of the symlink and make pg_pltemplate show what's really going on.
2011-03-04Create extension infrastructure for the core procedural languages.Tom Lane
This mostly just involves creating control, install, and update-from-unpackaged scripts for them. However, I had to adjust plperl and plpython to not share the same support functions between variants, because we can't put the same function into multiple extensions. catversion bump forced due to new contents of pg_pltemplate, and because initdb now installs plpgsql as an extension not a bare language. Add support for regression testing these as extensions not bare languages. Fix a couple of other issues that popped up while testing this: my initial hack at pg_dump binary-upgrade support didn't work right, and we don't want an extra schema permissions test after all. Documentation changes still to come, but I'm committing now to see whether the MSVC build scripts need work (likely they do).
2011-03-03Add a comment explaining the recent fix for plpython breakage in commit 4c966d9.Andrew Dunstan
Mostly text supplied by Jan Urbański.
2011-03-01Fix plpython breakage detected on certain Fedora machines on buildfarm.Andrew Dunstan
Patch from Jan Urbański.
2011-03-01Additional PL/Python regression test expected filePeter Eisentraut
plpython_subtransaction test needs a separate expected file specifically for Python 2.5.
2011-02-28Unbreak vpath builds broken by commit 474a42473adf9b18417242f1fc0691a857ec578b.Andrew Dunstan
2011-02-28Fix regression tests after PL/Python custom SPI exceptions patchPeter Eisentraut
2011-02-28PL/Python custom SPI exceptionsPeter Eisentraut
This provides a separate exception class for each error code that the backend defines, as well as the ability to get the SQLSTATE from the exception object. Jan Urbański, reviewed by Steve Singer
2011-02-27PL/Python explicit subtransactionsPeter Eisentraut
Adds a context manager, obtainable by plpy.subtransaction(), to run a group of statements in a subtransaction. Jan Urbański, reviewed by Steve Singer, additional scribbling by me
2011-02-27Remove remaining expected file for Python 2.2Peter Eisentraut
We don't have complete expected coverage for Python 2.2 anyway, so it doesn't seem worth keeping this one around that no one appears to be updating anyway. Visual inspection of the differences ought to be good enough for those few who care about this obsolete Python version.
2011-02-26Table function support for PL/PythonPeter Eisentraut
This allows functions with multiple OUT parameters returning both one or multiple records (RECORD or SETOF RECORD). Jan Urbański, reviewed by Hitoshi Harada
2011-02-22Add PL/Python functions for quoting stringsPeter Eisentraut
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-19Invalidate PL/Python functions with composite type argument when thePeter Eisentraut
type changes. The invalidation will cause the type information to be refetched, and everything will work. Jan Urbański, reviewed by Alex Hunsaker
2011-02-16Fix for warnings-free compilation with Python 3.2Peter Eisentraut
The first argument of PyEval_EvalCode() was changed from PyCodeObject* to PyObject* because of PEP 384.
2011-02-15Allow make check in PL directoriesPeter Eisentraut
Also add make check-world target, and refactor pg_regress invocation code in makefiles a bit.
2011-02-02Clean up missed change to plpython expected files.Tom Lane
2011-02-02Wrap PL/Python SPI calls into subtransactionsPeter Eisentraut
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-01Add validator to PL/PythonPeter Eisentraut
Jan Urbański, reviewed by Hitoshi Harada