summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-01-27Fix wording, per Peter GeogheganMagnus Hagander
2012-01-25Now that the shared library name can be adjusted in the library test,Bruce Momjian
have pg_upgrade allocate a maximum fixed size buffer for testing the library file name, rather than base the allocation on the library name. Backpatch to 9.1.
2012-01-24In pg_upgrade, when checking for the plpython library, we must check forBruce Momjian
"plpython2" when upgrading from pre-PG 9.1. Patch to head and 9.1. Per report from Peter.
2012-01-23Remove tab in 9.1 SGML file.Bruce Momjian
2012-01-18Fix corner case in cleanup of transactions using SSI.Heikki Linnakangas
When the only remaining active transactions are READ ONLY, we do a "partial cleanup" of committed transactions because certain types of conflicts aren't possible anymore. For committed r/w transactions, we release the SIREAD locks but keep the SERIALIZABLEXACT. However, for committed r/o transactions, we can go further and release the SERIALIZABLEXACT too. The problem was with the latter case: we were returning the SERIALIZABLEXACT to the free list without removing it from the finished list. The only real change in the patch is the SHMQueueDelete line, but I also reworked some of the surrounding code to make it obvious that r/o and r/w transactions are handled differently -- the existing code felt a bit too clever. Dan Ports
2012-01-15Improve efficiency of recent changes to plperl's sv2cstr().Andrew Dunstan
Along the way, add a missing dependency in the GNUmakefile. Alex Hunsaker, with a slight adjustment by me.
2012-01-12Fix CLUSTER/VACUUM FULL for toast values owned by recently-updated rows.Tom Lane
In commit 7b0d0e9356963d5c3e4d329a917f5fbb82a2ef05, I made CLUSTER and VACUUM FULL try to preserve toast value OIDs from the original toast table to the new one. However, if we have to copy both live and recently-dead versions of a row that has a toasted column, those versions may well reference the same toast value with the same OID. The patch then led to duplicate-key failures as we tried to insert the toast value twice with the same OID. (The previous behavior was not very desirable either, since it would have silently inserted the same value twice with different OIDs. That wastes space, but what's worse is that the toast values inserted for already-dead heap rows would not be reclaimed by subsequent ordinary VACUUMs, since they go into the new toast table marked live not deleted.) To fix, check if the copied OID already exists in the new toast table, and if so, assume that it stores the desired value. This is reasonably safe since the only case where we will copy an OID from a previous toast pointer is when toast_insert_or_update was given that toast pointer and so we just pulled the data from the old table; if we got two different values that way then we have big problems anyway. We do have to assume that no other backend is inserting items into the new toast table concurrently, but that's surely safe for CLUSTER and VACUUM FULL. Per bug #6393 from Maxim Boguk. Back-patch to 9.0, same as the previous patch.
2012-01-09Fix one-byte buffer overrun in contrib/test_parser.Tom Lane
The original coding examined the next character before verifying that there *is* a next character. In the worst case with the input buffer right up against the end of memory, this would result in a segfault. Problem spotted by Paul Guyot; this commit extends his patch to fix an additional case. In addition, make the code a tad more readable by not overloading the usage of *tlen.
2012-01-07Use __sync_lock_test_and_set() for spinlocks on ARM, if available.Tom Lane
Historically we've used the SWPB instruction for TAS() on ARM, but this is deprecated and not available on ARMv6 and later. Instead, make use of a GCC builtin if available. We'll still fall back to SWPB if not, so as not to break existing ports using older GCC versions. Eventually we might want to try using __sync_lock_test_and_set() on some other architectures too, but for now that seems to present only risk and not reward. Back-patch to all supported versions, since people might want to use any of them on more recent ARM chips. Martin Pitt
2012-01-06Fix typo, pg_types_date.h => pgtypes_date.h.Tom Lane
Spotted by Koizumi Satoru.
2012-01-06Fix pg_restore's direct-to-database mode for INSERT-style table data.Tom Lane
In commit 6545a901aaf84cb05212bb6a7674059908f527c3, I removed the mini SQL lexer that was in pg_backup_db.c, thinking that it had no real purpose beyond separating COPY data from SQL commands, which purpose had been obsoleted by long-ago fixes in pg_dump's archive file format. Unfortunately this was in error: that code was also used to identify command boundaries in INSERT-style table data, which is run together as a single string in the archive file for better compressibility. As a result, direct-to-database restores from archive files made with --inserts or --column-inserts fail in our latest releases, as reported by Dick Visser. To fix, restore the mini SQL lexer, but simplify it by adjusting the calling logic so that it's only required to cope with INSERT-style table data, not arbitrary SQL commands. This allows us to not have to deal with SQL comments, E'' strings, or dollar-quoted strings, none of which have ever been emitted by dumpTableData_insert. Also, fix the lexer to cope with standard-conforming strings, which was the actual bug that the previous patch was meant to solve. Back-patch to all supported branches. The previous patch went back to 8.2, which unfortunately means that the EOL release of 8.2 contains this bug, but I don't think we're doing another 8.2 release just because of that.
2012-01-06Fix variable confusion in BufferSync().Robert Haas
As noted by Heikki Linnakangas, the previous coding confused the "flags" variable with the "mask" variable. The affect of this appears to be that unlogged buffers would get written out at every checkpoint rather than only at shutdown time. Although that's arguably an acceptable failure mode, I'm back-patching this change, since it seems like a poor idea to rely on this happening to work.
2012-01-05Fix breakage from earlier plperl fix.Andrew Dunstan
Apparently the perl garbage collector was a bit too eager, so here we control when the new SV is garbage collected.
2012-01-05Work around perl bug in SvPVutf8().Andrew Dunstan
Certain things like typeglobs or readonly things like $^V cause perl's SvPVutf8() to die nastily and crash the backend. To avoid that bug we make a copy of the object, which will subsequently be garbage collected. Back patched to 9.1 where we first started using SvPVutf8(). Per -hackers discussion. Original problem reported by David Wheeler.
2012-01-04Make executor's SELECT INTO code save and restore original tuple receiver.Tom Lane
As previously coded, the QueryDesc's dest pointer was left dangling (pointing at an already-freed receiver object) after ExecutorEnd. It's a bit astonishing that it took us this long to notice, and I'm not sure that the known problem case with SQL functions is the only one. Fix it by saving and restoring the original receiver pointer, which seems the most bulletproof way of ensuring any related bugs are also covered. Per bug #6379 from Paul Ramsey. Back-patch to 8.4 where the current handling of SELECT INTO was introduced.
2012-01-02Fix coerce_to_target_type for coerce_type's klugy handling of COLLATE.Tom Lane
Because coerce_type recurses into the argument of a CollateExpr, coerce_to_target_type's longstanding code for detecting whether coerce_type had actually done anything (to wit, returned a different node than it passed in) was broken in 9.1. This resulted in unexpected failures in hide_coercion_node; which was not the latter's fault, since it's critical that we never call it on anything that wasn't inserted by coerce_type. (Else we might decide to "hide" a user-written function call.) Fix by removing and replacing the CollateExpr in coerce_to_target_type itself. This is all pretty ugly but I don't immediately see a way to make it nicer. Per report from Jean-Yves F. Barbier.
2011-12-21Update per-column ACLs, not only per-table ACL, when changing table owner.Tom Lane
We forgot to modify column ACLs, so privileges were still shown as having been granted by the old owner. This meant that neither the new owner nor a superuser could revoke the now-untraceable-to-table-owner permissions. Per bug #6350 from Marc Balmer. This has been wrong since column ACLs were added, so back-patch to 8.4.
2011-12-20Fix gincostestimate to handle ScalarArrayOpExpr reasonably.Tom Lane
The original coding of this function overlooked the possibility that it could be passed anything except simple OpExpr indexquals. But ScalarArrayOpExpr is possible too, and the code would probably crash (and surely give ridiculous answers) in such a case. Add logic to try to estimate sanely for such cases. In passing, fix the treatment of inner-indexscan cost estimation: it was failing to scale up properly for multiple iterations of a nestloop. (I think somebody might've thought that index_pages_fetched() is linear, but of course it's not.) Report, diagnosis, and preliminary patch by Marti Raudsepp; I refactored it a bit and fixed the cost estimation. Back-patch into 9.1 where the bogus code was introduced.
2011-12-20Avoid crashing when we have problems unlinking files post-commit.Tom Lane
smgrdounlink takes care to not throw an ERROR if it fails to unlink something, but that caution was rendered useless by commit 3396000684b41e7e9467d1abc67152b39e697035, which put an smgrexists call in front of it; smgrexists *does* throw error if anything looks funny, such as getting a permissions error from trying to open the file. If that happens post-commit, you get a PANIC, and what's worse the same logic appears in the WAL replay code, so the database even fails to restart. Restore the intended behavior by removing the smgrexists call --- it isn't accomplishing anything that we can't do better by adjusting mdunlink's ideas of whether it ought to warn about ENOENT or not. Per report from Joseph Shraibman of unrecoverable crash after trying to drop a table whose FSM fork had somehow gotten chmod'd to 000 permissions. Backpatch to 8.4, where the bogus coding was introduced.
2011-12-18In ecpg removed old leftover check for given connection name.Michael Meskes
Ever since we introduced real prepared statements this should work for different connections. The old solution just emulating prepared statements, though, wasn't able to handle this. Closes: #6309
2011-12-16Fix reference to "verify-ca" and "verify-full" in a note in the docs.Heikki Linnakangas
2011-12-14Disable excessive FP optimization by recent versions of gcc.Andrew Dunstan
Suggested solution from Tom Lane. Problem discovered, probably not for the first time, while testing the mingw-w64 32 bit compiler. Backpatched to all live branches.
2011-12-12Revert the behavior of inet/cidr functions to not unpack the arguments.Heikki Linnakangas
I forgot to change the functions to use the PG_GETARG_INET_PP() macro, when I changed DatumGetInetP() to unpack the datum, like Datum*P macros usually do. Also, I screwed up the definition of the PG_GETARG_INET_PP() macro, and didn't notice because it wasn't used. This fixes the memory leak when sorting inet values, as reported by Jochen Erwied and debugged by Andres Freund. Backpatch to 8.3, like the previous patch that broke it.
2011-12-09Don't set reachedMinRecoveryPoint during crash recovery. In crash recovery,Heikki Linnakangas
we don't reach consistency before replaying all of the WAL. Rename the variable to reachedConsistency, to make its intention clearer. In master, that was an active bug because of the recent patch to immediately PANIC if a reference to a missing page is found in WAL after reaching consistency, as Tom Lane's test case demonstrated. In 9.1 and 9.0, the only consequence was a misleading "consistent recovery state reached at %X/%X" message in the log at the beginning of crash recovery (the database is not consistent at that point yet). In 8.4, the log message was not printed in crash recovery, even though there was a similar reachedMinRecoveryPoint local variable that was also set early. So, backpatch to 9.1 and 9.0.
2011-12-07Fix corner cases in readlink() usage.Tom Lane
Make sure all calls are protected by HAVE_READLINK, and get the buffer overflow tests right. Be a bit more paranoid about string length in _tarWriteHeader(), too.
2011-12-07Avoid using readlink() on platforms that don't support itMagnus Hagander
We don't have any such platforms now, but might in the future. Also, detect cases when a tablespace symlink points to a path that is longer than we can handle, and give a warning.
2011-12-06Add missing documentation for function pg_stat_get_wal_senders()Magnus Hagander
Euler Taveira de Oliveira
2011-12-05In pg_upgrade, allow tables using regclass to be upgraded because weBruce Momjian
preserve pg_class oids since PG 9.0.
2011-12-04Applied another patch by Zoltan to fix memory alignement issues in ecpg's sqldaMichael Meskes
code.
2011-12-03Treat ENOTDIR as ENOENT when looking for client certificate fileMagnus Hagander
This makes it possible to use a libpq app with home directory set to /dev/null, for example - treating it the same as if the file doesn't exist (which it doesn't). Per bug #6302, reported by Diego Elio Petteno
2011-12-02Add some weasel wording about threaded usage of PGresults.Tom Lane
PGresults used to be read-only from the application's viewpoint, but now that we've exposed various functions that allow modification of a PGresult, that sweeping statement is no longer accurate. Noted by Dmitriy Igrishin.
2011-12-01Stamp 9.1.2.REL9_1_2Tom Lane
2011-12-01Clarify documentation about SQL:2008 variant of LIMIT/OFFSET syntax.Tom Lane
The point that you need parentheses for non-constant expressions apparently needs to be brought out a bit more clearly, per bug #6315.
2011-12-01Translation updatesPeter Eisentraut
2011-12-01Fix getTypeIOParam to support type record[].Tom Lane
Since record[] uses array_in, it needs to have its element type passed as typioparam. In HEAD and 9.1, this fix essentially reverts commit 9bc933b2125a5358722490acbc50889887bf7680, which was a hack that is no longer needed since domains don't set their typelem anymore. Before that, adjust the logic so that only domains are excluded from being treated like arrays, rather than assuming that only base types should be included. Add a regression test to demonstrate the need for this. Per report from Maxim Boguk. Back-patch to 8.4, where type record[] was added.
2011-11-30Update information about configuring SysV IPC parameters on NetBSD.Tom Lane
Per Emmanuel Kasper, sysctl works fine as of NetBSD 5.0.
2011-11-30Draft release notes for 9.1.2, 9.0.6, 8.4.10, 8.3.17, 8.2.23.Tom Lane
2011-11-30Update time zone data files to tzdata release 2011n.Tom Lane
DST law changes in Brazil, Cuba, Fiji, Palestine, Russia, Samoa. Historical corrections for Alaska and British East Africa.
2011-11-30Tweak previous patch to ensure edata->filename always gets initialized.Tom Lane
On a platform that isn't supplying __FILE__, previous coding would either crash or give a stale result for the filename string. Not sure how likely that is, but the original code catered for it, so let's keep doing so.
2011-11-30Strip file names reported in error messages in vpath buildsPeter Eisentraut
In vpath builds, the __FILE__ macro that is used in verbose error reports contains the full absolute file name, which makes the error messages excessively verbose. So keep only the base name, thus matching the behavior of non-vpath builds.
2011-11-29Prevent autovacuum transactions from running in serializable mode.Tom Lane
Force the transaction isolation level to READ COMMITTED in autovacuum worker and launcher processes. There is no benefit to using a higher isolation level, and doing so could result in delaying foreground transactions (or maybe even causing unnecessary serialization failures?). Noted by Dan Ports. Also, make sure we disable zero_damaged_pages and statement_timeout in the autovac launcher, not only workers. Now that the launcher can run transactions, these settings could affect its behavior, and it seems like the same arguments apply to the launcher as the workers.
2011-11-29pg_dump: Add gettext plural support to error messagePeter Eisentraut
2011-11-28Disallow deletion of CurrentExtensionObject while running extension script.Tom Lane
While the deletion in itself wouldn't break things, any further creation of objects in the script would result in dangling pg_depend entries being added by recordDependencyOnCurrentExtension(). An example from Phil Sorber convinced me that this is just barely likely enough to be worth expending a couple lines of code to defend against. The resulting error message might be confusing, but it's better than leaving corrupted catalog contents for the user to deal with.
2011-11-28Remove erroneous claim about use of pg_locks.objid for advisory locks.Tom Lane
The correct information appears in the text, so just remove the statement in the table, where it did not fit nicely anyway. (Curiously, the correct info has been there much longer than the erroneous table entry.) Resolves problem noted by Daniele Varrazzo. In HEAD and 9.1, also do a bit of wordsmithing on other text on the page.
2011-11-28Fix some bogosities in pg_dump's foreign-table support.Tom Lane
The server name for a foreign table was not quoted at need, as per report from Ronan Dunklau. Also, queries related to FDW options were inadequately schema-qualified in places where the search path isn't just pg_catalog, and were inconsistently formatted everywhere, and we didn't always check that we got the expected number of rows from them.
2011-11-27Ensure that whole-row junk Vars are always of composite type.Tom Lane
The EvalPlanQual machinery assumes that whole-row Vars generated for the outputs of non-table RTEs will be of composite types. However, for the case where the RTE is a function call returning a scalar type, we were doing the wrong thing, as a result of sharing code with a parser case where the function's scalar output is wanted. (Or at least, that's what that case has done historically; it does seem a bit inconsistent.) To fix, extend makeWholeRowVar's API so that it can support both use-cases. This fixes Belinda Cussen's report of crashes during concurrent execution of UPDATEs involving joins to the result of UNNEST() --- in READ COMMITTED mode, we'd run the EvalPlanQual machinery after a conflicting row update commits, and it was expecting to get a HeapTuple not a scalar datum from the "wholerowN" variable referencing the function RTE. Back-patch to 9.0 where the current EvalPlanQual implementation appeared. In 9.1 and up, this patch also fixes failure to attach the correct collation to the Var generated for a scalar-result case. An example: regression=# select upper(x.*) from textcat('ab', 'cd') x; ERROR: could not determine which collation to use for upper() function
2011-11-27Fix MSVC builds broken by xsubpp changeAndrew Dunstan
2011-11-26Use the right interpreter for encoding test.Andrew Dunstan
2011-11-26Use the preferred version of xsubpp, not necessarily the one that came with theAndrew Dunstan
distro version of perl. David Wheeler and Alex Hunsaker. Backpatch to 9.1 where it applies cleanly. A simple workaround is available for earlier branches, and further effort doesn't seem warranted.
2011-11-26Fix overly-aggressive and inconsistent quoting in OS X start script.Tom Lane
Sidar Lopez, per bug #6310, with some additional improvements by me. Back-patch to 9.0, where the issue was introduced.