OSDN Git Service
MasaoFujii [Fri, 12 Nov 2010 13:20:37 +0000 (22:20 +0900)]
Remove a junk space.
MasaoFujii [Fri, 12 Nov 2010 13:10:15 +0000 (22:10 +0900)]
Merge branch 'pgrex90-base' into pgrex90
MasaoFujii [Fri, 12 Nov 2010 13:09:44 +0000 (22:09 +0900)]
Merge branch 'REL9_0_STABLE' into pgrex90-base
Heikki Linnakangas [Thu, 11 Nov 2010 17:21:49 +0000 (19:21 +0200)]
Fix bug introduced by the recent patch to check that the checkpoint redo
location read from backup label file can be found: wasShutdown was set
incorrectly when a backup label file was found.
Jeff Davis, with a little tweaking by me.
Tom Lane [Wed, 10 Nov 2010 21:51:39 +0000 (16:51 -0500)]
Fix line_construct_pm() for the case of "infinite" (DBL_MAX) slope.
This code was just plain wrong: what you got was not a line through the
given point but a line almost indistinguishable from the Y-axis, although
not truly vertical. The only caller that tries to use this function with
m == DBL_MAX is dist_ps_internal for the case where the lseg is horizontal;
it would end up producing the distance from the given point to the place
where the lseg's line crosses the Y-axis. That function is used by other
operators too, so there are several operators that could compute wrong
distances from a line segment to something else. Per bug #5745 from
jindiax.
Back-patch to all supported branches.
Bruce Momjian [Wed, 10 Nov 2010 14:33:37 +0000 (14:33 +0000)]
Mention that pg_upgrade requires compatible 32/64-bit binaries.
MasaoFujii [Wed, 10 Nov 2010 13:19:41 +0000 (22:19 +0900)]
Merge branch 'pgrex90-base' into pgrex90
Simon Riggs [Thu, 14 Oct 2010 18:15:26 +0000 (19:15 +0100)]
Make startup process respond to signals to cancel waiting on latch.
A tidy up for recently committed changes to startup latch.
Fujii Masao
MasaoFujii [Wed, 10 Nov 2010 12:55:42 +0000 (21:55 +0900)]
Merge branch 'REL9_0_STABLE' into pgrex90-base
Itagaki Takahiro [Wed, 10 Nov 2010 03:17:43 +0000 (12:17 +0900)]
Don't use __declspec (dllimport) for PGDLLEXPORT to reduce warnings
by gcc version 4 on mingw and cygwin. We don't use dllexport here
because dllexport and dllwrap don't work well together.
Tom Lane [Tue, 9 Nov 2010 16:28:18 +0000 (11:28 -0500)]
Repair memory leakage while ANALYZE-ing complex index expressions.
The general design of memory management in Postgres is that intermediate
results computed by an expression are not freed until the end of the tuple
cycle. For expression indexes, ANALYZE has to re-evaluate each expression
for each of its sample rows, and it wasn't bothering to free intermediate
results until the end of processing of that index. This could lead to very
substantial leakage if the intermediate results were large, as in a recent
example from Jakub Ouhrabka. Fix by doing ResetExprContext for each sample
row. This necessitates adding a datumCopy step to ensure that the final
expression value isn't recycled too. Some quick testing suggests that this
change adds at worst about 10% to the time needed to analyze a table with
an expression index; which is annoying, but seems a tolerable price to pay
to avoid unexpected out-of-memory problems.
Back-patch to all supported branches.
Heikki Linnakangas [Tue, 9 Nov 2010 15:40:09 +0000 (17:40 +0200)]
In rewriteheap.c (used by VACUUM FULL and CLUSTER), calculate the tuple
length stored in the line pointer the same way it's calculated in the normal
heap_insert() codepath. As noted by Jeff Davis, the length stored by
raw_heap_insert() included padding but the one stored by the normal codepath
did not. While the mismatch seems to be harmless, inconsistency isn't good,
and the normal codepath has received a lot more testing over the years.
Backpatch to 8.3 where the heap rewrite code was introduced.
Alvaro Herrera [Tue, 9 Nov 2010 14:00:56 +0000 (11:00 -0300)]
plpython has plpy.Error instead of plpy.ERROR
Author: Marti Raudsepp <marti@juffo.org>
Tom Lane [Tue, 9 Nov 2010 03:14:55 +0000 (22:14 -0500)]
Fix error handling in temp-file deletion with log_temp_files active.
The original coding in FileClose() reset the file-is-temp flag before
unlinking the file, so that if control came back through due to an error,
it wouldn't try to unlink the file twice. This was correct when written,
but when the log_temp_files feature was added, the logging action was put
in between those two steps. An error occurring during the logging action
--- such as a query cancel --- would result in the unlink not getting done
at all, as in recent report from Michael Glaesemann.
To fix this, make sure that we do both the stat and the unlink before doing
anything that could conceivably CHECK_FOR_INTERRUPTS. There is a judgment
call here, which is which log message to emit first: if you can see only
one, which should it be? I chose to log unlink failure at the risk of
losing the log_temp_files log message --- after all, if the unlink does
fail, the temp file is still there for you to see.
Back-patch to all versions that have log_temp_files. The code was OK
before that.
Alvaro Herrera [Mon, 8 Nov 2010 21:35:42 +0000 (18:35 -0300)]
Fix permanent memory leak in autovacuum launcher
get_database_list was uselessly allocating its output data, along some
created along the way, in a permanent memory context. This didn't
matter when autovacuum was a single, short-lived process, but now that
the launcher is permanent, it shows up as a permanent leak.
To fix, make get_database list allocate its output data in the caller's
context, which is in charge of freeing it when appropriate; and the
memory leaked by heap_beginscan et al is allocated in a throwaway
transaction context.
Tom Lane [Sun, 7 Nov 2010 02:59:09 +0000 (22:59 -0400)]
Add support for detecting register-stack overrun on IA64.
Per recent investigation, the register stack can grow faster than the
regular stack depending on compiler and choice of options. To avoid
crashes we must check both stacks in check_stack_depth().
Back-patch to all supported versions.
Tom Lane [Wed, 3 Nov 2010 17:41:53 +0000 (13:41 -0400)]
Reduce recursion depth in recently-added regression test.
Some buildfarm members fail the test with the original depth of 10 levels,
apparently because they are running at the minimum max_stack_depth setting
of 100kB and using ~ 10k per recursion level. While it might be
interesting to try to figure out why they're eating so much stack, it isn't
likely that any fix for that would be back-patchable. So just change the
test to recurse only 5 levels. The extra levels don't prove anything
correctness-wise anyway.
Tom Lane [Tue, 2 Nov 2010 22:45:44 +0000 (18:45 -0400)]
Fix adjust_semi_join to be more cautious about clauseless joins.
It was reporting that these were fully indexed (hence cheap), when of
course they're the exact opposite of that. I'm not certain if the case
would arise in practice, since a clauseless semijoin is hard to produce
in SQL, but if it did happen we'd make some dumb decisions.
Tom Lane [Tue, 2 Nov 2010 21:31:54 +0000 (17:31 -0400)]
Fix buffer overrun in pg_upgrade.
Problem reported, and cause identified, by Hernan Gonzalez.
Tom Lane [Tue, 2 Nov 2010 21:15:13 +0000 (17:15 -0400)]
Ensure an index that uses a whole-row Var still depends on its table.
We failed to record any dependency on the underlying table for an index
declared like "create index i on t (foo(t.*))". This would create trouble
if the table were dropped without previously dropping the index. To fix,
simplify some overly-cute code in index_create(), accepting the possibility
that sometimes the whole-table dependency will be redundant. Also document
this hazard in dependency.c. Per report from Kevin Grittner.
In passing, prevent a core dump in pg_get_indexdef() if the index's table
can't be found. I came across this while experimenting with Kevin's
example. Not sure it's a real issue when the catalogs aren't corrupt, but
might as well be cautious.
Back-patch to all supported versions.
Heikki Linnakangas [Tue, 2 Nov 2010 09:23:43 +0000 (11:23 +0200)]
Bootstrap WAL to begin at segment logid=0 logseg=1 (
000000010000000000000001)
rather than 0/0, so that we can safely use 0/0 as an invalid value. This is a
more future-proof fix for the corner-case bug in streaming replication that
was fixed yesterday. We had a similar corner-case bug with log/seg 0/0 back in
February as well. Avoiding 0/0 as a valid value should prevent bugs like that
in the future. Per Tom Lane's idea.
Back-patch to 9.0. Since this only affects bootstrapping, it makes no
difference to existing installations. We don't need to worry about the
bug in existing installations, because if you've managed to get past the
initial base backup already, you won't hit the bug in the future either.
Heikki Linnakangas [Mon, 1 Nov 2010 07:56:45 +0000 (09:56 +0200)]
Fix corner-case bug in tracking of latest removed WAL segment during
streaming replication. We used log/seg 0/0 to indicate that no WAL segments
have been removed since startup, but 0/0 is a valid value for the very first
WAL segment after initdb. To make that disambiguous, store
(latest removed WAL segment + 1) in the global variable.
Per report from Matt Chesler, also reproduced by Greg Smith.
Tom Lane [Thu, 28 Oct 2010 17:01:01 +0000 (13:01 -0400)]
Fix plpgsql's handling of "simple" expression evaluation.
In general, expression execution state trees aren't re-entrantly usable,
since functions can store private state information in them.
For efficiency reasons, plpgsql tries to cache and reuse state trees for
"simple" expressions. It can get away with that most of the time, but it
can fail if the state tree is dirty from a previous failed execution (as
in an example from Alvaro) or is being used recursively (as noted by me).
Fix by tracking whether a state tree is in use, and falling back to the
"non-simple" code path if so. This results in a pretty considerable speed
hit when the non-simple path is taken, but the available alternatives seem
even more unpleasant because they add overhead in the simple path. Per
idea from Heikki.
Back-patch to all supported branches.
Heikki Linnakangas [Wed, 27 Oct 2010 17:03:00 +0000 (20:03 +0300)]
Fix long-standing segfault when accept() or one of the calls made right
after accepting a connection fails, and the server is compiled with GSSAPI
support. Report and patch by Alexander V. Chernikov, bug #5731.
Tom Lane [Wed, 27 Oct 2010 02:23:16 +0000 (22:23 -0400)]
Fix up some oversights in psql's Unicode-escape support.
Original patch failed to include new exclusive states in a switch that
needed to include them; and also was guilty of very fuzzy thinking
about how to handle error cases. Per bug #5729 from Alan Choi.
Heikki Linnakangas [Tue, 26 Oct 2010 19:50:31 +0000 (22:50 +0300)]
Note explicitly that hash indexes are also not replicated because they're not
WAL-logged. Make the notice about the lack of WAL-logging more visible by
making it a <caution>. Also remove the false statement from hot standby
caveats section that hash indexes are not used during hot standby.
Heikki Linnakangas [Tue, 26 Oct 2010 18:15:42 +0000 (21:15 +0300)]
Before removing backup_label and irrevocably changing pg_control file, check
that WAL file containing the checkpoint redo-location can be found. This
avoids making the cluster irrecoverable if the redo location is in an earlie
WAL file than the checkpoint record.
Report, analysis and patch by Jeff Davis, with small changes by me.
Tom Lane [Mon, 25 Oct 2010 17:04:42 +0000 (13:04 -0400)]
Fix inline_set_returning_function() to preserve the invalItems list properly.
This avoids a possible crash when inlining a SRF whose argument list
contains a reference to an inline-able user function. The crash is quite
reproducible with CLOBBER_FREED_MEMORY enabled, but would be less certain
in a production build. Problem introduced in 9.0 by the named-arguments
patch, which requires invoking eval_const_expressions() before we can try
to inline a SRF. Per report from Brendan Jurd.
Heikki Linnakangas [Fri, 22 Oct 2010 15:38:31 +0000 (18:38 +0300)]
Add semicolon, missed in previous patch. And update the keyword list in
the docs to reflect that OFF is now unreserved. Spotted by Tom Lane.
Heikki Linnakangas [Fri, 22 Oct 2010 14:37:38 +0000 (17:37 +0300)]
Make OFF keyword unreserved. It's not hard to imagine wanting to use 'off'
as a variable or column name, and it's not reserved in recent versions of
the SQL spec either. This became particularly annoying in 9.0, before that
PL/pgSQL replaced variable names in queries with parameter markers, so
it was possible to use OFF and many other backend parser keywords as
variable names. Because of that, backpatch to 9.0.
Tom Lane [Wed, 20 Oct 2010 21:05:15 +0000 (17:05 -0400)]
Remove obsolete comment, per Josh Kupershmidt.
Heikki Linnakangas [Wed, 20 Oct 2010 19:20:33 +0000 (22:20 +0300)]
If pk is NULL, the backend would segfault when accessing ->algo and the
following NULL check was never reached.
This problem was found by Coccinelle (null_ref.cocci from coccicheck).
Marti Raudsepp
Tom Lane [Wed, 20 Oct 2010 16:48:57 +0000 (12:48 -0400)]
Don't try to fetch database name when SetTransactionIdLimit() is executed
outside a transaction.
This repairs brain fade in my patch of 2009-08-30: the reason we had been
storing oldest-database name, not OID, in ShmemVariableCache was of course
to avoid having to do a catalog lookup at times when it might be unsafe.
This error explains why Aleksandr Dushein is having trouble getting out of
an XID wraparound state in bug #5718, though not how he got into that state
in the first place. I suspect pg_upgrade is at fault there.
Tom Lane [Wed, 20 Oct 2010 04:55:03 +0000 (00:55 -0400)]
Fix ecpg test building process to not generate *.dSYM junk on Macs.
The trick is to not try to build executables directly from .c files,
but to always build the intermediate .o files. For obscure reasons,
Darwin's version of gcc will leave debug cruft behind in the first
case but not the second. Per complaint from Robert Haas.
Tom Lane [Wed, 20 Oct 2010 01:53:08 +0000 (21:53 -0400)]
Update storage.sgml to describe the 9.0 tablespace directory layout.
Tom Lane [Tue, 19 Oct 2010 19:08:47 +0000 (15:08 -0400)]
Fix incorrect generation of whole-row variables in planner.
A couple of places in the planner need to generate whole-row Vars, and were
cutting corners by setting vartype = RECORDOID in the Vars, even in cases
where there's an identifiable named composite type for the RTE being
referenced. While we mostly got away with this, it failed when there was
also a parser-generated whole-row reference to the same RTE, because the
two Vars weren't equal() due to the difference in vartype. Fix by
providing a subroutine the planner can call to generate whole-row Vars
the same way the parser does.
Per bug #5716 from Andrew Tipton. Back-patch to 9.0 where one of the bogus
calls was introduced (the other one is new in HEAD).
Bruce Momjian [Tue, 19 Oct 2010 15:52:44 +0000 (15:52 +0000)]
Add removal of PG_VERSION to optional old cluster deletion script.
Backpatch to 9.0.X.
Bruce Momjian [Tue, 19 Oct 2010 14:58:03 +0000 (14:58 +0000)]
Add mention of using tools/fsync to test fsync methods. Restructure
recent wal_sync_method doc paragraph to be clearer.
Bruce Momjian [Tue, 19 Oct 2010 02:55:58 +0000 (02:55 +0000)]
In pg_upgrade, rename macro EXEC_EXT to SHELL_EXT for clarity.
Backpatch to 9.0.X.
Bruce Momjian [Mon, 18 Oct 2010 18:51:28 +0000 (18:51 +0000)]
Remove tab from SGML.
Bruce Momjian [Mon, 18 Oct 2010 18:16:45 +0000 (18:16 +0000)]
Document the tablespace directory "should" be empty, rather than "must"
be empty. Because of binary migration usage, it might not be empty.
Magnus Hagander [Sun, 17 Oct 2010 14:36:54 +0000 (16:36 +0200)]
Fix msvc build for localized versions of Visual C++
Look only at the non-localized part of the output from "vcbuild /?",
which is used to determine the version of Visual Studio in use. Different
languages seem to localize different amounts of the string, but we assume
the part "Microsoft Visual C++" won't be modified.
Magnus Hagander [Fri, 15 Oct 2010 14:59:12 +0000 (16:59 +0200)]
Fix low-risk potential denial of service against RADIUS login.
Corrupt RADIUS responses were treated as errors and not ignored
(which the RFC2865 states they should be). This meant that a
user with unfiltered access to the network of the PostgreSQL
or RADIUS server could send a spoofed RADIUS response
to the PostgreSQL server causing it to reject a valid login,
provided the attacker could also guess (or brute-force) the
correct port number.
Fix is to simply retry the receive in a loop until the timeout
has expired or a valid (signed by the correct RADIUS server)
packet arrives.
Reported by Alan DeKok in bug #5687.
Simon Riggs [Fri, 15 Oct 2010 09:19:10 +0000 (10:19 +0100)]
Correct WAL space calculation formula in docs.
Error pointed out by Fujii Masao, though not his patch.
Robert Haas [Thu, 14 Oct 2010 23:12:24 +0000 (19:12 -0400)]
Add pg_user_mappings to the table of system views.
Simon Riggs [Thu, 14 Oct 2010 22:23:26 +0000 (23:23 +0100)]
Improvements to docs about pg_archive_cleanup and use of archives
Brendan Jurd
Peter Eisentraut [Thu, 14 Oct 2010 17:36:42 +0000 (20:36 +0300)]
Complete the documentation of the USAGE privilege for foreign servers
The GRANT reference page failed to mention that the USAGE privilege
allows modifying associated user mappings, although this was already
documented on the CREATE/ALTER/DROP USER MAPPING pages.
Simon Riggs [Thu, 14 Oct 2010 18:13:09 +0000 (19:13 +0100)]
Fix bug in comment of timeline history file.
Fujii Masao
Michael Meskes [Thu, 14 Oct 2010 15:49:01 +0000 (17:49 +0200)]
Applied patch by Itagaki Takahiro to fix incorrect status calculation in
ecpglib. Instead of parsing the statement just as ask the database server.
Peter Eisentraut [Wed, 13 Oct 2010 17:05:16 +0000 (20:05 +0300)]
Make title capitalization consistent with surroundings
Tom Lane [Tue, 12 Oct 2010 02:16:46 +0000 (22:16 -0400)]
Fix plpython so that it again honors typmod while assigning to tuple fields.
This was broken in 9.0 while improving plpython's conversion behavior for
bytea and boolean. Per bug report from maizi.
Tom Lane [Mon, 11 Oct 2010 23:04:44 +0000 (19:04 -0400)]
Fix assorted bugs in GIN's WAL replay logic.
The original coding was quite sloppy about handling the case where
XLogReadBuffer fails (because the page has since been deleted). This
would result in either "bad buffer id: 0" or an Assert failure during
replay, if indeed the page were no longer there. In a couple of places
it also neglected to check whether the change had already been applied,
which would probably result in corrupted index contents. I believe that
bug #5703 is an instance of the first problem. These issues could show up
without replication, but only if you were unfortunate enough to crash
between modification of a GIN index and the next checkpoint.
Back-patch to 8.2, which is as far back as GIN has WAL support.
Robert Haas [Sat, 9 Oct 2010 02:59:48 +0000 (22:59 -0400)]
Adjust EXPLAIN documentation, so that it's not unreasonably wide.
The new formatting matches what we do for COPY.
Per a complaint from Bruce Momjian.
Robert Haas [Fri, 8 Oct 2010 13:15:17 +0000 (09:15 -0400)]
Warn that views can be safely used to hide columns, but not rows.
Robert Haas [Thu, 7 Oct 2010 16:19:03 +0000 (12:19 -0400)]
Improve WAL reliability documentation, and add more cross-references to it.
In particular, we are now more explicit about the fact that you may need
wal_sync_method=fsync_writethrough for crash-safety on some platforms,
including MaxOS X. There's also now an explicit caution against assuming
that the default setting of wal_sync_method is either crash-safe or best
for performance.
MasaoFujii [Thu, 7 Oct 2010 11:32:13 +0000 (20:32 +0900)]
Make walsender receive not only Terminate message but also XLogRecPtr one.
Conflicts:
src/backend/replication/walsender.c
MasaoFujii [Wed, 8 Sep 2010 07:54:48 +0000 (16:54 +0900)]
Define new message type 'l' which means the WAL acknowledgment message
from the standby.
MasaoFujii [Thu, 7 Oct 2010 11:06:34 +0000 (20:06 +0900)]
Make the startup process respond to SIGTERM and SIGHUP immediately.
To do that we make the signal handlers for those signals wake the
startup process up.
MasaoFujii [Wed, 29 Sep 2010 06:20:09 +0000 (15:20 +0900)]
Change the document to recent introduction of CopyXLogResponse.
MasaoFujii [Wed, 29 Sep 2010 06:06:32 +0000 (15:06 +0900)]
Introduce CopyXLogResponse message and make walsender send it as a
replication starting message instead of CopyOutResponse.
MasaoFujii [Wed, 8 Sep 2010 07:39:09 +0000 (16:39 +0900)]
Add interface function 'libpqrcv_send' to allow walreceiver to send messages back to the
Tom Lane [Tue, 21 Sep 2010 20:53:25 +0000 (16:53 -0400)]
The port/pg_latch.c symlink ought to be removed by make distclean.
Not sure why these symlinks are removed here and not in the port/
Makefile, but I won't second-guess that choice right now.
Heikki Linnakangas [Wed, 15 Sep 2010 13:58:22 +0000 (13:58 +0000)]
Fix two typos in comments, spotted by Fujii Masao and Thom Brown
MasaoFujii [Thu, 7 Oct 2010 10:49:34 +0000 (19:49 +0900)]
Use a latch to make startup process wake up and replay immediately when
new WAL arrives via streaming replication. This reduces the latency, and
also allows us to use a longer polling interval, which is good for energy
efficiency.
We still need to poll to check for the appearance of a trigger file, but
the interval is now 5 seconds (instead of 100ms), like when waiting for
a new WAL segment to appear in WAL archive.
Conflicts:
src/backend/access/transam/xlog.c
src/include/access/xlog.h
Heikki Linnakangas [Wed, 15 Sep 2010 10:06:21 +0000 (10:06 +0000)]
Simplify Windows implementation of latches. There's no need to keep a
dynamic pool of event handles, we can permanently assign one for each
shared latch. Thanks to that, we no longer need a separate shared memory
block for latches, and we don't need to know in advance how many shared
latches there is, so you no longer need to remember to update
NumSharedLatches when you introduce a new latch to the system.
Heikki Linnakangas [Wed, 15 Sep 2010 06:51:19 +0000 (06:51 +0000)]
Don't call OwnLatch while holding a spinlock. OwnLatch can elog() under
some "can't happen" scenarios, and spinlocks should only be held for
a few instructions anyway. As pointed out by Fujii Masao.
Heikki Linnakangas [Tue, 14 Sep 2010 13:35:14 +0000 (13:35 +0000)]
Oops, the timeout argument to WaitLatchOrSocket is in microseconds, not
milliseconds.
Heikki Linnakangas [Mon, 13 Sep 2010 18:01:20 +0000 (18:01 +0000)]
Add a comment noting that the owner_pid test in OwnLatch is just a sanity
check, per request by Jeff Davis.
Heikki Linnakangas [Sat, 11 Sep 2010 16:26:04 +0000 (16:26 +0000)]
Add missing #includes, needed on some platforms. This should make
the unixware buildfarm animals happy again.
MasaoFujii [Thu, 7 Oct 2010 10:43:58 +0000 (19:43 +0900)]
Introduce latches. A latch is a boolean variable, with the capability to
wait until it is set. Latches can be used to reliably wait until a signal
arrives, which is hard otherwise because signals don't interrupt select()
on some platforms, and even when they do, there's race conditions.
On Unix, latches use the so called self-pipe trick under the covers to
implement the sleep until the latch is set, without race conditions. On
Windows, Windows events are used.
Use the new latch abstraction to sleep in walsender, so that as soon as
a transaction finishes, walsender is woken up to immediately send the WAL
to the standby. This reduces the latency between master and standby, which
is good.
Preliminary work by Fujii Masao. The latch implementation is by me, with
helpful comments from many people.
Robert Haas [Tue, 27 Jul 2010 16:06:53 +0000 (16:06 +0000)]
In postgresql.conf.sample, use on/off rather than true/false.
We used to be consistent about this, but my recent patch to add a
restart_after_crash GUC failed to follow the existing convention.
Report and patch from Fujii Masao.
MasaoFujii [Thu, 7 Oct 2010 10:15:43 +0000 (19:15 +0900)]
Add restart_after_crash GUC.
Normally, we automatically restart after a backend crash, but in some
cases when PostgreSQL is invoked by clusterware it may be desirable to
suppress this behavior, so we provide an option which does this.
Since no existing GUC group quite fits, create a new group called
"error handling options" for this and the previously undocumented GUC
exit_on_error, which is now documented.
Review by Fujii Masao.
Conflicts:
doc/src/sgml/config.sgml
src/backend/postmaster/postmaster.c
src/backend/utils/misc/guc.c
Simon Riggs [Tue, 5 Oct 2010 23:20:54 +0000 (00:20 +0100)]
Correct docs for behaviour of ALTER DATABASE .. RENAME during Hot Standby.
Actual behaviour did not match documented behaviour and we have agreed
that it should be the docs that change.
Spotted by Bernd Helmle
Tom Lane [Tue, 5 Oct 2010 22:48:20 +0000 (18:48 -0400)]
Undo some poorly-thought-out "proofreading improvements".
Per Tatsuhito Kasahara.
Tom Lane [Sun, 3 Oct 2010 00:02:33 +0000 (20:02 -0400)]
Behave correctly if INSERT ... VALUES is decorated with additional clauses.
In versions 8.2 and up, the grammar allows attaching ORDER BY, LIMIT,
FOR UPDATE, or WITH to VALUES, and hence to INSERT ... VALUES. But the
special-case code for VALUES in transformInsertStmt() wasn't expecting any
of those, and just ignored them, leading to unexpected results. Rather
than complicate the special-case path, just ensure that the presence of any
of those clauses makes us treat the query as if it had a general SELECT.
Per report from Hitoshi Harada.
Tom Lane [Sat, 2 Oct 2010 22:40:28 +0000 (18:40 -0400)]
Remove excess argument to open(2).
Many compilers don't complain about this, but some do, and it's certainly
wrong. Back-patch to 8.4 where the error was introduced.
Mark Kirkwood
Tom Lane [Sat, 2 Oct 2010 22:21:41 +0000 (18:21 -0400)]
Throw an appropriate error if ALTER COLUMN TYPE finds a dependent trigger.
Actually making this case work, if the column is used in the trigger's
WHEN condition, will take some new code that probably isn't appropriate
to back-patch. For now, just throw a FEATURE_NOT_SUPPORTED error rather
than allowing control to reach the "unexpected object" case. Per bug #5688
from Daniel Grace. Back-patch to 9.0 where the possibility of such a
dependency was introduced.
Tom Lane [Fri, 1 Oct 2010 14:25:44 +0000 (10:25 -0400)]
Fix back-branch breakage from ill-advised last-minute commit.
Marc G. Fournier [Fri, 1 Oct 2010 13:28:42 +0000 (10:28 -0300)]
Tag 9.0.1
Tom Lane [Thu, 30 Sep 2010 21:19:44 +0000 (17:19 -0400)]
Use a separate interpreter for each calling SQL userid in plperl and pltcl.
There are numerous methods by which a Perl or Tcl function can subvert
the behavior of another such function executed later; for example, by
redefining standard functions or operators called by the target function.
If the target function is SECURITY DEFINER, or is called by such a
function, this means that any ordinary SQL user with Perl or Tcl language
usage rights can do essentially anything with the privileges of the target
function's owner.
To close this security hole, create a separate Perl or Tcl interpreter for
each SQL userid under which plperl or pltcl functions are executed within
a session. However, all plperlu or pltclu functions run within a session
still share a single interpreter, since they all execute at the trust
level of a database superuser anyway.
Note: this change results in a functionality loss when libperl has been
built without the "multiplicity" option: it's no longer possible to call
plperl functions under different userids in one session, since such a
libperl can't support multiple interpreters in one process. However, such
a libperl already failed to support concurrent use of plperl and plperlu,
so it's likely that few people use such versions with Postgres.
Security: CVE-2010-3433
Robert Haas [Thu, 30 Sep 2010 21:05:15 +0000 (17:05 -0400)]
Adjust pg_archivecleanup docs to match message changes made 2010-06-17.
Erik Rijkers
Peter Eisentraut [Thu, 30 Sep 2010 20:46:16 +0000 (23:46 +0300)]
Translation updates for 9.0.1
Tom Lane [Thu, 30 Sep 2010 18:27:28 +0000 (14:27 -0400)]
Update release notes for releases 9.0.1, 8.4.5, 8.3.12, 8.2.18, 8.1.22,
8.0.26, and 7.4.30.
Bruce Momjian [Wed, 29 Sep 2010 02:40:26 +0000 (02:40 +0000)]
Have pg_upgrade use strtoul(), not strtol().
Bruce Momjian [Tue, 28 Sep 2010 22:11:21 +0000 (22:11 +0000)]
Use macro atooid() for conversion of strings to oids, per suggestion
from Tom.
Bruce Momjian [Tue, 28 Sep 2010 21:41:03 +0000 (21:41 +0000)]
In pg_upgrade, properly handle oids > 2^31 by using strtoul() internally
rather than atol().
Per report from Brian Hirt
Bruce Momjian [Tue, 28 Sep 2010 21:37:14 +0000 (21:37 +0000)]
Fix leak patch that was using fclose() instead of close().
Bruce Momjian [Tue, 28 Sep 2010 19:25:13 +0000 (19:25 +0000)]
Properly close files after read file failure to prevent potential
resource leak. Of course, any such failure aborts pg_upgrade, but might
as well be clean about it.
Per patch from Grzegorz Ja?kiewicz.
Tom Lane [Tue, 28 Sep 2010 18:47:25 +0000 (14:47 -0400)]
Fix another small oversight in command_no_begin patch.
Need a "return false" to prevent tests from continuing after we've moved
the "query" pointer. As it stood, it'd accept "DROP DISCARD ALL" as a
match.
Bruce Momjian [Tue, 28 Sep 2010 18:43:01 +0000 (18:43 +0000)]
Mention that pg_upgrade requires write permission in the current
directory.
Per report from Harald Armin Massa.
Bruce Momjian [Tue, 28 Sep 2010 18:32:07 +0000 (18:32 +0000)]
Mention in pg_upgrade docs that the proper Win32 service name should be used.
Per report from Harald Armin Massa
Tom Lane [Tue, 28 Sep 2010 16:08:56 +0000 (12:08 -0400)]
Fix PlaceHolderVar mechanism's interaction with outer joins.
The point of a PlaceHolderVar is to allow a non-strict expression to be
evaluated below an outer join, after which its value bubbles up like a Var
and can be forced to NULL when the outer join's semantics require that.
However, there was a serious design oversight in that, namely that we
didn't ensure that there was actually a correct place in the plan tree
to evaluate the placeholder :-(. It may be necessary to delay evaluation
of an outer join to ensure that a placeholder that should be evaluated
below the join can be evaluated there. Per recent bug report from Kirill
Simonov.
Back-patch to 8.4 where the PlaceHolderVar mechanism was introduced.
Bruce Momjian [Tue, 28 Sep 2010 17:25:21 +0000 (17:25 +0000)]
Add mention of installing pg_upgrade_support in pg_upgrade doc section
title, per suggestion from Ian Barwick.
Itagaki Takahiro [Tue, 28 Sep 2010 06:56:46 +0000 (15:56 +0900)]
Only DISCARD ALL should be in the command_no_begin list.
We allowes DISCARD PLANS and TEMP in a transaction.
Itagaki Takahiro [Tue, 28 Sep 2010 05:24:02 +0000 (14:24 +0900)]
Add DISCARD to the command_no_begin list for AUTOCOMMIT=off.
Backpatch to 8.3.
Reported by Sergey Burladyan.
Robert Haas [Mon, 27 Sep 2010 13:14:14 +0000 (09:14 -0400)]
Add "(change requires restart)" note to some postgresql.conf parameters.
Devrim GÜNDÜZ
Tom Lane [Sat, 25 Sep 2010 23:04:02 +0000 (19:04 -0400)]
Fix another join removal bug: the check on PlaceHolderVars was wrong.
The previous coding would decide that join removal was unsafe upon finding
a PlaceHolderVar that needed to be evaluated at the inner rel and then used
above the join. However, this fails to cover the case of PlaceHolderVars
that refer to both the inner rel and some other rels. Per bug report from
Andrus.
Tom Lane [Sat, 25 Sep 2010 19:57:05 +0000 (15:57 -0400)]
Further fixes to the pg_get_expr() security fix in back branches.
It now emerges that the JDBC driver expects to be able to use pg_get_expr()
on an output of a sub-SELECT. So extend the check logic to be able to recurse
into a sub-SELECT to see if the argument is ultimately coming from an
appropriate column. Per report from Thomas Kellerer.
Peter Eisentraut [Sat, 25 Sep 2010 06:57:09 +0000 (09:57 +0300)]
Fix man page markup for <cmdsynopsis> with multiple variants
Command synopses using <cmdsynopsis> with multiple variants previously used
<sbr> to break lines between variants. The new man page toolchain introduced
in 9.0 makes a mess out of that, and that markup was probably wrong all along,
because <sbr> is supposed to break lines within a synopsis, not between them.
So fix that by using multiple <cmdsynopsis> elements inside <refsynopsisdiv>.
backpatched to 9.0
Tom Lane [Fri, 24 Sep 2010 17:48:20 +0000 (13:48 -0400)]
Still more .gitignore cleanup.
Fix overly-enthusiastic ignores, as identified by
git ls-files -i --exclude-standard