aboutsummaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAge
* Basic tab completion for partitioning.Robert Haas2017-02-26
| | | | | | Amit Langote Discussion: http://postgr.es/m/CA+TgmobYOj=A8GesiEs_V2Wq46-_w0+7MOwPiNWC+iuzJ-uWjA@mail.gmail.com
* Allow custom and foreign scans to have shutdown callbacks.Robert Haas2017-02-26
| | | | | | | | | | | | This is expected to be useful mostly when performing such scans in parallel, because in that case it allows (in combination with commit acf555bc53acb589b5a2827e65d655fa8c9adee0) nodes below a Gather to get control just before the DSM segment goes away. KaiGai Kohei, except that I rewrote the documentation. Reviewed by Claudio Freire. Discussion: http://postgr.es/m/CADyhKSXJK0jUJ8rWv4AmKDhsUh124_rEn39eqgfC5D8fu6xVuw@mail.gmail.com
* Put back #include <windows.h> in dirmod.c.Tom Lane2017-02-25
| | | | | | | | | | | I removed this in commit 9e3755ecb, reasoning that the win32.h port-specific header file included by c.h would have provided it. However, that's only true on native win32 builds, not Cygwin builds. It may be that some of the other <windows.h> inclusions also need to be put back on the same grounds; but this is the only one that is clearly meant to be included #ifdef __CYGWIN__, so maybe this is the extent of the problem. Awaiting further buildfarm results.
* Remove some configure header-file checks that we weren't really using.Tom Lane2017-02-25
| | | | | | | | | | | | | We had some AC_CHECK_HEADER tests that were really wastes of cycles, because the code proceeded to #include those headers unconditionally anyway, in all or a large majority of cases. The lack of complaints shows that those headers are available on every platform of interest, so we might as well let configure run a bit faster by not probing those headers at all. I suspect that some of the tests I left alone are equally useless, but since all the existing #includes of the remaining headers are properly guarded, I didn't touch them.
* Remove useless duplicate inclusions of system header files.Tom Lane2017-02-25
| | | | | | | | | | | | | | | | c.h #includes a number of core libc header files, such as <stdio.h>. There's no point in re-including these after having read postgres.h, postgres_fe.h, or c.h; so remove code that did so. While at it, also fix some places that were ignoring our standard pattern of "include postgres[_fe].h, then system header files, then other Postgres header files". While there's not any great magic in doing it that way rather than system headers last, it's silly to have just a few files deviating from the general pattern. (But I didn't attempt to enforce this globally, only in files I was touching anyway.) I'd be the first to say that this is mostly compulsive neatnik-ism, but over time it might save enough compile cycles to be useful.
* Suppress compiler warnings in ecpg test on newer Windows toolchains.Tom Lane2017-02-24
| | | | | | | | | | | nan_test.pgc supposed that it could unconditionally #define isnan() and isinf() on WIN32. This was evidently copied at some point from src/include/port/win32.h, but nowadays there's a test on _MSC_VER there. Make nan_test.pgc look the same. Per buildfarm warnings. There's no evidence this produces anything worse than a warning, and besides it's only a test case, so I don't feel a need to back-patch.
* Fix unportable definition of BSWAP64() macro.Tom Lane2017-02-24
| | | | | | | | | | | | We have a portable way of writing uint64 constants, but whoever wrote this macro didn't know about it. While at it, fix unsafe under-parenthesization of arguments. That might be moot, because there are already good reasons not to use the macro on anything more complicated than a simple variable, but it's still poor practice. Per buildfarm warnings.
* Make tablesample work with partitioned tables.Robert Haas2017-02-24
| | | | | | | | This was an oversight in the original partitioning commit. Amit Langote, reviewed by David Fetter Discussion: http://postgr.es/m/59af6590-8ace-04c4-c36c-ea35d435c60e@lab.ntt.co.jp
* Add an Assert that enum_cmp_internal() gets passed an FmgrInfo pointer.Tom Lane2017-02-23
| | | | | | | | | | | | If someone were to try to call one of the enum comparison functions using DirectFunctionCallN, it would very likely seem to work, because only in unusual cases does enum_cmp_internal() need to access the typcache. But once such a case occurred, code like that would crash with a null pointer dereference. To make an oversight of that sort less likely to escape detection, add a non-bypassable Assert that fcinfo->flinfo isn't NULL. Discussion: https://postgr.es/m/25226.1487900067@sss.pgh.pa.us
* Consistently declare timestamp variables as TimestampTz.Tom Lane2017-02-23
| | | | | | | | | | | | | | | | | | | Twiddle the replication-related code so that its timestamp variables are declared TimestampTz, rather than the uninformative "int64" that was previously used for meant-to-be-always-integer timestamps. This resolves the int64-vs-TimestampTz declaration inconsistencies introduced by commit 7c030783a, though in the opposite direction to what was originally suggested. This required including datatype/timestamp.h in a couple more places than before. I decided it would be a good idea to slim down that header by not having it pull in <float.h> etc, as those headers are no longer at all relevant to its purpose. Unsurprisingly, a small number of .c files turn out to have been depending on those inclusions, so add them back in the .c files as needed. Discussion: https://postgr.es/m/26788.1487455319@sss.pgh.pa.us Discussion: https://postgr.es/m/27694.1487456324@sss.pgh.pa.us
* Remove now-dead code for !HAVE_INT64_TIMESTAMP.Tom Lane2017-02-23
| | | | | | | This is a basically mechanical removal of #ifdef HAVE_INT64_TIMESTAMP tests and the negative-case controlled code. Discussion: https://postgr.es/m/26788.1487455319@sss.pgh.pa.us
* Remove pg_control's enableIntTimes field.Tom Lane2017-02-23
| | | | | | | | | | | | | | | We don't need it any more. pg_controldata continues to report that date/time type storage is "64-bit integers", but that's now a hard-wired behavior not something it sees in the data. This avoids breaking pg_upgrade, and perhaps other utilities that inspect pg_control this way. Ditto for pg_resetwal. I chose to remove the "bigint_timestamps" output column of pg_control_init(), though, as that function hasn't been around long and probably doesn't have ossified users. Discussion: https://postgr.es/m/26788.1487455319@sss.pgh.pa.us
* De-support floating-point timestamps.Tom Lane2017-02-23
| | | | | | | | | | | | | | | | | | | | | | | | Per discussion, the time has come to do this. The handwriting has been on the wall at least since 9.0 that this would happen someday, whenever it got to be too much of a burden to support the float-timestamp option. The triggering factor now is the discovery that there are multiple bugs in the code that attempts to implement use of integer timestamps in the replication protocol even when the server is built for float timestamps. The internal float timestamps leak into the protocol fields in places. While we could fix the identified bugs, there's a very high risk of introducing more. Trying to build a wall that would positively prevent mixing integer and float timestamps is more complexity than we want to undertake to maintain a long-deprecated option. The fact that these bugs weren't found through testing also indicates a lack of interest in float timestamps. This commit disables configure's --disable-integer-datetimes switch (it'll still accept --enable-integer-datetimes, though), removes direct references to USE_INTEGER_DATETIMES, and removes discussion of float timestamps from the user documentation. A considerable amount of code is rendered dead by this, but removing that will occur as separate mop-up. Discussion: https://postgr.es/m/26788.1487455319@sss.pgh.pa.us
* Fix logical replication with different encodingsPeter Eisentraut2017-02-23
| | | | | reported by Shinoda, Noriyoshi <noriyoshi.shinoda@hpe.com>; partial patch by Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
* Remove deprecated COMMENT ON RULE syntaxPeter Eisentraut2017-02-23
| | | | | This was only used for allowing upgrades from pre-7.3 instances, which was a long time ago.
* Correctly handle array pseudotypes in to_json and to_jsonbAndrew Dunstan2017-02-22
| | | | | | | Columns with array pseudotypes have not been identified as arrays, so they have been rendered as strings in the json and jsonb conversion routines. This change allows them to be rendered as json arrays, making it possible to deal correctly with the anyarray columns in pg_stats.
* Pass the source text for a parallel query to the workers.Robert Haas2017-02-22
| | | | | | | | | With this change, you can see the query that a parallel worker is executing in pg_stat_activity, and if the worker crashes you can see what query it was executing when it crashed. Rafia Sabih, reviewed by Kuntal Ghosh and Amit Kapila and slightly revised by me.
* Shut down Gather's children before shutting down Gather itself.Robert Haas2017-02-22
| | | | | | | | | | | | | It turns out that the original shutdown order here does not work well. Multiple people attempting to develop further parallel query patches have discovered that they need to do cleanup before the DSM goes away, and you can't do that if the parent node gets cleaned up first. Patch by me, reviewed by KaiGai Kohei and Dilip Kumar. Discussion: http://postgr.es/m/CA+TgmoY6bOc1YnhcAQnMfCBDbsJzROQ3sYxSAL-SYB5tMJcTKg@mail.gmail.com Discussion: http://postgr.es/m/9A28C8860F777E439AA12E8AEA7694F8012AEB82@BPXM15GP.gisp.nec.co.jp Discussion: http://postgr.es/m/CA+TgmoYuPOc=+xrG1v0fCsoLbKAab9F1ddOeaaiLMzKOiBar1Q@mail.gmail.com
* Suppress unused-variable warning.Tom Lane2017-02-21
| | | | | | Rearrange so we don't have an unused variable in disable-cassert case. Discussion: https://postgr.es/m/CAMkU=1x63f2QyFTeas83xJqD+Hm1PBuok1LrzYzS-OngDzYOVA@mail.gmail.com
* Fix sloppy handling of corner-case errors in fd.c.Tom Lane2017-02-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Several places in fd.c had badly-thought-through handling of error returns from lseek() and close(). The fact that those would seldom fail on valid FDs is probably the reason we've not noticed this up to now; but if they did fail, we'd get quite confused. LruDelete and LruInsert actually just Assert'd that lseek never fails, which is pretty awful on its face. In LruDelete, we indeed can't throw an error, because that's likely to get called during error abort and so throwing an error would probably just lead to an infinite loop. But by the same token, throwing an error from the close() right after that was ill-advised, not to mention that it would've left the LRU state corrupted since we'd already unlinked the VFD from the list. I also noticed that really, most of the time, we should know the current seek position and it shouldn't be necessary to do an lseek here at all. As patched, if we don't have a seek position and an lseek attempt doesn't give us one, we'll close the file but then subsequent re-open attempts will fail (except in the somewhat-unlikely case that a FileSeek(SEEK_SET) call comes between and allows us to re-establish a known target seek position). This isn't great but it won't result in any state corruption. Meanwhile, having an Assert instead of an honest test in LruInsert is really dangerous: if that lseek failed, a subsequent read or write would read or write from the start of the file, not where the caller expected, leading to data corruption. In both LruDelete and FileClose, if close() fails, just LOG that and mark the VFD closed anyway. Possibly leaking an FD is preferable to getting into an infinite loop or corrupting the VFD list. Besides, as far as I can tell from the POSIX spec, it's unspecified whether or not the file has been closed, so treating it as still open could be the wrong thing anyhow. I also fixed a number of other places that were being sloppy about behaving correctly when the seekPos is unknown. Also, I changed FileSeek to return -1 with EINVAL for the cases where it detects a bad offset, rather than throwing a hard elog(ERROR). It seemed pretty inconsistent that some bad-offset cases would get a failure return while others got elog(ERROR). It was missing an offset validity check for the SEEK_CUR case on a closed file, too. Back-patch to all supported branches, since all this code is fundamentally identical in all of them. Discussion: https://postgr.es/m/2982.1487617365@sss.pgh.pa.us
* Add tests for two-phase commitAlvaro Herrera2017-02-21
| | | | | | | | | | There's some ongoing performance work on this area, so let's make sure we don't break things. Extracted from a larger patch originally by Stas Kelvich. Authors: Stas Kelvich, Nikhil Sontakke, Michael Paquier Discussion: https://postgr.es/m/CAMGcDxfsuLLOg=h5cTg3g77Jjk-UGnt=RW7zK57zBSoFsapiWA@mail.gmail.com
* Fix whitespacePeter Eisentraut2017-02-21
|
* Fix typo in comment.Fujii Masao2017-02-22
| | | | neha khatri
* Fix connection leak in DROP SUBSCRIPTION command.Fujii Masao2017-02-22
| | | | | Previously the command forgot to close the connection to the publisher when it failed to drop the replication slot.
* Make walsender always initialize the buffers.Fujii Masao2017-02-22
| | | | | | | | | | | | | Walsender uses the local buffers for each outgoing and incoming message. Previously when creating replication slot, walsender forgot to initialize one of them and which can cause the segmentation fault error. To fix this issue, this commit changes walsender so that it always initialize them before it executes the requested replication command. Back-patch to 9.4 where replication slot was introduced. Problem report and initial patch by Stas Kelvich, modified by me. Report: https://www.postgresql.org/message-id/A1E9CB90-1FAC-4CAD-8DBA-9AA62A6E97C5@postgrespro.ru
* Remove confusing comment about unsupported feature.Fujii Masao2017-02-22
| | | | | The initial table synchronization feature has not been supported yet, but there was the confusing header comment about it in logical/worker.c.
* Use less-generic table name in new regression test case.Tom Lane2017-02-21
| | | | | | | | | Creating global objects named "foo" isn't an especially wise thing, but especially not in a test script that has already used that name for something else, and most especially not in a script that runs in parallel with other scripts that use that name :-( Per buildfarm.
* Make more use of castNode()Peter Eisentraut2017-02-21
|
* Drop support for Python 2.3Peter Eisentraut2017-02-21
| | | | | | | | | | | There is no specific reason for this right now, but keeping support for old Python versions around indefinitely increases the maintenance burden. The oldest supported Python version is now Python 2.4, which is still shipped in RHEL/CentOS 5 by default. In configure, add a check for the required Python version and give a friendly error message for an old version, instead of relying on an obscure build error later on.
* Improve error message for misuse of TZ, tz, OF formatting patterns.Tom Lane2017-02-20
| | | | | | | | | | Be specific about which pattern is being complained of, and avoid saying "it's not supported in to_date", which is just confusing if the error is actually coming out of to_timestamp. We can phrase it as "is only supported in to_char", instead. Also, use the term "formatting field" not "format pattern", because other error messages in the same file prefer that terminology. (This isn't terribly consistent with the documentation, so maybe we should change all these error messages?)
* Make src/interfaces/libpq/test clean up after itself.Tom Lane2017-02-19
| | | | | It failed to remove a .o file during "make clean", and it lacked a .gitignore file entirely.
* Dept of second thoughts: rename new perl script.Tom Lane2017-02-19
| | | | | | | It didn't take long at all for me to become irritated that the original choice of name for this script resulted in "warning" showing up in several places in build logs, because I tend to grep for that. Change the script name to avoid that.
* Adjust PL/Tcl regression test to dodge a possible bug or zone dependency.Tom Lane2017-02-19
| | | | | | | | | | | One case in the PL/Tcl tests is observed to fail on RHEL5 with a Turkish time zone setting. It's not clear if this is an old Tcl bug or something odd about the zone data, but in any case that test is meant to see if the Tcl [clock] command works at all, not what its corner-case behaviors are. Therefore we have no need to test exactly which week a Sunday midnight is considered to fall into. Probe the following Tuesday instead. Discussion: https://postgr.es/m/797.1487517822@sss.pgh.pa.us
* Suppress "unused variable" warnings with older versions of flex.Tom Lane2017-02-19
| | | | | | | | | | | | | | Versions of flex before 2.5.36 might generate code that results in an "unused variable" warning, when using %option reentrant. Historically we've worked around that by specifying -Wno-error, but that's an unsatisfying solution. The official "fix" for this was just to insert a dummy reference to the variable, so write a small perl script that edits the generated C code similarly. The MSVC side of this is untested, but the buildfarm should soon reveal if I broke that. Discussion: https://postgr.es/m/25456.1487437842@sss.pgh.pa.us
* Make partitions automatically inherit OIDs.Robert Haas2017-02-19
| | | | | | | | | | Previously, if the parent was specified as WITH OIDS, each child also had to be explicitly specified as WITH OIDS. Amit Langote, per a report from Simon Riggs. Some additional work on the documentation changes by me. Discussion: http://postgr.es/m/CANP8+jJBpWocfKrbJcaf3iBt9E3U=WPE_NC8YE6rye+YJ1sYnQ@mail.gmail.com
* Add optimizer and executor support for parallel index-only scans.Robert Haas2017-02-19
| | | | | | | | | | | | | Commit 5262f7a4fc44f651241d2ff1fa688dd664a34874 added similar support for parallel index scans; this extends that work to index-only scans. As with parallel index scans, this requires support from the index AM, so currently parallel index-only scans will only be possible for btree indexes. Rafia Sabih, reviewed and tested by Rahila Syed, Tushar Ahuja, and Amit Kapila Discussion: http://postgr.es/m/CAOGQiiPEAs4C=TBp0XShxBvnWXuzGL2u++Hm1=qnCpd6_Mf8Fw@mail.gmail.com
* Make dsa_allocate interface more like MemoryContextAlloc.Robert Haas2017-02-19
| | | | | | | | | | | | | | | | A new function dsa_allocate_extended now takes flags which indicate that huge allocations should be permitted, that out-of-memory conditions should not throw an error, and/or that the returned memory should be zero-filled, just like MemoryContextAllocateExtended. Commit 9acb85597f1223ac26a5b19a9345849c43d0ff54, which added dsa_allocate0, was broken because it failed to account for the possibility that dsa_allocate() might return InvalidDsaPointer. This fixes that problem along the way. Thomas Munro, with some comment changes by me. Discussion: http://postgr.es/m/CA+Tgmobt7CcF_uQP2UQwWmu4K9qCHehMJP9_9m1urwP8hbOeHQ@mail.gmail.com
* Fix help message for pg_basebackup -RMagnus Hagander2017-02-18
| | | | | | The recovery.conf file that's generated is specifically for replication, and not needed (or wanted) for regular backup restore, so indicate that in the message.
* Optimize query for information_schema.constraint_column_usagePeter Eisentraut2017-02-17
| | | | | | | | | | The way the old query was written prevented some join optimizations because the join conditions were hidden inside a CASE expression. With a large number of constraints, the query became unreasonably slow. The new query performs much better. From: Alexey Bashtanov <bashtanov@imap.cc> Reviewed-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
* pg_dump: Message style improvementsPeter Eisentraut2017-02-17
|
* Document usage of COPT environment variable for adjusting configure flags.Tom Lane2017-02-17
| | | | | | | Also add to the existing rather half-baked description of PROFILE, which does exactly the same thing, but I think people use it differently. Discussion: https://postgr.es/m/16461.1487361849@sss.pgh.pa.us
* pg_dump: Fix typo in queryPeter Eisentraut2017-02-17
| | | | | This could lead to incorrect dumping of language privileges in some cases, which is probably a rare situation.
* Remove redundant coverage targetPeter Eisentraut2017-02-17
| | | | | This was probably forgotten to be removed when general recursion support was added.
* Fix typo on commentPeter Eisentraut2017-02-16
|
* Add new function dsa_allocate0.Robert Haas2017-02-16
| | | | | | | This does the same thing as dsa_allocate, except that the memory is guaranteed to be zero-filled on return. Dilip Kumar, adjusted by me.
* Avoid crash in ALTER TABLE not_partitioned DETACH PARTITION.Robert Haas2017-02-16
| | | | Amit Langote, reviewed and slightly changed by me.
* Formatting and docs corrections for logical decoding output plugins.Tom Lane2017-02-15
| | | | | | | | | Make the typedefs for output plugins consistent with project style; they were previously not even consistent with each other as to layout or inclusion of parameter names. Make the documentation look the same, and fix errors therein (missing and misdescribed parameters). Back-patch because of the documentation bugs.
* Make sure that hash join's bulk-tuple-transfer loops are interruptible.Tom Lane2017-02-15
| | | | | | | | | | | | | | | | | | The loops in ExecHashJoinNewBatch(), ExecHashIncreaseNumBatches(), and ExecHashRemoveNextSkewBucket() are all capable of iterating over many tuples without ever doing a CHECK_FOR_INTERRUPTS, so that the backend might fail to respond to SIGINT or SIGTERM for an unreasonably long time. Fix that. In the case of ExecHashJoinNewBatch(), it seems useful to put the added CHECK_FOR_INTERRUPTS into ExecHashJoinGetSavedTuple() rather than directly in the loop, because that will also ensure that both principal code paths through ExecHashJoinOuterGetTuple() will do a CHECK_FOR_INTERRUPTS, which seems like a good idea to avoid surprises. Back-patch to all supported branches. Tom Lane and Thomas Munro Discussion: https://postgr.es/m/6044.1487121720@sss.pgh.pa.us
* Fix tab completion for "ALTER SYSTEM SET variable ...".Tom Lane2017-02-15
| | | | | | | | | | | | | It wouldn't complete "TO" after the variable name, which is certainly minor enough. But since we do complete "TO" after "SET variable ...", and since this case used to work pre-9.6, I think this is a bug. Also, fix the query used to collect the variable names; whoever last touched it evidently didn't understand how the pieces are supposed to fit together. It accidentally worked anyway, because readline ignores irrelevant completions, but it was randomly unlike the ones around it, and could be a source of actual bugs if someone copied it as a prototype for another query.
* Fix YA unwanted behavioral difference with operator_precedence_warning.Tom Lane2017-02-15
| | | | | | | | | | | | | | | | Jeff Janes noted that the error cursor position shown for some errors would vary when operator_precedence_warning is turned on. We'd prefer that option to have no undocumented effects, so this isn't desirable. To fix, make sure that an AEXPR_PAREN node has the same exprLocation as its child node. (Note: it would be a little cheaper to use @2 here instead of an exprLocation call, but there are cases where that wouldn't produce the identical answer, so don't do it like that.) Back-patch to 9.5 where this feature was introduced. Discussion: https://postgr.es/m/CAMkU=1ykK+VhhcQ4Ky8KBo9FoaUJH3f3rDQB8TkTXi-ZsBRUkQ@mail.gmail.com