summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Split tuple struct defs from htup.h to htup_details.hAlvaro Herrera2012-08-30156-638/+817
| | | | | | | | | | | | This reduces unnecessary exposure of other headers through htup.h, which is very widely included by many files. I have chosen to move the function prototypes to the new file as well, because that means htup.h no longer needs to include tupdesc.h. In itself this doesn't have much effect in indirect inclusion of tupdesc.h throughout the tree, because it's also required by execnodes.h; but it's something to explore in the future, and it seemed best to do the htup.h change now while I'm busy with it.
* Remove configure flag --disable-shared, as it is no longer used by anyBruce Momjian2012-08-304-34/+0
| | | | port. The last use was QNX, per Peter Eisentraut.
* Suppress creation of backwardly-indexed paths for LATERAL join clauses.Tom Lane2012-08-303-8/+46
| | | | | | | | | | | | | Given a query such as SELECT * FROM foo JOIN LATERAL (SELECT foo.var1) ss(x) ON ss.x = foo.var2 the existence of the join clause "ss.x = foo.var2" encourages indxpath.c to build a parameterized path for foo using any index available for foo.var2. This is completely useless activity, though, since foo has got to be on the outside not the inside of any nestloop join with ss. It's reasonably inexpensive to add tests that prevent creation of such paths, so let's do that.
* Fix division by zero in the new range type histogram creation.Heikki Linnakangas2012-08-301-1/+4
| | | | Report and analysis by Matthias.
* Add missing period to detail message.Robert Haas2012-08-301-1/+1
| | | | Per note from Peter Eisentraut.
* Fix logic bug in gistchoose and gistRelocateBuildBuffersOnSplit.Robert Haas2012-08-302-8/+80
| | | | | | | | | | | | Every time the best-tuple-found-so-far changes, we need to reset all the penalty values in which_grow[] to the penalties for the new best tuple. The old code failed to do this, resulting in inferior index quality. The original patch from Alexander Korotkov was just two lines; I took the liberty of fleshing that out by adding a bunch of comments that I hope will make this logic easier for others to understand than it was for me.
* Improve EXPLAIN's ability to cope with LATERAL references in plans.Tom Lane2012-08-302-9/+11
| | | | | | | | | | push_child_plan/pop_child_plan didn't bother to adjust the "ancestors" list of parent plan nodes when descending to a child plan node. I think this was okay when it was written, but it's not okay in the presence of LATERAL references, since a subplan node could easily be returning a LATERAL value back up to the same nestloop node that provides the value. Per changed regression test results, the omission led to failure to interpret Param nodes that have perfectly good interpretations.
* Comment fixes.Robert Haas2012-08-302-4/+4
| | | | Jeff Davis, somewhat edited by me
* Adjust definition of cheapest_total_path to work better with LATERAL.Tom Lane2012-08-298-252/+217
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the initial cut at LATERAL, I kept the rule that cheapest_total_path was always unparameterized, which meant it had to be NULL if the relation has no unparameterized paths. It turns out to work much more nicely if we always have *some* path nominated as cheapest-total for each relation. In particular, let's still say it's the cheapest unparameterized path if there is one; if not, take the cheapest-total-cost path among those of the minimum available parameterization. (The first rule is actually a special case of the second.) This allows reversion of some temporary lobotomizations I'd put in place. In particular, the planner can now consider hash and merge joins for joins below a parameter-supplying nestloop, even if there aren't any unparameterized paths available. This should bring planning of LATERAL-containing queries to the same level as queries not using that feature. Along the way, simplify management of parameterized paths in add_path() and friends. In the original coding for parameterized paths in 9.2, I tried to minimize the logic changes in add_path(), so it just treated parameterization as yet another dimension of comparison for paths. We later made it ignore pathkeys (sort ordering) of parameterized paths, on the grounds that ordering isn't a useful property for the path on the inside of a nestloop, so we might as well get rid of useless parameterized paths as quickly as possible. But we didn't take that reasoning as far as we should have. Startup cost isn't a useful property inside a nestloop either, so add_path() ought to discount startup cost of parameterized paths as well. Having done that, the secondary sorting I'd implemented (in add_parameterized_path) is no longer needed --- any parameterized path that survives add_path() at all is worth considering at higher levels. So this should be a bit faster as well as simpler.
* Report postmaster.pid file as empty if it is empty, rather thanBruce Momjian2012-08-292-2/+15
| | | | reporting in contains invalid data.
* Optimize SP-GiST insertions.Heikki Linnakangas2012-08-292-16/+27
| | | | | | | This includes two micro-optimizations to the tight inner loop in descending the SP-GiST tree: 1. avoid an extra function call to index_getprocinfo when calling user-defined choose function, and 2. avoid a useless palloc+pfree when node labels are not used.
* Add strerror() string to chdir() error messagePeter Eisentraut2012-08-281-3/+5
|
* Split heapam_xlog.h from heapam.hAlvaro Herrera2012-08-2826-244/+287
| | | | | | | | | | | | The heapam XLog functions are used by other modules, not all of which are interested in the rest of the heapam API. With this, we let them get just the XLog stuff in which they are interested and not pollute them with unrelated includes. Also, since heapam.h no longer requires xlog.h, many files that do include heapam.h no longer get xlog.h automatically, including a few headers. This is useful because heapam.h is getting pulled in by execnodes.h, which is in turn included by a lot of files.
* remove catcache.h from syscache.hAlvaro Herrera2012-08-2811-1/+14
| | | | | Instead, place a forward struct declaration for struct catclist in syscache.h. This reduces header proliferation somewhat.
* Split resowner.hAlvaro Herrera2012-08-2823-69/+106
| | | | | This lets files that are mere users of ResourceOwner not automatically include the headers for stuff that is managed by the resowner mechanism.
* add #includes to plpy_subxactobject.h to make it compile standaloneAlvaro Herrera2012-08-281-0/+3
|
* Prevent psql tab completion in SET from adding TO when the equals signBruce Momjian2012-08-281-0/+1
| | | | | | has no space before it. Report by Erik Rijkers
* syncrep.h must include xlogdefs.hAlvaro Herrera2012-08-281-0/+1
|
* Small punctuation fixesPeter Eisentraut2012-08-282-4/+5
|
* Fix DROP INDEX CONCURRENTLY IF EXISTS.Tom Lane2012-08-272-2/+2
| | | | | | | | This threw ERROR, not the expected NOTICE, if the index didn't exist. The bug was actually visible in not-as-expected regression test output, so somebody wasn't paying too close attention in commit 8cb53654dbdb4c386369eb988062d0bbb6de725e. Per report from Brendan Byrd.
* Have pgindent requre pg_bsd_indent version 1.2 now that a new versionBruce Momjian2012-08-271-1/+1
| | | | | | has been created by adding #include <stdlib.h> to parse.c. per request from Kevin Grittner.
* Collect and use histograms of lower and upper bounds for range types.Heikki Linnakangas2012-08-279-32/+881
| | | | | | | | | | | | | | | This enables selectivity estimation of the <<, >>, &<, &> and && operators, as well as the normal inequality operators: <, <=, >=, >. "range @> element" is also supported, but the range-variant @> and <@ operators are not, because they cannot be sensibly estimated with lower and upper bound histograms alone. We would need to make some assumption about the lengths of the ranges for that. Alexander's patch included a separate histogram of lengths for that, but I left that out of the patch for simplicity. Hopefully that will be added as a followup patch. The fraction of empty ranges is also calculated and used in estimation. Alexander Korotkov, heavily modified by me.
* pg_basebackup: Correct error messagePeter Eisentraut2012-08-271-1/+1
| | | | | It still thought that the --xlog-method option argument could be empty, as in a previous version of this feature.
* Fix up planner infrastructure to support LATERAL properly.Tom Lane2012-08-2630-182/+817
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch takes care of a number of problems having to do with failure to choose valid join orders and incorrect handling of lateral references pulled up from subqueries. Notable changes: * Add a LateralJoinInfo data structure similar to SpecialJoinInfo, to represent join ordering constraints created by lateral references. (I first considered extending the SpecialJoinInfo structure, but the semantics are different enough that a separate data structure seems better.) Extend join_is_legal() and related functions to prevent trying to form unworkable joins, and to ensure that we will consider joins that satisfy lateral references even if the joins would be clauseless. * Fill in the infrastructure needed for the last few types of relation scan paths to support parameterization. We'd have wanted this eventually anyway, but it is necessary now because a relation that gets pulled up out of a UNION ALL subquery may acquire a reltargetlist containing lateral references, meaning that its paths *have* to be parameterized whether or not we have any code that can push join quals down into the scan. * Compute data about lateral references early in query_planner(), and save in RelOptInfo nodes, to avoid repetitive calculations later. * Assorted corner-case bug fixes. There's probably still some bugs left, but this is a lot closer to being real than it was before.
* Use psql_error() for most psql error calls, per request from Magnus.Bruce Momjian2012-08-254-37/+38
|
* Allow text timezone designations, e.g. "America/Chicago", when using theBruce Momjian2012-08-251-0/+10
| | | | ISO "T" timestamptz format.
* Fix issues with checks for unsupported transaction states in Hot Standby.Tom Lane2012-08-243-2/+33
| | | | | | | | | | | | | | | | | | | | | | | | | The GUC check hooks for transaction_read_only and transaction_isolation tried to check RecoveryInProgress(), so as to disallow setting read/write mode or serializable isolation level (respectively) in hot standby sessions. However, GUC check hooks can be called in many situations where we're not connected to shared memory at all, resulting in a crash in RecoveryInProgress(). Among other cases, this results in EXEC_BACKEND builds crashing during child process start if default_transaction_isolation is serializable, as reported by Heikki Linnakangas. Protect those calls by silently allowing any setting when not inside a transaction; which is okay anyway since these GUCs are always reset at start of transaction. Also, add a check to GetSerializableTransactionSnapshot() to complain if we are in hot standby. We need that check despite the one in check_XactIsoLevel() because default_transaction_isolation could be serializable. We don't want to complain any sooner than this in such cases, since that would prevent running transactions at all in such a state; but a transaction can be run, if SET TRANSACTION ISOLATION is done before setting a snapshot. Per report some months ago from Robert Haas. Back-patch to 9.1, since these problems were introduced by the SSI patch. Kevin Grittner and Tom Lane, with ideas from Heikki Linnakangas
* Put options on man page and in help output in slightly better orderPeter Eisentraut2012-08-242-4/+4
|
* libpq: Fix memory leak in URI parserPeter Eisentraut2012-08-231-0/+5
| | | | | | When an invalid query parameter is reported, some memory leaks. found by Coverity
* Fix cascading privilege revoke to notice when privileges are still held.Tom Lane2012-08-233-2/+76
| | | | | | | | | | | | If we revoke a grant option from some role X, but X still holds the option via another grant, we should not recursively revoke the privilege from role(s) Y that X had granted it to. This was supposedly fixed as one aspect of commit 4b2dafcc0b1a579ef5daaa2728223006d1ff98e9, but I must not have tested it, because in fact that code never worked: it forgot to shift the grant-option bits back over when masking the bits being revoked. Per bug #6728 from Daniel German. Back-patch to all active branches, since this has been wrong since 8.0.
* Mark DateTimeParseError() noreturnPeter Eisentraut2012-08-211-1/+1
| | | | | This avoids a warning from clang 3.2 about an uninitialized variable 'dtype' in date_in().
* Avoid somewhat-theoretical overflow risks in RecordIsValid().Tom Lane2012-08-211-9/+17
| | | | | | | | | | | | | This improves on commit 51fed14d73ed3acd2282b531fb1396877e44e86a by eliminating the assumption that we can form <some pointer value> + <some offset> without overflow. The entire point of those tests is that we don't trust the offset value, so coding them in a way that could wrap around if the buffer happens to be near the top of memory doesn't seem sound. Instead, track the remaining space as a size_t variable and compare offsets against that. Also, improve comment about why we need the extra early check on xl_tot_len.
* Fix dumping of security_barrier views with circular dependencies.Tom Lane2012-08-213-6/+34
| | | | | | | | | If a view has circular dependencies, pg_dump splits it into a CREATE TABLE and a CREATE RULE command to break the dependency loop. However, if the view has reloptions, those options cannot be applied in the CREATE TABLE command, because views and tables have different allowed reloptions so CREATE TABLE would reject them. Instead apply the reloptions after the CREATE RULE, using ALTER VIEW SET.
* Improve C comments in GetSnapshotData.Robert Haas2012-08-211-8/+6
| | | | | | Move discussion of why our algorithm for taking snapshots in recovery to a more appropriate location in the function, and delete incorrect mention of taking a lock.
* Teach compiler that ereport(>=ERROR) does not returnPeter Eisentraut2012-08-211-1/+6
| | | | | | | | | | When elevel >= ERROR, we add an abort() call to the ereport() macro to give the compiler a hint that the ereport() expansion will not return, but the abort() isn't actually reached because the longjmp happens in errfinish(). Because the effect of ereport() varies with the elevel, we cannot use standard compiler attributes such as noreturn for this.
* Remove external PID file on postmaster exitPeter Eisentraut2012-08-201-1/+14
|
* Improved tab completion for CLUSTER VERBOSE.Robert Haas2012-08-201-2/+28
| | | | Jeff Janes
* Tab complete "TABLE whatever DROP CONSTRAINT" with a constraint name.Robert Haas2012-08-201-0/+16
| | | | Jeff Janes
* Don't get confused if a WAL partial record header has xl_tot_len == 0.Heikki Linnakangas2012-08-201-2/+36
| | | | | | | | | | | | | | | If a WAL record header was split across pages, but xl_tot_len was 0, we would get confused and conclude that we had already read the whole record, and proceed to CRC check it. That can lead to a crash in RecordIsValid(), which isn't careful to not read beyond end-of-record, as defined by xl_tot_len. Add an explicit sanity check for xl_tot_len <= SizeOfXlogRecord. Also, make RecordIsValid() more robust by checking in each step that it doesn't try to access memory beyond end of record, even if a length field in the record's or a backup block's header is bogus. Per report and analysis by Tom Lane.
* Fix typo in comment.Tom Lane2012-08-192-2/+2
|
* Remove obsolete comment.Tom Lane2012-08-191-3/+0
|
* Allow OLD and NEW in multi-row VALUES within rules.Tom Lane2012-08-198-47/+164
| | | | | Now that we have LATERAL, it's fairly painless to allow this case, which was left as a TODO in the original multi-row VALUES implementation.
* Make use of LATERAL in information_schema.sequences view.Tom Lane2012-08-181-7/+6
| | | | | | | It said "XXX: The following could be improved if we had LATERAL" ... so let's do that. No catversion bump since either version of the view works fine.
* Another round of planner fixes for LATERAL.Tom Lane2012-08-185-10/+205
| | | | | | | | | | | Formerly, subquery pullup had no need to examine other entries in the range table, since they could not contain any references to the subquery being pulled up. That's no longer true with LATERAL, so now we need to be able to visit rangetable subexpressions to replace Vars referencing the pulled-up subquery. Also, this means that extract_lateral_references must be unsurprised at encountering lateral PlaceHolderVars, since such might be created when pulling up a subquery that's underneath an outer join with respect to the lateral reference.
* Check LIBXML_VERSION instead of testing in configure script.Tom Lane2012-08-172-4/+11
| | | | | | | | | | We had put a test for libxml2's xmlStructuredErrorContext variable in configure, but of course that doesn't work on Windows builds. The next best alternative seems to be to test the LIBXML_VERSION symbol provided by xmlversion.h. Per report from Talha Bin Rizwan, though this fixes it in a different way than his proposed patch.
* Delete inaccurate C comment about FSM and adding pages, per Robert Haas.Bruce Momjian2012-08-161-3/+0
|
* Add URL for include file visualization tool.Bruce Momjian2012-08-161-0/+4
|
* Allow create_index_paths() to consider multiple join bitmapscan paths.Tom Lane2012-08-162-27/+99
| | | | | | | | | | | | | In the initial cut at the "parameterized paths" feature, I'd simplified create_index_paths() to the point where it would only generate a single parameterized bitmap path per relation. Experimentation with an example supplied by Josh Berkus convinces me that that's not good enough: we really need to consider a bitmap path for each possible outer relation. Otherwise we have regressions relative to pre-9.2 versions, in which the planner picks a plain indexscan where it should have used a bitmap scan in queries involving three or more tables. Indeed, after fixing this, several queries in the regression tests show improved plans as a result of using bitmap not plain indexscans.
* Suppress possibly-uninitialized-variable warning.Tom Lane2012-08-161-2/+1
|
* Add possible alternate tool for pgrminclude, from Peter GeogheganBruce Momjian2012-08-161-0/+4
|