summaryrefslogtreecommitdiff
path: root/src/pl/tcl/pltcl.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a dozen or so places that were passing unpredictable data stringsTom Lane2002-11-221-2/+2
| | | | | as elog format strings. Hai-Chen Tu pointed out the problem in contrib/dbmirror, but it wasn't the only such error.
* Fix within-function memory leaks in the various PLs' interfaces toTom Lane2002-10-191-3/+6
| | | | | | | SPI_prepare: they all save the prepared plan into topCxt, and so the procCxt copy that's actually returned by SPI_prepare ought to be freed. Diagnosis and plpython fix by Nigel Andrews, followup for other PLs by Tom Lane.
* I have attached two patches as per:Bruce Momjian2002-10-141-24/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) pltcl: Add SPI_freetuptable() calls to avoid memory leaks (Me + Neil Conway) Change sprintf()s to snprintf()s (Neil Conway) Remove header files included elsewhere (Neil Conway) 2)plpython: Add SPI_freetuptable() calls to avoid memory leaks Cosemtic change to remove a compiler warning Notes: I have tested pltcl.c for a) the original leak problem reported for the repeated call of spi_exec in a TCL fragment and b) the subsequent report resulting from the use of spi_exec -array in a TCL fragment. The plpython.c patch is exactly the same as that applied to make revision 1.23, the plpython_schema.sql and feature.expected sections of the patch are also the same as last submited, applied and subsequently reversed out. It remains untested by me (other than via make check). However, this should be safe provided PyString_FromString() _copies_ the given string to make a PyObject. Nigel J. Andrews
* Back out /pl memory leak patch. Wait for new version.Bruce Momjian2002-09-261-11/+1
|
* I have attached the pltcl patch again, just in case. For the sake of clarityBruce Momjian2002-09-261-1/+11
| | | | | | | | | | | | | | let's say this patch superscedes the previous one. I have also attached a patch addressing the similar memory leak problem in plpython. This includes a slight adjustment of the tests in the source directory. The patch also includes a cosmetic change to remove a compiler warning although I think the change makes the code look worse though. BTW, by my reckoning the memory leak would occur with prepared plans and without. If that is not the case then I've been barking up the wrong tree. Nigel J. Andrews
* Provide an upgrade strategy for dump files containing functions declaredTom Lane2002-09-211-3/+2
| | | | | | | | with OPAQUE. CREATE LANGUAGE, CREATE TRIGGER, and CREATE TYPE will all accept references to functions declared with OPAQUE --- but they will issue a NOTICE, and will modify the function entries in pg_proc to have the preferred type-safe argument or result types instead of OPAQUE. Per recent pghackers discussions.
* pgindent run.Bruce Momjian2002-09-041-3/+3
|
* Add a bunch of pseudo-types to replace the behavior formerly associatedTom Lane2002-08-221-12/+37
| | | | | | 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 ...
* oid is needed, it is added at the end of the struct (after the nullBruce Momjian2002-07-201-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | bitmap, if present). Per Tom Lane's suggestion the information whether a tuple has an oid or not is carried in the tuple descriptor. For debugging reasons tdhasoid is of type char, not bool. There are predefined values for WITHOID, WITHOUTOID and UNDEFOID. This patch has been generated against a cvs snapshot from last week and I don't expect it to apply cleanly to current sources. While I post it here for public review, I'm working on a new version against a current snapshot. (There's been heavy activity recently; hope to catch up some day ...) This is a long patch; if it is too hard to swallow, I can provide it in smaller pieces: Part 1: Accessor macros Part 2: tdhasoid in TupDesc Part 3: Regression test Part 4: Parameter withoid to heap_addheader Part 5: Eliminate t_oid from HeapTupleHeader Part 2 is the most hairy part because of changes in the executor and even in the parser; the other parts are straightforward. Up to part 4 the patched postmaster stays binary compatible to databases created with an unpatched version. Part 5 is small (100 lines) and finally breaks compatibility. Manfred Koizar
* Fix typo (PG_UNICODE -> PG_UTF8)Tatsuo Ishii2002-07-181-3/+3
|
* Fix breakage for pltcl modules. pg_get_enconv_by_encoding() has beenTatsuo Ishii2002-07-181-15/+3
| | | | changed since CREATE CONVERSION supported.
* This patch wraps all accesses to t_xmin, t_cmin, t_xmax, and t_cmax inBruce Momjian2002-06-151-5/+5
| | | | | | | | | | | HeapTupleHeaderData in setter and getter macros called HeapTupleHeaderGetXmin, HeapTupleHeaderSetXmin etc. It also introduces a "virtual" field xvac by defining HeapTupleHeaderGetXvac and HeapTupleHeaderSetXvac. Xvac is used by VACUUM, in fact it is stored in t_cmin. Manfred Koizar
* Fix coding error in UTF conversion.Tom Lane2002-05-241-3/+5
|
* Add 'volatile' to suppress gcc warning. Not sure why this warningTom Lane2002-05-241-2/+2
| | | | wasn't seen before, maybe the Tcl compiler flags were less strict.
* pg_type has a typnamespace column; system now supports creating typesTom Lane2002-03-291-13/+11
| | | | | | in different namespaces. Also, cleanup work on relation namespace support: drop, alter, rename commands work for tables in non-default namespaces.
* Add new elog() levels to stored procedure languages. plperl DEBUG hackBruce Momjian2002-03-061-4/+6
| | | | still needed because only removed in 7.4.
* Change made to elog:Bruce Momjian2002-03-061-5/+7
| | | | | | | | | | | | | | | | | | | o Change all current CVS messages of NOTICE to WARNING. We were going to do this just before 7.3 beta but it has to be done now, as you will see below. o Change current INFO messages that should be controlled by client_min_messages to NOTICE. o Force remaining INFO messages, like from EXPLAIN, VACUUM VERBOSE, etc. to always go to the client. o Remove INFO from the client_min_messages options and add NOTICE. Seems we do need three non-ERROR elog levels to handle the various behaviors we need for these messages. Regression passed.
* Commit to match discussed elog() changes. Only update is that LOG isBruce Momjian2002-03-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | now just below FATAL in server_min_messages. Added more text to highlight ordering difference between it and client_min_messages. --------------------------------------------------------------------------- REALLYFATAL => PANIC STOP => PANIC New INFO level the prints to client by default New LOG level the prints to server log by default Cause VACUUM information to print only to the client NOTICE => INFO where purely information messages are sent DEBUG => LOG for purely server status messages DEBUG removed, kept as backward compatible DEBUG5, DEBUG4, DEBUG3, DEBUG2, DEBUG1 added DebugLvl removed in favor of new DEBUG[1-5] symbols New server_min_messages GUC parameter with values: DEBUG[5-1], INFO, NOTICE, ERROR, LOG, FATAL, PANIC New client_min_messages GUC parameter with values: DEBUG[5-1], LOG, INFO, NOTICE, ERROR, FATAL, PANIC Server startup now logged with LOG instead of DEBUG Remove debug_level GUC parameter elog() numbers now start at 10 Add test to print error message if older elog() values are passed to elog() Bootstrap mode now has a -d that requires an argument, like postmaster
* pltcl's spi_execp didn't handle NULL arguments quite correctly.Tom Lane2002-01-241-49/+23
| | | | | It would try to call the input conversion routines for them anyway. So, a valid input string for the datatype had to be supplied.
* New pgindent run with fixes suggested by Tom. Patch manually reviewed,Bruce Momjian2001-11-051-4/+4
| | | | initdb/regression tests pass.
* pgindent run on all C files. Java run to follow. initdb/regressionBruce Momjian2001-10-251-33/+36
| | | | tests pass.
* Fix a lot of confusion between typlen and typmod. Didn't hurt too muchTom Lane2001-10-191-30/+28
| | | | back when only varlena types paid any attention to typmod ...
* Fix pltcl to update cached function def afterTom Lane2001-10-191-389/+311
| | | | CREATE OR REPLACE FUNCTION.
* Attached patch for unconditional enabling of pltcl-unknown support.Bruce Momjian2001-10-131-9/+1
| | | | | | | | Enabling this feature adds very light overhead of 1 select from pg_class on first using of pl/tcl in backend if unknown suppport is really unused. But pl/tcl with this support has very improved functionality. Patch includes changes to documentation.
* Rearrange fmgr.c and relcache so that it's possible to keep FmgrInfoTom Lane2001-10-061-9/+5
| | | | | | | | | lookup info in the relcache for index access method support functions. This makes a huge difference for dynamically loaded support functions, and should save a few cycles even for built-in ones. Also tweak dfmgr.c so that load_external_function is called only once, not twice, when doing fmgr_info for a dynamically loaded function. All per performance gripe from Teodor Sigaev, 5-Oct-01.
* elog command need to use unicode conversion too.Bruce Momjian2001-10-041-2/+4
| | | | Vsevolod Lobko
* This patch adds reporting of tcl global variable errorInfoBruce Momjian2001-10-041-3/+11
| | | | | | | | | which contains stack trace. One problem, after this patch errors will generate multiline ERROR messages. Is it acceptable or do I need split it and generate multiple singleline messages? Vsevolod Lobko
* > > > > > - PostgreSQL requires to be compiled with --enable-multibyteBruce Momjian2001-10-011-8/+37
| | | | | | | | | | | | | | | | | | | > > > > > and --enable-unicode-convertion if it ought to work correctly > > > > > with Tcl/Tk >= 8.1 (client or server side). > > > > > > > > > > - PL/Tcl needs to be changed to use pg_do_encoding_conversion > > > > > if it runs on a Tcl version >= 8.1 . > > > > > > > I'll do pl/tcl part in the next version of patch. Using this approach we > > > > can eliminate overhead for databases in UNICODE. > > > > > > Any progress on this? I'd prefer to get rid of this --enable-pltcl-utf > > > option before release. > > > > Done > > > > Next version removes --enable-pltcl-utf switch and enables embedded > > utf conversion of pgsql if tcl version >=8.1 and --enable-unicode-conversion
* Next version of patch.Bruce Momjian2001-09-061-12/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now with documentation update and disabling of UTF conversion for Tcl <=8.0 On Fri, 24 Aug 2001, Vsevolod Lobko wrote: > On Thu, 23 Aug 2001, Tom Lane wrote: > > > > Is this looks better? > > > > It does, but one small gripe: the lack of semicolons will probably cause > > pg_indent to mess up the indentation. (I know emacs' autoindent mode > > will not work nicely with it, either.) Please set up the macros so that > > you write > > > > UTF_BEGIN; > > Tcl_DStringAppend(&unknown_src, UTF_E2U(part), -1); > > UTF_END; > > > > and then I'll be happy. > > Attached revised patch > > > Your point about overhead is a good one, so I retract the gripe about > > using a configure switch. But please include documentation patches to > > describe the configure option in the administrator's guide (installation > > section). > > This patch still uses configure switch for enabling feature. > > For enabling based on tcl version we have 2 posibilites: > 1) having feature enabled by default, but in pltcl.c check for tcl > version and disable it for old versions > 2) enable or disable at configure time based on tcl version, but there > are problem - current configure don't checks for tcl version at all > and my configure skills not enought for adding this > Vsevolod Lobko
* I noticed that pltcl didn't have any way to get to SPI_lastoid like plpgsql ↵Bruce Momjian2001-08-021-2/+21
| | | | | | | | | | | | | | | | | does.. I started using pltcl a lot because I like to decide when and how my queries get planned.. so I put one together really quick Sorry I don't have the original around to make a quick diff, but its a very small change... I think this should be in the next release, there's no reason not to have it. its a function with no expected arguments, so you can use it like: spi_exec "INSERT INTO mytable(columns...) VALUES(values..)" set oid [spi_lastoid] spi_exec "SELECT mytable_id from mytable WHERE oid=$oid" It just didn't make sense for me to use plpgsql and pltcl, or just screw them both and use SPI from C. bob@redivi.com
* Fix a few missed NOIND usages.Tom Lane2001-06-091-3/+1
|
* pltcl, plperl, and plpython all suffer the same bug previously fixedTom Lane2001-06-011-5/+26
| | | | | | | | in plpgsql: they fail for datatypes that have old-style I/O functions due to caching FmgrInfo structs with wrong fn_mcxt lifetime. Although the plpython fix seems straightforward, I can't check it here since I don't have Python installed --- would someone check it?
* Cleanups of pltcl unknown thingy.Peter Eisentraut2001-05-111-8/+9
|
* pgindent run. Make it all clean.Bruce Momjian2001-03-221-44/+44
|
* > Applied. Thanks.Bruce Momjian2001-03-071-2/+2
| | | | | | | | | | | One more :)) It's for improper function argumets for PLTCL_UNKNOWN_SUPPORT code I'm not an autoconf expert, but is it possible to enable unknown support in pltcl with configure option ? This support is really handy for real life usage of pl/tcl. seva@sevasoft.kiev.ua
* Fix bugs in pltcl's new return_null command: it was liable to go belly upTom Lane2001-02-161-20/+41
| | | | | | | if the return datatype's input converter was at all strict, because the converter would get called on junk data when returning NULL. Also ensure that it gives an error rather than coredumping if someone tries to use it in a trigger function.
* Improve error message for erroneous use of 'opaque' as pltcl argumentTom Lane2000-12-081-5/+12
| | | | or return type.
* Revise handling of oldstyle/newstyle functions per recent discussionsTom Lane2000-11-201-1/+8
| | | | | | | | | in pghackers list. Support for oldstyle internal functions is gone (no longer needed, since conversion is complete) and pg_language entry 'internal' now implies newstyle call convention. pg_language entry 'newC' is gone; both old and newstyle dynamically loaded C functions are now called language 'C'. A newstyle function must be identified by an associated info routine. See src/backend/utils/fmgr/README.
* Change SearchSysCache coding conventions so that a reference count isTom Lane2000-11-161-27/+42
| | | | | | | maintained for each cache entry. A cache entry will not be freed until the matching ReleaseSysCache call has been executed. This eliminates worries about cache entries getting dropped while still in use. See my posting to pg-hackers of even date for more info.
* Added untrusted PL/TclU (pltclu) language. Executes all proceduresJan Wieck2000-07-191-118/+251
| | | | | | | | | | in a non-safe interpreter, so with full OS access! Language is restricted to be used by DB superusers. Added "argisnull n" and "return_null" commands to gain full control over NULL values from new FMGR capabilities. Jan
* Update textin() and textout() to new fmgr style. This is just phaseTom Lane2000-07-051-3/+5
| | | | | one of updating the whole text datatype, but there are so dang many calls of these two routines that it seems worth a separate commit.
* Latest round of fmgr updates. All functions with bool,char, or int2Tom Lane2000-06-051-2/+3
| | | | | | | inputs have been converted to newstyle. This should go a long way towards fixing our portability problems with platforms where char and short parameters are passed differently from int-width parameters. Still more to do for the Alpha port however.
* Third round of fmgr updates: eliminate calls using fmgr() andTom Lane2000-05-301-31/+24
| | | | | fmgr_faddr() in favor of new-style calls. Lots of cleanup of sloppy casts to use XXXGetDatum and DatumGetXXX ...
* Second round of fmgr changes: triggers are now invoked in new style,Tom Lane2000-05-291-11/+5
| | | | CurrentTriggerData is history.
* First round of changes for new fmgr interface. fmgr itself and theTom Lane2000-05-281-48/+44
| | | | | | | key call sites are changed, but most called functions are still oldstyle. An exception is that the PL managers are updated (so, for example, NULL handling now behaves as expected in plperl and plpgsql functions). NOTE initdb is forced due to added column in pg_proc.
* Cast parameters to ckfree to (char *) to suppress compiler warnings.Tom Lane2000-05-231-9/+9
|
* Show failing OID in 'cache lookup failed' messages;Tom Lane2000-04-161-11/+15
| | | | print OIDs as %u not %d.
* Ye-old pgindent run. Same 4-space tabs.Bruce Momjian2000-04-121-13/+13
|
* Add 'volatile' declarations to silence gcc warnings about longjmp.Tom Lane2000-02-271-13/+13
| | | | | Shouldn't create any portability problems, since we have a configure test to #define away volatile if the compiler doesn't support it.
* Fix a passel of problems with incorrect calls to typinput and typoutputTom Lane2000-01-151-9/+4
| | | | | | | functions, which would lead to trouble with datatypes that paid attention to the typelem or typmod parameters to these functions. In particular, incorrect code in pg_aggregate.c explains the platform-specific failures that have been reported in NUMERIC avg().