Bruce Momjian [Tue, 12 Dec 2006 22:31:19 +0000 (22:31 +0000)]
Update entry:
< * Have EXPLAIN ANALYZE highlight poor optimizer estimates
> * Have EXPLAIN ANALYZE issue NOTICE messages when the estimated and
> actual row counts differ by a specified percentage
Tom Lane [Tue, 12 Dec 2006 21:31:02 +0000 (21:31 +0000)]
Fix planner to do the right thing when a degenerate outer join (one whose
joinclause doesn't use any outer-side vars) requires a "bushy" plan to be
created. The normal heuristic to avoid joins with no joinclause has to be
overridden in that case. Problem is new in 8.2; before that we forced the
outer join order anyway. Per example from Teodor.
Tom Lane [Sun, 10 Dec 2006 22:13:27 +0000 (22:13 +0000)]
Add a paramtypmod field to Param nodes. This is dead weight for Params
representing externally-supplied values, since the APIs that carry such
values only specify type not typmod. However, for PARAM_SUBLINK Params
it is handy to carry the typmod of the sublink's output column. This
is a much cleaner solution for the recently reported 'could not find
pathkey item to sort' and 'failed to find unique expression in subplan
tlist' bugs than my original 8.2-compatible patch. Besides, someday we
might want to support typmods for external parameters ...
Tom Lane [Fri, 8 Dec 2006 19:50:53 +0000 (19:50 +0000)]
Remove the logId/logSeg fields from pg_control, because they are not needed
in normal operation, and we can avoid rewriting pg_control at every log
segment switch if we don't insist that these values be valid. Reducing
the number of pg_control updates is a good idea for both performance and
reliability. It does make pg_resetxlog's life a bit harder, but that seems
a good tradeoff; and anyway the change to pg_resetxlog amounts to automating
something people formerly needed to do by hand, namely look at the existing
pg_xlog files to make sure the new WAL start point was past them.
In passing, change the wording of xlog.c's "database system was interrupted"
messages: describe the pg_control timestamp as "last known up at" rather than
implying it is the exact time of service interruption. With this change the
timestamp will generally be the time of the last checkpoint, which could be
many minutes before the failure; and we've already seen indications that
people tend to misinterpret the old wording.
initdb forced due to change in pg_control layout. Simon Riggs and Tom Lane
Tom Lane [Fri, 8 Dec 2006 00:40:27 +0000 (00:40 +0000)]
Avoid double free of _SPI_current->tuptable. AtEOSubXact_SPI() now tries to
release it in a subtransaction abort, but this neglects possibility that
someone outside SPI already did. Fix is for spi.c to forget about a tuptable
as soon as it's handed it back to the caller.
Per bug #2817 from Michael Andreen.
Tom Lane [Thu, 7 Dec 2006 19:33:40 +0000 (19:33 +0000)]
Repair incorrect placement of WHERE clauses when there are multiple,
rearrangeable outer joins and the WHERE clause is non-strict and mentions
only nullable-side relations. New bug in 8.2, caused by new logic to allow
rearranging outer joins. Per bug #2807 from Ross Cohen; thanks to Jeff
Davis for producing a usable test case.
Tom Lane [Wed, 6 Dec 2006 19:40:01 +0000 (19:40 +0000)]
Fix planning of SubLinks to ensure that Vars generated from transformation of
a sublink's test expression have the correct vartypmod, rather than defaulting
to -1. There's at least one place where this is important because we're
expecting these Vars to be exactly equal() to those appearing in the subplan
itself. This is a pretty klugy solution --- it would likely be cleaner to
change Param nodes to include a typmod field --- but we can't do that in the
already-released 8.2 branch.
Per bug report from Hubert Fongarnand.
Neil Conway [Wed, 6 Dec 2006 18:06:48 +0000 (18:06 +0000)]
Add a txn_start column to pg_stat_activity. This makes it easier to
identify long-running transactions. Since we already need to record
the transaction-start time (e.g. for now()), we don't need any
additional system calls to report this information.
Neil Conway [Wed, 6 Dec 2006 17:35:49 +0000 (17:35 +0000)]
Various improvements to the GUC description strings. Punctuate and
capitalize the strings like sentences. Remove unnecessarily
specific descriptions of the units used by GUC variables, since
we now allow any reasonable unit to be specified.
Tom Lane [Mon, 4 Dec 2006 02:06:55 +0000 (02:06 +0000)]
Refactor ExecGetJunkAttribute to avoid searching for junk attributes
by name on each and every row processed. Profiling suggests this may
buy a percent or two for simple UPDATE scenarios, which isn't huge,
but when it's so easy to get ...
Tom Lane [Sun, 3 Dec 2006 21:40:07 +0000 (21:40 +0000)]
Fix LIMIT/OFFSET for null limit values. This worked before 8.2 but was broken
by the change to make limit values int8 instead of int4. (Specifically, you
can do DatumGetInt32 safely on a null value, but not DatumGetInt64.) Per
bug #2803 from Greg Johnson.
Tom Lane [Fri, 1 Dec 2006 21:17:51 +0000 (21:17 +0000)]
Some more supported-platforms updates: buildfarm hare is alive again,
and penguin reported in recently enough to justify the assumption that
we haven't broken ARM support in 8.2.
Tom Lane [Fri, 1 Dec 2006 20:49:53 +0000 (20:49 +0000)]
Document the recently-understood hazard that a rollback can release row-level
locks that logically should not be released, because when a subtransaction
overwrites XMAX all knowledge of the previous lock state is lost. It seems
unlikely that we will be able to fix this before 8.3...
Tom Lane [Fri, 1 Dec 2006 19:55:28 +0000 (19:55 +0000)]
Make the bgwriter's error recovery path do smgrcloseall(). On Windows this
should allow delete-pending files to actually go away, and thereby work
around the various complaints we've seen about 'permission denied'
errors in such cases. Should be reasonably harmless in any case...
Tom Lane [Fri, 1 Dec 2006 01:04:36 +0000 (01:04 +0000)]
Adjust the description of locking to clarify that locks held by a
subtransaction are released if the subtransaction aborts --- in user-level
terminology, this means either rolling back to a savepoint or escaping from
a plpgsql exception block. Per recent suggestion from Simon.
Tom Lane [Thu, 30 Nov 2006 18:29:12 +0000 (18:29 +0000)]
Minor adjustments to make failures in startup/shutdown behave more cleanly.
StartupXLOG and ShutdownXLOG no longer need to be critical sections, because
in all contexts where they are invoked, elog(ERROR) would be translated to
elog(FATAL) anyway. (One change in bgwriter.c is needed to make this true:
set ExitOnAnyError before trying to exit. This is a good fix anyway since
the existing code would have gone into an infinite loop on elog(ERROR) during
shutdown.) That avoids a misleading report of PANIC during semi-orderly
failures. Modify the postmaster to include the startup process in the set of
processes that get SIGTERM when a fast shutdown is requested, and also fix it
to not try to restart the bgwriter if the bgwriter fails while trying to write
the shutdown checkpoint. Net result is that "pg_ctl stop -m fast" does
something reasonable for a system in warm standby mode, and so should Unix
system shutdown (ie, universal SIGTERM). Per gripe from Stephen Harris and
some corner-case testing of my own.
Teodor Sigaev [Thu, 30 Nov 2006 16:22:32 +0000 (16:22 +0000)]
Fix bug with page deletion. If inner page is removed and it tries to
remove page on next level linked from next inner page, ginScanToDelete()
wrongly sets parent page. Bug reveals when many item pointers from index
was deleted ( several hundred thousands).
Bug is discovered by hubert depesz lubaczewski <depesz@gmail.com>
Tom Lane [Tue, 28 Nov 2006 19:37:03 +0000 (19:37 +0000)]
Update timezone data to tzdata2006p zic distribution. It seems Western
Australia decided to institute DST with one month's notice ... way to go,
politicians.
Tom Lane [Tue, 28 Nov 2006 19:18:44 +0000 (19:18 +0000)]
Mark to_char(timestamp without timezone) as stable, not immutable, since its
result now depends on the lc_messages setting, as noted by Bruce.
Also, mark to_number() and the numeric-type variants of to_char() as stable,
because their results depend on lc_numeric; this is a longstanding oversight.
Also, mark to_date() and to_char(interval) as stable; although these appear
not to depend on any GUC variables as of CVS HEAD, that seems a property
unlikely to survive future improvements. It seems best to mark all the
formatting functions stable and be done with it.
catversion not bumped, because this does not seem critical enough to force
a post-RC1 initdb, and anyway we cannot do so in the back branches.
Tom Lane [Fri, 24 Nov 2006 23:06:50 +0000 (23:06 +0000)]
Fix psql's \copy command to ensure that it cycles libpq back to the idle state
(in particular, causing the ReadyForQuery message to be eaten) before
returning from do_copy. The only known consequence of failing to do so is
that get_prompt might show a wrong result for the %x transaction status
escape, as reported by Bernd Helmle; but it's possible there are other issues.
Back-patch as far as 7.4, the oldest version supporting %x.
Tom Lane [Fri, 24 Nov 2006 21:18:42 +0000 (21:18 +0000)]
Change pg_stat_all_tables and sister views to put the recently-added
vacuum/analyze timestamp columns at the end, rather than at a random
spot in the middle as in the original patch. This was deemed more usable
as well as less likely to break existing application code. initdb forced
accordingly. In passing, remove former kluge for initializing
pg_stat_file()'s pg_proc entry --- bootstrap mode was fixed recently
so that this can be done without any hacks, but I overlooked this usage.
Tom Lane [Fri, 24 Nov 2006 18:44:37 +0000 (18:44 +0000)]
Make contrib/isn pass the opr_sanity sanity checks: add missing
commutator operators, and mark hash-opclass members as oprcanhash.
This is a pretty ugly, brute-force solution, but it seems that getting
rid of all these redundant-looking operators would require some tweaks
in the core operator-resolution code to behave nicely, and I'm not
willing to risk that just before RC1.