summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2012-04-07Stamp libraries versions for 9.2 (better late than never).Bruce Momjian
2012-04-06Fix misleading output from gin_desc().Tom Lane
XLOG_GIN_UPDATE_META_PAGE and XLOG_GIN_DELETE_LISTPAGE records were printed with a list link field labeled as "blkno", which was confusing, especially when the link was empty (InvalidBlockNumber). Print the metapage block number instead, since that's what's actually being updated. We could include the link values too as a separate field, but not clear it's worth the trouble. Back-patch to 8.4 where the dubious code was added.
2012-04-06Fix broken comparetup_datum code.Tom Lane
Commit 337b6f5ecf05b21b5e997986884d097d60e4e3d0 contained the entirely fanciful assumption that it had made comparetup_datum unreachable. Reported and patched by Takashi Yamamoto. Fix up some not terribly accurate/useful comments from that commit, too.
2012-04-06Dept of second thoughts: improve the API for AnalyzeForeignTable.Tom Lane
If we make the initially-called function return the table physical-size estimate, acquire_inherited_sample_rows will be able to use that to allocate numbers of samples among child tables, when the day comes that we want to support foreign tables in inheritance trees.
2012-04-06Allow statistics to be collected for foreign tables.Tom Lane
ANALYZE now accepts foreign tables and allows the table's FDW to control how the sample rows are collected. (But only manual ANALYZEs will touch foreign tables, for the moment, since among other things it's not very clear how to handle remote permissions checks in an auto-analyze.) contrib/file_fdw is extended to support this. Etsuro Fujita, reviewed by Shigeru Hanada, some further tweaking by me.
2012-04-06Add DROP INDEX CONCURRENTLY [IF EXISTS], uses ShareUpdateExclusiveLockSimon Riggs
2012-04-05checkopint -> checkpointRobert Haas
Report by Guillaume Lelarge.
2012-04-05Put back code inadvertently deleted from exit_nicely.Robert Haas
Report by Andrew Dunstan.
2012-04-05NLS: Use msgmerge/xgettext --no-wrap and --sort-by-filePeter Eisentraut
The option --no-wrap prevents wars with (most?) editors about proper line wrapping. --sort-by-file ensures consistent file order, for easier diffing.
2012-04-05Publish checkpoint timing information to pg_stat_bgwriter.Robert Haas
Greg Smith, Peter Geoghegan, and Robert Haas
2012-04-05Update obsolete comment.Tom Lane
Somebody didn't bother to fix this comment while adding foreign table support to the code below it. In passing, remove the explicit calling-out of relkind letters, which adds complexity to the comment but doesn't help in understanding the code.
2012-04-05Expose track_iotiming data via the statistics collector.Robert Haas
Ants Aasma's original patch to add timing information for buffer I/O requests exposed this data at the relation level, which was judged too costly. I've here exposed it at the database level instead.
2012-04-04Fix plpgsql named-cursor-parameter feature for variable name conflicts.Tom Lane
The parser got confused if a cursor parameter had the same name as a plpgsql variable. Reported and diagnosed by Yeb Havinga, though this isn't exactly his proposed fix. Also, some mostly-but-not-entirely-cosmetic adjustments to the original named-cursor-parameter patch, for code readability and better error diagnostics.
2012-04-04Add a "row processor" API to libpq for better handling of large results.Tom Lane
Traditionally libpq has collected an entire query result before passing it back to the application. That provides a simple and transactional API, but it's pretty inefficient for large result sets. This patch allows the application to process each row on-the-fly instead of accumulating the rows into the PGresult. Error recovery becomes a bit more complex, but often that tradeoff is well worth making. Kyotaro Horiguchi, reviewed by Marko Kreen and Tom Lane
2012-04-04Remove useless PGRES_COPY_BOTH "support" in psql.Tom Lane
There is no existing or foreseeable case in which psql should see a PGRES_COPY_BOTH PQresultStatus; and if such a case ever emerges, it's a pretty good bet that these code fragments wouldn't do the right thing anyway. Remove them, and let the existing default cases do the appropriate thing, namely emit an "unexpected PQresultStatus" bleat. Noted while working on libpq row processor patch, for which I was considering adding a PGRES_SUSPENDED status code --- the same default-case treatment would be appropriate for that.
2012-04-04Fix syslogger to not lose log coherency under high load.Tom Lane
The original coding of the syslogger had an arbitrary limit of 20 large messages concurrently in progress, after which it would just punt and dump message fragments to the output file separately. Our ambitions are a bit higher than that now, so allow the data structure to expand as necessary. Reported and patched by Andrew Dunstan; some editing by Tom
2012-04-03Arrange for on_exit_nicely to be thread-safe.Robert Haas
Extracted from Joachim Wieland's parallel pg_dump patch, with some additional comments by me.
2012-04-03Add support for renaming domain constraintsPeter Eisentraut
2012-04-02NLS: Seed Language field in PO headerPeter Eisentraut
Use msgmerge --lang option to seed the Language field, recently introduced by gettext, in the header of the new PO file.
2012-04-02Fix recently introduced typo in NLS file listsPeter Eisentraut
2012-03-31Fix O(N^2) behavior in pg_dump when many objects are in dependency loops.Tom Lane
Combining the loop workspace with the record of already-processed objects might have been a cute trick, but it behaves horridly if there are many dependency loops to repair: the time spent in the first step of findLoop() grows as O(N^2). Instead use a separate flag array indexed by dump ID, which we can check in constant time. The length of the workspace array is now never more than the actual length of a dependency chain, which should be reasonably short in all cases of practical interest. The code is noticeably easier to understand this way, too. Per gripe from Mike Roest. Since this is a longstanding performance bug, backpatch to all supported versions.
2012-03-31Fix O(N^2) behavior in pg_dump for large numbers of owned sequences.Tom Lane
The loop that matched owned sequences to their owning tables required time proportional to number of owned sequences times number of tables; although this work was only expended in selective-dump situations, which is probably why the issue wasn't recognized long since. Refactor slightly so that we can perform this work after the index array for findTableByOid has been set up, reducing the time to O(M log N). Per gripe from Mike Roest. Since this is a longstanding performance bug, backpatch to all supported versions.
2012-03-31Rename frontend keyword arrays to avoid conflict with backend.Tom Lane
ecpg and pg_dump each contain keyword arrays with structure similar to the backend's keyword array. Up to now, we actually named those arrays the same as the backend's and relied on parser/keywords.h to declare them. This seems a tad too cute, though, and it breaks now that we need to PGDLLIMPORT-decorate the backend symbols. Rename to avoid the problem. Per buildfarm. (It strikes me that maybe we should get rid of the separate keywords.c files altogether, and just define these arrays in the modules that use them, but that's a rather more invasive change.)
2012-03-31Fix glitch recently introduced in psql tab completion.Tom Lane
Over-optimization (by me, looks like :-() broke the case of recognizing a word boundary just before a quoted identifier. Reported and diagnosed by Dean Rasheed.
2012-03-31Add PGDLLIMPORT to ScanKeywords and NumScanKeywords.Tom Lane
Per buildfarm, this is now needed by contrib/pg_stat_statements.
2012-03-30Add new files to NLS file listsPeter Eisentraut
Some of these are newly added, some are older and were forgotten, some don't contain any translatable strings right now but look like they could in the future.
2012-03-30Replace printf format %i by %dPeter Eisentraut
see also ce8d7bb6440710058503d213b2aafcdf56a5b481
2012-03-30pgxs: Supply default values for BISON and FLEX variablesPeter Eisentraut
Otherwise, the availability of these variables depends on what happened to be available at the time the PostgreSQL build was configured.
2012-03-29initdb: Mark more messages for translationPeter Eisentraut
Some Windows-only messages had apparently been forgotten so far. Also make the wording of the messages more consistent with similar messages other parts, such as pg_ctl and pg_regress.
2012-03-29Correct epoch of txid_current() when executed on a Hot Standby server.Simon Riggs
Initialise ckptXidEpoch from starting checkpoint and maintain the correct value as we roll forwards. This allows GetNextXidAndEpoch() to return the correct epoch when executed during recovery. Backpatch to 9.0 when the problem is first observable by a user. Bug report from Daniel Farina
2012-03-29Unbreak Windows builds broken by pgpipe removal.Andrew Dunstan
2012-03-29Inherit max_safe_fds to child processes in EXEC_BACKEND mode.Heikki Linnakangas
Postmaster sets max_safe_fds by testing how many open file descriptors it can open, and that is normally inherited by all child processes at fork(). Not so on EXEC_BACKEND, ie. Windows, however. Because of that, we effectively ignored max_files_per_process on Windows, and always assumed a conservative default of 32 simultaneous open files. That could have an impact on performance, if you need to access a lot of different files in a query. After this patch, the value is passed to child processes by save/restore_backend_variables() among many other global variables. It has been like this forever, but given the lack of complaints about it, I'm not backpatching this.
2012-03-28Remove now redundant pgpipe code.Andrew Dunstan
2012-03-28Run maintainer-check on all PO files, not only configured onesPeter Eisentraut
The intent is to allow configure --enable-nls=xx for installation speed and size, but have maintainer-check check all source files regardless.
2012-03-28Attempt to unbreak pg_test_timing on Windows.Robert Haas
Per buildfarm, and Álvaro Herrera.
2012-03-28pg_basebackup: Error handling fixes.Robert Haas
Thomas Ogrisegg and Fujii Masao
2012-03-28pg_basebackup: Error message improvements.Robert Haas
Fujii Masao
2012-03-27Bend parse location rules for the convenience of pg_stat_statements.Tom Lane
Generally, the parse location assigned to a multiple-token construct is the location of its leftmost token. This commit breaks that rule for the syntaxes TYPENAME 'LITERAL' and CAST(CONSTANT AS TYPENAME) --- the resulting Const will have the location of the literal string, not the typename or CAST keyword. The cases where this matters are pretty thin on the ground (no error messages in the regression tests change, for example), and it's unlikely that any user would be confused anyway by an error cursor pointing at the literal. But still it's less than consistent. The reason for changing it is that contrib/pg_stat_statements wants to know the parse location of the original literal, and it was agreed that this is the least unpleasant way to preserve that information through parse analysis. Peter Geoghegan
2012-03-27Add some infrastructure for contrib/pg_stat_statements.Tom Lane
Add a queryId field to Query and PlannedStmt. This is not used by the core backend, except for being copied around at appropriate times. It's meant to allow plug-ins to track a particular query forward from parse analysis to execution. The queryId is intentionally not dumped into stored rules (and hence this commit doesn't bump catversion). You could argue that choice either way, but it seems better that stored rule strings not have any dependency on plug-ins that might or might not be present. Also, add a post_parse_analyze_hook that gets invoked at the end of parse analysis (but only for top-level analysis of complete queries, not cases such as analyzing a domain's default-value expression). This is mainly meant to be used to compute and assign a queryId, but it could have other applications. Peter Geoghegan
2012-03-27New GUC, track_iotiming, to track I/O timings.Robert Haas
Currently, the only way to see the numbers this gathers is via EXPLAIN (ANALYZE, BUFFERS), but the plan is to add visibility through the stats collector and pg_stat_statements in subsequent patches. Ants Aasma, reviewed by Greg Smith, with some further changes by me.
2012-03-27pg_dump: Small message adjustment for consistencyPeter Eisentraut
2012-03-26Remove dead assignmentPeter Eisentraut
found by Coverity
2012-03-26Code cleanup for heap_freeze_tuple.Robert Haas
It used to be case that lazy vacuum could call this function with only a shared lock on the buffer, but neither lazy vacuum nor any other code path does that any more. Simplify the code accordingly and clean up some related, obsolete comments.
2012-03-25Fix COPY FROM for null marker strings that correspond to invalid encoding.Tom Lane
The COPY documentation says "COPY FROM matches the input against the null string before removing backslashes". It is therefore reasonable to presume that null markers like E'\\0' will work ... and they did, until someone put the tests in the wrong order during microoptimization-driven rewrites. Since then, we've been failing if the null marker is something that would de-escape to an invalidly-encoded string. Since null markers generally need to be something that can't appear in the data, this represents a nontrivial loss of functionality; surprising nobody noticed it earlier. Per report from Jeff Davis. Backpatch to 8.4 where this got broken.
2012-03-25Replace empty locale name with implied value in CREATE DATABASE and initdb.Tom Lane
setlocale() accepts locale name "" as meaning "the locale specified by the process's environment variables". Historically we've accepted that for Postgres' locale settings, too. However, it's fairly unsafe to store an empty string in a new database's pg_database.datcollate or datctype fields, because then the interpretation could vary across postmaster restarts, possibly resulting in index corruption and other unpleasantness. Instead, we should expand "" to whatever it means at the moment of calling CREATE DATABASE, which we can do by saving the value returned by setlocale(). For consistency, make initdb set up the initial lc_xxx parameter values the same way. initdb was already doing the right thing for empty locale names, but it did not replace non-empty names with setlocale results. On a platform where setlocale chooses to canonicalize the spellings of locale names, this would result in annoying inconsistency. (It seems that popular implementations of setlocale don't do such canonicalization, which is a pity, but the POSIX spec certainly allows it to be done.) The same risk of inconsistency leads me to not venture back-patching this, although it could certainly be seen as a longstanding bug. Per report from Jeff Davis, though this is not his proposed patch.
2012-03-24Fix planner's handling of outer PlaceHolderVars within subqueries.Tom Lane
For some reason, in the original coding of the PlaceHolderVar mechanism I had supposed that PlaceHolderVars couldn't propagate into subqueries. That is of course entirely possible. When it happens, we need to treat an outer-level PlaceHolderVar much like an outer Var or Aggref, that is SS_replace_correlation_vars() needs to replace the PlaceHolderVar with a Param, and then when building the finished SubPlan we have to provide the PlaceHolderVar expression as an actual parameter for the SubPlan. The handling of the contained expression is a bit delicate but it can be treated exactly like an Aggref's expression. In addition to the missing logic in subselect.c, prepjointree.c was failing to search subqueries for PlaceHolderVars that need their relids adjusted during subquery pullup. It looks like everyplace else that touches PlaceHolderVars got it right, though. Per report from Mark Murawski. In 9.1 and HEAD, queries affected by this oversight would fail with "ERROR: Upper-level PlaceHolderVar found where not expected". But in 9.0 and 8.4, you'd silently get possibly-wrong answers, since the value transmitted into the subquery wouldn't go to null when it should.
2012-03-23Cast some printf arguments to avoid possibly-nonportable behavior.Tom Lane
Per compiler warnings on buildfarm member black_firefly.
2012-03-23Refactor simplify_function et al to centralize argument simplification.Tom Lane
We were doing the recursive simplification of function/operator arguments in half a dozen different places, with rather baroque logic to ensure it didn't get done multiple times on some arguments. This patch improves that by postponing argument simplification until after we've dealt with named parameters and added any needed default expressions. Marti Raudsepp, somewhat hacked on by me
2012-03-23Code review for protransform patches.Tom Lane
Fix loss of previous expression-simplification work when a transform function fires: we must not simply revert to untransformed input tree. Instead build a dummy FuncExpr node to pass to the transform function. This has the additional advantage of providing a simpler, more uniform API for transform functions. Move documentation to a somewhat less buried spot, relocate some poorly-placed code, be more wary of null constants and invalid typmod values, add an opr_sanity check on protransform function signatures, and some other minor cosmetic adjustments. Note: although this patch touches pg_proc.h, no need for catversion bump, because the changes are cosmetic and don't actually change the intended catalog contents.
2012-03-22Fix GET DIAGNOSTICS for case of assignment to function's first variable.Tom Lane
An incorrect and entirely unnecessary "safety check" in exec_stmt_getdiag() caused the code to treat an assignment to a variable with dno zero as a no-op. Unfortunately, that's a perfectly valid dno. This has been broken since GET DIAGNOSTICS was invented. It's not terribly surprising that the bug went unnoticed for so long, since in most cases you probably wouldn't use the function's first-created variable (normally its first parameter) as a GET DIAGNOSTICS target. Nonetheless, it's broken. Per bug #6551 from Adam Buraczewski.