]> granicus.if.org Git - postgresql/log
postgresql
14 years agoClean up handling of XactReadOnly and RecoveryInProgress checks.
Tom Lane [Sat, 20 Feb 2010 21:24:02 +0000 (21:24 +0000)]
Clean up handling of XactReadOnly and RecoveryInProgress checks.

Add some checks that seem logically necessary, in particular let's make
real sure that HS slave sessions cannot create temp tables.  (If they did
they would think that temp tables belonging to the master's session with
the same BackendId were theirs.  We *must* not allow myTempNamespace to
become set in a slave session.)

Change setval() and nextval() so that they are only allowed on temp sequences
in a read-only transaction.  This seems consistent with what we allow for
table modifications in read-only transactions.  Since an HS slave can't have a
temp sequence, this also provides a nicer cure for the setval PANIC reported
by Erik Rijkers.

Make the error messages more uniform, and have them mention the specific
command being complained of.  This seems worth the trifling amount of extra
code, since people are likely to see such messages a lot more than before.

14 years agoMake 'include_realm' ordering consistent in the docs, to match recent
Bruce Momjian [Sat, 20 Feb 2010 21:04:28 +0000 (21:04 +0000)]
Make 'include_realm' ordering consistent in the docs, to match recent
doc change.

14 years agoClarify documentation about username mapping when authenticating with
Bruce Momjian [Sat, 20 Feb 2010 19:21:14 +0000 (19:21 +0000)]
Clarify documentation about username mapping when authenticating with
GSSAPI or Kerberos.

Ian Turner

14 years agoDocument that many solid-state drives have volatile write-back caches.
Bruce Momjian [Sat, 20 Feb 2010 18:28:37 +0000 (18:28 +0000)]
Document that many solid-state drives have volatile write-back caches.

14 years agoCopy editing of Hot Standby docs. Some clarifications, addition
Simon Riggs [Sat, 20 Feb 2010 10:07:27 +0000 (10:07 +0000)]
Copy editing of Hot Standby docs. Some clarifications, addition
of missing items and minor edits.

14 years agoReduce the rescan cost estimate for Materialize nodes to cpu_operator_cost per
Tom Lane [Fri, 19 Feb 2010 21:49:10 +0000 (21:49 +0000)]
Reduce the rescan cost estimate for Materialize nodes to cpu_operator_cost per
tuple, instead of the former cpu_tuple_cost.  It is sane to charge less than
cpu_tuple_cost because Materialize never does any qual-checking or projection,
so it's got less overhead than most plan node types.  In particular, we want
to have the same charge here as is charged for readout in cost_sort.  That
avoids the problem recently exhibited by Teodor wherein the planner prefers
a useless sort over a materialize step in a context where a lot of rescanning
will happen.  The rescan costs should be just about the same for both node
types, so make their estimates the same.

Not back-patching because all of the current logic for rescan cost estimates
is new in 9.0.  The old handling of rescans is sufficiently not-sane that
changing this in that structure is a bit pointless, and might indeed cause
regressions.

14 years agoRevert version stamping in wrong branch
Peter Eisentraut [Fri, 19 Feb 2010 18:42:30 +0000 (18:42 +0000)]
Revert version stamping in wrong branch

14 years agoVersion stamp 9.0alpha4
Peter Eisentraut [Fri, 19 Feb 2010 16:03:22 +0000 (16:03 +0000)]
Version stamp 9.0alpha4

14 years agoDocument --version and --help options for all client applications (they
Bruce Momjian [Fri, 19 Feb 2010 14:36:45 +0000 (14:36 +0000)]
Document --version and --help options for all client applications (they
all support it).

Per report from Josh Kupershmidt

14 years agoSmall corrections to message output targets in pg_ctl
Peter Eisentraut [Fri, 19 Feb 2010 14:12:19 +0000 (14:12 +0000)]
Small corrections to message output targets in pg_ctl

- The message "server stopped" should be affected by the -s option, just
  like "server started" already was.

- The message "could not start server" should consistently go to stderr.

14 years agoDon't use O_DIRECT when writing WAL files if archiving or streaming is
Heikki Linnakangas [Fri, 19 Feb 2010 10:51:04 +0000 (10:51 +0000)]
Don't use O_DIRECT when writing WAL files if archiving or streaming is
enabled. Bypassing the kernel cache is counter-productive in that case,
because the archiver/walsender process will read from the WAL file
soon after it's written, and if it's not cached the read will cause
a physical read, eating I/O bandwidth available on the WAL drive.

Also, walreceiver process does unaligned writes, so disable O_DIRECT
in walreceiver process for that reason too.

14 years agoForbid setval() during recovery. This prevents the PANIC reported by
Heikki Linnakangas [Fri, 19 Feb 2010 06:29:19 +0000 (06:29 +0000)]
Forbid setval() during recovery. This prevents the PANIC reported  by
Erik Rijkers. Patch by Andres Freund.

14 years agoFirst pass over client applications documentation proofreading.
Bruce Momjian [Fri, 19 Feb 2010 03:50:03 +0000 (03:50 +0000)]
First pass over client applications documentation proofreading.

gabrielle

14 years agoRemove mention that binary distributions pre-compile the tutorial files.
Bruce Momjian [Fri, 19 Feb 2010 01:15:54 +0000 (01:15 +0000)]
Remove mention that binary distributions pre-compile the tutorial files.

14 years agoFix STOP WAL LOCATION in backup history files no to return the next
Itagaki Takahiro [Fri, 19 Feb 2010 01:04:03 +0000 (01:04 +0000)]
Fix STOP WAL LOCATION in backup history files no to return the next
segment of XLOG_BACKUP_END record even if the the record is placed
at a segment boundary. Furthermore the previous implementation could
return nonexistent segment file name when the boundary is in segments
that has "FE" suffix; We never use segments with "FF" suffix.

Backpatch to 8.0, where hot backup was introduced.

Reported by Fujii Masao.

14 years agoTranslation updates for 9.0alpha4
Peter Eisentraut [Fri, 19 Feb 2010 00:40:05 +0000 (00:40 +0000)]
Translation updates for 9.0alpha4

14 years agoPreliminary release notes for 9.0alpha4
Peter Eisentraut [Fri, 19 Feb 2010 00:35:18 +0000 (00:35 +0000)]
Preliminary release notes for 9.0alpha4

14 years agoHot Standby documentation updates
Bruce Momjian [Fri, 19 Feb 2010 00:15:25 +0000 (00:15 +0000)]
Hot Standby documentation updates

Greg Smith

14 years agoVolatile-ize all five places where we expect a PG_TRY block to restore
Tom Lane [Thu, 18 Feb 2010 23:50:06 +0000 (23:50 +0000)]
Volatile-ize all five places where we expect a PG_TRY block to restore
old memory context in plpython.  Before only one of them was marked
volatile, but per report from Zdenek Kotala, some compilers do the
wrong thing here.

14 years agoProvide some rather hokey ways for EXPLAIN to print FieldStore and assignment
Tom Lane [Thu, 18 Feb 2010 22:43:31 +0000 (22:43 +0000)]
Provide some rather hokey ways for EXPLAIN to print FieldStore and assignment
ArrayRef expressions that are not in the immediate context of an INSERT or
UPDATE targetlist.  Such cases never arise in stored rules, so ruleutils.c
hadn't tried to handle them.  However, they do occur in the targetlists of
plans derived from such statements, and now that EXPLAIN VERBOSE tries to
print targetlists, we need some way to deal with the case.

I chose to represent an assignment ArrayRef as "array[subscripts] := source",
which is fairly reasonable and doesn't omit any information.  However,
FieldStore is problematic because the planner will fold multiple assignments
to fields of the same composite column into one FieldStore, resulting in a
structure that is hard to understand at all, let alone display comprehensibly.
So in that case I punted and just made it print the source expression(s).

Backpatch to 8.4 --- the lack of functionality exists in older releases,
but doesn't seem to be important for lack of anything that would call it.

14 years agoFix ExecEvalArrayRef to pass down the old value of the array element or slice
Tom Lane [Thu, 18 Feb 2010 18:41:47 +0000 (18:41 +0000)]
Fix ExecEvalArrayRef to pass down the old value of the array element or slice
being assigned to, in case the expression to be assigned is a FieldStore that
would need to modify that value.  The need for this was foreseen some time
ago, but not implemented then because we did not have arrays of composites.
Now we do, but the point evidently got overlooked in that patch.  Net result
is that updating a field of an array element doesn't work right, as
illustrated if you try the new regression test on an unpatched backend.
Noted while experimenting with EXPLAIN VERBOSE, which has also got some issues
in this area.

Backpatch to 8.3, where arrays of composites were introduced.

14 years agoFix pq_getbyte_if_available() function. It was confused on what it
Heikki Linnakangas [Thu, 18 Feb 2010 11:13:46 +0000 (11:13 +0000)]
Fix pq_getbyte_if_available() function. It was confused on what it
returns if no data is immediately available. Patch by me with numerous
fixes from Fujii Masao and Magnus Hagander.

14 years agodate_recv should accept infinities.
Itagaki Takahiro [Thu, 18 Feb 2010 04:31:16 +0000 (04:31 +0000)]
date_recv should accept infinities.

Reported by James William Pye.

14 years agoAdd missing close tag.
Bruce Momjian [Thu, 18 Feb 2010 04:14:38 +0000 (04:14 +0000)]
Add missing close tag.

14 years agoWordsmithing of HS and SR documentation, with some wording improvements
Bruce Momjian [Thu, 18 Feb 2010 03:16:09 +0000 (03:16 +0000)]
Wordsmithing of HS and SR documentation, with some wording improvements
from Erik Rijkers too.

14 years agoForce READY portals into FAILED state when a transaction or subtransaction
Tom Lane [Thu, 18 Feb 2010 03:06:46 +0000 (03:06 +0000)]
Force READY portals into FAILED state when a transaction or subtransaction
is aborted, if they were created within the failed xact.  This prevents
ExecutorEnd from being run on them, which is a good idea because they may
contain references to tables or other objects that no longer exist.
In particular this is hazardous when auto_explain is active, but it's
really rather surprising that nobody has seen an issue with this before.
I'm back-patching this to 8.4, since that's the first version that contains
auto_explain or an ExecutorEnd hook, but I wonder whether we shouldn't
back-patch further.

14 years agoFix up pg_dump's treatment of large object ownership and ACLs. We now emit
Tom Lane [Thu, 18 Feb 2010 01:29:10 +0000 (01:29 +0000)]
Fix up pg_dump's treatment of large object ownership and ACLs.  We now emit
a separate archive entry for each BLOB, and use pg_dump's standard methods
for dealing with its ownership, ACL if any, and comment if any.  This means
that switches like --no-owner and --no-privileges do what they're supposed
to.  Preliminary testing says that performance is still reasonable even
with many blobs, though we'll have to see how that shakes out in the field.

KaiGai Kohei, revised by me

14 years agoTake care to reprocess an uncommitted notify message.
Tom Lane [Wed, 17 Feb 2010 16:54:06 +0000 (16:54 +0000)]
Take care to reprocess an uncommitted notify message.

Oversight in my changes to cope with possible errors during message
processing; spotted by Joachim Wieland.

14 years agoAnother typo fix.
Magnus Hagander [Wed, 17 Feb 2010 05:51:40 +0000 (05:51 +0000)]
Another typo fix.

Thom Brown

14 years agoUse a fatal warning check with what looks like a more portable error message. Error...
Andrew Dunstan [Wed, 17 Feb 2010 05:32:48 +0000 (05:32 +0000)]
Use a fatal warning check with what looks like a more portable error message. Error noticed by Tom and buildfarm member kite.

14 years agoStamp HEAD as 9.0devel, and update various places that were referring to 8.5
Tom Lane [Wed, 17 Feb 2010 04:19:41 +0000 (04:19 +0000)]
Stamp HEAD as 9.0devel, and update various places that were referring to 8.5
(hope I got 'em all).  Per discussion, this release will be 9.0 not 8.5.

14 years agoSupport new syntax and improve handling of parentheses in psql tab-completion.
Itagaki Takahiro [Wed, 17 Feb 2010 04:09:40 +0000 (04:09 +0000)]
Support new syntax and improve handling of parentheses in psql tab-completion.

Newly supported syntax are:
  - ALTER {TABLE|INDEX|TABLESPACE} {SET|RESET} with options
  - ALTER TABLE ALTER COLUMN {SET|RESET} with options
  - ALTER TABLE ALTER COLUMN SET STORAGE
  - CREATE INDEX CONCURRENTLY
  - CREATE INDEX ON (without name)
  - CREATE INDEX ... USING with pg_am.amname instead of hard-corded names
  - CREATE TRIGGER with events
  - DROP AGGREGATE function with arguments

14 years agoWhen updating ShmemVariableCache from a checkpoint record, be sure to set
Tom Lane [Wed, 17 Feb 2010 03:10:33 +0000 (03:10 +0000)]
When updating ShmemVariableCache from a checkpoint record, be sure to set
all the values derived from oldestXid, not just that field.  Brain fade in
one of my patches associated with flat file removal, exposed by a report
from Fujii Masao.

With this change, xidVacLimit should always be valid, so remove a couple of
bits of complexity associated with the previous assumption that sometimes
it wouldn't get set right away.

14 years agoPrevent #option dump from crashing on FORI statement with null step. Reported by...
Tom Lane [Wed, 17 Feb 2010 01:48:45 +0000 (01:48 +0000)]
Prevent #option dump from crashing on FORI statement with null step.  Reported by Pavel.

14 years agolog_error_verbosity is now LOGGING_WHAT category.
Tom Lane [Wed, 17 Feb 2010 01:39:35 +0000 (01:39 +0000)]
log_error_verbosity is now LOGGING_WHAT category.

14 years agoTweak description of payload parameter.
Tom Lane [Wed, 17 Feb 2010 00:57:06 +0000 (00:57 +0000)]
Tweak description of payload parameter.

14 years agoMake NOTIFY_PAYLOAD_MAX_LENGTH depend explicitly on BLCKSZ and
Tom Lane [Wed, 17 Feb 2010 00:52:09 +0000 (00:52 +0000)]
Make NOTIFY_PAYLOAD_MAX_LENGTH depend explicitly on BLCKSZ and
NAMEDATALEN, so this code doesn't go nuts with smaller than default
BLCKSZ or larger than default NAMEDATALEN.  The standard value is
still exactly 8000.

14 years agoReplace the pg_listener-based LISTEN/NOTIFY mechanism with an in-memory queue.
Tom Lane [Tue, 16 Feb 2010 22:34:57 +0000 (22:34 +0000)]
Replace the pg_listener-based LISTEN/NOTIFY mechanism with an in-memory queue.
In addition, add support for a "payload" string to be passed along with
each notify event.

This implementation should be significantly more efficient than the old one,
and is also more compatible with Hot Standby usage.  There is not yet any
facility for HS slaves to receive notifications generated on the master,
although such a thing is possible in future.

Joachim Wieland, reviewed by Jeff Davis; also hacked on by me.

14 years agoAdd query text to auto_explain output.
Andrew Dunstan [Tue, 16 Feb 2010 22:19:59 +0000 (22:19 +0000)]
Add query text to auto_explain output.

Still to be done: fix docs and fix regression failures under auto_explain.

14 years agoClean up package namespace use and use of Safe in plperl.
Andrew Dunstan [Tue, 16 Feb 2010 21:39:52 +0000 (21:39 +0000)]
Clean up package namespace use and use of Safe in plperl.
Prevent use of another buggy version of Safe.pm.
Only register the exit handler if we have  successfully created an interpreter.
Change log level of perl warnings from NOTICE to WARNING.

The infrastructure is there if in future we decide to allow
DBAs to specify extra modules that will be allowed in trusted code.
However, for now the relevant variables are declared as lexicals
rather than as package variables, so that they are not (or should not be)
accessible.

Mostly code from Tim Bunce, reviewed by Alex Hunsaker, with some
tweaks by me.

14 years agoMove log_error_verbosity GUC setting to "What to log" section, and
Bruce Momjian [Tue, 16 Feb 2010 21:35:51 +0000 (21:35 +0000)]
Move log_error_verbosity GUC setting to "What to log" section, and
document the behavior of terse and verbose output options.

14 years agoHonor to_char() "FM" specification in YYY, YY, and Y; it was already
Bruce Momjian [Tue, 16 Feb 2010 21:18:02 +0000 (21:18 +0000)]
Honor to_char() "FM" specification in YYY, YY, and Y;  it was already
honored by YYYY.  Also document Oracle "toggle" FM behavior.

Per report from Guy Rouillier

14 years agoPrevent psql version banner from being printed by the \c command if the
Bruce Momjian [Tue, 16 Feb 2010 21:07:01 +0000 (21:07 +0000)]
Prevent psql version banner from being printed by the \c command if the
versions match, per report from Peter.

14 years agoHave SELECT and CREATE TABLE AS queries return a row count. While this
Bruce Momjian [Tue, 16 Feb 2010 20:58:14 +0000 (20:58 +0000)]
Have SELECT and CREATE TABLE AS queries return a row count.  While this
is invisible in psql, other interfaces, like libpq, make this value
visible.

Boszormenyi Zoltan

14 years agoRemove personal copyright now that file has been rewritten using
Bruce Momjian [Tue, 16 Feb 2010 20:35:07 +0000 (20:35 +0000)]
Remove personal copyright now that file has been rewritten using
existing *.pl conversion script.

Andreas 'ads' Scherbaum

14 years agoClarify documentation on the behavior of unnamed bind queries.
Bruce Momjian [Tue, 16 Feb 2010 20:15:14 +0000 (20:15 +0000)]
Clarify documentation on the behavior of unnamed bind queries.

14 years agorevert to showing buffer counts in explain (buffers)
Greg Stark [Tue, 16 Feb 2010 20:07:13 +0000 (20:07 +0000)]
revert to showing buffer counts in explain (buffers)

14 years agoAdd emulation of non-blocking sockets to the win32 socket/signal layer,
Magnus Hagander [Tue, 16 Feb 2010 19:26:02 +0000 (19:26 +0000)]
Add emulation of non-blocking sockets to the win32 socket/signal layer,
and use this in pq_getbyte_if_available.

It's only a limited implementation which swithes the whole emulation layer
no non-blocking mode, but that's enough as long as non-blocking is only
used during a short period of time, and only one socket is accessed during
this time.

14 years agoDo not check nan values for infinity. Some system are not able to handle this.
Michael Meskes [Tue, 16 Feb 2010 18:41:23 +0000 (18:41 +0000)]
Do not check nan values for infinity. Some system are not able to handle this.

By Zoltán Böszörményi

14 years agoFix synopsis of DO statement.
Itagaki Takahiro [Tue, 16 Feb 2010 00:49:42 +0000 (00:49 +0000)]
Fix synopsis of DO statement.

14 years agoMove main error message text in plperl into errmsg from errdetail,
Alvaro Herrera [Mon, 15 Feb 2010 22:23:25 +0000 (22:23 +0000)]
Move main error message text in plperl into errmsg from errdetail,
and move the context information into errcontext instead of errmsg.
This makes them better conform to our guidelines.

Also remove a few errcode declarations that were providing the default
value ERRCODE_INTERNAL_ERROR.

14 years agoWhen sorting functions in pg_dump, break ties (same name) by number of arguments
Peter Eisentraut [Mon, 15 Feb 2010 19:59:47 +0000 (19:59 +0000)]
When sorting functions in pg_dump, break ties (same name) by number of arguments

14 years agoFix another stupid typo...
Magnus Hagander [Mon, 15 Feb 2010 17:10:50 +0000 (17:10 +0000)]
Fix another stupid typo...

Jan Urbanski

14 years agoFix typo in comment
Alvaro Herrera [Mon, 15 Feb 2010 16:10:34 +0000 (16:10 +0000)]
Fix typo in comment

14 years agoTemporarily disable fsyncing the database directory in CREATE DATABASE
Greg Stark [Mon, 15 Feb 2010 11:40:49 +0000 (11:40 +0000)]
Temporarily disable fsyncing the database directory in CREATE DATABASE
until we can work out portability issues the build farm uncovered.

In passing avoid fsyncing subdirectories twice.

14 years agoremove an unused variable 'dirfd'.
Itagaki Takahiro [Mon, 15 Feb 2010 04:05:06 +0000 (04:05 +0000)]
remove an unused variable 'dirfd'.

14 years agoAdd psql tab completion for DO blocks.
Itagaki Takahiro [Mon, 15 Feb 2010 02:55:01 +0000 (02:55 +0000)]
Add psql tab completion for DO blocks.
Also adjust documentation of DO.

Patch from David Fetter and subsequent discussion.

14 years agoDisplay explain buffers measurements in memory units rather than blocks. Also show...
Greg Stark [Mon, 15 Feb 2010 02:36:26 +0000 (02:36 +0000)]
Display explain buffers measurements in memory units rather than blocks. Also show "Total Buffer Usage" to hint that these are totals not averages per loop

14 years agoSpeed up CREATE DATABASE by deferring the fsyncs until after copying
Greg Stark [Mon, 15 Feb 2010 00:50:57 +0000 (00:50 +0000)]
Speed up CREATE DATABASE by deferring the fsyncs until after copying
all the data and using posix_fadvise to nudge the OS into flushing it
earlier. This also hopefully makes CREATE DATABASE avoid spamming the
cache.

Tests show a big speedup on Linux at least on some filesystems.

Idea and patch from Andres Freund.

14 years agoWrap calls to SearchSysCache and related functions using macros.
Robert Haas [Sun, 14 Feb 2010 18:42:19 +0000 (18:42 +0000)]
Wrap calls to SearchSysCache and related functions using macros.

The purpose of this change is to eliminate the need for every caller
of SearchSysCache, SearchSysCacheCopy, SearchSysCacheExists,
GetSysCacheOid, and SearchSysCacheList to know the maximum number
of allowable keys for a syscache entry (currently 4).  This will
make it far easier to increase the maximum number of keys in a
future release should we choose to do so, and it makes the code
shorter, too.

Design and review by Tom Lane.

14 years agoMake CREATE DATABASE safe against losing whole files by fsyncing the
Greg Stark [Sun, 14 Feb 2010 17:50:52 +0000 (17:50 +0000)]
Make CREATE DATABASE safe against losing whole files by fsyncing the
directory and not just the individual files.

Back-patch to 8.1 -- before that we just called "cp -r" and never
fsynced anything anyways.

14 years agoMake the msvc build system ask python about details of version and installation
Magnus Hagander [Sun, 14 Feb 2010 14:10:23 +0000 (14:10 +0000)]
Make the msvc build system ask python about details of version and installation
prefix, instead of assuming it will always be following the default layout.

All information we need is not available on Windows, but the number of
assumptions are at least fewer this way than before.

Based on suggestions from James William Pye.

14 years agoOoops, let's get the non-null vs null bit right ...
Tom Lane [Sun, 14 Feb 2010 01:01:35 +0000 (01:01 +0000)]
Ooops, let's get the non-null vs null bit right ...

14 years agoDocument the behavior of STRICT VARIADIC functions.
Tom Lane [Sun, 14 Feb 2010 00:48:12 +0000 (00:48 +0000)]
Document the behavior of STRICT VARIADIC functions.

14 years agoImprove C comment about why we return "0 0" for some tags.
Bruce Momjian [Sat, 13 Feb 2010 22:45:41 +0000 (22:45 +0000)]
Improve C comment about why we return "0 0" for some tags.

14 years agoDon't expose the inline definition of MemoryContextSwitchTo when FRONTEND is
Tom Lane [Sat, 13 Feb 2010 20:46:52 +0000 (20:46 +0000)]
Don't expose the inline definition of MemoryContextSwitchTo when FRONTEND is
defined.  Its reference to CurrentMemoryContext causes link failures on some
platforms, evidently because the inline function gets compiled despite lack of
use.  Per buildfarm member warthog.

14 years agoImprovements to ps message of startup process during Hot Standby.
Simon Riggs [Sat, 13 Feb 2010 16:29:38 +0000 (16:29 +0000)]
Improvements to ps message of startup process during Hot Standby.
Message is reset earlier and potential bug avoided.

Andres Freund

14 years agoFix relcache init file invalidation during Hot Standby for the case
Simon Riggs [Sat, 13 Feb 2010 16:15:48 +0000 (16:15 +0000)]
Fix relcache init file invalidation during Hot Standby for the case
where a database has a non-default tablespaceid. Pass thru MyDatabaseId
and MyDatabaseTableSpace to allow file path to be re-created in
standby and correct invalidation to take place in all cases.
Update and rework xact_commit_desc() debug messages.
Bug report from Tom by code inspection. Fix by me.

14 years agoRemove tabs from sgml.
Bruce Momjian [Sat, 13 Feb 2010 03:38:26 +0000 (03:38 +0000)]
Remove tabs from sgml.

14 years agoSupport inlining various small performance-critical functions on non-GCC
Tom Lane [Sat, 13 Feb 2010 02:34:16 +0000 (02:34 +0000)]
Support inlining various small performance-critical functions on non-GCC
compilers, by applying a configure check to see if the compiler will accept
an unreferenced "static inline foo ..." function without warnings.  It is
believed that such warnings are the only reason not to declare inlined
functions in headers, if the compiler understands "inline" at all.

Kurt Harriman

14 years agoRe-enable max_standby_delay = -1 using deadlock detection on startup
Simon Riggs [Sat, 13 Feb 2010 01:32:20 +0000 (01:32 +0000)]
Re-enable max_standby_delay = -1 using deadlock detection on startup
process. If startup waits on a buffer pin we send a request to all
backends to cancel themselves if they are holding the buffer pin
required and they are also waiting on a lock. If not, startup waits
until max_standby_delay before cancelling any backend waiting for
the requested buffer pin.

14 years agoIntroduce WAL records to log reuse of btree pages, allowing conflict
Simon Riggs [Sat, 13 Feb 2010 00:59:58 +0000 (00:59 +0000)]
Introduce WAL records to log reuse of btree pages, allowing conflict
resolution during Hot Standby. Page reuse interlock requested by Tom.
Analysis and patch by me.

14 years agoTweak the order of processing of WITH clauses so that they are processed
Tom Lane [Fri, 12 Feb 2010 22:48:56 +0000 (22:48 +0000)]
Tweak the order of processing of WITH clauses so that they are processed
before we start analyzing the parent statement.  This is to make it
more clear that the WITH isn't affected by anything in the parent.
I don't believe there's any actual bug here, because the stuff that
was being done before WITH didn't affect subqueries; but it's certainly
a potential for error (and apparently misled Marko into committing some
real errors...).

14 years agoAdd regression test files inadvertantly omitted in plperl.on_plperl{u}_init patch
Andrew Dunstan [Fri, 12 Feb 2010 19:38:14 +0000 (19:38 +0000)]
Add regression test files inadvertantly omitted in plperl.on_plperl{u}_init patch

14 years agoDon't choke when exec_move_row assigns a synthesized null to a column
Tom Lane [Fri, 12 Feb 2010 19:37:36 +0000 (19:37 +0000)]
Don't choke when exec_move_row assigns a synthesized null to a column
that happens to be composite itself.  Per bug #5314 from Oleg Serov.

Backpatch to 8.0 --- 7.4 has got too many other shortcomings in
composite-type support to make this worth worrying about in that branch.

14 years agoAdd plperl.on_plperl_init and plperl.on_plperlu_init settings for language-specific...
Andrew Dunstan [Fri, 12 Feb 2010 19:35:25 +0000 (19:35 +0000)]
Add plperl.on_plperl_init and plperl.on_plperlu_init settings for language-specific startup. Rename recently added plperl.on_perl_init to plperl.on_init. Also, code cleanup for utf8 hack. Patch from Tim Bunce, reviewed by Alex Hunsaker.

14 years agoExtend the set of frame options supported for window functions.
Tom Lane [Fri, 12 Feb 2010 17:33:21 +0000 (17:33 +0000)]
Extend the set of frame options supported for window functions.

This patch allows the frame to start from CURRENT ROW (in either RANGE or
ROWS mode), and it also adds support for ROWS n PRECEDING and ROWS n FOLLOWING
start and end points.  (RANGE value PRECEDING/FOLLOWING isn't there yet ---
the grammar works, but that's all.)

Hitoshi Harada, reviewed by Pavel Stehule

14 years agoUpdate Hot Standby documentation to reflect the change in the LOG
Heikki Linnakangas [Fri, 12 Feb 2010 14:53:22 +0000 (14:53 +0000)]
Update Hot Standby documentation to reflect the change in the LOG
messages printed at startup. As pointed out by Simon Riggs.

14 years agoReduce the chatter to the log when starting a standby server. Don't
Heikki Linnakangas [Fri, 12 Feb 2010 09:49:08 +0000 (09:49 +0000)]
Reduce the chatter to the log when starting a standby server. Don't
echo all the recovery.conf options. Don't emit the "initializing
recovery connections" message, which doesn't mean anything to a user.
Remove the "starting archive recovery" message and replace the
"automatic recovery in progress" message with a more informative message
saying whether the server is doing PITR, normal archive recovery, or
standby mode.

14 years agoClean up Streaming Replication documentation a little bit. A lot more
Heikki Linnakangas [Fri, 12 Feb 2010 08:28:44 +0000 (08:28 +0000)]
Clean up Streaming Replication documentation a little bit. A lot more
needs to be done, but it's a step forward..

14 years agoIf primary_conninfo is not set, don't try to establish streaming
Heikki Linnakangas [Fri, 12 Feb 2010 07:56:36 +0000 (07:56 +0000)]
If primary_conninfo is not set, don't try to establish streaming
connection.

14 years agoCheck for partial WAL files in standby mode. If restore_command restores
Heikki Linnakangas [Fri, 12 Feb 2010 07:36:44 +0000 (07:36 +0000)]
Check for partial WAL files in standby mode. If restore_command restores
a partial WAL file, assume it's because the file is just being copied to
the archive and treat it the same as "file not found" in standby mode.
pg_standby has a similar check, so it seems reasonable to have the same
level of protection in the built-in standby mode.

14 years agoFree reference in correct Perl context. Backpatch to release 8.2. Patch from Tim...
Andrew Dunstan [Fri, 12 Feb 2010 04:31:14 +0000 (04:31 +0000)]
Free reference in correct Perl context. Backpatch to release 8.2. Patch from Tim Bunce.

14 years agoSuppress uninitialized-variable warning.
Tom Lane [Thu, 11 Feb 2010 22:17:27 +0000 (22:17 +0000)]
Suppress uninitialized-variable warning.

14 years agoFix typo bug in Hot Standby from recent refactoring. Bug introduced
Simon Riggs [Thu, 11 Feb 2010 19:35:22 +0000 (19:35 +0000)]
Fix typo bug in Hot Standby from recent refactoring. Bug introduced
into code recently patched by Andres Freund, so quickly fixed by him
when bug report from Tatsuo Ishii arrived.

14 years agoGeneric implementation of red-black binary tree. It's planned to use in
Teodor Sigaev [Thu, 11 Feb 2010 14:29:50 +0000 (14:29 +0000)]
Generic implementation of red-black binary tree. It's planned to use in
several places, but for now only GIN uses it during index creation.
Using self-balanced tree greatly speeds up index creation in corner cases
with preordered data.

14 years agoNow that streaming replication switches between streaming mode and
Heikki Linnakangas [Wed, 10 Feb 2010 08:25:25 +0000 (08:25 +0000)]
Now that streaming replication switches between streaming mode and
restoring from archive, the last WAL segment is not necessarily open at
the end of recovery. Fix assertion that assumed that.

Fujii Masao, fixing the assertion failure reported by Martin Pihlak.

14 years agoImprove planner's choices about when to use hashing vs sorting for DISTINCT.
Tom Lane [Wed, 10 Feb 2010 03:38:35 +0000 (03:38 +0000)]
Improve planner's choices about when to use hashing vs sorting for DISTINCT.

The previous coding missed a bet by sometimes picking the "sorted" path
from query_planner even though hashing would be preferable.  To fix, we have
to be willing to make the choice sooner.  This contorts things a little bit,
but I thought of a factorization that makes it not too awful.

14 years agoFix up rickety handling of relation-truncation interlocks.
Tom Lane [Tue, 9 Feb 2010 21:43:30 +0000 (21:43 +0000)]
Fix up rickety handling of relation-truncation interlocks.

Move rd_targblock, rd_fsm_nblocks, and rd_vm_nblocks from relcache to the smgr
relation entries, so that they will get reset to InvalidBlockNumber whenever
an smgr-level flush happens.  Because we now send smgr invalidation messages
immediately (not at end of transaction) when a relation truncation occurs,
this ensures that other backends will reset their values before they next
access the relation.  We no longer need the unreliable assumption that a
VACUUM that's doing a truncation will hold its AccessExclusive lock until
commit --- in fact, we can intentionally release that lock as soon as we've
completed the truncation.  This patch therefore reverts (most of) Alvaro's
patch of 2009-11-10, as well as my marginal hacking on it yesterday.  We can
also get rid of assorted no-longer-needed relcache flushes, which are far more
expensive than an smgr flush because they kill a lot more state.

In passing this patch fixes smgr_redo's failure to perform visibility-map
truncation, and cleans up some rather dubious assumptions in freespace.c and
visibilitymap.c about when rd_fsm_nblocks and rd_vm_nblocks can be out of
date.

14 years agoFix bug in GIN WAL redo cleanup function: don't free fake relcache entry
Heikki Linnakangas [Tue, 9 Feb 2010 20:31:24 +0000 (20:31 +0000)]
Fix bug in GIN WAL redo cleanup function: don't free fake relcache entry
while it's still being used.

Backpatch to 8.4, where the fake relcache method was introduced.

14 years agoTypo fix, per Thom Brown
Magnus Hagander [Tue, 9 Feb 2010 20:22:20 +0000 (20:22 +0000)]
Typo fix, per Thom Brown

14 years agoDefine the value for in6addr_any on MingW, since it provides the struct
Magnus Hagander [Tue, 9 Feb 2010 19:55:14 +0000 (19:55 +0000)]
Define the value for in6addr_any on MingW, since it provides the struct
only in the header files and not in any libraries, yet declare it as
an extern.

14 years agoMove "Warm Standby Servers for High Availability" and "Hot Standby"
Heikki Linnakangas [Tue, 9 Feb 2010 16:50:25 +0000 (16:50 +0000)]
Move "Warm Standby Servers for High Availability" and "Hot Standby"
sections under "High Availability, Load Balancing, and Replication"
chapter. Streaming replication chapter needs a lot more work, but this
commit just moves things around.

14 years agoFirst try to make this one ecpg regression test work on Windows too. I'm just trying...
Michael Meskes [Tue, 9 Feb 2010 08:57:13 +0000 (08:57 +0000)]
First try to make this one ecpg regression test work on Windows too. I'm just trying to figure out the minimal amount of defines needed.

14 years agoAllow free space map vacuuming to be interrupted.
Tom Lane [Tue, 9 Feb 2010 00:28:57 +0000 (00:28 +0000)]
Allow free space map vacuuming to be interrupted.

14 years agoRearrange lazy-vacuum code a little bit to reduce the window between
Tom Lane [Tue, 9 Feb 2010 00:28:30 +0000 (00:28 +0000)]
Rearrange lazy-vacuum code a little bit to reduce the window between
truncating the table and transaction commit.  This isn't really making
it safe, but at least there is no good reason to do free space map
cleanup within the risk window.  Don't lock out cancel interrupts
until we have to, either.

14 years agoCreate an official API function for C functions to use to check if they are
Tom Lane [Mon, 8 Feb 2010 20:39:52 +0000 (20:39 +0000)]
Create an official API function for C functions to use to check if they are
being called as aggregates, and to get the aggregate transition state memory
context if needed.  Use it instead of poking directly into AggState and
WindowAggState in places that shouldn't know so much.

We should have done this in 8.4, probably, but better late than never.

Revised version of a patch by Hitoshi Harada.

14 years agoRemove obsolete comment about 'fsm' argument, which isn't an argument
Heikki Linnakangas [Mon, 8 Feb 2010 19:59:49 +0000 (19:59 +0000)]
Remove obsolete comment about 'fsm' argument, which isn't an argument
anymore.

14 years agoFix serious performance bug in new implementation of VACUUM FULL:
Tom Lane [Mon, 8 Feb 2010 16:50:21 +0000 (16:50 +0000)]
Fix serious performance bug in new implementation of VACUUM FULL:
cluster_rel necessarily builds an all-new toast table, so it's useless to
then go and VACUUM FULL the toast table.

14 years agoAdd C comments that HEAP_MOVED_* define usage is only for pre-9.0 binary
Bruce Momjian [Mon, 8 Feb 2010 14:10:21 +0000 (14:10 +0000)]
Add C comments that HEAP_MOVED_* define usage is only for pre-9.0 binary
upgrades.