summaryrefslogtreecommitdiff
path: root/contrib
AgeCommit message (Collapse)Author
2014-01-28Update comment.Tom Lane
generate_normalized_query() no longer needs to truncate text, but this one comment didn't get the memo. Per Peter Geoghegan.
2014-01-27Keep pg_stat_statements' query texts in a file, not in shared memory.Tom Lane
This change allows us to eliminate the previous limit on stored query length, and it makes the shared-memory hash table very much smaller, allowing more statements to be tracked. (The default value of pg_stat_statements.max is therefore increased from 1000 to 5000.) In typical scenarios, the hash table can be large enough to hold all the statements commonly issued by an application, so that there is little "churn" in the set of tracked statements, and thus little need to do I/O to the file. To further reduce the need for I/O to the query-texts file, add a way to retrieve all the columns of the pg_stat_statements view except for the query text column. This is probably not of much interest for human use but it could be exploited by programs, which will prefer using the queryid anyway. Ordinarily, we'd need to bump the extension version number for the latter change. But since we already advanced pg_stat_statements' version number from 1.1 to 1.2 in the 9.4 development cycle, it seems all right to just redefine what 1.2 means. Peter Geoghegan, reviewed by Pavel Stehule
2014-01-27Relax the requirement that all lwlocks be stored in a single array.Robert Haas
This makes it possible to store lwlocks as part of some other data structure in the main shared memory segment, or in a dynamic shared memory segment. There is still a main LWLock array and this patch does not move anything out of it, but it provides necessary infrastructure for doing that in the future. This change is likely to increase the size of LWLockPadded on some platforms, especially 32-bit platforms where it was previously only 16 bytes. Patch by me. Review by Andres Freund and KaiGai Kohei.
2014-01-22Compress GIN posting lists, for smaller index size.Heikki Linnakangas
GIN posting lists are now encoded using varbyte-encoding, which allows them to fit in much smaller space than the straight ItemPointer array format used before. The new encoding is used for both the lists stored in-line in entry tree items, and in posting tree leaf pages. To maintain backwards-compatibility and keep pg_upgrade working, the code can still read old-style pages and tuples. Posting tree leaf pages in the new format are flagged with GIN_COMPRESSED flag, to distinguish old and new format pages. Likewise, entry tree tuples in the new format have a GIN_ITUP_COMPRESSED flag set in a bit that was previously unused. This patch bumps GIN_CURRENT_VERSION from 1 to 2. New indexes created with version 9.4 will therefore have version number 2 in the metapage, while old pg_upgraded indexes will have version 1. The code treats them the same, but it might be come handy in the future, if we want to drop support for the uncompressed format. Alexander Korotkov and me. Reviewed by Tomas Vondra and Amit Langote.
2014-01-20Remove pg_stat_statements--1.1.sql.Tom Lane
Commit 91484409bdd17f330d10671d388b72d4ef1451d7 should have removed this file, not just reduced it to zero size.
2014-01-17Minor code beautification in contrib/sslinfo.Tom Lane
Static-ify some functions that didn't need to be exported, and improve a couple of comments. Gurjeet Singh
2014-01-17Add gen_random_uuid() to contrib/pgcrypto.Tom Lane
This function provides a way of generating version 4 (pseudorandom) UUIDs based on pgcrypto's PRNG. The main reason for doing this is that the OSSP UUID library depended on by contrib/uuid-ossp is becoming more and more of a porting headache, so we need an alternative for people who can't install that. A nice side benefit though is that this implementation is noticeably faster than uuid-ossp's uuid_generate_v4() function. Oskari Saarenmaa, reviewed by Emre Hasegeli
2014-01-17Prevent integer overflow with --progress >= 2148Heikki Linnakangas
If --progress=2148 or higher was given, the calculation of the next time to report overflowed, and pgbench would print a progress report very frequently. Kingter Wang
2014-01-15Fix whitespacePeter Eisentraut
2014-01-15test_shm_mq: Try again to fix compiler warning.Robert Haas
Per complaints from Andres Freund and Tom Lane.
2014-01-15test_shm_mq: Fix checks for negative queue size.Robert Haas
Noted while addressing compiler warnings pointed out on pgsql-hackers.
2014-01-15Fix compiler warning.Robert Haas
Kevin Gritter reports that his compiler complains about inq and outq being possibly-uninitialized at the point where they are passed to shm_mq_attach(). They are initialized by the call to setup_dynamic_shared_memory, but apparently his compiler is inlining that function and then having doubts about whether the for loop will always execute at least once. Fix by initializing them to NULL.
2014-01-15Fix compiler warning: Size isn't 64 bits on 32 bit platforms.Robert Haas
Report by Peter Eisentraut.
2014-01-14Test code for shared memory message queue facility.Robert Haas
This code is intended as a demonstration of how the dynamic shared memory and dynamic background worker facilities can be used to establish a group of coooperating processes which can coordinate their activities using the shared memory message queue facility. By itself, the code does nothing particularly interesting: it simply allows messages to be passed through a loop of workers and back to the original process. But it's a useful unit test, in addition to its demonstration value.
2014-01-13Fix possible buffer overrun in contrib/pg_trgm.Tom Lane
Allow for the possibility that folding a string to lower case makes it longer (due to replacing a character with a longer multibyte character). This doesn't change the number of trigrams that will be extracted, but it does affect the required size of an intermediate buffer in generate_trgm(). Per bug #8821 from Ufuk Kayserilioglu. Also install some checks that the input string length is not so large as to cause overflow in the calculations of palloc request sizes. Back-patch to all supported versions.
2014-01-13Fix calculation of ISMN check digit.Heikki Linnakangas
This has always been broken, so back-patch to all supported versions. Fabien COELHO
2014-01-10Adjust pg_upgrade for move of username lookup functions to /commonBruce Momjian
2014-01-09pgcrypto: Make header files stand alonePeter Eisentraut
pgp.h used to require including mbuf.h and px.h first. Include those in pgp.h, so that it can be used without prerequisites. Remove mbuf.h inclusions in .c files where mbuf.h features are not used directly. (px.h was always used.)
2014-01-08pg_upgrade: Fix fatal error handlingPeter Eisentraut
Restore exiting when pg_log(PG_FATAL) is called directly instead of calling pg_fatal(). Fault introduced in 264aa14a2f687eba8c8cc2a5b6cbd6397973da98.
2014-01-07Update copyright for 2014Bruce Momjian
Update all files in head, and files COPYRIGHT and legal.sgml in all back branches.
2014-01-06Add 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-07Fix 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-08Expose 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-03Fix 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-23Defend 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-21Support 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-18pg_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-15Remove 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.