aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Fix longstanding race condition in plancache.c.Tom Lane2013-04-20
| | | | | | | | | | | | | | | | | | | When creating or manipulating a cached plan for a transaction control command (particularly ROLLBACK), we must not perform any catalog accesses, since we might be in an aborted transaction. However, plancache.c busily saved or examined the search_path for every cached plan. If we were unlucky enough to do this at a moment where the path's expansion into schema OIDs wasn't already cached, we'd do some catalog accesses; and with some more bad luck such as an ill-timed signal arrival, that could lead to crashes or Assert failures, as exhibited in bug #8095 from Nachiket Vaidya. Fortunately, there's no real need to consider the search path for such commands, so we can just skip the relevant steps when the subject statement is a TransactionStmt. This is somewhat related to bug #5269, though the failure happens during initial cached-plan creation rather than revalidation. This bug has been there since the plan cache was invented, so back-patch to all supported branches.
* Clean up references to SQL92Peter Eisentraut2013-04-20
| | | | | | In most cases, these were just references to the SQL standard in general. In a few cases, a contrast was made between SQL92 and later standards -- those have been kept unchanged.
* Improve error message when an FDW doesn't support WHERE CURRENT OF.Tom Lane2013-04-19
| | | | | | | If an FDW fails to take special measures with a CurrentOfExpr, we will end up trying to execute it as an ordinary qual, which was being treated as a purely internal failure condition. Provide a more user-oriented error message for such cases.
* Standardize spelling of "nonblocking"Peter Eisentraut2013-04-18
| | | | | Only adjusted the user-exposed messages and documentation, not all source code comments.
* pgindent: add newline to die() so script line number is not reported on ↵Bruce Momjian2013-04-16
| | | | failure.
* Remove some unused and seldom used fields from RelationAmInfo.Heikki Linnakangas2013-04-16
| | | | | | | This saves some memory from each index relcache entry. At least on a 64-bit machine, it saves just enough to shrink a typical relcache entry's memory usage from 2k to 1k. That's nice if you have a lot of backends and a lot of indexes.
* Fix function return type confusionPeter Eisentraut2013-04-15
| | | | | When parse_hba_line's return type was changed from bool to a pointer, the MANDATORY_AUTH_ARG macro wasn't adjusted.
* Mark json IO and extraction functions immutable.Andrew Dunstan2013-04-15
| | | | | | Per complaint from Hubert Depesz Lubaczewski. Catalog version bumped.
* Correct handling of NULL arguments in json funcs.Andrew Dunstan2013-04-15
| | | | Per gripe from Tom Lane.
* Add serial commaPeter Eisentraut2013-04-14
|
* pg_ctl: Add idempotent optionPeter Eisentraut2013-04-13
| | | | | | | | | | | | | This changes the behavior of the start and stop actions to exit successfully if the server was already started or stopped. This changes the default behavior of the start action: Before, if the server was already running, it would print a message and succeed. Now, that situation will result in an error. When running in idempotent mode, no message is printed and pg_ctl exits successfully. It was considered to just make the idempotent behavior the default and only option, but pg_upgrade needs the old behavior.
* Fix sporadic rebuilds for .pc filesPeter Eisentraut2013-04-12
| | | | | | | | | The build of .pc (pkg-config) files depends on all makefiles in use, and in dependency tracking mode, the previous coding ended up including /dev/null as a makefile. Apparently, on some platforms the modification time of /dev/null changes sporadically, and so the .pc files would end up being rebuilt every so often. Fix that by changing the makefile code to do without using /dev/null.
* Clean up the mess around EXPLAIN and materialized views.Tom Lane2013-04-12
| | | | | | | | | | | | | | | | | | | | | | | | | Revert the matview-related changes in explain.c's API, as per recent complaint from Robert Haas. The reason for these appears to have been principally some ill-considered choices around having intorel_startup do what ought to be parse-time checking, plus a poor arrangement for passing it the view parsetree it needs to store into pg_rewrite when creating a materialized view. Do the latter by having parse analysis stick a copy into the IntoClause, instead of doing it at runtime. (On the whole, I seriously question the choice to represent CREATE MATERIALIZED VIEW as a variant of SELECT INTO/CREATE TABLE AS, because that means injecting even more complexity into what was already a horrid legacy kluge. However, I didn't go so far as to rethink that choice ... yet.) I also moved several error checks into matview parse analysis, and made the check for external Params in a matview more accurate. In passing, clean things up a bit more around interpretOidsOption(), and fix things so that we can use that to force no-oids for views, sequences, etc, thereby eliminating the need to cons up "oids = false" options when creating them. catversion bump due to change in IntoClause. (I wonder though if we really need readfuncs/outfuncs support for IntoClause anymore.)
* pgindent: improve error messagesBruce Momjian2013-04-12
| | | | per suggestion from Gurjeet Singh
* pgindent: fix downloading of BSD indent binaryBruce Momjian2013-04-12
| | | | | | Also fix accessing pgentab binary and tar. Gurjeet Singh
* sepgsql: Enforce db_procedure:{execute} permission.Robert Haas2013-04-12
| | | | | | | To do this, we add an additional object access hook type, OAT_FUNCTION_EXECUTE. KaiGai Kohei
* Minor wording corrections for object-access hook stuff.Robert Haas2013-04-12
| | | | KaiGai Kohei
* Document that git_changelog needs updating for major version stamping.Bruce Momjian2013-04-11
|
* Remove quotes around SQL statement in error messageAlvaro Herrera2013-04-11
|
* Fix confusion between ObjectType and ObjectClassAlvaro Herrera2013-04-11
| | | | Per report by Will Leinweber and Peter Eisentraut
* Fix SIGUSR1 handling by unconnected bgworkersAlvaro Herrera2013-04-10
| | | | | | | | Latch activity was not being detected by non-database-connected workers; the SIGUSR1 signal handler which is normally in charge of that was set to SIG_IGN. Create a simple handler to call latch_sigusr1_handler instead. Robert Haas (bug report and suggested fix)
* Fix SIGHUP handling by unconnected bgworkersAlvaro Herrera2013-04-10
| | | | | | | | Add a SignalUnconnectedWorkers() call so that non-database-connected background workers are also notified when postmaster is SIGHUPped. Previously, only database-connected workers were. Michael Paquier (bug report and fix)
* Remove duplicate initialization in XLogReadRecord.Robert Haas2013-04-09
| | | | Per a note from Dickson S. Guedes.
* Create a distinction between a populated matview and a scannable one.Kevin Grittner2013-04-09
| | | | | | | | | | | | | | | | The intent was that being populated would, long term, be just one of the conditions which could affect whether a matview was scannable; being populated should be necessary but not always sufficient to scan the relation. Since only CREATE and REFRESH currently determine the scannability, names and comments accidentally conflated these concepts, leading to confusion. Also add missing locking for the SQL function which allows a test for scannability, and fix a modularity violatiion. Per complaints from Tom Lane, although its not clear that these will satisfy his concerns. Hopefully this will at least better frame the discussion.
* Adjust ExplainOneQuery_hook_type to take a DestReceiver argument.Robert Haas2013-04-09
| | | | | | | | The materialized views patch adjusted ExplainOneQuery to take an additional DestReceiver argument, but failed to add a matching argument to the definition of ExplainOneQuery_hook. This is a problem for users of the hook that want to call ExplainOnePlan. Fix by adding the missing argument.
* Support indexing of regular-expression searches in contrib/pg_trgm.Tom Lane2013-04-09
| | | | | | | | | | | | | | | | This works by extracting trigrams from the given regular expression, in generally the same spirit as the previously-existing support for LIKE searches, though of course the details are far more complicated. Currently, only GIN indexes are supported. We might be able to make it work with GiST indexes later. The implementation includes adding API functions to backend/regex/ to provide a view of the search NFA created from a regular expression. These functions are meant to be generic enough to be supportable in a standalone version of the regex library, should that ever happen. Alexander Korotkov, reviewed by Heikki Linnakangas and Tom Lane
* Minor rewording of README commentsSimon Riggs2013-04-08
|
* Fix calculation of how many segments to retain for wal_keep_segments.Heikki Linnakangas2013-04-08
| | | | | | | KeepLogSeg function was broken when we switched to use a 64-bit int for the segment number. Per report from Jeff Janes.
* Skip extraneous locking in XLogCheckBuffer().Simon Riggs2013-04-08
| | | | | | | Heikki reported comment was wrong, so fixed code to match the comment: we only need to take additional locking precautions when we have a shared lock on the buffer.
* Avoid tricky race condition recording XLOG_HINTSimon Riggs2013-04-08
| | | | | | | | | | | | | | | | | | We copy the buffer before inserting an XLOG_HINT to avoid WAL CRC errors caused by concurrent hint writes to buffer while share locked. To make this work we refactor RestoreBackupBlock() to allow an XLOG_HINT to avoid the normal path for backup blocks, which assumes the underlying buffer is exclusive locked. Resulting code completely changes layout of XLOG_HINT WAL records, but this isn't even beta code, so this is a low impact change. In passing, avoid taking WALInsertLock for full page writes on checksummed hints, remove related cruft from XLogInsert() and improve xlog_desc record for XLOG_HINT. Andres Freund Bug report by Fujii Masao, testing by Jeff Janes and Jaime Casanova, review by Jeff Davis and Simon Riggs. Applied with changes from review and some comment editing.
* README comments on checksums on page holes.Simon Riggs2013-04-08
|
* Tune BufferGetLSNAtomic() when checksums !enabledSimon Riggs2013-04-07
| | | | From performance analysis by Heikki Linnakangas
* Fix checksums for CLUSTER, VACUUM FULL etc.Simon Riggs2013-04-07
| | | | | | | | | In CLUSTER, VACUUM FULL and ALTER TABLE SET TABLESPACE I erroneously set checksum before log_newpage, which sets the LSN and invalidates the checksum. So set checksum immediately *after* log_newpage. Bug report Fujii Masao, Fix and patch by Jeff Davis
* In isolationtester, retry after EINTR return from select(2).Tom Lane2013-04-06
| | | | | Per report from Jaime Casanova. Very curious that no one else has seen this failure ... but the code is clearly wrong as-is.
* sepgsql: Enforce db_schema:search permission.Robert Haas2013-04-05
| | | | KaiGai Kohei, with comment and doc wordsmithing by me
* Fix line count in slashUsage().Tom Lane2013-04-04
| | | | | | | | Counting newlines shows that quite a few recent patches have neglected to update the output-lines count given to PageOutput(). Fortunately it's not terribly critical that this be exact, since we long since exceeded the height of most people's terminal windows. Still, maybe we ought to think of a way to not have to maintain this manually anymore.
* Add \watch [SEC] command to psql.Tom Lane2013-04-04
| | | | | | This allows convenient re-execution of commands. Will Leinweber, reviewed by Peter Eisentraut, Daniel Farina, and Tom Lane
* Fix off by one error in JSON extract path code.Andrew Dunstan2013-04-04
| | | | Bug report by David Wheeler, diagnosis assistance from Tom Lane.
* psql: fix startup crash caused by PSQLRC containing a tildeBruce Momjian2013-04-04
| | | | | | | 'strdup' the PSQLRC environment variable value before calling a routine that might free() it. Backpatch to 9.2, where the bug first appeared.
* Fix crash on compiling a regular expression with more than 32k colors.Heikki Linnakangas2013-04-04
| | | | | | Throw an error instead. Backpatch to all supported branches.
* Calculate # of semaphores correctly with --disable-spinlocks.Heikki Linnakangas2013-04-04
| | | | | | | | | | The old formula didn't take into account that each WAL sender process needs a spinlock. We had also already exceeded the fixed number of spinlocks reserved for misc purposes (10). Bump that to 30. Backpatch to 9.0, where WAL senders were introduced. If I counted correctly, 9.0 had exactly 10 predefined spinlocks, and 9.1 exceeded that, but bump the limit in 9.0 too because 10 is uncomfortably close to the edge.
* Avoid updating our PgBackendStatus entry when track_activities is off.Tom Lane2013-04-03
| | | | | | | | The point of turning off track_activities is to avoid this reporting overhead, but a thinko in commit 4f42b546fd87a80be30c53a0f2c897acb826ad52 caused pgstat_report_activity() to perform half of its updates anyway. Fix that, and also make sure that we clear all the now-disabled fields when transitioning to the non-reporting state.
* Minor robustness improvements for isolationtester.Tom Lane2013-04-02
| | | | | | | | | | | | | Notice and complain about PQcancel() failures. Also, don't dump core if an error PGresult doesn't contain severity and message subfields, as it might not if it was generated by libpq itself. (We have a longstanding TODO item to improve that, but in the meantime isolationtester had better cope.) I tripped across the latter item while investigating a trouble report on buildfarm member spoonbill. As for the former, there's no evidence that PQcancel failure is actually involved in spoonbill's problem, but it still seems like a bad idea to ignore an error return code.
* Fix insecure parsing of server command-line switches.Tom Lane2013-04-01
| | | | | | | | | | | | | | | | | | | | | | | | An oversight in commit e710b65c1c56ca7b91f662c63d37ff2e72862a94 allowed database names beginning with "-" to be treated as though they were secure command-line switches; and this switch processing occurs before client authentication, so that even an unprivileged remote attacker could exploit the bug, needing only connectivity to the postmaster's port. Assorted exploits for this are possible, some requiring a valid database login, some not. The worst known problem is that the "-r" switch can be invoked to redirect the process's stderr output, so that subsequent error messages will be appended to any file the server can write. This can for example be used to corrupt the server's configuration files, so that it will fail when next restarted. Complete destruction of database tables is also possible. Fix by keeping the database name extracted from a startup packet fully separate from command-line switches, as had already been done with the user name field. The Postgres project thanks Mitsumasa Kondo for discovering this bug, Kyotaro Horiguchi for drafting the fix, and Noah Misch for recognizing the full extent of the danger. Security: CVE-2013-1899
* Make REPLICATION privilege checks test current user not authenticated user.Tom Lane2013-04-01
| | | | | | | | | | | The pg_start_backup() and pg_stop_backup() functions checked the privileges of the initially-authenticated user rather than the current user, which is wrong. For example, a user-defined index function could successfully call these functions when executed by ANALYZE within autovacuum. This could allow an attacker with valid but low-privilege database access to interfere with creation of routine backups. Reported and fixed by Noah Misch. Security: CVE-2013-1901
* Revert "ecpg: Don't link compatlib with libpq"Peter Eisentraut2013-03-31
| | | | | | | | This reverts commit 3780fc679cc428c1f211e1728c4281ca15e9746b. HP-UX didn't like it. There would probably be a way to fix that, but since the net effect of all of this is zero because ecpg ends up using libpq anyway, it's not worth bothering further.
* Ignore extra subquery outputs in set_subquery_size_estimates().Tom Lane2013-03-31
| | | | | | | | | | | | In commit 0f61d4dd1b4f95832dcd81c9688dac56fd6b5687, I added code to copy up column width estimates for each column of a subquery. That code supposed that the subquery couldn't have any output columns that didn't correspond to known columns of the current query level --- which is true when a query is parsed from scratch, but the assumption fails when planning a view that depends on another view that's been redefined (adding output columns) since the upper view was made. This results in an assertion failure or even a crash, as per bug #8025 from lindebg. Remove the Assert and instead skip the column if its resno is out of the expected range.
* Add pkg-config files for libpq and ecpg librariesPeter Eisentraut2013-03-31
| | | | | | | | This will hopefully be easier to use than pg_config for users who are already used to the pkg-config interface. It also works better for multi-arch installations. reviewed by Tom Lane
* ecpg: Don't link compatlib with libpqPeter Eisentraut2013-03-31
| | | | | | | | It doesn't actually use libpq. But we need to keep libpq in the CPPFLAGS for building, because compatlib uses ecpglib.h which uses libpq-fe.h, but we don't need to refer to libpq for linking. reviewed by Tom Lane
* Improve code documentation about "magnetic disk" storage manager.Tom Lane2013-03-30
| | | | | | | The modern incarnation of md.c is by no means specific to magnetic disk technology, but every so often we hear from someone who's misled by the label. Try to clarify that it will work for anything that supports standard filesystem operations. Per suggestion from Andrew Dunstan.