Commit Graph

4865 Commits

Author SHA1 Message Date
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 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 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
Tom Lane ef9db25a7e Fix typo in _copyAlterUserSetStmt. 2002-05-13 20:39:43 +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 9b5ca7ee0c Forgot to handle 'opaque' function arguments in regprocedurein/out. 2002-05-11 00:24:16 +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
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 1cf693ab86 Reorder snapshot checks to save a couple comparisons in the common case,
where the tuple's xmin or xmax is older than the snapshot xmin.  There
is no need to check it against snapshot xmax in that case.
2002-05-06 02:39:01 +00:00
Tom Lane 205b5c2f4b A little paranoia never hurt anyone. 2002-05-05 17:50:04 +00:00
Tom Lane d15c30d327 Add missing includes. 2002-05-05 16:14:24 +00:00
Tom Lane 17ea23dd17 Add a trivial testbed for pg_sema and pg_shmem code. 2002-05-05 16:02:37 +00:00
Tom Lane 2010a43fcb Cope with case that SEM_FAILED is not defined (assume failure code is -1) 2002-05-05 16:01:50 +00:00
Tom Lane 8df5625966 First test of Darwin port with POSIX semaphore code. 2002-05-05 01:03:26 +00:00
Tom Lane 3e48c66136 Fix code to work when isalpha and friends are macros, not functions. 2002-05-05 00:50:31 +00:00
Tom Lane 72a3902a66 Create an internal semaphore API that is not tied to SysV semaphores.
As proof of concept, provide an alternate implementation based on POSIX
semaphores.  Also push the SysV shared-memory implementation into a
separate file so that it can be replaced conveniently.
2002-05-05 00:03:29 +00:00
Tom Lane 91fc10fdac Fix compile errors in CYR_RECODE code, per report from Oliver Elphick. 2002-05-03 20:43:30 +00:00
Tom Lane 90739d4621 Make ruleutils.c schema-aware. Displayed names are schema-qualified
only if they would not be found without qualification given the current
search path, as per idea from Peter Eisentraut.
2002-05-03 20:15:02 +00:00
Tom Lane 1a69a37d5b Fix obsolete comments. 2002-05-03 17:42:11 +00:00
Tom Lane d662f29302 Use quote_identifier on relation names in EXPLAIN output, per suggestion
from Liam Stewart.  Minor code cleanups also.
2002-05-03 15:56:45 +00:00
Tom Lane 8338cc03a8 Remove the last traces of datatypes datetime and timespan. 2002-05-03 04:11:08 +00:00
Tom Lane 53cedcac22 Retire xlateSqlType/xlateSqlFunc; all type name translations are now
handled as special productions.  This is needed to keep us honest about
user-schema type names that happen to coincide with system type names.
Per pghackers discussion 24-Apr.  To avoid bloating the keyword list
too much, I removed the translations for datetime, timespan, and lztext,
all of which were slated for destruction several versions back anyway.
2002-05-03 00:32:19 +00:00
Tom Lane c2def1b128 Fix backslash-n typo, per Joe Conway. 2002-05-02 21:44:43 +00:00
Tom Lane 3220fd2138 Tweak scanner/grammar interface so that the keyword-as-identifier rules
in gram.y can make use of the keywords.c string table, instead of having
their own copies of the keyword strings.  This saves a few kilobytes and
more importantly eliminates an opportunity for cut-and-paste errors.
2002-05-02 18:44:11 +00:00
Tom Lane 0041a3d72f Add routines in namespace.c to determine whether objects are visible
in the search path.  (We might want to make these available as SQL
functions too, but I haven't done that yet.)  Fix format_type to be
schema-aware.
2002-05-01 23:06:41 +00:00
Tom Lane a829cbb877 Give left_oper() and right_oper() noError parameters like oper() (the
binary case) already has.  Needed for upcoming ruleutils change.
2002-05-01 19:26:08 +00:00
Tom Lane 61446e0927 Improve lexer's error reporting. You get the whole token mentioned now
in parse error messages, not just the part scanned by the last flex rule.
For example,
	select "foo" "bar";
used to draw
	ERROR:  parser: parse error at or near """
which was rather unhelpful.  Now it gives
	ERROR:  parser: parse error at or near ""bar""
Also, error messages concerning bitstring literals and suchlike will
quote the source text at you, not the processed internal form of the literal.
2002-05-01 17:12:08 +00:00
Hiroshi Inoue d1406f1b1e Change heap_get_latest_tid() so that a transaction can
see changes made by the transaction itself.
2002-05-01 01:23:37 +00:00
Tom Lane e4f06dc12e Clean up loose ends remaining from schema privileges discussion.
I concluded that RENAME should require CREATE privilege on the namespace
as well as ownership of the table.
2002-04-30 01:26:26 +00:00
Tom Lane 4c25a0655b Code review for ALTER TRIGGER RENAME patch: make better use of index,
don't scribble on tuple returned by table scan.
2002-04-30 01:24:57 +00:00
Tom Lane 857661ba2e Enforce EXECUTE privilege for aggregate functions. 2002-04-29 22:28:19 +00:00
Tom Lane ccfaf9067d Implement checking of USAGE rights on namespaces. 2002-04-29 22:15:07 +00:00
Tom Lane 88ef7067f7 Add cache invalidation callback hooks. 2002-04-29 22:14:34 +00:00
Bruce Momjian ea43fec258 Fix problem with new pg_hba.conf code where the same comparison function
was incorrectly used for both qsort and bsearch.
2002-04-28 22:49:07 +00:00
Tom Lane 6c59886942 Second try at fixing join alias variables. Instead of attaching miscellaneous
lists to join RTEs, attach a list of Vars and COALESCE expressions that will
replace the join's alias variables during planning.  This simplifies
flatten_join_alias_vars while still making it easy to fix up varno references
when transforming the query tree.  Add regression test cases for interactions
of subqueries with outer joins.
2002-04-28 19:54:29 +00:00
Tom Lane 25dfba3954 Make ruleutils.c use format_type for printing typenames. Minor tweaks
in quoting rules and recognition of implicit type coercions.
2002-04-28 00:49:13 +00:00
Tom Lane 7677fe0aa6 Minor code cleanup. 2002-04-28 00:36:38 +00:00