Commit Graph

241 Commits

Author SHA1 Message Date
Peter Eisentraut 1837f8cbdf Add -Wno-error because of "unclean" flex output. 2001-08-21 16:25:21 +00:00
Tom Lane 42fbb6dbe7 Clean up various memory leaks within plpgsql, and re-enable the
exec_eval_simple_expr shortcut, which was diked out in 7.1 because it
leaked too much space.  CVS tip now leaks no memory in Chris Ruprecht's
example, which formerly leaked to the tune of 500 MB.  (Much of this
is work that Jan already did; this commit just cleans up around the
edges.)
2001-08-02 21:31:23 +00:00
Bruce Momjian 84d2c518fe I noticed that pltcl didn't have any way to get to SPI_lastoid like plpgsql 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
2001-08-02 15:45:55 +00:00
Bruce Momjian 5c4d1398a6 Back out SET AUTHORIZATION patch until security is resolved. 2001-07-12 17:42:08 +00:00
Bruce Momjian 09523c90fa Make code malloc memory of proper length. 2001-07-12 01:19:40 +00:00
Bruce Momjian d946b2083a I updated the patch to use the SET AUTHORIZATION { INVOKER | DEFINER }
terminology. Also, the function owner is now determined and saved at compile
time (no gotchas here, right?)/

Mark Volpe
2001-07-11 18:54:19 +00:00
Peter Eisentraut 8237d89c0f Support fake root install, separate build dir, dependency tracking, our
choice of compiler and flags, uninstall, and peculiar Python installation
layouts for PyGreSql.  Also install into site-packages now, as officially
recommended.  And pgdb.py is also installed now, used to be forgotten.
2001-07-10 16:33:02 +00:00
Bruce Momjian f5d0c6cad5 Apparently, on some systems, ExtUtils::Embed and MakeMaker are slightly
broken, and its impossible to make a shared library when compiling with
both CCDLFLAGS and LDDLFAGS, you have to pick one or the other.

Alex Pilosov
2001-06-20 00:26:06 +00:00
Bruce Momjian 0ed7864d68 Well, after persuading cvsup and cvs that it _is_ possible to have local
modifiable repositories, I have a clean untrusted plperl patch to offer
you :)

Highlights:
* There's one perl interpreter used for both trusted and untrusted
procedures. I do think its unnecessary to keep two perl
interpreters around. If someone can break out from trusted "Safe" perl
mode, well, they can do what they want already. If someone disagrees, I
can change this.

* Opcode is not statically loaded anymore. Instead, we load Dynaloader,
which then can grab Opcode (and anything else you can 'use') on its own.

* Checked to work on FreeBSD 4.3 + perl 5.5.3 , OpenBSD 2.8 + perl5.6.1,
RedHat 6.2 + perl 5.5.3

* Uses ExtUtils::Embed to find what options are necessary to link with
perl shared libraries

* createlang is also updated, it can create untrusted perl using 'plperlu'

* Example script (assuming you have Mail::Sendmail installed):
create function foo() returns text as '
         use Mail::Sendmail;

         %mail = ( To      => q(you@yourname.com),
                   From    => q(me@here.com),
                   Message => "This is a very short message"
                  );
         sendmail(%mail) or die $Mail::Sendmail::error;
return          "OK. Log says:\n", $Mail::Sendmail::log;
' language 'plperlu';

Alex Pilosov
2001-06-18 21:40:06 +00:00
Tom Lane 7c106621de Fix a few missed NOIND usages. 2001-06-09 02:19:07 +00:00
Jan Wieck ce62c8b10e Patch from Ian Lance Taylor fixing multiple cursor arguments
and buffer zero termination.

Jan
2001-06-06 18:54:41 +00:00
Tom Lane 7748e9e7e5 pltcl, plperl, and plpython all suffer the same bug previously fixed
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?
2001-06-01 18:17:44 +00:00
Bruce Momjian c9a001a11e Allow IS and FOR in Pl/PgSQL cursors, per Oracle and ANSI. Jan-approved. 2001-05-31 17:15:40 +00:00
Tom Lane a056f14be0 Cause plpgsql's PERFORM to behave according to its documentation,
which says that PERFORM will execute any SELECT query and discard the
result.  The former implementation would in fact raise an error if the
result contained more than one row or more than one column.

Also, change plpgsql's error-logging mechanism to emit the additional
messages about error location at NOTICE rather than DEBUG level.  This
allows them to be seen by the client without having to dig into the
postmaster log file (which may be nonexistent or inaccessible by the
client).
2001-05-28 19:33:24 +00:00
Bruce Momjian 06a8346c84 See attached for a small patch that enables plpython to build cleanly
under Cygwin.  This patch together with my previous Python patch:

    http://postgresql.readysetnet.com/mhonarc/pgsql-patches/2001-05/msg00075.htm
l

enables full Python support (i.e., configure --with-python) for Cygwin
PostgreSQL.

Jason Tishler
2001-05-25 15:48:33 +00:00
Bruce Momjian f3c1ae58f2 Another Makefile fix for qnx patch. 2001-05-25 04:26:21 +00:00
Bruce Momjian 248a5a7257 Fix tabs in Makefile. 2001-05-25 04:24:33 +00:00
Bruce Momjian a1f14d30b1 Back out qnx plpgsql/Makefile change and move to src/Makefile. 2001-05-24 22:33:18 +00:00
Bruce Momjian f36fc7bb63 I haven't tried building postgres with the Watcom compiler for 7.1 because
it does not support 64bit integers. AFAIK that's the default data type for
OIDs, so I am not surprised that this does not work. Use gcc instead.
BTW., 7.1 does not compile as is with gcc either, I believed the
required patches made it into the 7.1.1 release but obviously I missed
the deadline.
Since the ports mailing list does not seem to be archived I have attached
a copy of the patch (for 7.1 and 7.1.1).

I've just performed a build of a Watcom compiled version and found a couple
of bugs in the watcom specific part of that patch. Please use the attached
version instead.

Tegge, Bernd
2001-05-24 15:53:34 +00:00
Jan Wieck d27f363e3f Enhancement of SPI to get access to portals
- New functions to create a portal using a prepared/saved
  SPI plan or lookup an existing portal by name.
- Functions to fetch/move from/in portals. Results are placed
  in the usual SPI_processed and SPI_tuptable, so the entire
  set of utility functions can be used to gain attribute access.
- Prepared/saved SPI plans now use their own memory context
  and SPI_freeplan(plan) can remove them.
- Tuple result sets (SPI_tuptable) now uses it's own memory
  context and can be free'd by SPI_freetuptable(tuptab).

Enhancement of PL/pgSQL

- Uses generic named portals internally in FOR ... SELECT
  loops to avoid running out of memory on huge result sets.
- Support for CURSOR and REFCURSOR syntax using the new SPI
  functionality. Cursors used internally only need no explicit
  transaction block. Refcursor variables can be used inside
  of explicit transaction block to pass cursors between main
  application and functions.


Jan
2001-05-21 14:22:19 +00:00
Jan Wieck 27b0e8c0b0 Adding ELSIF support contributed by Klaus Reger.
Jan
2001-05-18 21:16:59 +00:00
Peter Eisentraut 70aa2ae6a5 Remove linking hacks now that dynloader is fixed. 2001-05-14 22:06:50 +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
Peter Eisentraut c51b00a213 PL/Python integration: support in create/droplang, add CVS keywords,
remove useless files, beat some sense into Makefile.  For me it builds
and sort of runs, so it's a start.
2001-05-12 01:30:30 +00:00
Peter Eisentraut 5e19e14ecd Cleanups of pltcl unknown thingy. 2001-05-11 23:38:06 +00:00
Bruce Momjian 72c8af51fd Move disabled message up to a higher makefile. 2001-05-10 03:00:11 +00:00
Bruce Momjian 8ace5114dc This directory contains a module that implements the "Metaphone" code as
a PostgreSQL user-defined function.  The Metaphone system is a method of
matching similar sounding names (or any words) to the same code.

Metaphone was invented by Lawrence Philips as an improvement to the popular
name-hashing routine, Soundex.

This metaphone code is from Michael Kuhn, and is detailed at
   http://aspell.sourceforge.net/metaphone/metaphone-kuhn.txt

Joel Burton
2001-05-09 23:00:44 +00:00
Bruce Momjian 91e3b85529 Wow, I am getting good at this Makefile stuff. Peter may be OK with it. 2001-05-09 21:42:29 +00:00
Bruce Momjian a1a12b8a0c I think I got the pltcl Makefile unknown rules working properly. 2001-05-09 21:35:11 +00:00
Bruce Momjian 0007be5da7 More cleanups to generate tcl unknown from Makefile. 2001-05-09 20:30:09 +00:00
Bruce Momjian 36f41c7126 Make tcl unknown configure from Makefile, not configure. 2001-05-09 20:19:30 +00:00
Bruce Momjian 14536f591d More --enable-pltcl-unknown renames. 2001-05-09 20:08:08 +00:00
Bruce Momjian ec9cc733ca Add TODO file. 2001-05-09 19:55:22 +00:00
Bruce Momjian 0bef7ba549 Add plpython code. 2001-05-09 19:54:38 +00:00
Bruce Momjian f7659a9c18 This patch adds a new configure option --with-pltcl-unknown which
enables pltcl unknown support.


Also it adds substituting of tclsh with tclsh that was by configure in
pltcl_*mod scripts. For example, On freebsd, tclsh can be called
tclsh8.2 or
tclsh8.3 depending on installed version of Tcl.

After patching files
  src/pl/tcl/modules/pltcl_listmod
  src/pl/tcl/modules/pltcl_loadmod
  src/pl/tcl/modules/pltcl_delmod
must be renamed(copied,repocopied) to
  src/pl/tcl/modules/pltcl_listmod.in
  src/pl/tcl/modules/pltcl_loadmod.in
  src/pl/tcl/modules/pltcl_delmod.in

seva@sevasoft.kiev.ua
2001-05-09 19:19:00 +00:00
Tom Lane eb62f076d0 Un-break exec_move_row() for case that a NULL tuple and tupdesc are
passed, which occurs when no rows are retrieved by a SELECT.
Mea maxima culpa ... I should have caught this.
2001-05-08 01:00:53 +00:00
Tom Lane 8bb3c8fe54 exec_move_row() should be more forgiving of tuples with a different
number of columns than it was expecting, for reasons that are now
documented in the code...
2001-04-30 20:05:40 +00:00
Tom Lane d5096af2c4 Make the world safe for passing whole rows of views to functions. This
already worked fine for whole rows of tables, but not so well for views...
2001-04-18 20:42:56 +00:00
Tom Lane a3ed622b63 Since plpgsql keeps its compiled function parsetrees until backend exit,
it needs to ensure that data structures attached to fmgr info records in
the trees will stick around that long, too.  Current code was crashing
on cases like datatypes with old-style I/O functions.
2001-04-06 02:06:48 +00:00
Tom Lane 6faf150a30 Fix/cleanup DLLLIBS handling for Cygwin port. If it works it's to
Jason Tishler's credit, if it's broken it's my fault ...
2001-04-04 21:15:56 +00:00
Bruce Momjian 0686d49da0 Remove dashes in comments that don't need them, rewrap with pgindent. 2001-03-22 06:16:21 +00:00
Bruce Momjian 9e1552607a pgindent run. Make it all clean. 2001-03-22 04:01:46 +00:00
Bruce Momjian 296c806dd5 > Applied. Thanks.
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
2001-03-07 16:18:08 +00:00
Bruce Momjian 3dc1b2b71d pltcl_loadmod has problems with big (>4k) modules because of missing incr
in splitting code:

seva@sevasoft.kiev.ua
2001-03-07 16:09:09 +00:00
Peter Eisentraut cb6edf9d56 Make sure -L and -I's for our source tree are always before system include
or library directories on the command line.
2001-02-20 19:20:30 +00:00
Tom Lane 414f94f262 Change plpgsql's GET DIAGNOSTICS statement to use SQL99-compatible
syntax.  Fix the RESULT_OID case, which never worked.  Add documentation.
2001-02-19 19:49:53 +00:00
Tom Lane a2dafc6416 Fix bugs in pltcl's new return_null command: it was liable to go belly up
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.
2001-02-16 03:26:40 +00:00
Tom Lane 60d1d671a8 Fix erroneous sort request in pltcl selftest. 2001-02-16 03:22:41 +00:00
Bruce Momjian 4ea081e94f Format to match standard conventions 2001-02-10 22:53:40 +00:00
Bruce Momjian b54073ea4c Convert to standard 4-space tabs. 2001-02-10 22:42:01 +00:00