Commit Graph

1051 Commits

Author SHA1 Message Date
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
Bruce Momjian 3eabc4490e Tweak CREATE SEQUENCE grammar to be more SQL1999 standards compliant.
Neil Conway
2002-11-10 00:10:20 +00:00
Bruce Momjian ebb531836a Add code to handle [ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP }]
for temp tables.

Gavin Sherry
2002-11-09 23:56:39 +00:00
Tom Lane f6dba10e62 First phase of implementing hash-based grouping/aggregation. An AGG plan
node now does its own grouping of the input rows, and has no need for a
preceding GROUP node in the plan pipeline.  This allows elimination of
the misnamed tuplePerGroup option for GROUP, and actually saves more code
in nodeGroup.c than it costs in nodeAgg.c, as well as being presumably
faster.  Restructure the API of query_planner so that we do not commit to
using a sorted or unsorted plan in query_planner; instead grouping_planner
makes the decision.  (Right now it isn't any smarter than query_planner
was, but that will change as soon as it has the option to select a hash-
based aggregation step.)  Despite all the hackery, no initdb needed since
only in-memory node types changed.
2002-11-06 00:00:45 +00:00
Tom Lane 2a01b05936 Code review for recent patch to allow ALTER TABLE ADD COLUMN when
a child table already has a matching column.  Acquire appropriate
lock on child table; do the right thing with any CHECK constraints
attached to the new parent column.
2002-11-02 22:02:08 +00:00
Tom Lane e02d1abee6 During swap_relfilenodes, swap relation size statistic fields along with
the relfilenode and toast fields.  This ensures that the newly-computed
statistics will be available on completion of CLUSTER.
2002-11-02 21:20:40 +00:00
Tom Lane 5123139210 Remove encoding lookups from grammar stage, push them back to places
where it's safe to do database access.  Along the way, fix core dump
for 'DEFAULT' parameters to CREATE DATABASE.  initdb forced due to
change in pg_proc entry.
2002-11-02 18:41:22 +00:00
Tom Lane 6a7273e14c Fix permissions-checking bugs and namespace-search-path bugs in
CONVERSION code.  Still need to figure out what to do about inappropriate
coding in parsing.
2002-11-02 02:33:03 +00:00
Tom Lane 8d43947886 Reduce messages associated with shell-type function arguments/results
from WARNING to NOTICE, since they are expected messages in common cases.
2002-11-01 19:19:58 +00:00
Tom Lane 8a45a2e9b6 Fix miscalculation of remaining free space during tuple chain moving.
Only affects machines where MAXALIGN > 4, and is a boundary-condition
case even there, but still surprising that it's not been identified
before.  Also reduce tuple chain move give-up messages from WARNING
to DEBUG1, since they are not unexpected conditions.
2002-10-31 19:25:29 +00:00
Tom Lane 200b151615 Fix places that were using IsTransactionBlock() as an (inadequate) check
that they'd get to commit immediately on finishing.  There's now a
centralized routine PreventTransactionChain() that implements the
necessary tests.
2002-10-21 22:06:20 +00:00
Bruce Momjian e49c1a9234 Fix ALTER TABLE ... ADD COLUMN for inheritance cases.
Alvaro Herrera
2002-10-21 20:31:52 +00:00
Tom Lane a20e49bea8 Avoid using IsTransactionBlock() in DeferredTriggerSetState(); no real
need for this optimization, and it's too easily fooled anyway.
2002-10-21 19:55:49 +00:00
Tom Lane e16f04cf72 Make CREATE/ALTER/DROP USER/GROUP transaction-safe, or at least pretty
nearly so, by postponing write of flat password file until transaction
commit.
2002-10-21 19:46:45 +00:00
Tom Lane 60992456ed Invert logic in pg_exec_query_string() so that we set a snapshot for
all utility statement types *except* a short list, per discussion a few
days ago.  Add missing SetQuerySnapshot calls in VACUUM and REINDEX,
and guard against calling REINDEX DATABASE from a function (has same
problem as VACUUM).
2002-10-19 20:15:09 +00:00
Bruce Momjian 757b98fda8 Back out Alvaro's patch until regression tests pass. 2002-10-19 03:01:09 +00:00
Bruce Momjian 1a63cc5e90 Fix compile failure caused by new patch. 2002-10-19 02:25:51 +00:00
Bruce Momjian cabad378fc > Huh, I don't know where I got the idea you were (or someone else was?)
> in the position that attislocal should be reset.  I'll clean everything
> up and submit the patch I had originally made.

All right, this is it.  This patch merely checks if child tables have
the column.  If atttypid and atttypmod are the same, the attributes'
attinhcount is incremented; else the operation is aborted.  If child
tables don't have the column, recursively add it.

attislocal is not touched in any case.

Alvaro Herrera
2002-10-19 02:09:45 +00:00
Tom Lane 5a0a79d694 Add missing #include <errno.h>. 2002-10-19 00:25:36 +00:00
Tom Lane 8f2a289d78 Arrange to copy relcache's trigdesc structure at the start of any
query that uses it.  This ensures that triggers will be applied consistently
throughout a query even if someone commits changes to the relation's
pg_class.reltriggers field meanwhile.  Per crash report from Laurette Cisneros.
While at it, simplify memory management in relcache.c, which no longer
needs the old hack to try to keep trigger info in the same place over
a relcache entry rebuild.  (Should try to fix rd_att and rewrite-rule
access similarly, someday.)  And make RelationBuildTriggers simpler and
more robust by making it build the trigdesc in working memory and then
CopyTriggerDesc() into cache memory.
2002-10-14 16:51:30 +00:00
Bruce Momjian ac376a3eb9 As Niel so nicely pointed out this morning, the output of EXPLAIN
ANALYZE is not quite clear when branches of the query are never
executed. So this tiny patch fixes that.

The patch is attached and can also be found at:
http://svana.org/kleptog/pgsql/pgsql-explain.patch

Martijn van Oosterhout
2002-10-14 04:26:54 +00:00
Bruce Momjian 8a7cfa3756 Lock on the rule relation wasn't removed after adding the comment.
Added Tom's patch fix for heap_close.

Rod Taylor
2002-10-09 16:26:46 +00:00
Tom Lane 916d8164df Restrict CREATE OPERATOR CLASS to superusers, per discussion some weeks
ago.
2002-10-04 22:19:29 +00:00
Tom Lane d2db166c75 Require superuser privilege to create a binary-compatible cast, per
discussion some weeks ago.  Also, add a check that two types to be
binary-equivalenced match as to typlen, typbyval, and typalign; if
they don't then it's surely a mistake to equivalence them.
2002-10-04 22:08:44 +00:00