aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Fix get_name_for_var_field() to deal with RECORD Params.Tom Lane2011-09-07
| | | | | | | | | | | | | | | | With 9.1's use of Params to pass down values from NestLoop join nodes to their inner plans, it is possible for a Param to have type RECORD, in which case the set of fields comprising the value isn't determinable by inspection of the Param alone. However, just as with a Var of type RECORD, we can find out what we need to know if we can locate the expression that the Param represents. We already knew how to do this in get_parameter(), but I'd overlooked the need to be able to cope in get_name_for_var_field(), which led to EXPLAIN failing with "record type has not been registered". To fix, refactor the search code in get_parameter() so it can be used by both functions. Per report from Marti Raudsepp.
* Have pgrminclude skip files that use CppAsString2 because CppAsString2Bruce Momjian2011-09-07
| | | | will expaned undefined identifiers.
* Fix bug introduced by pgrminclude where the tablespace version name wasBruce Momjian2011-09-07
| | | | | | not expanded. Bump catalog version number to force initdb for all tablespaces.
* Fix to_date() and to_timestamp() to handle year masks of length < 4 soBruce Momjian2011-09-07
| | | | | they wrap toward year 2020, rather than the inconsistent behavior we had before.
* Partially revoke attempt to improve performance with many savepoints.Simon Riggs2011-09-07
| | | | | Maintain difference between subtransaction release and commit introduced by earlier patch.
* Emit cascaded standby message on shutdown only when appropriate.Simon Riggs2011-09-07
| | | | | | | Adds additional test for active walsenders and closes a race condition for when we failover when a new walsender was connecting. Reported and fixed bu Fujii Masao. Review by Heikki Linnakangas
* Improve comment about handling of temp tables in shared-inval code.Tom Lane2011-09-06
|
* Correct ancient logic mistake in assertionPeter Eisentraut2011-09-06
| | | | Found by gcc -Wlogical-op
* Avoid possibly accessing off the end of memory in SJIS2004 conversion.Tom Lane2011-09-06
| | | | | | | | | | | The code in shift_jis_20042euc_jis_2004() would fetch two bytes even when only one remained in the string. Since conversion functions aren't supposed to assume null-terminated input, this poses a small risk of fetching past the end of memory and incurring SIGSEGV. No such crash has been identified in the field, but we've certainly seen the equivalent happen in other code paths, so patch this one all the way back. Report and patch by Noah Misch.
* Avoid possibly accessing off the end of memory in examine_attribute().Tom Lane2011-09-06
| | | | | | | | | | | | | | Since the last couple of columns of pg_type are often NULL, sizeof(FormData_pg_type) can be an overestimate of the actual size of the tuple data part. Therefore memcpy'ing that much out of the catalog cache, as analyze.c was doing, poses a small risk of copying past the end of memory and incurring SIGSEGV. No such crash has been identified in the field, but we've certainly seen the equivalent happen in other code paths, so patch this one all the way back. Per valgrind testing by Noah Misch, though this is not his proposed patch. I chose to use SearchSysCacheCopy1 rather than inventing special-purpose infrastructure for copying only the minimal part of a pg_type tuple.
* Add C comment about why we send cache invalidation messages forBruce Momjian2011-09-05
| | | | session-local objects.
* Adjust translator comment format to xgettext expectationsAlvaro Herrera2011-09-05
|
* Mark some untranslatable messages with errmsg_internalAlvaro Herrera2011-09-05
|
* Improve "invalid byte sequence for encoding" messagePeter Eisentraut2011-09-05
| | | | | | | | | | | | | | | It used to say ERROR: invalid byte sequence for encoding "UTF8": 0xdb24 Change this to ERROR: invalid byte sequence for encoding "UTF8": 0xdb 0x24 to make it clear that this is a byte sequence and not a code point. Also fix the adjacent "character has no equivalent" message that has the same issue.
* Update time zone data files to tzdata release 2011i.Tom Lane2011-09-05
| | | | DST law changes in Canada, Egypt, Russia, Samoa, South Sudan.
* Guard against using plperl's Makefile without specifying --with-perl.Tom Lane2011-09-04
| | | | | | | | | | | | The $(PERL) macro will be set by configure if it finds perl at all, but $(perl_privlibexp) isn't configured unless you said --with-perl. This results in confusing error messages if someone cd's into src/pl/plperl and tries to build there despite the configure omission, as reported by Tomas Vondra in bug #6198. Add simple checks to provide a more useful report, while not disabling other use of the makefile such as "make clean". Back-patch to 9.0, which is as far as the patch applies easily.
* Change get_variable_numdistinct's API to flag default estimates explicitly.Tom Lane2011-09-04
| | | | | | Formerly, callers tested for DEFAULT_NUM_DISTINCT, which had the problem that a perfectly solid estimate might be mistaken for a content-free default.
* Dig down into sub-selects to look for column statistics.Tom Lane2011-09-04
| | | | | | | | | | | | | | | | If a sub-select's output column is a simple Var, recursively look for statistics applying to that Var, and use them if available. The need for this was foreseen ages ago, but we didn't have enough infrastructure to do it with reasonable speed until just now. We punt and stick with default estimates if the subquery uses set operations, GROUP BY, or DISTINCT, since those operations would change the underlying column statistics (particularly, the relative frequencies of different values) beyond recognition. This means that the types of sub-selects for which this improvement applies are fairly limited, since most subqueries satisfying those restrictions would have gotten flattened into the parent query anyway. But it does help for some cases, such as subqueries with ORDER BY or LIMIT.
* Can't print PlannerGlobal's subroots list in outfuncs.Tom Lane2011-09-04
| | | | | | Since the subroots will surely link back to the same glob struct, this necessarily leads to infinite recursion. Doh. Found while trying to debug some other code.
* Clean up the #include mess a little.Tom Lane2011-09-04
| | | | | | | | | | | | | | | | | walsender.h should depend on xlog.h, not vice versa. (Actually, the inclusion was circular until a couple hours ago, which was even sillier; but Bruce broke it in the expedient rather than logically correct direction.) Because of that poor decision, plus blind application of pgrminclude, we had a situation where half the system was depending on xlog.h to include such unrelated stuff as array.h and guc.h. Clean up the header inclusion, and manually revert a lot of what pgrminclude had done so things build again. This episode reinforces my feeling that pgrminclude should not be run without adult supervision. Inclusion changes in header files in particular need to be reviewed with great care. More generally, it'd be good if we had a clearer notion of module layering to dictate which headers can sanely include which others ... but that's a big task for another day.
* Remove unnecessary and circular #include.Tom Lane2011-09-03
| | | | | | storage/proc.h should not include replication/syncrep.h, especially not when the latter includes storage/proc.h; but in any case this was a pretty poor thing from a modular layering standpoint.
* walsender.h doesn't need xlog.h, per Tom.Bruce Momjian2011-09-03
|
* Move AllowCascadeReplication() define from xlog.h to replication includeBruce Momjian2011-09-03
| | | | | | file. Per suggestion from Alvaro.
* Remove find_lt sgml tool, as it is not needed.Bruce Momjian2011-09-03
| | | | Per suggestion from Peter.
* Fix typo in pg_srand48 (srand48 in older branches).Tom Lane2011-09-03
| | | | | | | | | | | | ">" should be ">>". This typo results in failure to use all of the bits of the provided seed. This might rise to the level of a security bug if we were relying on srand48 for any security-critical purposes, but we are not --- in fact, it's not used at all unless the platform lacks srandom(), which is improbable. Even on such a platform the exposure seems minimal. Reported privately by Andres Freund.
* Rearrange planner to save the whole PlannerInfo (subroot) for a subquery.Tom Lane2011-09-03
| | | | | | | | | | | | | | | | | | | | | | | | | Formerly, set_subquery_pathlist and other creators of plans for subqueries saved only the rangetable and rowMarks lists from the lower-level PlannerInfo. But there's no reason not to remember the whole PlannerInfo, and indeed this turns out to simplify matters in a number of places. The immediate reason for doing this was so that the subroot will still be accessible when we're trying to extract column statistics out of an already-planned subquery. But now that I've done it, it seems like a good code-beautification effort in its own right. I also chose to get rid of the transient subrtable and subrowmark fields in SubqueryScan nodes, in favor of having setrefs.c look up the subquery's RelOptInfo. That required changing all the APIs in setrefs.c to pass PlannerInfo not PlannerGlobal, which was a large but quite mechanical transformation. One side-effect not foreseen at the beginning is that this finally broke inheritance_planner's assumption that replanning the same subquery RTE N times would necessarily give interchangeable results each time. That assumption was always pretty risky, but now we really have to make a separate RTE for each instance so that there's a place to carry the separate subroots.
* Add archive_command examplePeter Eisentraut2011-09-03
|
* Whitespace adjustment for consistency in the filePeter Eisentraut2011-09-03
|
* Teach ANALYZE to clear pg_class.relhassubclass when appropriate.Tom Lane2011-09-02
| | | | | | | | | | | | | In the past, relhassubclass always remained true if a relation had ever had child relations, even if the last subclass was long gone. While this had only marginal performance implications in most cases, it was annoying, and I'm now considering some planner changes that would raise the cost of a false positive. It was previously impractical to fix this because of race condition concerns. However, given the recent change that made tablecmds.c take ShareExclusiveLock on relations that are gaining a child (commit fbcf4b92aa64d4577bcf25925b055316b978744a), we can now allow ANALYZE to clear the flag when it's no longer relevant. There is no additional locking cost to do so, since ANALYZE takes ShareExclusiveLock anyway.
* Fix brace indentation of commit 63d06ef59156719efd0208c62e764a69611b3f12 to ↵Michael Meskes2011-09-02
| | | | fit PostgreSQL style.
* Improve method of avoiding fcinfo compile errors.Bruce Momjian2011-09-01
| | | | Fix pgrminclude C comment marker.
* Remove spurious comma. Spotted by Tom.Heikki Linnakangas2011-09-01
|
* Add C comment about needed include.Bruce Momjian2011-09-01
|
* libpq compiles various pgport files like ecpg does, and needs similar MakefileHeikki Linnakangas2011-09-01
| | | | | changes for the win32 setlocale() wrapper I put into ecpg, to make it compile on MinGW.
* Put back improperly removed #include.Tom Lane2011-09-01
|
* Add C comment about necessary NetBSD include.Bruce Momjian2011-09-01
|
* Add missing hba.h include for NetBSD.Bruce Momjian2011-09-01
|
* In SGML we only need to worry about "<", not ">"; update scripts.Bruce Momjian2011-09-01
|
* Remove unnecessary #include references, per pgrminclude script.Bruce Momjian2011-09-01
|
* In ecpglib restore LC_NUMERIC in case of an error.Michael Meskes2011-09-01
|
* Minor improvements to mbregress.sh script.Robert Haas2011-09-01
| | | | | | | | | | 1. Use new dropdb --if-exists option, to avoid alarming the user if the database being dropped doesn't already exist. 2. Bail out if createdb fails. 3. exit 1 if the checks fail. 4. Make it executable. Josh Kupershmidt, with some kibitzing by me.
* Fix MinGW build, broken by my previous patch to add a setlocale() wrapperHeikki Linnakangas2011-09-01
| | | | | | | on Windows. ecpglib doesn't link with libpgport, but picks and compiles the .c files it needs individually. To cope with that, move the setlocale() wrapper from chklocale.c to a separate setlocale.c file, and include that in ecpglib.
* setlocale() on Windows doesn't work correctly if the locale name containsHeikki Linnakangas2011-09-01
| | | | | | | | | | | | | | | | | | | | | | dots. I previously worked around this in initdb, mapping the known problematic locale names to aliases that work, but Hiroshi Inoue pointed out that that's not enough because even if you use one of the aliases, like "Chinese_HKG", setlocale(LC_CTYPE, NULL) returns back the long form, ie. "Chinese_Hong Kong S.A.R.". When we try to restore an old locale value by passing that value back to setlocale(), it fails. Note that you are affected by this bug also if you use one of those short-form names manually, so just reverting the hack in initdb won't fix it. To work around that, move the locale name mapping from initdb to a wrapper around setlocale(), so that the mapping is invoked on every setlocale() call. Also, add a few checks for failed setlocale() calls in the backend. These calls shouldn't fail, and if they do there isn't much we can do about it, but at least you'll get a warning. Backpatch to 9.1, where the initdb hack was introduced. The Windows bug affects older versions too if you set locale manually to one of the aliases, but given the lack of complaints from the field, I'm hesitent to backpatch.
* Move the line to undefine setlocale() macro on Win32 outside USE_REPL_SNPRINTFHeikki Linnakangas2011-09-01
| | | | | | ifdef block. It has nothing to do with whether the replacement snprintf function is used. It caused no live bug, because the replacement snprintf function is always used on Win32, but it was nevertheless misplaced.
* Further repair of eqjoinsel ndistinct-clamping logic.Tom Lane2011-09-01
| | | | | | | | | | | | | | | | | | | | | Examination of examples provided by Mark Kirkwood and others has convinced me that actually commit 7f3eba30c9d622d1981b1368f2d79ba0999cdff2 was quite a few bricks shy of a load. The useful part of that patch was clamping ndistinct for the inner side of a semi or anti join, and the reason why that's needed is that it's the only way that restriction clauses eliminating rows from the inner relation can affect the estimated size of the join result. I had not clearly understood why the clamping was appropriate, and so mis-extrapolated to conclude that we should clamp ndistinct for the outer side too, as well as for both sides of regular joins. These latter actions were all wrong, and are reverted with this patch. In addition, the clamping logic is now made to affect the behavior of both paths in eqjoinsel_semi, with or without MCV lists to compare. When we have MCVs, we suppose that the most common values are the ones that are most likely to survive the decimation resulting from a lower restriction clause, so we think of the clamping as eliminating non-MCV values, or potentially even the least-common MCVs for the inner relation. Back-patch to 8.4, same as previous fixes in this area.
* Fix pg_upgrade to preserve toast relfrozenxids for old 8.3 servers.Bruce Momjian2011-08-31
| | | | | | | This fixes a pg_upgrade bug that could lead to query errors when clog files are improperly removed. Backpatch to 8.4, 9.0, 9.1.
* Improve eqjoinsel's ndistinct clamping to work for multiple levels of join.Tom Lane2011-08-31
| | | | | | | | | | | | | | | | | This patch fixes an oversight in my commit 7f3eba30c9d622d1981b1368f2d79ba0999cdff2 of 2008-10-23. That patch accounted for baserel restriction clauses that reduced the number of rows coming out of a table (and hence the number of possibly-distinct values of a join variable), but not for join restriction clauses that might have been applied at a lower level of join. To account for the latter, look up the sizes of the min_lefthand and min_righthand inputs of the current join, and clamp with those in the same way as for the base relations. Noted while investigating a complaint from Ben Chobot, although this in itself doesn't seem to explain his report. Back-patch to 8.4; previous versions used different estimation methods for which this heuristic isn't relevant.
* Fix a missed case in code for "moving average" estimate of reltuples.Tom Lane2011-08-30
| | | | | | | | | | | | | | | | | | | | | | | | It is possible for VACUUM to scan no pages at all, if the visibility map shows that all pages are all-visible. In this situation VACUUM has no new information to report about the relation's tuple density, so it wasn't changing pg_class.reltuples ... but it updated pg_class.relpages anyway. That's wrong in general, since there is no evidence to justify changing the density ratio reltuples/relpages, but it's particularly bad if the previous state was relpages=reltuples=0, which means "unknown tuple density". We just replaced "unknown" with "zero". ANALYZE would eventually recover from this, but it could take a lot of repetitions of ANALYZE to do so if the relation size is much larger than the maximum number of pages ANALYZE will scan, because of the moving-average behavior introduced by commit b4b6923e03f4d29636a94f6f4cc2f5cf6298b8c8. The only known situation where we could have relpages=reltuples=0 and yet the visibility map asserts everything's visible is immediately following a pg_upgrade. It might be advisable for pg_upgrade to try to preserve the relpages/reltuples statistics; but in any case this code is wrong on its own terms, so fix it. Per report from Sergey Koposov. Back-patch to 8.4, where the visibility map was introduced, same as the previous change.
* Clean up pg_regress --help outputPeter Eisentraut2011-08-30
| | | | | Put options listing in a less random order, fix capitalization, and some typos.
* Add --if-exists option to dropdb and dropuser.Robert Haas2011-08-30
| | | | Josh Kupershmidt, with some further editing by me.