Commit Graph

12600 Commits

Author SHA1 Message Date
Peter Eisentraut d60f10b0e7 Add optional "validator" function to languages that can validate the
function body (and other properties) as a function in the language
is created.  This generalizes ad hoc code that already existed for
the built-in languages.

The validation now happens after the pg_proc tuple of the new function
is created, so it is possible to define recursive SQL functions.

Add some regression test cases that cover bogus function definition
attempts.
2002-05-22 17:21:02 +00:00
Tom Lane df9c8e1a39 Make RelationForgetRelation error out if the relcache entry has nonzero
reference count.  This avoids leaving dangling pointers around, as in
recent bug report against sequences (bug# 671).
2002-05-22 15:57:40 +00:00
Tom Lane 0352e3a783 Un-break table creation. 2002-05-22 15:35:43 +00:00
Hiroshi Inoue a3519a2fcc Allow
CREATE VIEW as SELECT CTID, ....
  SELECT currtid( a view, ..).
2002-05-22 07:46:58 +00:00
Hiroshi Inoue 79420840ee 1) Support Keyset Driven driver cursors.
2) Supprt ARD precision/scale and SQL_C_NUEMRIC.
3) Minimal implementation of SQLGetDiagField().
4) SQLRowCount() reports the result of SQLSetPos and SQLBulkOperation.
5) int8 -> SQL_NUMERIC for Microsoft Jet.
6) Support isolation level change.
7) ODBC3.0 SQLSTATE code.
8) Append mode log files.
2002-05-22 05:51:03 +00:00
Tom Lane 6c6f395a8a Since COPY fires triggers, it seems like a good idea for it to use
a frozen (copied) snapshot too.  Move execMain's snapshot copying code
out into a subroutine in case we find other places that need it.
2002-05-21 22:59:01 +00:00
Tom Lane 26fcd25c57 Remove SetQuerySnapshot() from FETCH processing. No longer necessary
or appropriate, since the snapshot that will be used by the cursor was
frozen when ExecutorStart was run for it.
2002-05-21 22:18:08 +00:00
Tom Lane 959e61e917 Remove global variable scanCommandId in favor of storing a command ID
in snapshots, per my proposal of a few days ago.  Also, tweak heapam.c
routines (heap_insert, heap_update, heap_delete, heap_mark4update) to
be passed the command ID to use, instead of doing GetCurrentCommandID.
For catalog updates they'll still get passed current command ID, but
for updates generated from the main executor they'll get passed the
command ID saved in the snapshot the query is using.  This should fix
some corner cases associated with functions and triggers that advance
current command ID while an outer query is still in progress.
2002-05-21 22:05:55 +00:00
Tom Lane 0a2682445e Spell long option with -c not --, for compatibility's sake. 2002-05-21 19:06:00 +00:00
Tom Lane 38f5fdb1e9 Repair OPEN cursor(args), which I broke on 11/29/01 with a change to
be smarter about parentheses in read_sql_construct().  Sigh.
2002-05-21 18:50:16 +00:00
Tom Lane 44fbe20d62 Restructure indexscan API (index_beginscan, index_getnext) per
yesterday's proposal to pghackers.  Also remove unnecessary parameters
to heap_beginscan, heap_rescan.  I modified pg_proc.h to reflect the
new numbers of parameters for the AM interface routines, but did not
force an initdb because nothing actually looks at those fields.
2002-05-20 23:51:44 +00:00
Bruce Momjian c961474c96 Mark as done:
> 	o -Disallow missing columns in INSERT ... VALUES, per ANSI
2002-05-20 22:22:27 +00:00
Michael Meskes 7f660adeb1 - Fixed some parser bugs.
- Removed some simple rules to work arounf bison limit for now.
        - Update c_keywords.c to reflect changes in keywords.c.
2002-05-20 09:29:41 +00:00
Tatsuo Ishii 0d7c58a977 Update docs about new -N option 2002-05-20 05:07:28 +00:00
Michael Meskes f35ced3de9 - Fixed reduce/reduce conflict in parser.
- Synced preproc.y with gram.y.
        - Synced pgc.l with scan.l.
        - Synced keywords.c.
2002-05-19 20:00:53 +00:00
Peter Eisentraut f76bc9c776 Reorder keyword token declarations alphabetically. Status of the keywords
in the various standards can be found in the documentation these days.
2002-05-19 15:16:55 +00:00
Peter Eisentraut 13cd9eb9b8 Remove bitrotten view_perms test. Add some similar test cases to
privileges test.
2002-05-19 15:13:20 +00:00
Peter Eisentraut c88540fb0e Dump privileges on functions, aggregates, languages. 2002-05-19 10:08:25 +00:00
Tom Lane dd9af92c41 Add display of sort keys to the default EXPLAIN output. 2002-05-18 21:38:41 +00:00
Tom Lane a5b370943e Teach query_tree_walker, query_tree_mutator, and SS_finalize_plan to
process function RTE expressions, which they were previously missing.
This allows outer-Var references and subselects to work correctly in
the arguments of a function RTE.  Install check to prevent function RTEs
from cross-referencing Vars of sibling FROM-items, which doesn't make
any sense (if you want to join, write a JOIN or WHERE clause).
2002-05-18 18:49:41 +00:00
Peter Eisentraut 2c50f6344b Revise command completion tags as per hackers message on 20 March. 2002-05-18 15:44:48 +00:00
Peter Eisentraut e8ac187c68 Allow functions to be executed with the privileges of the function owner.
I took the opportunity to remove the pg_proc.proistrusted field.
2002-05-18 13:48:01 +00:00
Tom Lane 51fd22abdd Change set_plan_references and join_references to take an rtable List
rather than a Query node; this allows set_plan_references to recurse
into subplans correctly.  Fixes core dump on full outer joins in
subplans.  Also, invoke preprocess_expression on function RTEs'
function expressions.  This seems to fix the planner's problems with
outer-level Vars in function RTEs.
2002-05-18 02:25:50 +00:00
Tom Lane 0a757154bd Add missing fix_expr_references() step for the funcexpr of a
FunctionScan plan node.
2002-05-18 00:42:55 +00:00
Tom Lane 22d641a7d4 Get rid of the last few uses of typeidTypeName() rather than
format_type_be() in error messages.
2002-05-17 22:35:13 +00:00
Tom Lane 940f772a29 Support temporary setting of search path during CREATE SCHEMA; this
allows the example in the CREATE SCHEMA ref page to actually work now.
Also, clean up when the transaction that initially creates a temp-table
namespace is later aborted.  Simplify internal representation of search
path by folding special cases into the main list.
2002-05-17 20:53:33 +00:00
Tom Lane 5f21560ae8 Dept. of second thoughts: interaction between DoIt and makeDepend
in set_config_option wasn't quite right.  Also clean up a couple other
things that could have been done better.
2002-05-17 20:32:29 +00:00
Peter Eisentraut 94bdc4855c Extend syntax of CREATE FUNCTION to resemble SQL99. 2002-05-17 18:32:52 +00:00
Tom Lane 97f7ceaaa6 Guard against empty-string results from pg_getlocale. 2002-05-17 02:20:26 +00:00
Tom Lane f0811a74b3 Merge the last few variable.c configuration variables into the generic
GUC support.  It's now possible to set datestyle, timezone, and
client_encoding from postgresql.conf and per-database or per-user
settings.  Also, implement rollback of SET commands that occur in a
transaction that later fails.  Create a SET LOCAL var = value syntax
that sets the variable only for the duration of the current transaction.
All per previous discussions in pghackers.
2002-05-17 01:19:19 +00:00
Tom Lane fa613fa1ea Fix obsolete statement about permissions on COPY ref page, and confusion
about TO/FROM direction in several places.
2002-05-14 18:47:58 +00:00
Tom Lane cbd3b97e5a Remove unnecessary pfree's in geometric operators. At least one of these
is actively dangerous, per bug report from Ewald Geschwinde 14-May-02,
and several of the rest look suspicious to me.  Since there is no longer
any significant value in retail pfree's in these functions, just get
rid of all of them for safety's sake.
2002-05-14 18:16:51 +00:00
Thomas G. Lockhart cc2ce83633 Fix lookup tables used for rounding interval data values when not using
integer datetimes. Thanks to Tom Lane for spotting the problem.
2002-05-14 13:37:27 +00:00
Peter Eisentraut 5c4e5aa3ff Make regression tests locale-proof by setting some locale categories
to C at run-time, and providing alternative output files for different
sort orders.
2002-05-14 13:05:43 +00:00
Tatsuo Ishii cd61650f89 Fix bug in psql.
per report from sugita@sra.co.jp on Thu, 09 May 2002 11:57:51 +0900
(JST) at pgsql-patches list.

Illegal long options to pg_dump makes core on some systems, since it
lacks the last null sentinel of struct option array.

Attached is a patch made by Mr. Ishida Akio <iakio@pjam.jpweb.net>.
2002-05-14 04:20:15 +00:00
Barry Lind e25c93c7eb fixed problem connecting to server with client_min_messages set to debug. The code was not expecting to receive notice messages during the connection handshake. 2002-05-14 03:00:35 +00:00
Tom Lane ef9db25a7e Fix typo in _copyAlterUserSetStmt. 2002-05-13 20:39:43 +00:00
Tom Lane c5741a448e AVG probably shouldn't be upper case here, considering
that we don't upcase the others.
2002-05-13 19:22:06 +00:00
Tom Lane f69bc37be8 Make operators have their own comments separate from those of the
underlying function; but cause psql's \do to show the underlying
function's comment if the operator has no comment of its own, to preserve
the useful functionality of the original behavior.  Also, implement
COMMENT ON SCHEMA.  Patch from Rod Taylor.
2002-05-13 17:45:30 +00:00
Tom Lane 3389a110d4 Get rid of long-since-vestigial Iter node type, in favor of adding a
returns-set boolean field in Func and Oper nodes.  This allows cleaner,
more reliable tests for expressions returning sets in the planner and
parser.  For example, a WHERE clause returning a set is now detected
and complained of in the parser, not only at runtime.
2002-05-12 23:43:04 +00:00
Tom Lane f9e4f611a1 First pass at set-returning-functions in FROM, by Joe Conway with
some kibitzing from Tom Lane.  Not everything works yet, and there's
no documentation or regression test, but let's commit this so Joe
doesn't need to cope with tracking changes in so many files ...
2002-05-12 20:10:05 +00:00
Tom Lane 71009354c8 Update for additional options in CREATE OPERATOR. 2002-05-11 02:09:41 +00:00
Tom Lane 9b5ca7ee0c Forgot to handle 'opaque' function arguments in regprocedurein/out. 2002-05-11 00:24:16 +00:00
Tom Lane 9f0ae0c820 First pass at schema-fying pg_dump/pg_restore. Much to do still,
but the basic capability seems to work.
2002-05-10 22:36:27 +00:00
Tom Lane 1011fb651d Suppress duplicate logging of utility commands under debug_print_query. 2002-05-10 20:22:13 +00:00
Peter Eisentraut 1944bff1d6 Make initdb print a message about which locale it is about to use.
Re-add warning if the locale prevents LIKE-optimization.  Done within
initdb now.
2002-05-09 13:30:24 +00:00
Hiroshi Inoue 16e22de53a Add a file for version control. 2002-05-09 04:10:22 +00:00
Tom Lane 2822788993 Accept SET SESSION AUTHORIZATION DEFAULT and RESET SESSION AUTHORIZATION
to reset session userid to the originally-authenticated name.  Also,
relax SET SESSION AUTHORIZATION to allow specifying one's own username
even if one is not superuser, so as to avoid unnecessary error messages
when loading a pg_dump file that uses this command.  Per discussion from
several months ago.
2002-05-06 19:47:30 +00:00
Tom Lane 15162aef24 Make dumpACL behave more reasonably for case where owner has revoked
some of his own privileges.
2002-05-06 18:33:45 +00:00
Tom Lane 340b66cc70 Cause fmtId to always use its internal buffer for the returned value,
in hopes of making erroneous usage more apparent.  Per discussion 15-Apr.
2002-05-06 17:34:45 +00:00