summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2007-02-10Hm, seems my hack on rowtypes regression test has made its output rowTom Lane
order platform-specific. Add an ORDER BY clause to stop buildfarm failures.
2007-02-09Minor tweak to make rowtypes regression test run faster. We don'tTom Lane
currently have any better strategy for this query than re-running the sub-select over and over; it seems unlikely that doing so 10000 times is a more useful test than doing it a few dozen times.
2007-02-09Call pgstat_drop_database during DROP DATABASE, so that any stats fileTom Lane
entries for the victim database go away sooner rather than later. We already did the equivalent thing at the per-relation level, not sure why it's not been done for whole databases. With this change, pgstat_vacuum_tabstat should usually not find anything to do; though we still need it as a backstop in case DROPDB or TABPURGE messages get lost under load.
2007-02-09Replace useless uses of := by = in makefiles.Peter Eisentraut
2007-02-09Remove blank lines in code.Bruce Momjian
2007-02-09Combine cmin and cmax fields of HeapTupleHeaders into a single field, byTom Lane
keeping private state in each backend that has inserted and deleted the same tuple during its current top-level transaction. This is sufficient since there is no need to be able to determine the cmin/cmax from any other transaction. This gets us back down to 23-byte headers, removing a penalty paid in 8.0 to support subtransactions. Patch by Heikki Linnakangas, with minor revisions by moi, following a design hashed out awhile back on the pghackers list.
2007-02-09Remove blank line from C code.Bruce Momjian
2007-02-08Add missing #define for mingw, per Magnus.Tom Lane
2007-02-08Fix an ancient logic error in plpgsql's exec_stmt_block: it thought it couldTom Lane
get away with not (re)initializing a local variable if the variable is marked "isconst" and not "isnull". Unfortunately it makes this decision after having already freed the old value, meaning that something like for i in 1..10 loop declare c constant text := 'hi there'; leads to subsequent accesses to freed memory, and hence probably crashes. (In particular, this is why Asif Ali Rehman's bug leads to crash and not just an unexpectedly-NULL value for SQLERRM: SQLERRM is marked CONSTANT and so triggers this error.) The whole thing seems wrong on its face anyway: CONSTANT means that you can't change the variable inside the block, not that the initializer expression is guaranteed not to change value across successive block entries. Hence, remove the "optimization" instead of trying to fix it.
2007-02-08Rearrange use of plpgsql_add_initdatums() so that only the parsing of aTom Lane
DECLARE section needs to know about it. Formerly, everyplace besides DECLARE that created variables needed to do "plpgsql_add_initdatums(NULL)" to prevent those variables from being sucked up as part of a subsequent DECLARE block. This is obviously error-prone, and in fact the SQLSTATE/SQLERRM patch had failed to do it for those two variables, leading to the bug recently exhibited by Asif Ali Rehman: a DECLARE within an exception handler tried to reinitialize SQLERRM. Although the SQLSTATE/SQLERRM patch isn't in any pre-8.1 branches, and so I can't point to a demonstrable failure there, it seems wise to back-patch this into the older branches anyway, just to keep the logic similar to HEAD.
2007-02-08Fix bug when localized to_char() day or month names were incorectlyBruce Momjian
trnasformed to lower or upper string. Pavel Stehule
2007-02-08This patch fixes shared_preload_libraries on Windows hosts. It forcesBruce Momjian
ach backend to re-load all shared_preload_libraries. Korry Douglas
2007-02-08Win32 regression test fixes:Bruce Momjian
For win32 in general, this makes it possible to run the regression tests as an admin user by using the same restricted token method that's used by pg_ctl and initdb. For vc++, it adds building of pg_regress.exe, adds a resultmap, and fixes how it runs the install. Magnus Hagander
2007-02-08Fix reference-after-free in the new btree page split code, as reported byAlvaro Herrera
the buildfarm via Stefan Kaltenbrunner. Patch from Heikki Linnakangas.
2007-02-08Normalize fgets() calls to use sizeof() for calculating the buffer sizePeter Eisentraut
where possible, and fix some sites that apparently thought that fgets() will overwrite the buffer by one byte. Also add some strlcpy() to eliminate some weird memory handling.
2007-02-08Reduce WAL activity for page splits:Bruce Momjian
> Currently, an index split writes all the data on the split page to > WAL. That's a lot of WAL traffic. The tuples that are copied to the > right page need to be WAL logged, but the tuples that stay on the > original page don't. Heikki Linnakangas
2007-02-08Check if the role exists before doing more complex ident and KerberosBruce Momjian
authentication checks in the backend. Gavin Sherry
2007-02-08Fix bug in our code when using to_timestamp() or to_date() without "TM".Bruce Momjian
Assume "TM" when input fields are variable-length, like month or day names. This matches Oracle behavior.
2007-02-07Add a function pg_stat_clear_snapshot() that discards any statistics snapshotTom Lane
already collected in the current transaction; this allows plpgsql functions to watch for stats updates even though they are confined to a single transaction. Use this instead of the previous kluge involving pg_stat_file() to wait for the stats collector to update in the stats regression test. Internally, decouple storage of stats snapshots from transaction boundaries; they'll now stick around until someone calls pgstat_clear_snapshot --- which xact.c still does at transaction end, to maintain the previous behavior. This makes the logic a lot cleaner, at the price of a couple dozen cycles per transaction exit.
2007-02-07Modify the stats regression test to delay until the stats file actuallyTom Lane
changes (with an upper limit of 30 seconds), and record the delay time in the postmaster log. This should give us some info about what's happening with the intermittent stats failures in buildfarm. After an idea of Andrew Dunstan's.
2007-02-07Remove the xlog-centric "database system is ready" message and replace it withTom Lane
"database system is ready to accept connections", which is issued by the postmaster when it really is ready to accept connections. Per proposal from Markus Schiltknecht and subsequent discussion.
2007-02-07The VC++ build needs to compile the new strlcat.c file. Patch from MagnusAlvaro Herrera
Hagander.
2007-02-07Replace some strncpy() by strlcpy().Peter Eisentraut
2007-02-07Add strlcat() from OpenBSD, to be used for replacing strncat and otherPeter Eisentraut
strange coding practices.
2007-02-06Fix an error in the original coding of holdable cursors: PersistHoldablePortalTom Lane
thought that it didn't have to reposition the underlying tuplestore if the portal is atEnd. But this is not so, because tuplestores have separate read and write cursors ... and the read cursor hasn't moved from the start. This mistake explains bug #2970 from William Zhang. Note: the coding here is pretty inefficient, but given that no one has noticed this bug until now, I'd say hardly anyone uses the case where the cursor has been advanced before being persisted. So maybe it's not worth worrying about.
2007-02-06Remove typmod checking from the recent security-related patches. It turnsTom Lane
out that ExecEvalVar and friends don't necessarily have access to a tuple descriptor with correct typmod: it definitely can contain -1, and possibly might contain other values that are different from the Var's value. Arguably this should be cleaned up someday, but it's not a simple change, and in any case typmod discrepancies don't pose a security hazard. Per reports from numerous people :-( I'm not entirely sure whether the failure can occur in 8.0 --- the simple test cases reported so far don't trigger it there. But back-patch the change all the way anyway.
2007-02-06Fix typo in comment.Tom Lane
2007-02-06Remove some dead code, per Heikki.Tom Lane
2007-02-06Move NAMEDATALEN definition from postgres_ext.h to pg_config_manual.h. ItPeter Eisentraut
used to be part of libpq's exported interface many releases ago, but now it's no longer necessary to make it accessible to clients.
2007-02-06Fix a performance regression in 8.2: optimization of MIN/MAX into indexscansTom Lane
had stopped working for tables buried inside views or sub-selects. This is because I had gotten rid of the simplify_jointree() preprocessing step, and optimize_minmax_aggregates() wasn't smart enough to deal with a non-canonical FromExpr. Per gripe from Bill Howe.
2007-02-06Come to think of it, we should check that commutator pairs have the sameTom Lane
merges/hashes property settings.
2007-02-06Add support for cross-type hashing in hashed subplans (hashed IN/NOT IN casesTom Lane
that aren't turned into true joins). Since this is the last missing bit of infrastructure, go ahead and fill out the hash integer_ops and float_ops opfamilies with cross-type operators. The operator family project is now DONE ... er, except for documentation ...
2007-02-05Pass modern COPY syntax to backend, since copy (query) does not accept old ↵Andrew Dunstan
syntax. Per complaint from Michael Fuhr.
2007-02-05Rename MaxTupleSize to MaxHeapTupleSize to clarify that it's not meant toTom Lane
describe the maximum size of index tuples (which is typically AM-dependent anyway); and consequently remove the bogus deduction for "special space" that was built into it. Adjust TOAST_TUPLE_THRESHOLD and TOAST_MAX_CHUNK_SIZE to avoid wasting two bytes per toast chunk, and to ensure that the calculation correctly tracks any future changes in page header size. The computation had been inaccurate in a way that didn't cause any harm except space wastage, but future changes could have broken it more drastically. Fix the calculation of BTMaxItemSize, which was formerly computed as 1 byte more than it could safely be. This didn't cause any harm in practice because it's only compared against maxalign'd lengths, but future changes in the size of page headers or btree special space could have exposed the problem. initdb forced because of change in TOAST_MAX_CHUNK_SIZE, which alters the storage of toast tables.
2007-02-04Don't MAXALIGN in the checks to decide whether a tuple is over TOAST'sTom Lane
threshold for tuple length. On 4-byte-MAXALIGN machines, the toast code creates tuples that have t_len exactly TOAST_TUPLE_THRESHOLD ... but this number is not itself maxaligned, so if heap_insert maxaligns t_len before comparing to TOAST_TUPLE_THRESHOLD, it'll uselessly recurse back to tuptoaster.c, wasting cycles. (It turns out that this does not happen on 8-byte-MAXALIGN machines, because for them the outer MAXALIGN in the TOAST_MAX_CHUNK_SIZE macro reduces TOAST_MAX_CHUNK_SIZE so that toast tuples will be less than TOAST_TUPLE_THRESHOLD in size. That MAXALIGN is really incorrect, but we can't remove it now, see below.) There isn't any particular value in maxaligning before comparing to the thresholds, so just don't do that, which saves a small number of cycles in itself. These numbers should be rejiggered to minimize wasted space on toast-relation pages, but we can't do that in the back branches because changing TOAST_MAX_CHUNK_SIZE would force an initdb (by changing the contents of toast tables). We can move the toast decision thresholds a bit, though, which is what this patch effectively does. Thanks to Pavan Deolasee for discovering the unintended recursion. Back-patch into 8.2, but not further, pending more testing. (HEAD is about to get a further patch modifying the thresholds, so it won't help much for testing this form of the patch.)
2007-02-04Change vacuum lazy "compacting" warning message to:Bruce Momjian
errhint("Consider using VACUUM FULL on this relation or increasing the configuration parameter \"max_fsm_pages\".")));
2007-02-03Update SQL conformance information about XML features.Peter Eisentraut
2007-02-03Implement XMLSERIALIZE for real. Analogously, make the xml to text castPeter Eisentraut
observe the xmloption. Reorganize the representation of the XML option in the parse tree and the API to make it easier to manage and understand. Add regression tests for parsing back XML expressions.
2007-02-02This patch changes the installscript for vcbuild to actually parse theNeil Conway
generated solution files for what to install, instead of blindly copying everything as it previously did. With the previous quick-n-dirty version, it would copy old DLLs if you reconfigured in a way that didn't include subprojects like a PL for example. Magnus Hagander.
2007-02-02Applied Magnus Hagander's patch to take away some compiler warnings.Michael Meskes
2007-02-02Cleaned up va_list handling. Hopefully this now works on all archs.Michael Meskes
2007-02-02Repair failure to check that a table is still compatible with a previouslyTom Lane
made query plan. Use of ALTER COLUMN TYPE creates a hazard for cached query plans: they could contain Vars that claim a column has a different type than it now has. Fix this by checking during plan startup that Vars at relation scan level match the current relation tuple descriptor. Since at that point we already have at least AccessShareLock, we can be sure the column type will not change underneath us later in the query. However, since a backend's locks do not conflict against itself, there is still a hole for an attacker to exploit: he could try to execute ALTER COLUMN TYPE while a query is in progress in the current backend. Seal that hole by rejecting ALTER TABLE whenever the target relation is already open in the current backend. This is a significant security hole: not only can one trivially crash the backend, but with appropriate misuse of pass-by-reference datatypes it is possible to read out arbitrary locations in the server process's memory, which could allow retrieving database content the user should not be able to see. Our thanks to Jeff Trout for the initial report. Security: CVE-2007-0556
2007-02-02Repair insufficiently careful type checking for SQL-language functions:Tom Lane
we should check that the function code returns the claimed result datatype every time we parse the function for execution. Formerly, for simple scalar result types we assumed the creation-time check was sufficient, but this fails if the function selects from a table that's been redefined since then, and even more obviously fails if check_function_bodies had been OFF. This is a significant security hole: not only can one trivially crash the backend, but with appropriate misuse of pass-by-reference datatypes it is possible to read out arbitrary locations in the server process's memory, which could allow retrieving database content the user should not be able to see. Our thanks to Jeff Trout for the initial report. Security: CVE-2007-0555
2007-02-01Update some of the "expected" regression test results for Bruce'sNeil Conway
recent may/might cleanup, in the hopes that this will unbreak the buildfarm. Per report from Stefan Kaltenbrunner.
2007-02-01Fix plpgsql so that when a local variable has no initial-value expression,Tom Lane
an error will be thrown correctly if the variable is of a NOT NULL domain. Report and almost-correct fix from Sergiy Vyshnevetskiy (bug #2948).
2007-02-01Wording cleanup for error messages. Also change can't -> cannot.Bruce Momjian
Standard English uses "may", "can", and "might" in different ways: may - permission, "You may borrow my rake." can - ability, "I can lift that log." might - possibility, "It might rain today." Unfortunately, in conversational English, their use is often mixed, as in, "You may use this variable to do X", when in fact, "can" is a better choice. Similarly, "It may crash" is better stated, "It might crash".
2007-02-01Fix a few typos in comments in GiN.Neil Conway
2007-01-31Update comment.Bruce Momjian
2007-01-31Revert error message change for may/can/might --- needs discussion.Bruce Momjian
2007-01-31Update documentation on may/can/might:Bruce Momjian
Standard English uses "may", "can", and "might" in different ways: may - permission, "You may borrow my rake." can - ability, "I can lift that log." might - possibility, "It might rain today." Unfortunately, in conversational English, their use is often mixed, as in, "You may use this variable to do X", when in fact, "can" is a better choice. Similarly, "It may crash" is better stated, "It might crash". Also update two error messages mentioned in the documenation to match.