summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2012-08-31psql: Reduce compatibility warningPeter Eisentraut
Only warn when connecting to a newer server, since connecting to older servers works pretty well nowadays. Also update the documentation a little about current psql/server compatibility expectations.
2012-08-31Restore setting of _USE_32BIT_TIME_T to 32 bit MSVC builds.Andrew Dunstan
This was removed in commit cd004067742ee16ee63e55abfb4acbd5f09fbaab, we're not quite sure why, but there have been reports of crashes due to AS Perl being built with it when we are not, and it certainly seems like the right thing to do. There is still some uncertainty as to why it sometimes fails and sometimes doesn't. Original patch from Owais Khani, substantially reworked and extended by Andrew Dunstan.
2012-08-31Partially restore qual scope checks in distribute_qual_to_rels().Tom Lane
The LATERAL implementation is now basically complete, and I still don't see a cost-effective way to make an exact qual scope cross-check in the presence of LATERAL. However, I did add a PlannerInfo.hasLateralRTEs flag along the way, so it's easy to make the check only when not hasLateralRTEs. That seems to still be useful, and it beats having no check at all.
2012-08-31Fix LATERAL references to join alias variables.Tom Lane
I had thought this case worked already, but perhaps I didn't re-test it after adding extract_lateral_references() ...
2012-08-31Make configure probe for mbstowcs_l as well as wcstombs_l.Tom Lane
We previously supposed that any given platform would supply both or neither of these functions, so that one configure test would be sufficient. It now appears that at least on AIX this is not the case ... which is likely an AIX bug, but nonetheless we need to cope with it. So use separate tests. Per bug #6758; thanks to Andrew Hastie for doing the followup testing needed to confirm what was happening. Backpatch to 9.1, where we began using these functions.
2012-08-31Fix typos in README.Heikki Linnakangas
2012-08-30Improve coding of gistchoose and gistRelocateBuildBuffersOnSplit.Tom Lane
This is mostly cosmetic, but it does eliminate a speculative portability issue. The previous coding ignored the fact that sum_grow could easily overflow (in fact, it could be summing multiple IEEE float infinities). On a platform where that didn't guarantee to produce a positive result, the code would misbehave. In any case, it was less than readable.
2012-08-30Add Perl emacs formatting macros to src/tools/editors/emacs.samples.Bruce Momjian
Peter Eisentraut
2012-08-30Split tuple struct defs from htup.h to htup_details.hAlvaro Herrera
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.
2012-08-30Remove configure flag --disable-shared, as it is no longer used by anyBruce Momjian
port. The last use was QNX, per Peter Eisentraut.
2012-08-30Suppress creation of backwardly-indexed paths for LATERAL join clauses.Tom Lane
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.
2012-08-30Fix division by zero in the new range type histogram creation.Heikki Linnakangas
Report and analysis by Matthias.
2012-08-30Add missing period to detail message.Robert Haas
Per note from Peter Eisentraut.
2012-08-30Fix logic bug in gistchoose and gistRelocateBuildBuffersOnSplit.Robert Haas
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.
2012-08-30Improve EXPLAIN's ability to cope with LATERAL references in plans.Tom Lane
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.
2012-08-30Comment fixes.Robert Haas
Jeff Davis, somewhat edited by me
2012-08-29Adjust definition of cheapest_total_path to work better with LATERAL.Tom Lane
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.
2012-08-29Report postmaster.pid file as empty if it is empty, rather thanBruce Momjian
reporting in contains invalid data.
2012-08-29Optimize SP-GiST insertions.Heikki Linnakangas
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.
2012-08-28Add strerror() string to chdir() error messagePeter Eisentraut
2012-08-28Split heapam_xlog.h from heapam.hAlvaro Herrera
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.
2012-08-28remove catcache.h from syscache.hAlvaro Herrera
Instead, place a forward struct declaration for struct catclist in syscache.h. This reduces header proliferation somewhat.
2012-08-28Split resowner.hAlvaro Herrera
This lets files that are mere users of ResourceOwner not automatically include the headers for stuff that is managed by the resowner mechanism.
2012-08-28add #includes to plpy_subxactobject.h to make it compile standaloneAlvaro Herrera
2012-08-28Prevent psql tab completion in SET from adding TO when the equals signBruce Momjian
has no space before it. Report by Erik Rijkers
2012-08-28syncrep.h must include xlogdefs.hAlvaro Herrera
2012-08-28Small punctuation fixesPeter Eisentraut
2012-08-27Fix DROP INDEX CONCURRENTLY IF EXISTS.Tom Lane
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.
2012-08-27Have pgindent requre pg_bsd_indent version 1.2 now that a new versionBruce Momjian
has been created by adding #include <stdlib.h> to parse.c. per request from Kevin Grittner.
2012-08-27Collect and use histograms of lower and upper bounds for range types.Heikki Linnakangas
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.
2012-08-27pg_basebackup: Correct error messagePeter Eisentraut
It still thought that the --xlog-method option argument could be empty, as in a previous version of this feature.
2012-08-26Fix up planner infrastructure to support LATERAL properly.Tom Lane
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.
2012-08-25Use psql_error() for most psql error calls, per request from Magnus.Bruce Momjian
2012-08-25Allow text timezone designations, e.g. "America/Chicago", when using theBruce Momjian
ISO "T" timestamptz format.
2012-08-24Fix issues with checks for unsupported transaction states in Hot Standby.Tom Lane
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
2012-08-24Put options on man page and in help output in slightly better orderPeter Eisentraut
2012-08-23libpq: Fix memory leak in URI parserPeter Eisentraut
When an invalid query parameter is reported, some memory leaks. found by Coverity
2012-08-23Fix cascading privilege revoke to notice when privileges are still held.Tom Lane
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.
2012-08-21Mark DateTimeParseError() noreturnPeter Eisentraut
This avoids a warning from clang 3.2 about an uninitialized variable 'dtype' in date_in().
2012-08-21Avoid somewhat-theoretical overflow risks in RecordIsValid().Tom Lane
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.
2012-08-21Fix dumping of security_barrier views with circular dependencies.Tom Lane
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.
2012-08-21Improve C comments in GetSnapshotData.Robert Haas
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.
2012-08-21Teach compiler that ereport(>=ERROR) does not returnPeter Eisentraut
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.
2012-08-20Remove external PID file on postmaster exitPeter Eisentraut
2012-08-20Improved tab completion for CLUSTER VERBOSE.Robert Haas
Jeff Janes
2012-08-20Tab complete "TABLE whatever DROP CONSTRAINT" with a constraint name.Robert Haas
Jeff Janes
2012-08-20Don't get confused if a WAL partial record header has xl_tot_len == 0.Heikki Linnakangas
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.
2012-08-19Fix typo in comment.Tom Lane
2012-08-19Remove obsolete comment.Tom Lane
2012-08-19Allow OLD and NEW in multi-row VALUES within rules.Tom Lane
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.