summaryrefslogtreecommitdiff
path: root/contrib
AgeCommit message (Collapse)Author
2014-01-07Add more use of psprintf()Peter Eisentraut
2014-01-04Fix typo in comment.Tom Lane
classifyClauses was renamed to classifyConditions somewhere along the line, but this comment didn't get the memo. Ian Barwick
2014-01-02Fix contrib/pg_upgrade to clean all the cruft made during "make check".Tom Lane
Although these files get cleaned up if the test runs to completion, a failure partway through leaves trash all over the floor. The Makefile ought to be bright enough to get rid of it when you say "make clean".
2013-12-23Support ordered-set (WITHIN GROUP) aggregates.Tom Lane
This patch introduces generic support for ordered-set and hypothetical-set aggregate functions, as well as implementations of the instances defined in SQL:2008 (percentile_cont(), percentile_disc(), rank(), dense_rank(), percent_rank(), cume_dist()). We also added mode() though it is not in the spec, as well as versions of percentile_cont() and percentile_disc() that can compute multiple percentile values in one pass over the data. Unlike the original submission, this patch puts full control of the sorting process in the hands of the aggregate's support functions. To allow the support functions to find out how they're supposed to sort, a new API function AggGetAggref() is added to nodeAgg.c. This allows retrieval of the aggregate call's Aggref node, which may have other uses beyond the immediate need. There is also support for ordered-set aggregates to install cleanup callback functions, so that they can be sure that infrastructure such as tuplesort objects gets cleaned up. In passing, make some fixes in the recently-added support for variadic aggregates, and make some editorial adjustments in the recent FILTER additions for aggregates. Also, simplify use of IsBinaryCoercible() by allowing it to succeed whenever the target type is ANY or ANYELEMENT. It was inconsistent that it dealt with other polymorphic target types but not these. Atri Sharma and Andrew Gierth; reviewed by Pavel Stehule and Vik Fearing, and rather heavily editorialized upon by Tom Lane
2013-12-22Change the way we mark tuples as frozen.Robert Haas
Instead of changing the tuple xmin to FrozenTransactionId, the combination of HEAP_XMIN_COMMITTED and HEAP_XMIN_INVALID, which were previously never set together, is now defined as HEAP_XMIN_FROZEN. A variety of previous proposals to freeze tuples opportunistically before vacuum_freeze_min_age is reached have foundered on the objection that replacing xmin by FrozenTransactionId might hinder debugging efforts when things in this area go awry; this patch is intended to solve that problem by keeping the XID around (but largely ignoring the value to which it is set). Third-party code that checks for HEAP_XMIN_INVALID on tuples where HEAP_XMIN_COMMITTED might be set will be broken by this change. To fix, use the new accessor macros in htup_details.h rather than consulting the bits directly. HeapTupleHeaderGetXmin has been modified to return FrozenTransactionId when the infomask bits indicate that the tuple is frozen; use HeapTupleHeaderGetRawXmin when you already know that the tuple isn't marked commited or frozen, or want the raw value anyway. We currently do this in routines that display the xmin for user consumption, in tqual.c where it's known to be safe and important for the avoidance of extra cycles, and in the function-caching code for various procedural languages, which shouldn't invalidate the cache just because the tuple gets frozen. Robert Haas and Andres Freund
2013-12-20pg_prewarm, a contrib module for prewarming relationd data.Robert Haas
Patch by me. Review by Álvaro Herrera, Amit Kapila, Jeff Janes, Gurjeet Singh, and others.
2013-12-19Move pg_upgrade_support global variables to their own include fileBruce Momjian
Previously their declarations were spread around to avoid accidental access.
2013-12-18Fix compiler warning.Robert Haas
get_user_name returns const char *, but we were assigning the result to a char * variable.
2013-12-18Fix incorrect error message reported for non-existent usersBruce Momjian
Previously, lookups of non-existent user names could return "Success"; it will now return "User does not exist" by resetting errno. This also centralizes the user name lookup code in libpgport. Report and analysis by Nicolas Marchildon; patch by me
2013-12-12Fix progress logging when scale factor is large.Tatsuo Ishii
Integer overflow showed minus percent and minus remaining time something like this. 239300000 of 3800000000 tuples (-48%) done (elapsed 226.86 s, remaining -696.10 s).
2013-12-08Fix pg_stat_statements build on 32-bit systemsMagnus Hagander
Peter Geoghegan
2013-12-08Fix performance regression in dblink connection speed.Joe Conway
Previous commit e5de601267d98c5d60df6de8d436685c7105d149 modified dblink to ensure client encoding matched the server. However the added PQsetClientEncoding() call added significant overhead. Restore original performance in the common case where client encoding already matches server encoding by doing nothing in that case. Applies to all active branches. Issue reported and work sponsored by Zonar Systems.
2013-12-07Expose qurey ID in pg_stat_statements view.Fujii Masao
The query ID is the internal hash identifier of the statement, and was not available in pg_stat_statements view so far. Daniel Farina, Sameer Thakur and Peter Geoghegan, reviewed by me.
2013-12-04build: pass EXTRA_REGRESS_OPTS to secondary regression testsBruce Momjian
Christoph Berg
2013-12-04Fix whitespacePeter Eisentraut
2013-12-03libpq: change PQconndefaults() to ignore invalid service filesBruce Momjian
Previously missing or invalid service files returned NULL. Also fix pg_upgrade to report "out of memory" for a null return from PQconndefaults(). Patch by Steve Singer, rewritten by me
2013-11-30pg_upgrade: Handle default_transaction_read_only settingsBruce Momjian
Setting default_transaction_read_only=true could prevent pg_upgrade from completing, so prepend default_transaction_read_only=false to PGOPTIONS.
2013-11-24Defend against bad trigger definitions in contrib/lo's lo_manage() trigger.Tom Lane
This function formerly crashed if called as a statement-level trigger, or if a column-name argument wasn't given. In passing, add the trigger name to all error messages from the function. (None of them are expected cases, so this shouldn't pose any compatibility risk.) Marc Cousin, reviewed by Sawada Masahiko
2013-11-22Fix quoting in help messages in uuid-ossp extension scripts.Tom Lane
The command we're telling people to type needs to include double-quoting around the unfortunately-chosen extension name. Twiddle the textual quoting so that it looks somewhat sane. Per gripe from roadrunner6.
2013-11-22Support multi-argument UNNEST(), and TABLE() syntax for multiple functions.Tom Lane
This patch adds the ability to write TABLE( function1(), function2(), ...) as a single FROM-clause entry. The result is the concatenation of the first row from each function, followed by the second row from each function, etc; with NULLs inserted if any function produces fewer rows than others. This is believed to be a much more useful behavior than what Postgres currently does with multiple SRFs in a SELECT list. This syntax also provides a reasonable way to combine use of column definition lists with WITH ORDINALITY: put the column definition list inside TABLE(), where it's clear that it doesn't control the ordinality column as well. Also implement SQL-compliant multiple-argument UNNEST(), by turning UNNEST(a,b,c) into TABLE(unnest(a), unnest(b), unnest(c)). The SQL standard specifies TABLE() with only a single function, not multiple functions, and it seems to require an implicit UNNEST() which is not what this patch does. There may be something wrong with that reading of the spec, though, because if it's right then the spec's TABLE() is just a pointless alternative spelling of UNNEST(). After further review of that, we might choose to adopt a different syntax for what this patch does, but in any case this functionality seems clearly worthwhile. Andrew Gierth, reviewed by Zoltán Böszörményi and Heikki Linnakangas, and significantly revised by me
2013-11-19pg_upgrade: avoid ALTER COLUMN TYPE on inherited columnsBruce Momjian
This only affects upgrades from 8.3 currently, and is harmless as the child just generates an error in the script, but we should get it right in case we ever need this for more complex uses. Per report from Peter Eisentraut
2013-11-19pg_upgrade: Report full disk betterPeter Eisentraut
Previously, pg_upgrade would abort copy_file() on a short write without setting errno, which the caller would report as an error with the message "Success". We assume ENOSPC in that case, as we do elsewhere in the code. Also set errno in some other error cases in copy_file() to avoid bogus "Success" error messages. This was broken in 6b711cf37c228749b6a8cef50e16e3c587d18dd4, so 9.2 and before are OK.
2013-11-18unaccent: Revert patch 9299f6179838cef8aa1123f6fb76f0d3d6f2deccBruce Momjian
The reverted patch to change functions from strict to immutable was incorrect and needs additional research.
2013-11-18Use cstring_to_text_with_len when length is known.Robert Haas
This avoids a potentially-expensive extra call to strlen(). David Rowley
2013-11-16pg_upgrade: Fix some whitespace odditiesPeter Eisentraut
2013-11-16Remove pgbench's hardwired limit on line length in custom script files.Tom Lane
pgbench formerly failed on lines longer than BUFSIZ, unexpectedly splitting them into multiple commands. Allow it to work with any length of input line. Sawada Masahiko
2013-11-10Fix whitespace issues found by git diff --check, add gitattributesPeter Eisentraut
Set per file type attributes in .gitattributes to fine-tune whitespace checks. With the associated cleanups, the tree is now clean for git
2013-11-07Silence benign warnings from clang version 3.0-6ubuntu3.Kevin Grittner
2013-10-31Use appendStringInfoString instead of appendStringInfo where possible.Robert Haas
This shaves a few cycles, and generally seems like good programming practice. David Rowley
2013-10-28Work around NetBSD shell issue in pg_upgrade test script.Andrew Dunstan
The NetBSD shell apparently returns non-zero from an unset command if the variable is already unset. This matters when, as in pg_upgrade's test.sh, we are working under 'set -e'. To protect against this, we first set the PG variables to an empty string before unsetting them completely. Error found on buildfarm member coypu, solution from Rémi Zara.
2013-10-22Replace pg_asprintf() with psprintf().Tom Lane
This eliminates an awkward coding pattern that's also unnecessarily inconsistent with backend coding. psprintf() is now the thing to use everywhere.
2013-10-22Adjust cube.out expected output for new test queries.Heikki Linnakangas
Previous commit modified the test case, but I didn't update cube.out expected output file in previous commit because it was not needed by the platforms I have easy access to. Buildfarm animal 'dugong', running "Debian 4.0 icc 10.1.011 ia64", has now gone red because of that, so update it now. Also adjust cube_3.out. According to git history, it was added to support 64-bit MinGW. There is no such animal in the buildfarm, so I'm doing this blindly, but it was added quite recently so maybe someone still cares.
2013-10-21Extend cube on-disk format to pack points more tightly.Heikki Linnakangas
If the lower left and upper right corners of a cube are the same, set a flag in the cube header, and only store one copy of the coordinates. That cuts the on-disk size into half for the common case that the cube datatype is used to represent points rather than boxes. The new format is backwards-compatible with the old one, so pg_upgrade still works. However, to get the space savings, the data needs to be rewritten. A simple VACUUM FULL or REINDEX is not enough, as the old Datums will just be moved to the new heap/index as is. A pg_dump and reload, or something similar like casting to text and back, will do the trick. This patch deliberately doesn't update all the alternative expected output files, as I don't have access to machines that produce those outputs. I'm not sure if they are still relevant, but if they are, the buildfarm will tell us and produce the diff required to fix it. If none of the buildfarm animals need them, they should be removed altogether. Patch by Stas Kelvich.
2013-10-17Return valid json when converting an empty hstore.Andrew Dunstan
Oskari Saarenmaa.
2013-10-13Add use of asprintf()Peter Eisentraut
Add asprintf(), pg_asprintf(), and psprintf() to simplify string allocation and composition. Replacement implementations taken from NetBSD. Reviewed-by: Álvaro Herrera <alvherre@2ndquadrant.com> Reviewed-by: Asif Naeem <anaeem.it@gmail.com>
2013-10-10pg_upgrade: Split off pg_fatal() from pg_log()Peter Eisentraut
This allows decorating pg_fatal() with noreturn compiler hints, leading to better diagnostics. Reviewed-by: Marko Tiikkaja <marko@joh.to>
2013-10-09Add record_image_ops opclass for matview concurrent refresh.Kevin Grittner
REFRESH MATERIALIZED VIEW CONCURRENTLY was broken for any matview containing a column of a type without a default btree operator class. It also did not produce results consistent with a non- concurrent REFRESH or a normal view if any column was of a type which allowed user-visible differences between values which compared as equal according to the type's default btree opclass. Concurrent matview refresh was modified to use the new operators to solve these problems. Documentation was added for record comparison, both for the default btree operator class for record, and the newly added operators. Regression tests now check for proper behavior both for a matview with a box column and a matview containing a citext column. Reviewed by Steve Singer, who suggested some of the doc language.
2013-10-08unaccent: mark unaccent() functions as immutableBruce Momjian
Suggestion from Pavel Stehule
2013-10-06pgbench: Comment on thread timing hazards.Noah Misch
Reviewed by Fabien COELHO.
2013-10-05pgbench: Elaborate latency reporting.Noah Misch
Isolate transaction latency (elapsed time between submitting first command and receiving response to last command) from client-side delays pertaining to the --rate schedule. Under --rate, report schedule lag as defined in the documentation. Report latency standard deviation whenever we collect the measurements to do so. All of these changes affect --progress messages and the final report. Fabien COELHO, reviewed by Pavel Stehule.
2013-10-05pgbench: Remove stray use of "float" math.Noah Misch
Oversight in commit 4a87f308b33457670f9ab4bc622678e5d285b9c2. Fabien COELHO
2013-10-01Remove broken PGXS code for pg_xlogdumpAlvaro Herrera
With the PGXS boilerplate in place, pg_xlogdump currently fails with an ominous error message that certain targets cannot be built because certain files do not exist. Remove that and instead throw a quick error message alerting the user of the actual problem, which should be easier to diagnose that the statu quo. Andres Freund
2013-09-30Add missing condition for pg_depend in hstore migration script.Andrew Dunstan
Error noted by Andres Freund.
2013-09-30Correct comment of pgbench "filler" columns.Fujii Masao
Pavan Deolasee
2013-09-30Fix makefile broken by hstore fix.Andrew Dunstan
2013-09-29Use a new hstore extension version for added json functions.Andrew Dunstan
This should have been done when the json functionality was added to hstore in 9.3.0. To handle this correctly, the upgrade script therefore uses conditional logic by using plpgsql in a DO statement to add the two new functions and the new cast. If hstore_to_json_loose is detected as already present and dependent on the hstore extension nothing is done. This will require that the database be loaded with plpgsql. People who have installed the earlier and spurious 1.1 version of hstore will need to do: ALTER EXTENSION hstore UPDATE; to pick up the new functions properly.
2013-09-26pgbench: Correct for bias in --rate schedule generation.Noah Misch
Previous code gave a mean delay 0.44% below target. This change also has the effect of increasing the maximum possible delay. Fabien COELHO
2013-09-23pgbench: Tweak documentation.Noah Misch
Fabien COELHO
2013-09-23pg_upgrade: more C comment fixesBruce Momjian
2013-09-23pg_upgrade: fix C comment typoBruce Momjian