aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
...
* Fix two low-probability memory leaks in regular expression parsing.Tom Lane2014-07-18
| | | | | | | | | | | | | | | | | If pg_regcomp failed after having invoked markst/cleanst, it would leak any "struct subre" nodes it had created. (We've already detected all regex syntax errors at that point, so the only likely causes of later failure would be query cancel or out-of-memory.) To fix, make sure freesrnode knows the difference between the pre-cleanst and post-cleanst cleanup procedures. Add some documentation of this less-than-obvious point. Also, newlacon did the wrong thing with an out-of-memory failure from realloc(), so that the previously allocated array would be leaked. Both of these are pretty low-probability scenarios, but a bug is a bug, so patch all the way back. Per bug #10976 from Arthur O'Dwyer.
* Revert broken change to pgevent.cMagnus Hagander2014-07-17
| | | | | pgevent doesn't include the global PostgreSQL headers, for a reason, and therefor cannot rely on defines in it...
* Add option to pg_ctl to choose event source for loggingMagnus Hagander2014-07-17
| | | | | | | | | | | pg_ctl will log to the Windows event log when it is running as a service, which is the primary way of running PostgreSQL on Windows. This option makes it possible to specify which event source to use for this, in order to separate different instances. The server logging itself is still controlled by the regular logging parameters, including a separate setting for the event source. The parameter to pg_ctl only controlls the logging from pg_ctl itself. MauMau, review in many iterations by Amit Kapila and me.
* Fix bugs in SP-GiST search with range type's -|- (adjacent) operator.Heikki Linnakangas2014-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The consistent function contained several bugs: * The "if (which2) { ... }" block was broken. It compared the argument's lower bound against centroid's upper bound, while it was supposed to compare the argument's upper bound against the centroid's lower bound (the comment was correct, code was wrong). Also, it cleared bits in the "which1" variable, while it was supposed to clear bits in "which2". * If the argument's upper bound was equal to the centroid's lower bound, we descended to both halves (= all quadrants). That's unnecessary, searching the right quadrants is sufficient. This didn't lead to incorrect query results, but was clearly wrong, and slowed down queries unnecessarily. * In the case that argument's lower bound is adjacent to the centroid's upper bound, we also don't need to visit all quadrants. Per similar reasoning as previous point. * The code where we compare the previous centroid with the current centroid should match the code where we compare the current centroid with the argument. The point of that code is to redo the calculation done in the previous level, to see if we were supposed to traverse left or right (or up or down), and if we actually did. If we moved in the different direction, then we know there are no matches for bound. Refactor the code and adds comments to make it more readable and easier to reason about. Backpatch to 9.3 where SP-GiST support for range types was introduced.
* Allow join removal in some cases involving a left join to a subquery.Tom Lane2014-07-15
| | | | | | | | | | | | | | | | | | | We can remove a left join to a relation if the relation's output is provably distinct for the columns involved in the join clause (considering only equijoin clauses) and the relation supplies no variables needed above the join. Previously, the join removal logic could only prove distinctness by reference to unique indexes of a table. This patch extends the logic to consider subquery relations, wherein distinctness might be proven by reference to GROUP BY, DISTINCT, etc. We actually already had some code to check that a subquery's output was provably distinct, but it was hidden inside pathnode.c; which was a pretty bad place for it really, since that file is mostly boilerplate Path construction and comparison. Move that code to analyzejoins.c, which is arguably a more appropriate location, and is certainly the site of the new usage for it. David Rowley, reviewed by Simon Riggs
* pg_basebackup: Add more information about --max-rate option to help outputPeter Eisentraut2014-07-15
| | | | It was previously not clear what unit the option argument should have.
* json_build_object and json_build_array are stable, not immutable.Andrew Dunstan2014-07-15
| | | | | | | | | These functions indirectly invoke output functions, so they can't be immutable. Backpatch to 9.4 where they were introduced. Catalog version bumped.
* Fix REASSIGN OWNED for text search objectsAlvaro Herrera2014-07-15
| | | | | | | | | | | | | | | | | | | | | Trying to reassign objects owned by a user that had text search dictionaries or configurations used to fail with: ERROR: unexpected classid 3600 or ERROR: unexpected classid 3602 Fix by adding cases for those object types in a switch in pg_shdepend.c. Both REASSIGN OWNED and text search objects go back all the way to 8.1, so backpatch to all supported branches. In 9.3 the alter-owner code was made generic, so the required change in recent branches is pretty simple; however, for 9.2 and older ones we need some additional reshuffling to enable specifying objects by OID rather than name. Text search templates and parsers are not owned objects, so there's no change required for them. Per bug #9749 reported by Michal Novotný
* Detect presence of SSL_get_current_compressionMagnus Hagander2014-07-15
| | | | | | | | | | | Apparently we still build against OpenSSL so old that it doesn't have this function, so add an autoconf check for it to make the buildfarm happy. If the function doesn't exist, always return that compression is disabled, since presumably the actual compression functionality is always missing. For now, hardcode the function as present on MSVC, since we should hopefully be well beyond those old versions on that platform.
* Add missing source files to nls.mkPeter Eisentraut2014-07-15
| | | | | | These are files under common/ that have been moved around. Updating these manually is not satisfactory, but it's the only solution at the moment.
* Include SSL compression status in psql banner and connection loggingMagnus Hagander2014-07-15
| | | | | | Both the psql banner and the connection logging already included SSL status, cipher and bitlength, this adds the information about compression being on or off.
* Small spelling fixPeter Eisentraut2014-07-15
|
* Add missing serial commasPeter Eisentraut2014-07-15
| | | | | Also update one place where the wal_level "logical" was not added to an error message.
* Remove dependency on wsock32.lib in favor of ws2_32Magnus Hagander2014-07-15
| | | | | | | | ws2_32 is the new version of the library that should be used, as it contains the require functionality from wsock32 as well as some more (which is why some binaries were already using ws2_32). Michael Paquier, reviewed by MauMau
* psql: Show tablespace size in \db+Alvaro Herrera2014-07-14
| | | | Fabrízio de Royes Mello
* Move view reloptions into their own varlena structAlvaro Herrera2014-07-14
| | | | | | | Per discussion after a gripe from me in http://www.postgresql.org/message-id/20140611194633.GH18688@eldon.alvh.no-ip.org Jaime Casanova
* Add file version information to most installed Windows binaries.Noah Misch2014-07-14
| | | | | | | | Prominent binaries already had this metadata. A handful of minor binaries, such as pg_regress.exe, still lack it; efforts to eliminate such exceptions are welcome. Michael Paquier, reviewed by MauMau.
* MSVC: Apply icons to all binaries having them in a MinGW build.Noah Misch2014-07-14
|
* MSVC: Process Makefile line continuations more like "make" does.Noah Misch2014-07-14
| | | | | | | | Unlike "make" itself, the MSVC build process recognized a continuation even with whitespace after the backslash. (Due to a typo, some code sites accepted the letter "s" instead of whitespace). Also, it would consume any number of newlines following a single backslash. This is mere cleanup; those behaviors were unlikely to cause bugs.
* MSVC: Recognize PGFILEDESC in contrib and conversion_procs modules.Noah Misch2014-07-14
| | | | | | | Achieve this by consistently using four-argument Solution::AddProject() calls. Remove ad hoc Makefile parsing made redundant by doing that. Michael Paquier and Noah Misch, reviewed by MauMau.
* Fix warnings added in 8d9a0e85bd6ab4fe5268a1d759a787f72ff9333e.Noah Misch2014-07-14
|
* Prevent bitmap heap scans from showing unnecessary block info in EXPLAIN ↵Fujii Masao2014-07-14
| | | | | | | | | | | | | | ANALYZE. EXPLAIN ANALYZE shows the information of the numbers of exact/lossy blocks which bitmap heap scan processes. But, previously, when those numbers were both zero, it displayed only the prefix "Heap Blocks:" in TEXT output format. This is strange and would confuse the users. So this commit suppresses such unnecessary information. Backpatch to 9.4 where EXPLAIN ANALYZE was changed so that such information was displayed. Etsuro Fujita
* Support --with-extra-version equivalent functionality in MSVC buildMagnus Hagander2014-07-12
| | | | | | | Adds a configuration parameter, extraver, that is appended to the version number when built. Michael Paquier, reviewed by Muhammad Asif Naeem
* Minimal psql tab completion support for SET search_path.Andres Freund2014-07-12
| | | | | | | | | | | Complete SET search_path = ... to non-temporary and non-toast schemas. Since there pretty much is no use case to add those to the search path and there can be many it's helpful to exclude them. It'd be nicer to complete multiple search path elements, but that's not easy. Jeff Janes
* Fix decoding of consecutive MULTI_INSERTs emitted by one heap_multi_insert().Andres Freund2014-07-12
| | | | | | | | | | | | | | | | | | | Commit 1b86c81d2d fixed the decoding of toasted columns for the rows contained in one xl_heap_multi_insert record. But that's not actually enough, because heap_multi_insert() will actually first toast all passed in rows and then emit several *_multi_insert records; one for each page it fills with tuples. Add a XLOG_HEAP_LAST_MULTI_INSERT flag which is set in xl_heap_multi_insert->flag denoting that this multi_insert record is the last emitted by one heap_multi_insert() call. Then use that flag in decode.c to only set clear_toast_afterwards in the right situation. Expand the number of rows inserted via COPY in the corresponding regression test to make sure that more than one heap page is filled with tuples by one heap_multi_insert() call. Backpatch to 9.4 like the previous commit.
* Add autocompletion of locale keywords for CREATE DATABASEMagnus Hagander2014-07-12
| | | | | Adds support for autocomplete of LC_COLLATE and LC_CTYPE to the CREATE DATABASE command in psql.
* Fix bug with whole-row references to append subplans.Tom Lane2014-07-11
| | | | | | | | | | | | | | ExecEvalWholeRowVar incorrectly supposed that it could "bless" the source TupleTableSlot just once per query. But if the input is coming from an Append (or, perhaps, other cases?) more than one slot might be returned over the query run. This led to "record type has not been registered" errors when a composite datum was extracted from a non-blessed slot. This bug has been there a long time; I guess it escaped notice because when dealing with subqueries the planner tends to expand whole-row Vars into RowExprs, which don't have the same problem. It is possible to trigger the problem in all active branches, though, as illustrated by the added regression test.
* Fix whitespacePeter Eisentraut2014-07-11
|
* Implement IMPORT FOREIGN SCHEMA.Tom Lane2014-07-10
| | | | | | | | | | | This command provides an automated way to create foreign table definitions that match remote tables, thereby reducing tedium and chances for error. In this patch, we provide the necessary core-server infrastructure and implement the feature fully in the postgres_fdw foreign-data wrapper. Other wrappers will throw a "feature not supported" error until/unless they are updated. Ronan Dunklau and Michael Paquier, additional work by me
* Adjust blank lines around PG_MODULE_MAGIC defines, for consistencyBruce Momjian2014-07-10
| | | | Report by Robert Haas
* Add new ECHO mode 'errors' that displays only failed commands in psql.Fujii Masao2014-07-10
| | | | | | | | | When the psql variable ECHO is set to 'erros', only failed SQL commands are printed to standard error output. Also this patch adds -b option into psql. This is equivalent to setting the variable ECHO to 'errors'. Pavel Stehule, reviewed by Fabrízio de Royes Mello, Samrat Revagade, Kumar Rajeev Rastogi, Abhijit Menon-Sen, and me.
* Fix error hint style.Robert Haas2014-07-09
| | | | Mistake caught by Tom Lane.
* Improve error messages for bytea decoding failures.Robert Haas2014-07-09
| | | | Craig Ringer
* Don't assume a subquery's output is unique if there's a SRF in its tlist.Tom Lane2014-07-08
| | | | | | | | | | | | | While the x output of "select x from t group by x" can be presumed unique, this does not hold for "select x, generate_series(1,10) from t group by x", because we may expand the set-returning function after the grouping step. (Perhaps that should be re-thought; but considering all the other oddities involved with SRFs in targetlists, it seems unlikely we'll change it.) Put a check in query_is_distinct_for() so it's not fooled by such cases. Back-patch to all supported branches. David Rowley
* Fix typo in comment.Fujii Masao2014-07-08
| | | | This typo was accidentally added by recent commit 4cbd128.
* In pg_dump, show server and pg_dump versions with or without --verbose.Tom Lane2014-07-07
| | | | | | | | | We used to print this information only in verbose mode, but it's argued that it's useful enough to print always; one reason being that this provides some documentation about which Postgres versions the dump is meant to reload into. Jing Wang, reviewed by Jeevan Chalke
* Fix typos in comments.Fujii Masao2014-07-07
|
* Remove swpb-based spinlock implementation for ARMv5 and earlier.Robert Haas2014-07-06
| | | | | | | | | | | | | | Per recent analysis by Andres Freund, this implementation is in fact unsafe, because ARMv5 has weak memory ordering, which means tha the CPU could move loads or stores across the volatile store performed by the default S_UNLOCK. We could try to fix this, but have no ARMv5 hardware to test on, so removing support seems better. We can still support ARMv5 systems on GCC versions new enough to have built-in atomics support for this platform, and can also re-add support for the old way if someone has hardware that can be used to test a fix. However, since the requirement to use a relatively-new GCC hasn't been an issue for ARMv6 or ARMv7, which lack the swpb instruction altogether, perhaps it won't be an issue for ARMv5 either.
* Fix decoding of MULTI_INSERTs when rows other than the last are toasted.Andres Freund2014-07-06
| | | | | | | | | | | | | | | | | | | | | | | When decoding the results of a HEAP2_MULTI_INSERT (currently only generated by COPY FROM) toast columns for all but the last tuple weren't replaced by their actual contents before being handed to the output plugin. The reassembled toast datums where disregarded after every REORDER_BUFFER_CHANGE_(INSERT|UPDATE|DELETE) which is correct for plain inserts, updates, deletes, but not multi inserts - there we generate several REORDER_BUFFER_CHANGE_INSERTs for a single xl_heap_multi_insert record. To solve the problem add a clear_toast_afterwards boolean to ReorderBufferChange's union member that's used by modifications. All row changes but multi_inserts always set that to true, but multi_insert sets it only for the last change generated. Add a regression test covering decoding of multi_inserts - there was none at all before. Backpatch to 9.4 where logical decoding was introduced. Bug found by Petr Jelinek.
* Consistently pass an "unsigned char" to ctype.h functions.Noah Misch2014-07-06
| | | | | | The isxdigit() calls relied on undefined behavior. The isascii() call was well-defined, but our prevailing style is to include the cast. Back-patch to 9.4, where the isxdigit() calls were introduced.
* Remove dead typeStruct variable from plpy_spi.c.Kevin Grittner2014-07-05
| | | | Left behind by 8b6010b8350a1756cd85595705971df81b5ffc07.
* Fix double-free bug of WAL streaming buffer in pg_receivexlog.Fujii Masao2014-07-04
| | | | This bug was introduced while refactoring in commit 74cbe96.
* Refactor pg_receivexlog main loop code, for readability.Fujii Masao2014-07-04
| | | | | | | | Previously the source codes for receiving the data and for polling the socket were included in pg_receivexlog main loop. This commit splits out them as separate functions. This is useful for improving the readability of main loop code and making the future pg_receivexlog-related patch simpler.
* Don't cache per-group context across the whole query in orderedsetaggs.c.Tom Lane2014-07-03
| | | | | | | | | | | Although nodeAgg.c currently uses the same per-group memory context for all groups of a query, that might change in future. Avoid assuming it. This costs us an extra AggCheckCallContext() call per group, but that's pretty cheap and is probably good from a safety standpoint anyway. Back-patch to 9.4 in case any third-party code copies this logic. Andrew Gierth
* Redesign API presented by nodeAgg.c for ordered-set and similar aggregates.Tom Lane2014-07-03
| | | | | | | | | | | | | The previous design exposed the input and output ExprContexts of the Agg plan node, but work on grouping sets has suggested that we'll regret doing that. Instead provide more narrowly-defined APIs that can be implemented in multiple ways, namely a way to get a short-term memory context and a way to register an aggregate shutdown callback. Back-patch to 9.4 where the bad APIs were introduced, since we don't want third-party code using these APIs and then having to change in 9.5. Andrew Gierth
* Improve support for composite types in PL/Python.Tom Lane2014-07-03
| | | | | | | | | | | | | | | Allow PL/Python functions to return arrays of composite types. Also, fix the restriction that plpy.prepare/plpy.execute couldn't handle query parameters or result columns of composite types. In passing, adopt a saner arrangement for where to release the tupledesc reference counts acquired via lookup_rowtype_tupdesc. The callers of PLyObject_ToCompositeDatum were doing the lookups, but then the releases happened somewhere down inside subroutines of PLyObject_ToCompositeDatum, which is bizarre and bug-prone. Instead release in the same function that acquires the refcount. Ed Behn and Ronan Dunklau, reviewed by Abhijit Menon-Sen
* Use a separate temporary directory for the Unix-domain socketPeter Eisentraut2014-07-02
| | | | | | | Creating the Unix-domain socket in the build directory can run into name-length limitations. Therefore, create the socket file in the default temporary directory of the operating system. Keep the temporary data directory etc. in the build tree.
* Support vpath builds in TAP testsPeter Eisentraut2014-07-02
|
* Smooth reporting of commit/rollback statistics.Kevin Grittner2014-07-02
| | | | | | | | | | | | | | | | | | | | If a connection committed or rolled back any transactions within a PGSTAT_STAT_INTERVAL pacing interval without accessing any tables, the reporting of those statistics would be held up until the connection closed or until it ended a PGSTAT_STAT_INTERVAL interval in which it had accessed a table. This could result in under- reporting of transactions for an extended period, followed by a spike in reported transactions. While this is arguably a bug, the impact is minimal, primarily affecting, and being affected by, monitoring software. It might cause more confusion than benefit to change the existing behavior in released stable branches, so apply only to master and the 9.4 beta. Gurjeet Singh, with review and editing by Kevin Grittner, incorporating suggested changes from Abhijit Menon-Sen and Tom Lane.
* pg_upgrade: preserve database and relation minmxid valuesBruce Momjian2014-07-02
| | | | | | | | | Also set these values for pre-9.3 old clusters that don't have values to preserve. Analysis by Alvaro Backpatch through 9.3