summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2006-11-01Fix "failed to re-find parent key" btree VACUUM failure by tweakingTom Lane
_bt_pagedel to recover from the failure: just search the whole parent level if searching to the right fails. This does nothing for the underlying problem that index keys became out-of-order in the grandparent level. However, we believe that there is no other consequence worse than slightly inefficient searching, so this narrow patch seems like the safest solution for the back branches.
2006-10-20Back-patch second version of AIX getaddrinfo fix.Tom Lane
2006-10-19Work around reported problem that AIX's getaddrinfo() doesn't seem to zeroTom Lane
sin_port in the returned IP address struct when servname is NULL. This has been observed to cause failure to bind the stats collection socket, and could perhaps cause other issues too. Per reports from Brad Nicholson and Chris Browne.
2006-10-13Fix infinite sleep and failes of send in Win32.Teodor Sigaev
1) pgwin32_waitforsinglesocket(): WaitForMultipleObjectsEx now called with finite timeout (100ms) in case of FP_WRITE and UDP socket. If timeout occurs then pgwin32_waitforsinglesocket() tries to write empty packet goes to WaitForMultipleObjectsEx again. 2) pgwin32_send(): add loop around WSASend and pgwin32_waitforsinglesocket(). The reason is: for overlapped socket, 'ok' result from pgwin32_waitforsinglesocket() isn't guarantee that socket is still free, it can become busy again and following WSASend call will fail with WSAEWOULDBLOCK error. See http://archives.postgresql.org/pgsql-hackers/2006-10/msg00561.php
2006-10-12Fix mishandling of after-trigger state when a SQL function returns multipleTom Lane
rows --- if the surrounding query queued any trigger events between the rows, the events would be fired at the wrong time, leading to bizarre behavior. Per report from Merlin Moncure. This is a simple patch that should solve the problem fully in the back branches, but in HEAD we also need to consider the possibility of queries with RETURNING clauses. Will look into a fix for that separately.
2006-10-11Repair incorrect check for coercion of unknown literal to ANYARRAY, a bugTom Lane
I introduced in 7.4.1 :-(. It's correct to allow unknown to be coerced to ANY or ANYELEMENT, since it's a real-enough data type, but it most certainly isn't an array datatype. This can cause a backend crash but AFAICT is not exploitable as a security hole. Per report from Michael Fuhr. Note: as fixed in HEAD, this changes a constant in the pg_stats view, resulting in a change in the expected regression outputs. The back-branch patches have been hacked to avoid that, so that pre-existing installations won't start failing their regression tests.
2006-10-11CREATE TABLE ... LIKE ... should mark the columns it creates withTom Lane
attislocal = true, since they are not really inherited but merely copied from the original table. I'm not sure if there are any cases where it makes a real difference given the existing uses of the flag, but wrong is wrong. This was fixed in passing in HEAD by the LIKE INCLUDING CONSTRAINTS patch, but never back-patched.
2006-10-10Fix psql \d commands to behave properly when a pattern using regex | is given.Tom Lane
Formerly they'd emit '^foo|bar$' which is wrong because the anchors are parsed as part of the alternatives; must emit '^(foo|bar)$' to get expected behavior. Same as bug found previously in similar_escape(). Already fixed in HEAD, this is just back-porting the part of that patch that was a bug fix.
2006-10-09Stamp releases 7.3.16, 7.4.14, 8.0.9, and 8.1.5.Bruce Momjian
2006-10-09Fix back-branch pg_regress scripts to try the "canonical" expected file if weTom Lane
tried a variant file from resultmap and it didn't match. This is already done in HEAD's C-code version, and is needed because OpenBSD has recently migrated to a more standard handling of float underflow --- see buildfarm results from emu.
2006-10-07Fix ancient oversight in psql's \d pattern processing code: when seeing twoTom Lane
quote chars inside quote marks, should emit one quote *and stay in inquotes mode*. No doubt the lack of reports of this have something to do with the poor documentation of the feature ...
2006-10-07Fix string_to_array() to correctly handle the case where there areTom Lane
overlapping possible matches for the separator string, such as string_to_array('123xx456xxx789', 'xx'). Also, revise the logic of replace(), split_part(), and string_to_array() to avoid O(N^2) work from redundant searches and conversions to pg_wchar format when there are N matches to the separator string. Backpatched the full patch as far as 8.0. 7.4 also has the bug, but the code has diverged a lot, so I just went for a quick-and-dirty fix of the bug itself in that branch.
2006-10-06Fix SysCacheGetAttr() to handle the case where the specified syscache has notTom Lane
been initialized yet. This can happen because there are code paths that call SysCacheGetAttr() on a tuple originally fetched from a different syscache (hopefully on the same catalog) than the one specified in the call. It doesn't seem useful or robust to try to prevent that from happening, so just improve the function to cope instead. Per bug#2678 from Jeff Trout. The specific example shown by Jeff is new in 8.1, but to be on the safe side I'm backpatching 8.0 as well. We could patch 7.x similarly but I think that's probably overkill, given the lack of evidence of old bugs of this ilk.
2006-08-31Clean up rather sloppy fix in HEAD for the ancient bug that CREATE CONVERSIONTom Lane
didn't create a dependency from the new conversion to its schema. Back-patch to all supported releases.
2006-08-29Fix mistypingTeodor Sigaev
2006-08-18Backported buffer overrun fix from HEADMichael Meskes
2006-08-18Applied the connect patch from HEADMichael Meskes
2006-07-29prevent multiplexing Windows kernel event objects we listen for across ↵Andrew Dunstan
various sockets - should fix the occasional stats test regression failures we see.
2006-07-16Ensure that we retry rather than erroring out when send() or recv() returnTom Lane
EINTR; the stats code was failing to do this and so were a couple of places in the postmaster. The stats code assumed that recv() could not return EINTR if a preceding select() showed the socket to be read-ready, but this is demonstrably false with our Windows implementation of recv(), and it may not be the case on all Unix variants either. I think this explains the intermittent stats regression test failures we've been seeing, as well as reports of stats collector instability under high load on Windows. Backpatch as far as 8.0.
2006-07-14Add dependency to fix parallel-make race condition. Alexander DupuyTom Lane
2006-07-10Fix ALTER TABLE to check pre-existing NOT NULL constraints when rewritingTom Lane
a table. Otherwise a USING clause that yields NULL can leave the table violating its constraint (possibly there are other cases too). Per report from Alexander Pravking.
2006-07-05Fixed remaining Coverity bugs.Michael Meskes
2006-06-26Added missing braces to prevent a segfault after usage of an undeclared cursor.Michael Meskes
2006-06-26Added some more coverity report patches send in by Joachim Wieland ↵Michael Meskes
<joe@mcknight.de>.
2006-06-25Moved some free() calls that coverity correctly complains about.Michael Meskes
2006-06-25Our version of getopt_long does not set optarg upon detecting an error, asAlvaro Herrera
opposed to what other versions apparently do, so it's not safe to print an error message. Besides, getopt_long itself already did, so it's redundant anyway.
2006-06-21Added some more coverity report patches send in by Martijn van Oosterhout ↵Michael Meskes
<kleptog@svana.org>.
2006-06-21Added fixes from the coverity report send in by Joachim Wieland ↵Michael Meskes
<joe@mcknight.de> Added missing error handling in a few functions in ecpglib.
2006-06-19Back-port shell script syntax fix needed for some BSD machines.Tom Lane
Per buildfarm results from spoonbill.
2006-06-19Do not use already free'ed errmsg, bug found by Joachim WielandMichael Meskes
<joachim.wieland@credativ.de>
2006-06-18Increase timeout in statement_timeout test from 1 second to 2 seconds.Tom Lane
We have once or twice seen failures suggesting that control didn't get to the exception block before the timeout elapsed, which is unlikely but not impossible in a parallel regression test (with a dozen other backends competing for cycles). This change doesn't completely prevent the problem of course, but it should reduce the probability enough that we don't see it anymore. Per buildfarm results.
2006-06-11Fix Assert failure when a fastpath function call is attempted inside anTom Lane
already-aborted transaction block. GetSnapshotData throws an Assert if not in a valid transaction; hence we mustn't attempt to set a snapshot for the function until after checking for aborted transaction. This is harmless AFAICT if Asserts aren't enabled (GetSnapshotData will compute a bogus snapshot, but it doesn't matter since HandleFunctionRequest will throw an error shortly anywy). Hence, not a major bug. Along the way, add some ability to log fastpath calls when statement logging is turned on. This could probably stand to be improved further, but not logging anything is clearly undesirable. Backpatched as far as 8.0; bug doesn't exist before that.
2006-06-06Fixed two memory leaks in ecpglib.Michael Meskes
2006-06-03Fix copy-and-pasteo in Russian translation: message complaining aboutTom Lane
HAVE_INT64_TIMESTAMP was mentioning PG_CONTROL_VERSION instead. Victor Snezhko
2006-06-01Back-port recent ppport.h fix to 8.0 branch.Tom Lane
2006-05-30Remove pqsignalinquire(), which is unused and has portability issues.Tom Lane
2006-05-23Klugy fix for bug #2447: we can't expand a whole-row reference to NEWTom Lane
in a rule WHERE expression while inserting it into the original query, because the 8.0 ResolveNew API is wrongly designed. This is fixed in 8.1 but I'm disinclined to risk back-porting the changes. Instead, just stop the coredump and instead issue the same 'cannot handle whole-row reference' message that 7.4 and before generated in this situation.
2006-05-21Stamp releases 7.3.15, 7.4.13, and 8.0.8.Bruce Momjian
2006-05-21Modify libpq's string-escaping routines to be aware of encoding considerationsTom Lane
and standard_conforming_strings. The encoding changes are needed for proper escaping in multibyte encodings, as per the SQL-injection vulnerabilities noted in CVE-2006-2313 and CVE-2006-2314. Concurrent fixes are being applied to the server to ensure that it rejects queries that may have been corrupted by attempted SQL injection, but this merely guarantees that unpatched clients will fail rather than allow injection. An actual fix requires changing the client-side code. While at it we have also fixed these routines to understand about standard_conforming_strings, so that the upcoming changeover to SQL-spec string syntax can be somewhat transparent to client code. Since the existing API of PQescapeString and PQescapeBytea provides no way to inform them which settings are in use, these functions are now deprecated in favor of new functions PQescapeStringConn and PQescapeByteaConn. The new functions take the PGconn to which the string will be sent as an additional parameter, and look inside the connection structure to determine what to do. So as to provide some functionality for clients using the old functions, libpq stores the latest encoding and standard_conforming_strings values received from the backend in static variables, and the old functions consult these variables. This will work reliably in clients using only one Postgres connection at a time, or even multiple connections if they all use the same encoding and string syntax settings; which should cover many practical scenarios. Clients that use homebrew escaping methods, such as PHP's addslashes() function or even hardwired regexp substitution, will require extra effort to fix :-(. It is strongly recommended that such code be replaced by use of PQescapeStringConn/PQescapeByteaConn if at all feasible.
2006-05-21Add a new GUC parameter backslash_quote, which determines whether the SQLTom Lane
parser will allow "\'" to be used to represent a literal quote mark. The "\'" representation has been deprecated for some time in favor of the SQL-standard representation "''" (two single quote marks), but it has been used often enough that just disallowing it immediately won't do. Hence backslash_quote allows the settings "on", "off", and "safe_encoding", the last meaning to allow "\'" only if client_encoding is a valid server encoding. That is now the default, and the reason is that in encodings such as SJIS that allow 0x5c (ASCII backslash) to be the last byte of a multibyte character, accepting "\'" allows SQL-injection attacks as per CVE-2006-2314 (further details will be published after release). The "on" setting is available for backward compatibility, but it must not be used with clients that are exposed to untrusted input. Thanks to Akio Ishida and Yasuo Ohgaki for identifying this security issue.
2006-05-21Change the backend to reject strings containing invalidly-encoded multibyteTom Lane
characters in all cases. Formerly we mostly just threw warnings for invalid input, and failed to detect it at all if no encoding conversion was required. The tighter check is needed to defend against SQL-injection attacks as per CVE-2006-2313 (further details will be published after release). Embedded zero (null) bytes will be rejected as well. The checks are applied during input to the backend (receipt from client or COPY IN), so it no longer seems necessary to check in textin() and related routines; any string arriving at those functions will already have been validated. Conversion failure reporting (for characters with no equivalent in the destination encoding) has been cleaned up and made consistent while at it. Also, fix a few longstanding errors in little-used encoding conversion routines: win1251_to_iso, win866_to_iso, euc_tw_to_big5, euc_tw_to_mic, mic_to_euc_tw were all broken to varying extents. Patches by Tatsuo Ishii and Tom Lane. Thanks to Akio Ishida and Yasuo Ohgaki for identifying the security issues.
2006-05-21Change \' to '', for SQL standards compliance. Backpatch to 7.3, 7.4,Bruce Momjian
and 8.0. Later releases already patched.
2006-05-19Fix nasty bug in nodeIndexscan.c's detection of duplicate tuples duringTom Lane
a multiple (OR'ed) indexscan. It was checking for duplicate tuple->t_data->t_ctid, when what it should be checking is tuple->t_self. The trouble situation occurs when a live tuple has t_ctid not pointing to itself, which can happen if an attempted UPDATE was rolled back. After a VACUUM, an unrelated tuple could be installed where the failed update tuple was, leading to one live tuple's t_ctid pointing to an unrelated tuple. If one of these tuples is fetched by an earlier OR'ed indexscan and the other by a later indexscan, nodeIndexscan.c would incorrectly ignore the second tuple. The bug exists in all 7.4.* and 8.0.* versions, but not in earlier or later branches because this code was only used in those releases. Per trouble report from Rafael Martinez Guerrero.
2006-05-12Fix the sense of the test on DH_check()'s return value. This was preventingTom Lane
custom-generated DH parameters from actually being used by the server. Found by Michael Fuhr.
2006-05-11Remove unnecessary .seg/.section directives, per Alan Stange.Tom Lane
2006-05-08Build server libpgport with all non-FRONTEND object files. This is toBruce Momjian
fix a Win32 bug where pipe.c included a file that used FRONTEND, but it wasn't on the server-build list.
2006-04-26Fix SELECT INTO and CREATE TABLE AS to create tables in the defaultBruce Momjian
tablespace, not the base directory. Kris Jurka
2006-04-24Fixed memory leak bugs found by Martijn Oosterhout.Michael Meskes
2006-04-19Fix ancient memory leak in PQprintTuples(); our code no longer uses thisTom Lane
routine, but perhaps some applications do. Found by Martijn van Oosterhout using Coverity.
2006-04-13Fix similar_escape() so that SIMILAR TO works properly for patterns involvingTom Lane
alternatives ("|" symbol). The original coding allowed the added ^ and $ constraints to be absorbed into the first and last alternatives, producing a pattern that would match more than it should. Per report from Eric Noriega. I also changed the pattern to add an ARE director ("***:"), ensuring that SIMILAR TO patterns do not change behavior if regex_flavor is changed. This is necessary to make the non-capturing parentheses work, and seems like a good idea on general principles. Back-patched as far as 7.4. 7.3 also has the bug, but a fix seems impractical because that version's regex engine doesn't have non-capturing parens.