summaryrefslogtreecommitdiff
path: root/src/backend
AgeCommit message (Collapse)Author
2010-07-02Move copydir.c from src/port to src/backend/storage/fileRobert Haas
The previous commit to make copydir() interruptible prevented postgres.exe from linking on MinGW and Cygwin, because on those platforms libpgport_srv.a can't freely reference symbols defined by the backend. Since that code is already backend-specific anyway, just move the whole file into the backend rather than adding further kludges to deal with the symbols needed by CHECK_FOR_INTERRUPTS(). This probably needs some further cleanup, but this commit just moves the file as-is, which should hopefully be enough to turn the buildfarm green again.
2010-07-02Issue 'mkdir' hint when replying CREATE TABLESPACE in recovery mode.Bruce Momjian
Per idea from Fujii Masao
2010-07-01Allow ALTER TABLE .. SET TABLESPACE to be interrupted.Robert Haas
Backpatch to 8.0, where tablespaces were introduced. Guillaume Lelarge
2010-06-30stringToNode() and deparse_expression_pretty() crash on invalid input,Heikki Linnakangas
but we have nevertheless exposed them to users via pg_get_expr(). It would be too much maintenance effort to rigorously check the input, so put a hack in place instead to restrict pg_get_expr() so that the argument must come from one of the system catalog columns known to contain valid expressions. Per report from Rushabh Lathia. Backpatch to 7.4 which is the oldest supported version at the moment.
2010-06-29Add C comment about why synchronous_commit=off behavior can loseBruce Momjian
committed transactions in a postmaster crash.
2010-06-29Message tuningPeter Eisentraut
2010-06-28emode_for_corrupt_record shouldn't reduce LOG messages to WARNING.Robert Haas
In non-interactive sessions, WARNING sorts below LOG.
2010-06-25Fix log_temp_files docs and comments to say bytes not kilobytes.Simon Riggs
stat(2) field st_size returns bytes not kilobytes. Bug found during recent performance tuning for PostgreSQL user.
2010-06-24Add stray "else" that seems to have gone missing.Robert Haas
2010-06-22Deprecate the use of => as an operator name.Robert Haas
In HEAD, emit a warning when an operator named => is defined. In both HEAD and the backbranches (except in 8.2, where contrib modules do not have documentation), document that hstore's text => text operator may be removed in a future release, and encourage the use of the hstore(text, text) function instead. This function only exists in HEAD (previously, it was called tconvert), so backpatch it back to 8.2, when hstore was added. Per discussion.
2010-06-21Fix mishandling of whole-row Vars referencing a view or sub-select.Tom Lane
If such a Var appeared within a nested sub-select, we failed to translate it correctly during pullup of the view, because the recursive call to replace_rte_variables_mutator was looking for the wrong sublevels_up value. Bug was introduced during the addition of the PlaceHolderVar mechanism. Per bug #5514 from Marcos Castedo.
2010-06-17Clean up some randomness associated with trace_recovery_messages: don'tTom Lane
put the variable declaration in the middle of a bunch of externs, and do use extern where it should be used.
2010-06-17Make RemoveOldXlogFiles's debug printout match style used elsewhere:Tom Lane
log and seg aren't an XLogRecPtr and shouldn't be printed like one. Fujii Masao
2010-06-17Don't allow walsender to send WAL data until it's been safely fsync'd on theTom Lane
master. Otherwise a subsequent crash could cause the master to lose WAL that has already been applied on the slave, resulting in the slave being out of sync and soon corrupt. Per recent discussion and an example from Robert Haas. Fujii Masao
2010-06-16Refactor sprintf calls with computed format strings into multiple calls withPeter Eisentraut
constant format strings, so that the compiler can more easily check the formats for correctness.
2010-06-15Add new GUC categories corresponding to sections in docs, and moveItagaki Takahiro
description for vacuum_defer_cleanup_age to the correct category. Sections in postgresql.conf are also sorted in the same order with docs. Per gripe by Fujii Masao, suggestion by Heikki Linnakangas, and patch by me.
2010-06-14If a corrupt WAL record is received by streaming replication, disconnectHeikki Linnakangas
and retry. If the record is genuinely corrupt in the master database, there's little hope of recovering, but it's better than simply retrying to apply the corrupt WAL record in a tight loop without even trying to retransmit it, which is what we used to do.
2010-06-14Remove max_standby_delay message from ps display of recovery processItagaki Takahiro
in waiting status. The parameter is not so interesting in ps display because it is referable in postgresql.conf.
2010-06-13Fix ALTER LARGE OBJECT and GRANT ... ON LARGE OBJECT for large OIDs.Robert Haas
The previous coding failed for OIDs too large to be represented by a signed integer.
2010-06-12Fix typo/bug, found by Clang compilerPeter Eisentraut
2010-06-11Use "replication" as the database name when constructing a connectionHeikki Linnakangas
string for a streaming replication connection. It's ignored by the server, but allows libpq to pick up the password from .pgpass where "replication" is specified as the database name. Patch by Fujii Masao per Tom's suggestion, with some wording changes by me.
2010-06-10Rename restartpoint_command to archive_cleanup_command.Itagaki Takahiro
2010-06-10Make TriggerFile variable static. It's not used outside xlog.c.Heikki Linnakangas
Fujii Masao
2010-06-10Return NULL instead of 0/0 in pg_last_xlog_receive_location() andHeikki Linnakangas
pg_last_xlog_replay_location(). Per Robert Haas's suggestion, after Itagaki Takahiro pointed out an issue in the docs. Also, some wording changes in the docs by me.
2010-06-10Quote all string values in EXPLAIN (FORMAT YAML) output.Robert Haas
While my previous attempt seems to always produce valid YAML, it doesn't always produce YAML that means what it appears to mean, because of tokens like "0xa" and "true", which without quotes will be interpreted as integer or Boolean literals. So, instead, just quote everything that's not known to be a number, as we do for JSON. Dean Rasheed, with some changes to the comments by me.
2010-06-09Remove stray word from comment.Robert Haas
2010-06-09In standby mode, respect checkpoint_segments in addition toHeikki Linnakangas
checkpoint_timeout to trigger restartpoints. We used to deliberately only do time-based restartpoints, because if checkpoint_segments is small we would spend time doing restartpoints more often than really necessary. But now that restartpoints are done in bgwriter, they're not as disruptive as they used to be. Secondly, because streaming replication stores the streamed WAL files in pg_xlog, we want to clean it up more often to avoid running out of disk space when checkpoint_timeout is large and checkpoint_segments small. Patch by Fujii Masao, with some minor changes by me.
2010-06-09Make the walwriter close it's handle to an old xlog segment if it's no longerMagnus Hagander
the current one. Not doing this would leave the walwriter with a handle to a deleted file if there was nothing for it to do for a long period of time, preventing the file from being completely removed. Reported by Tollef Fog Heen, and thanks to Heikki for some hand-holding with the patch.
2010-06-09Attempt to fix EXPLAIN (FORMAT YAML) quoting to behave sanely.Robert Haas
The previous code failed to quote in many cases where quoting was necessary - YAML has loads of special characters, including -:[]{},"'|*& - so quote much more aggressively, and only refrain from quoting things where it seems fairly clear that it isn't necessary. Per report from Dean Rasheed.
2010-06-09Fix typo in the header comment. Per request from Masao Fujii.Tatsuo Ishii
2010-06-07Avoid useless snprintf() call when update_process_title is turned off.Tom Lane
Fujii Masao
2010-06-07Ensure default-only storage parameters for TOAST relationsItagaki Takahiro
to be initialized with proper values. Affected parameters are fillfactor, analyze_threshold, and analyze_scale_factor. Especially uninitialized fillfactor caused inefficient page usage because we built a StdRdOptions struct in which fillfactor is zero if any reloption is set for the toast table. In addition, we disallow toast.autovacuum_analyze_threshold and toast.autovacuum_analyze_scale_factor because we didn't actually support them; they are always ignored. Report by Rumko on pgsql-bugs on 12 May 2010. Analysis by Tom Lane and Alvaro Herrera. Patch by me. Backpatch to 8.4.
2010-06-03Adjust misleading comment in walsender.c. We try to send all WAL data that'sTom Lane
been written out from shared memory, but the previous phrasing might be read to say that we send only what's been fsync'd.
2010-06-03Add current WAL end (as seen by walsender, ie, GetWriteRecPtr() result)Tom Lane
and current server clock time to SR data messages. These are not currently used on the slave side but seem likely to be useful in future, and it'd be better not to change the SR protocol after release. Per discussion. Also do some minor code review and cleanup on walsender.c, and improve the protocol documentation.
2010-06-03Translation updates for 9.0beta2Peter Eisentraut
2010-06-03Fix some inconsistent quoting of wal_level values in messagesPeter Eisentraut
When referring to postgresql.conf syntax, then it's without quotes (wal_level=archive); in narrative it's with double quotes. But never single quotes.
2010-06-03Fix reference to nonexistent configure optionPeter Eisentraut
--enable-ssl -> --with-openssl
2010-06-03On clean shutdown during recovery, don't warn about possible corruption.Robert Haas
Fujii Masao. Review by Heikki Linnakangas and myself.
2010-06-02Fix obsolete comments that I neglected to update in a previous patch.Heikki Linnakangas
Fujii Masao
2010-06-01Show schema name for REINDEX.Bruce Momjian
Greg Sabino Mullane
2010-05-31Send all outstanding WAL before exiting when smart shutdown is requested.Heikki Linnakangas
This was broken by my previous patch to send WAL in smaller batches. Patch by Fujii Masao.
2010-05-30Fix misuse of Lossy Counting (LC) algorithm in compute_tsvector_stats().Tom Lane
We must filter out hashtable entries with frequencies less than those specified by the algorithm, else we risk emitting junk entries whose actual frequency is much less than other lexemes that did not get tabulated. This is bad enough by itself, but even worse is that tsquerysel() believes that the minimum frequency seen in pg_statistic is a hard upper bound for lexemes not included, and was thus underestimating the frequency of non-MCEs. Also, set the threshold frequency to something with a little bit of theory behind it, to wit assume that the input distribution is approximately Zipfian. This might need adjustment in future, but some preliminary experiments suggest that it's not too unreasonable. Back-patch to 8.4, where this code was introduced. Jan Urbanski, with some editorialization by Tom
2010-05-30Change the notation for calling functions with named parameters fromTom Lane
"val AS name" to "name := val", as per recent discussion. This patch catches everything in the original named-parameters patch, but I'm not certain that no other dependencies snuck in later (grepping the source tree for all uses of AS soon proved unworkable). In passing I note that we've dropped the ball at least once on keeping ecpg's lexer (as opposed to parser) in sync with the backend. It would be a good idea to go through all of pgc.l and see if it's in sync now. I didn't attempt that at the moment.
2010-05-29Add C comment that we will have to remove an exclusion constraint checkBruce Momjian
if we ever implement '<>' index opclasses. Jeff Davis
2010-05-28Fix oversight in the previous patch that made LIKE throw error for \ at theTom Lane
end of the pattern: the code path that handles \ just after % should throw error too. As in the previous patch, not back-patching for fear of breaking apps that worked before.
2010-05-28Rewrite LIKE's %-followed-by-_ optimization so it really works (this timeTom Lane
for sure ;-)). It now also optimizes more cases, such as %_%_. Improve comments too. Per bug #5478. In passing, also rename the TCHAR macro to GETCHAR, because pgindent is messing with the formatting of the former (apparently it now thinks TCHAR is a typedef name). Back-patch to 8.3, where the bug was introduced.
2010-05-28Rejigger mergejoin logic so that a tuple with a null in the first merge columnTom Lane
is treated like end-of-input, if nulls sort last in that column and we are not doing outer-join filling for that input. In such a case, the tuple cannot join to anything from the other input (because we assume mergejoinable operators are strict), and neither can any tuple following it in the sort order. If we're not interested in doing outer-join filling we can just pretend the tuple and its successors aren't there at all. This can save a great deal of time in situations where there are many nulls in the join column, as in a recent example from Scott Marlowe. Also, since the planner tends to not count nulls in its mergejoin scan selectivity estimates, this is an important fix to make the runtime behavior more like the estimate. I regard this as an omission in the patch I wrote years ago to teach mergejoin that tuples containing nulls aren't joinable, so I'm back-patching it. But only to 8.3 --- in older versions, we didn't have a solid notion of whether nulls sort high or low, so attempting to apply this optimization could break things.
2010-05-27Change ps_status.c to explicitly track the current logical length of ps_buffer.Tom Lane
This saves cycles in get_ps_display() on many popular platforms, and more importantly ensures that get_ps_display() will correctly return an empty string if init_ps_display() hasn't been called yet. Per trouble report from Ray Stell, in which log_line_prefix %i produced junk early in backend startup. Back-patch to 8.0. 7.4 doesn't have %i and its version of get_ps_display() makes no pretense of avoiding pad junk anyhow.
2010-05-27Make CREATE INDEX run expression preprocessing on a proposed index expressionTom Lane
before it checks whether the expression is immutable. This covers two cases that were previously handled poorly: 1. SQL function inlining could reduce the apparent volatility of the expression, allowing an expression to be accepted where it previously would not have been. As an example, polymorphic functions must be marked with the worst-case volatility they have for any argument type, but for specific argument types they might not be so volatile, so indexing could be allowed. (Since the planner will refuse to inline functions in cases where the apparent volatility of the expression would increase, this won't break any cases that were accepted before.) 2. A nominally immutable function could have default arguments that are volatile expressions. In such a case insertion of the defaults will increase both the apparent and actual volatility of the expression, so it is *necessary* to check this before allowing the expression to be indexed. Back-patch to 8.4, where default arguments were introduced.
2010-05-27Avoid starting walreceiver in states where it shouldn't be running.Robert Haas
In particular, it's bad to start walreceiver when in state PM_WAIT_BACKENDS, because we have no provision to kill walreceiver when in that state. Fujii Masao