Commit Graph

1074 Commits

Author SHA1 Message Date
Tom Lane 6ba8af9d5d Remove restriction that cast functions cannot be volatile. This
restriction was debatable to begin with, but it has now become obvious
that it breaks forward-porting of user-defined types; contrib/lo being
the most salient example.
2003-02-01 22:09:26 +00:00
Tom Lane 21166170c8 Fix assign_session_authorization() to not be confused by all-numeric
user names.  Per recent reports.
2003-02-01 18:31:28 +00:00
Tom Lane 33875872fd Get rid of last few unadorned 'permission denied' messages. 2003-01-27 00:51:06 +00:00
Tom Lane 36777c1e35 Fix obsolete error message (isImmutable doesn't exist). 2003-01-23 15:18:40 +00:00
Peter Eisentraut b65cd56240 Read-only transactions, as defined in SQL. 2003-01-10 22:03:30 +00:00
Bruce Momjian 5e36cbe6ee Updated deferred trigger patch.
Neil Conway
2003-01-08 22:29:23 +00:00
Bruce Momjian c77bc1380a This trivial patch implements disabled, deferred triggers, per my
proposal on -hackers a couple days ago. The 'tgenabled' status of the
trigger is consulted when the trigger is added to the deferred queue
(i.e. when the event occurs that fires the trigger), not when the
deferred event is executed.

No regression tests, as another bug prevents them (the pg_trigger row
for a trigger is only loaded once per session, so any changes to it are
not noticed unless the client disconnects and reconnects).

Neil Conway
2003-01-08 22:28:32 +00:00
Tom Lane 2d140d35a4 Reconsider old decision to try to constant-fold default and constraint
expressions before they are stored.  This seems like not such a hot idea,
particularly now that the constant-folder will try to inline SQL functions.
2003-01-08 22:06:23 +00:00
Tom Lane 51d2e3bd6e Repair bug noticed by Deepak Bhole: a shell type should have a dependency
on its namespace, so that it will go away if the schema is dropped.
2003-01-08 21:40:39 +00:00
Tom Lane 061168d38f Code review for FETCH/MOVE 0 changes. Improve documentation, do the
right thing with the destination when FETCH 0 can't return a row,
don't try to stuff LONG_MAX into an int value.
2003-01-08 00:22:27 +00:00
Tom Lane 9f1f2bfb66 Fix various places where global s/NOTICE/WARNING/ was applied with too
much enthusiasm.
2003-01-07 22:23:17 +00:00
Tom Lane daec989f6a ALTER DOMAIN OWNER, from Rod Taylor. 2003-01-06 00:31:45 +00:00
Tom Lane 17194f4112 Partial code review for ALTER DOMAIN patch. Incorporates Rod Taylor's
patches of 9-Dec (permissions fix) and 13-Dec (performance) as well as
a partial fix for locking issues: concurrent DROP COLUMN should not
create trouble anymore.  But concurrent DROP TABLE is still a risk, and
there is no protection at all against creating a column of a domain while
we are altering the domain.
2003-01-04 00:46:08 +00:00
Tom Lane 0a02d47a11 Enforces NOT NULL constraints to be applied against new PRIMARY KEY
columns in DefineIndex.  So, ALTER TABLE ... PRIMARY KEY will now
automatically add the NOT NULL constraint.  It appeared the alter_table
regression test wanted this to occur, as after the change the regression
test better matched in inline 'fails'/'succeeds' comments.

Rod Taylor
2003-01-02 19:29:22 +00:00
Tom Lane 896bd121cc Code review for transaction-safe-TRUNCATE patch: minor cleanups. 2002-12-30 19:45:17 +00:00
Tom Lane a03c0d93d5 Code review for CLUSTER ALL patch. Fix bogus locking, incorrect transaction
stop/start nesting, other infelicities.
2002-12-30 18:42:17 +00:00
Bruce Momjian 33f0108df8 Cause FETCH 1 to return the current cursor row, or zero if at
beginning/end of cursor.

Have MOVE return 0/1 depending on cursor position.

Matches SQL spec.

Pass cursor counter from parser as a long rather than int.

Doc updates.
2002-12-30 15:31:51 +00:00
Tom Lane 260faf0b63 Fix ALTER TABLE ADD COLUMN to disallow the same column types that are
disallowed by CREATE TABLE (eg, pseudo-types); also disallow these types
from being introduced by the range-function syntax.  While at it, allow
CREATE TABLE to create zero-column tables, per recent pghackers discussion.
I am back-patching this into 7.3 since failure to disallow pseudo-types
is arguably a security hole.
2002-12-16 18:39:22 +00:00
Tom Lane e64c7feb2f Tweak default memory context allocation policy so that a context is not
given any malloc block until something is first allocated in it; but
thereafter, MemoryContextReset won't release that first malloc block.
This preserves the quick-reset property of the original policy, without
forcing 8K to be allocated to every context whether any of it is ever
used or not.  Also, remove some more no-longer-needed explicit freeing
during ExecEndPlan.
2002-12-15 21:01:34 +00:00
Tom Lane 5bab36e9f6 Revise executor APIs so that all per-query state structure is built in
a per-query memory context created by CreateExecutorState --- and destroyed
by FreeExecutorState.  This provides a final solution to the longstanding
problem of memory leaked by various ExecEndNode calls.
2002-12-15 16:17:59 +00:00
Tom Lane 2d8d66628a Clean up plantree representation of SubPlan-s --- SubLink does not appear
in the planned representation of a subplan at all any more, only SubPlan.
This means subselect.c doesn't scribble on its input anymore, which seems
like a good thing; and there are no longer three different possible
interpretations of a SubLink.  Simplify node naming and improve comments
in primnodes.h.  No change to stored rules, though.
2002-12-14 00:17:59 +00:00
Tom Lane 3a4f7dde16 Phase 3 of read-only-plans project: ExecInitExpr now builds expression
execution state trees, and ExecEvalExpr takes an expression state tree
not an expression plan tree.  The plan tree is now read-only as far as
the executor is concerned.  Next step is to begin actually exploiting
this property.
2002-12-13 19:46:01 +00:00
Tom Lane b0422b215c Preliminary code review for domain CHECK constraints patch: add documentation,
make VALUE a non-reserved word again, use less invasive method of passing
ConstraintTestValue into transformExpr, fix problems with nested constraint
testing, do correct thing with NULL result from a constraint expression,
remove memory leak.  Domain checks still need much more work if we are going
to allow ALTER DOMAIN, however.
2002-12-12 20:35:16 +00:00
Tom Lane a0bf885f9e Phase 2 of read-only-plans project: restructure expression-tree nodes
so that all executable expression nodes inherit from a common supertype
Expr.  This is somewhat of an exercise in code purity rather than any
real functional advance, but getting rid of the extra Oper or Func node
formerly used in each operator or function call should provide at least
a little space and speed improvement.
initdb forced by changes in stored-rules representation.
2002-12-12 15:49:42 +00:00
Tom Lane 9ee4891570 Some quick fixes for ALTER DOMAIN patch. It still needs a lot of work,
but at least it doesn't generate gcc warnings.
2002-12-09 20:31:05 +00:00
Tom Lane d6161ba7ec Explain's code for showing quals of SubqueryScan nodes has been broken
all along; not noticed till now.  It's a scan not an upper qual ...
2002-12-06 19:28:03 +00:00
Bruce Momjian 05a6b37912 Re-addd Rod's ALTER DOMAIN patch. 2002-12-06 05:00:34 +00:00
Bruce Momjian 5b4c16e099 Back out ALTER DOMAIN patch until missing file appears. 2002-12-06 03:43:35 +00:00
Bruce Momjian 853153ca6d ALTER DOMAIN .. SET / DROP NOT NULL
ALTER DOMAIN .. SET / DROP DEFAULT
ALTER DOMAIN .. ADD / DROP CONSTRAINT

New files:
- doc/src/sgml/ref/alter_domain.sgml

Rod Taylor
2002-12-06 03:28:34 +00:00
Tom Lane 1fd0c59e25 Phase 1 of read-only-plans project: cause executor state nodes to point
to plan nodes, not vice-versa.  All executor state nodes now inherit from
struct PlanState.  Copying of plan trees has been simplified by not
storing a list of SubPlans in Plan nodes (eliminating duplicate links).
The executor still needs such a list, but it can build it during
ExecutorStart since it has to scan the plan tree anyway.
No initdb forced since no stored-on-disk structures changed, but you
will need a full recompile because of node-numbering changes.
2002-12-05 15:50:39 +00:00
Bruce Momjian 7816c7cb94 More cleanup of userid to be AclId rather than Oid. 2002-12-05 04:04:51 +00:00
Bruce Momjian 93902e9521 Make usesysid consistently int4, not oid.
Catalog patch from Alvaro Herrera for same.

catversion updated. initdb required.
2002-12-04 05:18:38 +00:00
Tom Lane 2802668159 Repair core dump when trying to delete an entry from an already-NULL
datconfig or useconfig field.  Per report from Dustin Sallings.
2002-12-02 05:20:47 +00:00
Tom Lane 3a18f01b7a Run COPY OUT in a temporary memory context that's reset once per row,
and eliminate its manual pfree() calls.  This solves the encoding-conversion
bug recently reported, and should be faster and more robust than the
original coding anyway.  For example, we are no longer at risk if
datatype output routines leak memory or choose to return a constant string.
2002-12-01 18:14:22 +00:00
Tom Lane f68f11928d Tighten selection of equality and ordering operators for grouping
operations: make sure we use operators that are compatible, as determined
by a mergejoin link in pg_operator.  Also, add code to planner to ensure
we don't try to use hashed grouping when the grouping operators aren't
marked hashable.
2002-11-29 21:39:12 +00:00
Tom Lane ea0b5c8569 Use Params, rather than run-time-modified Const nodes, to handle
sublink results and COPY's domain constraint checking.  A Const that
isn't really constant is just a Bad Idea(tm).  Remove hacks in
parse_coerce and other places that were needed because of the former
klugery.
2002-11-26 03:01:59 +00:00
Tom Lane f893ee271f Remove unused constisset and constiscast fields of Const nodes. Clean
up code and documentation associated with Param nodes.
2002-11-25 21:29:42 +00:00
Tom Lane 0aa5b6866e Un-break triggers declared for INSERT OR DELETE OR UPDATE. This worked
okay in 7.3, so I think it must have been busted in the recent triggers
patch.
2002-11-25 03:36:50 +00:00
Tom Lane 4c61c827d3 Fix compile warnings from truncate patch. 2002-11-23 18:26:45 +00:00
Bruce Momjian d46f3de363 Transaction safe Truncate
Rod Taylor
2002-11-23 04:05:52 +00:00
Bruce Momjian 1b7f3cc02d This patch implements FOR EACH STATEMENT triggers, per my email to
-hackers a couple days ago.

Notes/caveats:

        - added regression tests for the new functionality, all
          regression tests pass on my machine

        - added pg_dump support

        - updated PL/PgSQL to support per-statement triggers; didn't
          look at the other procedural languages.

        - there's (even) more code duplication in trigger.c than there
          was previously. Any suggestions on how to refactor the
          ExecXXXTriggers() functions to reuse more code would be
          welcome -- I took a brief look at it, but couldn't see an
          easy way to do it (there are several subtly-different
          versions of the code in question)

        - updated the documentation. I also took the liberty of
          removing a big chunk of duplicated syntax documentation in
          the Programmer's Guide on triggers, and moving that
          information to the CREATE TRIGGER reference page.

        - I also included some spelling fixes and similar small
          cleanups I noticed while making the changes. If you'd like
          me to split those into a separate patch, let me know.

Neil Conway
2002-11-23 03:59:09 +00:00
Bruce Momjian c4501ec551 Remove ALL from CLUSTER ALL. Use just CLUSTER. 2002-11-18 17:12:07 +00:00
Bruce Momjian 8bc717cb88 New version attached. The following is implemented:
- CLUSTER ALL clusters all the tables that have some index with
  indisclustered set and the calling user owns.
- CLUSTER tablename clusters the named table, using the index with
  indisclustered set.  If no index has the bit set, throws elog(ERROR).
- The multi-relation version (CLUSTER ALL) uses a multitransaction
  approach, similar to what VACUUM does.

Alvaro Herrera
2002-11-15 03:09:39 +00:00
Bruce Momjian 6b603e67dc Add DOMAIN check constraints.
Rod Taylor
2002-11-15 02:50:21 +00:00
Bruce Momjian d36aa2e885 Rename:
! #show_parser_stats = false
! #show_planner_stats = false
! #show_executor_stats = false
! #show_statement_stats = false

TO:

! #log_parser_stats = false
! #log_planner_stats = false
! #log_executor_stats = false
! #log_statement_stats = false
2002-11-15 00:47:22 +00:00
Bruce Momjian 4e5a947d1c Make MOVE/FETCH 0 actually move/fetch 0. Add MOVE LAST to move to end
of cursor.
2002-11-13 00:44:09 +00:00
Bruce Momjian 9b12ab6d5d Add new palloc0 call as merge of palloc and MemSet(0). 2002-11-13 00:39:48 +00:00
Tom Lane f9b5b41ef9 Code review for ON COMMIT patch. Make the actual on-commit action happen
before commit, not after :-( --- the original coding is not only unsafe
if an error occurs while it's processing, but it generates an invalid
sequence of WAL entries.  Resurrect 7.2 logic for deleting items when
no longer needed.  Use an enum instead of random macros.  Editorialize
on names used for routines and constants.  Teach backend/nodes routines
about new field in CreateTable struct.  Add a regression test.
2002-11-11 22:19:25 +00:00
Bruce Momjian 75fee4535d Back out use of palloc0 in place if palloc/MemSet. Seems constant len
to MemSet is a performance boost.
2002-11-11 03:02:20 +00:00
Bruce Momjian 8fee9615cc Merge palloc()/MemSet(0) calls into a single palloc0() call. 2002-11-10 07:25:14 +00:00