aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Move copydir.c from src/port to src/backend/storage/fileRobert Haas2010-07-02
| | | | | | | | | | | | | 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.
* Allow copydir() to be interrupted.Robert Haas2010-07-01
| | | | | | | | | This makes ALTER DATABASE .. SET TABLESPACE and CREATE DATABASE more sensitive to interrupts. Backpatch to 8.4, where ALTER DATABASE .. SET TABLESPACE was introduced. We could go back further, but in the absence of complaints about the CREATE DATABASE case it doesn't seem worth it. Guillaume Lelarge, with a small correction by me.
* Allow ALTER TABLE .. SET TABLESPACE to be interrupted.Robert Haas2010-07-01
| | | | | | Backpatch to 8.0, where tablespaces were introduced. Guillaume Lelarge
* stringToNode() and deparse_expression_pretty() crash on invalid input,Heikki Linnakangas2010-06-30
| | | | | | | | | | 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.
* Improve pg_dump's checkSeek() function to verify the functioning of ftelloTom Lane2010-06-28
| | | | | | | | | | as well as fseeko, and to not assume that fseeko(fp, 0, SEEK_CUR) proves anything. Also improve some related comments. Per my observation that the SEEK_CUR test didn't actually work on some platforms, and subsequent discussion with Robert Haas. Back-patch to 8.4. In earlier releases it's not that important whether we get the hasSeek test right, but with parallel restore it matters.
* Fix pg_restore so parallel restore doesn't fail when the input file doesn'tTom Lane2010-06-27
| | | | | | | | | | contain data offsets (which it won't, if pg_dump thought its output wasn't seekable). To do that, remove an unnecessarily aggressive error check, and instead fail if we get to the end of the archive without finding the desired data item. Also improve the error message to be more specific about the cause of the problem. Per discussion of recent report from Igor Neyman. Back-patch to 8.4 where parallel restore was introduced.
* In a PL/pgSQL "FOR cursor" statement, the statements executed in the loopHeikki Linnakangas2010-06-21
| | | | | | | might close the cursor, rendering the Portal pointer to it invalid. Closing the cursor in the middle of the loop is not a very sensible thing to do, but we must handle it gracefully and throw an error instead of crashing.
* Fix mishandling of whole-row Vars referencing a view or sub-select.Tom Lane2010-06-21
| | | | | | | | 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.
* Make the walwriter close it's handle to an old xlog segment if it's no longerMagnus Hagander2010-06-09
| | | | | | | | | 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.
* Ensure default-only storage parameters for TOAST relationsItagaki Takahiro2010-06-07
| | | | | | | | | | | | | | | | | | 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.
* Data returned by RETURNING clause wasn't correctly processed by ecpg. Patch ↵Michael Meskes2010-06-04
| | | | backported from HEAD.
* Fix regression test name for plperlu_plperl in msvc.Andrew Dunstan2010-06-03
|
* Run recently backported plperlu_plperl regression tests when building with ↵Andrew Dunstan2010-06-02
| | | | MSVC on releases 8.4 and 8.3. Regression tests weren't supported before that.
* Fix misuse of Lossy Counting (LC) algorithm in compute_tsvector_stats().Tom Lane2010-05-30
| | | | | | | | | | | | | | | | | | | 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
* Rewrite LIKE's %-followed-by-_ optimization so it really works (this timeTom Lane2010-05-28
| | | | | | | | | | | 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.
* Rejigger mergejoin logic so that a tuple with a null in the first merge columnTom Lane2010-05-28
| | | | | | | | | | | | | | | | | | | 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.
* Change ps_status.c to explicitly track the current logical length of ps_buffer.Tom Lane2010-05-27
| | | | | | | | | | | 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.
* Make CREATE INDEX run expression preprocessing on a proposed index expressionTom Lane2010-05-27
| | | | | | | | | | | | | | | | | | | | | 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.
* Fix oversight in construction of sort/unique plans for UniquePaths.Tom Lane2010-05-25
| | | | | | | | | | | | | If the original IN operator is cross-type, for example int8 = int4, we need to use int4 < int4 to sort the inner data and int4 = int4 to unique-ify it. We got the first part of that right, but tried to use the original IN operator for the equality checks. Per bug #5472 from Vlad Romascanu. Backpatch to 8.4, where the bug was introduced by the patch that unified SortClause and GroupClause. I was able to take out a whole lot of on-the-fly calls of get_equality_op_for_ordering_op(), but failed to realize that I needed to put one back in right here :-(
* Change the "N. Central Asia Standard Time" timezone to map toMagnus Hagander2010-05-20
| | | | | | | | | | Asia/Novosibirsk on Windows. Microsoft changed the behaviour of this zone in the timezone update from KB976098. The zones differ in handling of DST, and the old zone was just removed. Noted by Dmitry Funk
* > Follow up a visit from the style police.Andrew Dunstan2010-05-17
|
* tag 8.4.4REL8_4_4Marc G. Fournier2010-05-14
|
* Fix MSVC builds for recent plperl changes. Go back to version 8.2, which isAndrew Dunstan2010-05-13
| | | | | | where we started supporting MSVC builds. Security: CVE-2010-1169
* Prevent PL/Tcl from loading the "unknown" module from pltcl_modules unlessTom Lane2010-05-13
| | | | | | | | | | | | | | | | | | | that is a regular table or view owned by a superuser. This prevents a trojan horse attack whereby any unprivileged SQL user could create such a table and insert code into it that would then get executed in other users' sessions whenever they call pltcl functions. Worse yet, because the code was automatically loaded into both the "normal" and "safe" interpreters at first use, the attacker could execute unrestricted Tcl code in the "normal" interpreter without there being any pltclu functions anywhere, or indeed anyone else using pltcl at all: installing pltcl is sufficient to open the hole. Change the initialization logic so that the "unknown" code is only loaded into an interpreter when the interpreter is first really used. (That doesn't add any additional security in this particular context, but it seems a prudent change, and anyway the former behavior violated the principle of least astonishment.) Security: CVE-2010-1170
* Abandon the use of Perl's Safe.pm to enforce restrictions in plperl, as it isAndrew Dunstan2010-05-13
| | | | | | | | | | | | | | | | | | | | | | | | fundamentally insecure. Instead apply an opmask to the whole interpreter that imposes restrictions on unsafe operations. These restrictions are much harder to subvert than is Safe.pm, since there is no container to be broken out of. Backported to release 7.4. In releases 7.4, 8.0 and 8.1 this also includes the necessary backporting of the two interpreters model for plperl and plperlu adopted in release 8.2. In versions 8.0 and up, the use of Perl's POSIX module to undo its locale mangling on Windows has become insecure with these changes, so it is replaced by our own routine, which is also faster. Nice side effects of the changes include that it is now possible to use perl's "strict" pragma in a natural way in plperl, and that perl's $a and $b variables now work as expected in sort routines, and that function compilation is significantly faster. Tim Bunce and Andrew Dunstan, with reviews from Alex Hunsaker and Alexey Klyukin. Security: CVE-2010-1169
* Translation updatePeter Eisentraut2010-05-13
|
* Update time zone data files to tzdata release 2010j: DST law changes inTom Lane2010-05-11
| | | | | Argentina, Australian Antarctic, Bangladesh, Mexico, Morocco, Pakistan, Palestine, Russia, Syria, Tunisia. Historical corrections for Taiwan.
* Add PKST to the default set of timezone abbreviations.Tom Lane2010-05-11
| | | | | Per discussion, if we have PKT in there then PKST should be too. Also, fix mistaken claim that these abbrevs are not known to zic.
* Cause the archiver process to adopt new postgresql.conf settings (particularlyTom Lane2010-05-11
| | | | | | | | | | archive_command) as soon as possible, namely just before issuing a new call of archive_command, even when there is a backlog of files to be archived. The original coding would only absorb new settings after clearing the backlog and returning to the outer loop. Per discussion. Back-patch to 8.3. The logic in prior versions is a bit different and it doesn't seem worth taking any risks of breaking it.
* Set per-function GUC settings during validating the function.Itagaki Takahiro2010-05-11
| | | | | | | Now validators work properly even when the settings contain parameters that affect behavior of the function, like search_path. Reported by Erwin Brandstetter.
* Suppress signed-vs-unsigned-char warning.Tom Lane2010-05-09
|
* Work around a subtle portability problem in use of printf %s format.Tom Lane2010-05-08
| | | | | | | | | | | | | Depending on which spec you read, field widths and precisions in %s may be counted either in bytes or characters. Our code was assuming bytes, which is wrong at least for glibc's implementation, and in any case libc might have a different idea of the prevailing encoding than we do. Hence, for portable results we must avoid using anything more complex than just "%s" unless the string to be printed is known to be all-ASCII. This patch fixes the cases I could find, including the psql formatting failure reported by Hernan Gonzalez. In HEAD only, I also added comments to some places where it appears safe to continue using "%.*s".
* ECPG connect routine only checked for NULL to find empty parameters, but ↵Michael Meskes2010-05-07
| | | | user and password can also be "".
* Fix psql to not go into infinite recursion when expanding a variable thatTom Lane2010-05-05
| | | | | | | | | | refers to itself (directly or indirectly). Instead, print a message when recursion is detected, and don't expand the repeated reference. Per bug #5448 from Francis Markham. Back-patch to 8.0. Although the issue exists in 7.4 as well, it seems impractical to fix there because of the lack of any state stack that could be used to track active expansions.
* Fix replay of XLOG_HEAP_NEWPAGE WAL records to pay attention to the forknumTom Lane2010-05-02
| | | | | | | | | | | | | | | field of the WAL record. The previous coding always wrote to the main fork, resulting in data corruption if the page was meant to go into a non-default fork. At present, the only operation that can produce such WAL records is ALTER TABLE/INDEX SET TABLESPACE when executed with archive_mode = on. Data corruption would be observed on standby slaves, and could occur on the master as well if a database crash and recovery occurred after committing the ALTER and before the next checkpoint. Per report from Gordon Shannon. Back-patch to 8.4; the problem doesn't exist in earlier branches because we didn't have a concept of multiple relation forks then.
* Add code to InternalIpcMemoryCreate() to handle the case where shmget()Tom Lane2010-05-01
| | | | | | | | | | | | | | | | returns EINVAL for an existing shared memory segment. Although it's not terribly sensible, that behavior does meet the POSIX spec because EINVAL is the appropriate error code when the existing segment is smaller than the requested size, and the spec explicitly disclaims any particular ordering of error checks. Moreover, it does in fact happen on OS X and probably other BSD-derived kernels. (We were able to talk NetBSD into changing their code, but purging that behavior from the wild completely seems unlikely to happen.) We need to distinguish collision with a pre-existing segment from invalid size request in order to behave sensibly, so it's worth some extra code here to get it right. Per report from Gavin Kistner and subsequent investigation. Back-patch to all supported versions, since any of them could get used with a kernel having the debatable behavior.
* Fix multiple memory leaks in PLy_spi_execute_fetch_result: it would leakTom Lane2010-04-30
| | | | | | | | | | memory if the result had zero rows, and also if there was any sort of error while converting the result tuples into Python data. Reported and partially fixed by Andres Freund. Back-patch to all supported versions. Note: I haven't tested the 7.4 fix. 7.4's configure check for python is so obsolete it doesn't work on my current machines :-(. The logic change is pretty straightforward though.
* On Windows, syslogger runs in two threads. The main thread processes configHeikki Linnakangas2010-04-16
| | | | | | | | reload and rotation signals, and a helper thread reads messages from the pipe and writes them to the log file. However, server code isn't generally thread-safe, so if both try to do e.g palloc()/pfree() at the same time, bad things will happen. To fix that, use a critical section (which is like a mutex) to enforce that only one the threads are active at a time.
* Fix psql's \copy to not insert spaces around dots and commas in the text ofTom Lane2010-04-15
| | | | | | | | the SELECT query in \copy (SELECT ...) commands. This is unnecessary and breaks numeric literals, as seen in bug #5411 from Vitalii Tymchyshyn. This change has already been made in passing in HEAD; backpatch to 8.2 through 8.4 (earlier releases don't have COPY (SELECT ...) at all).
* Fix plpgsql's exec_eval_expr() to ensure it returns a sane type OIDTom Lane2010-04-14
| | | | | | | | | | | | | | | even when the expression is a query that returns no rows. So far as I can tell, the only caller that actually fails when a garbage OID is returned is exec_stmt_case(), which is new in 8.4 --- in all other cases, we might make a useless trip through casting logic, but we won't fail since the isnull flag will be set. Hence, backpatch only to 8.4, just in case there are apps out there that aren't expecting an error to be thrown if the query returns more or less than one column. (Which seems unlikely, since the error would be thrown if the query ever did return a row; but it's possible there's some never-exercised code out there.) Per report from Mario Splivalo.
* Fix a problem introduced by my patch of 2010-01-12 that revised the wayTom Lane2010-04-14
| | | | | | | | | | | | | | | | | | | | | relcache reload works. In the patched code, a relcache entry in process of being rebuilt doesn't get unhooked from the relcache hash table; which means that if a cache flush occurs due to sinval queue overrun while we're rebuilding it, the entry could get blown away by RelationCacheInvalidate, resulting in crash or misbehavior. Fix by ensuring that an entry being rebuilt has positive refcount, so it won't be seen as a target for removal if a cache flush occurs. (This will mean that the entry gets rebuilt twice in such a scenario, but that's okay.) It appears that the problem can only arise within a transaction that has previously reassigned the relfilenode of a pre-existing table, via TRUNCATE or a similar operation. Per bug #5412 from Rusty Conover. Back-patch to 8.2, same as the patch that introduced the problem. I think that the failure can't actually occur in 8.2, since it lacks the rd_newRelfilenodeSubid optimization, but let's make it work like the later branches anyway. Patch by Heikki, slightly editorialized on by me.
* Clean up inconsistent commasMagnus Hagander2010-04-09
|
* Update list of Windows timezones we try to match localized names againstMagnus Hagander2010-04-09
| | | | to one that's up to date with Windows 2003R2.
* Proceed to look for the next timezone when matching a localizedMagnus Hagander2010-04-08
| | | | | | | | | | Windows timezone name where the information in the registry is incomplete, instead of aborting. This fixes cases when the registry information is incomplete for a timezone that is alphabetically before the one that is in use. Per report from Alexander Forschner
* Log the actual timezone name that we fail to look up the values for inMagnus Hagander2010-04-06
| | | | | case the registry data doesn't follow the format we expect, to facilitate debugging.
* Sync perl's ppport.h on all branches back to 7.4 with recent update on HEAD, ↵Andrew Dunstan2010-04-03
| | | | ensuring we can build older branches with modern Perl installations.
* Don't pass an invalid file handle to dup2(). That causes a crash onHeikki Linnakangas2010-04-01
| | | | | | | | | | | Windows, thanks to a feature in CRT called Parameter Validation. Backpatch to 8.2, which is the oldest version supported on Windows. In 8.2 and 8.3 also backpatch the earlier change to use DEVNULL instead of NULL_DEV #define for a /dev/null-like device. NULL_DEV was hard-coded to "/dev/null" regardless of platform, which didn't work on Windows, while DEVNULL works on all platforms. Restarting syslogger didn't work on Windows on versions 8.3 and below because of that.
* Fix "constraint_exclusion = partition" logic so that it will also attemptTom Lane2010-03-30
| | | | | | constraint exclusion on an inheritance set that is the target of an UPDATE or DELETE query. Per gripe from Marc Cousin. Back-patch to 8.4 where the feature was introduced.
* Prevent ALTER USER f RESET ALL from removing the settings that were put thereAlvaro Herrera2010-03-25
| | | | | | | | by a superuser -- "ALTER USER f RESET setting" already disallows removing such a setting. Apply the same treatment to ALTER DATABASE d RESET ALL when run by a database owner that's not superuser.
* Fix thinko in log message for "sameuser" ident map mismatch: the providedTom Lane2010-03-24
| | | | | | | and authenticated usernames were swapped. Reported by Bryan Henderson in bug #5386. Also clean up poorly-maintained header comment for this function.