]> granicus.if.org Git - postgresql/log
postgresql
9 years agoOptimize pg_comp_crc32c_sse42 routine slightly, and also use it on x86.
Heikki Linnakangas [Tue, 14 Apr 2015 20:58:16 +0000 (23:58 +0300)]
Optimize pg_comp_crc32c_sse42 routine slightly, and also use it on x86.

Eliminate the separate 'len' variable from the loops, and also use the 4
byte instruction. This shaves off a few more cycles. Even though this
routine that uses the special SSE 4.2 instructions is much faster than a
generic routine, it's still a hot spot, so let's make it as fast as
possible.

Change the configure test to not test _mm_crc32_u64. That variant is only
available in the 64-bit x86-64 architecture, not in 32-bit x86. Modify
pg_comp_crc32c_sse42 so that it only uses _mm_crc32_u64 on x86-64. With
these changes, the SSE accelerated CRC-32C implementation can also be used
on 32-bit x86 systems.

This also fixes the 32-bit MSVC build.

9 years agoOops, fix misspelled #endif
Heikki Linnakangas [Tue, 14 Apr 2015 19:00:52 +0000 (22:00 +0300)]
Oops, fix misspelled #endif

I hope this fixes the Windows builfarm failures.

9 years agoTry to fix the CRC-32C autoconf magic for icc compiler.
Heikki Linnakangas [Tue, 14 Apr 2015 16:56:03 +0000 (19:56 +0300)]
Try to fix the CRC-32C autoconf magic for icc compiler.

On gcc and clang, the _mm_crc32_u8 and _mm_crc32_u64 intrinsics are not
defined at all, when not building with -msse4.2. But on icc, they are.
So we cannot assume that if those intrinsics are defined, we can always use
them safely, we might still need the runtime check.

To fix, check if the __SSE_4_2__ preprocessor symbol is defined. That's
supposed to be defined only when the compiler is targeting a processor that
has SSE 4.2 support.

Per buildfarm members fulmar and okapi.

9 years agoFix typo in comment
Alvaro Herrera [Tue, 14 Apr 2015 15:12:18 +0000 (12:12 -0300)]
Fix typo in comment

SLRU_SEGMENTS_PER_PAGE -> SLRU_PAGES_PER_SEGMENT

I introduced this ancient typo in subtrans.c and later propagated it to
multixact.c.  I fixed the latter in f741300c, but only back to 9.3;
backpatch to all supported branches for consistency.

9 years agoUse Intel SSE 4.2 CRC instructions where available.
Heikki Linnakangas [Tue, 14 Apr 2015 14:05:03 +0000 (17:05 +0300)]
Use Intel SSE 4.2 CRC instructions where available.

Modern x86 and x86-64 processors with SSE 4.2 support have special
instructions, crc32b and crc32q, for calculating CRC-32C. They greatly
speed up CRC calculation.

Whether the instructions can be used or not depends on the compiler and the
target architecture. If generation of SSE 4.2 instructions is allowed for
the target (-msse4.2 flag on gcc and clang), use them. If they are not
allowed by default, but the compiler supports the -msse4.2 flag to enable
them, compile just the CRC-32C function with -msse4.2 flag, and check at
runtime whether the processor we're running on supports it. If it doesn't,
fall back to the slicing-by-8 algorithm. (With the common defaults on
current operating systems, the runtime-check variant is what you get in
practice.)

Abhijit Menon-Sen, heavily modified by me, reviewed by Andres Freund.

9 years agoReorganize our CRC source files again.
Heikki Linnakangas [Tue, 14 Apr 2015 14:03:42 +0000 (17:03 +0300)]
Reorganize our CRC source files again.

Now that we use CRC-32C in WAL and the control file, the "traditional" and
"legacy" CRC-32 variants are not used in any frontend programs anymore.
Move the code for those back from src/common to src/backend/utils/hash.

Also move the slicing-by-8 implementation (back) to src/port. This is in
preparation for next patch that will add another implementation that uses
Intel SSE 4.2 instructions to calculate CRC-32C, where available.

9 years agopgbench: Attempt fix build on Windows
Peter Eisentraut [Mon, 13 Apr 2015 19:32:57 +0000 (15:32 -0400)]
pgbench: Attempt fix build on Windows

9 years agoRemove duplicated word in README
Alvaro Herrera [Mon, 13 Apr 2015 17:28:21 +0000 (14:28 -0300)]
Remove duplicated word in README

9 years agoMove pgbench from contrib/ to src/bin/
Peter Eisentraut [Wed, 11 Mar 2015 02:33:24 +0000 (22:33 -0400)]
Move pgbench from contrib/ to src/bin/

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
9 years agoFix pg_rewind regression tests in VPATH builds
Heikki Linnakangas [Mon, 13 Apr 2015 15:28:42 +0000 (18:28 +0300)]
Fix pg_rewind regression tests in VPATH builds

Should call just "pg_rewind", instead of "./pg_rewind". The tests are called
so that PATH contains the temporariy installation bin dir.

Per report from Alvaro Herrera

9 years agoRefactor and fix TAP tests of pg_rewind
Heikki Linnakangas [Mon, 13 Apr 2015 15:06:12 +0000 (18:06 +0300)]
Refactor and fix TAP tests of pg_rewind

* Don't pass arguments to prove, since that's not supported on perl 5.8
which is the minimum version supported by the TAP tests. Refactor the
test files themselves to run the tests twice, in both local and remote mode.

* Use eq rather than == for string comparison. This thinko caused the remote
versions of the tests to never run.

* Add "use strict" and "use warnings", and fix warnings that that produced.

* Increase the delay after standby promotion, to make the tests more robust.

* In remote mode, the connection string to the promoted standby was
incorrect, leading to connection errors.

Patch by Michael Paquier, to address Peter Eisentraut's report.

9 years agoDon't archive bogus recycled or preallocated files after timeline switch.
Heikki Linnakangas [Mon, 13 Apr 2015 13:53:49 +0000 (16:53 +0300)]
Don't archive bogus recycled or preallocated files after timeline switch.

After a timeline switch, we would leave behind recycled WAL segments that
are in the future, but on the old timeline. After promotion, and after they
become old enough to be recycled again, we would notice that they don't have
a .ready or .done file, create a .ready file for them, and archive them.
That's bogus, because the files contain garbage, recycled from an older
timeline (or prealloced as zeros). We shouldn't archive such files.

This could happen when we're following a timeline switch during replay, or
when we switch to new timeline at end-of-recovery.

To fix, whenever we switch to a new timeline, scan the data directory for
WAL segments on the old timeline, but with a higher segment number, and
remove them. Those don't belong to our timeline history, and are most
likely bogus recycled or preallocated files. They could also be valid files
that we streamed from the primary ahead of time, but in any case, they're
not needed to recover to the new timeline.

9 years agoSilence gettext warning about '\r' escape sequence in translatable string.
Fujii Masao [Mon, 13 Apr 2015 04:30:59 +0000 (13:30 +0900)]
Silence gettext warning about '\r' escape sequence in translatable string.

gettext was unhappy about the commit b216ad7 because it revealed
the problem that internationalized messages may contain '\r' escape
sequence in pg_rewind. This commit moves '\r' to a separate printf() call.

Michael Paquier, bug reported by Peter Eisentraut

9 years agoemacs: Set indent-tabs-mode in perl-mode
Peter Eisentraut [Mon, 13 Apr 2015 03:53:23 +0000 (23:53 -0400)]
emacs: Set indent-tabs-mode in perl-mode

This matches existing practice, but makes the setup complete and
consistent with the C code setup.

9 years agoFree leaked result set in pg_rewind
Heikki Linnakangas [Sun, 12 Apr 2015 19:42:01 +0000 (22:42 +0300)]
Free leaked result set in pg_rewind

It was not significant in practice, it was just one instance of a small
result set, but let's pacify Coverity.

Michael Paquier

9 years agoAdd system view pg_stat_ssl
Magnus Hagander [Sun, 12 Apr 2015 17:07:46 +0000 (19:07 +0200)]
Add system view pg_stat_ssl

This view shows information about all connections, such as if the
connection is using SSL, which cipher is used, and which client
certificate (if any) is used.

Reviews by Alex Shulgin, Heikki Linnakangas, Andres Freund & Michael Paquier

9 years agoRemove duplicated words in comments.
Heikki Linnakangas [Sun, 12 Apr 2015 07:46:17 +0000 (10:46 +0300)]
Remove duplicated words in comments.

David Rowley

9 years agoMove pg_archivecleanup from contrib/ to src/bin/
Peter Eisentraut [Wed, 11 Mar 2015 02:33:23 +0000 (22:33 -0400)]
Move pg_archivecleanup from contrib/ to src/bin/

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
9 years agoOptimize locking a tuple already locked by another subxact
Alvaro Herrera [Fri, 10 Apr 2015 16:47:15 +0000 (13:47 -0300)]
Optimize locking a tuple already locked by another subxact

Locking and updating the same tuple repeatedly led to some strange
multixacts being created which had several subtransactions of the same
parent transaction holding locks of the same strength.  However,
once a subxact of the current transaction holds a lock of a given
strength, it's not necessary to acquire the same lock again.  This made
some coding patterns much slower than required.

The fix is twofold.  First we change HeapTupleSatisfiesUpdate to return
HeapTupleBeingUpdated for the case where the current transaction is
already a single-xid locker for the given tuple; it used to return
HeapTupleMayBeUpdated for that case.  The new logic is simpler, and the
change to pgrowlocks is a testament to that: previously we needed to
check for the single-xid locker separately in a very ugly way.  That
test is simpler now.

As fallout from the HTSU change, some of its callers need to be amended
so that tuple-locked-by-own-transaction is taken into account in the
BeingUpdated case rather than the MayBeUpdated case.  For many of them
there is no difference; but heap_delete() and heap_update now check
explicitely and do not grab tuple lock in that case.

The HTSU change also means that routine MultiXactHasRunningRemoteMembers
introduced in commit 11ac4c73cb895 is no longer necessary and can be
removed; the case that used to require it is now handled naturally as
result of the changes to heap_delete and heap_update.

The second part of the fix to the performance issue is to adjust
heap_lock_tuple to avoid the slowness:

1. Previously we checked for the case that our own transaction already
held a strong enough lock and returned MayBeUpdated, but only in the
multixact case.  Now we do it for the plain Xid case as well, which
saves having to LockTuple.

2. If the current transaction is the only locker of the tuple (but with
a lock not as strong as what we need; otherwise it would have been
caught in the check mentioned above), we can skip sleeping on the
multixact, and instead go straight to create an updated multixact with
the additional lock strength.

3. Most importantly, make sure that both the single-xid-locker case and
the multixact-locker case optimization are applied always.  We do this
by checking both in a single place, rather than them appearing in two
separate portions of the routine -- something that is made possible by
the HeapTupleSatisfiesUpdate API change.  Previously we would only check
for the single-xid case when HTSU returned MayBeUpdated, and only
checked for the multixact case when HTSU returned BeingUpdated.  This
was at odds with what HTSU actually returned in one case: if our own
transaction was locker in a multixact, it returned MayBeUpdated, so the
optimization never applied.  This is what led to the large multixacts in
the first place.

Per bug report #8470 by Oskari Saarenmaa.

9 years agolibpq: Don't overwrite existing OpenSSL thread callbacks
Peter Eisentraut [Fri, 10 Apr 2015 00:45:34 +0000 (20:45 -0400)]
libpq: Don't overwrite existing OpenSSL thread callbacks

If someone else already set the callbacks, don't overwrite them with
ours.  When unsetting the callbacks, only unset them if they point to
ours.

Author: Jan Urbański <wulczer@wulczer.org>

9 years agoShow owner of types in psql \dT+
Magnus Hagander [Thu, 9 Apr 2015 19:39:35 +0000 (21:39 +0200)]
Show owner of types in psql \dT+

9 years agoMake SSL regression test suite more portable by avoiding cp.
Heikki Linnakangas [Thu, 9 Apr 2015 19:07:18 +0000 (22:07 +0300)]
Make SSL regression test suite more portable by avoiding cp.

Use perl 'glob' and File::Copy instead of "cp". This takes us one step
closer to running the suite on Windows.

Michael Paquier

9 years agoGitignore temp files generated by SSL regression suite
Heikki Linnakangas [Thu, 9 Apr 2015 18:58:10 +0000 (21:58 +0300)]
Gitignore temp files generated by SSL regression suite

Michael Paquier

9 years agoFix typo
Magnus Hagander [Thu, 9 Apr 2015 12:15:39 +0000 (14:15 +0200)]
Fix typo

Michael Paquier

9 years agoFix incorrect punctuation
Magnus Hagander [Thu, 9 Apr 2015 11:35:30 +0000 (13:35 +0200)]
Fix incorrect punctuation

Amit Langote

9 years agoFix typo in eb68379c3.
Andres Freund [Thu, 9 Apr 2015 11:29:22 +0000 (13:29 +0200)]
Fix typo in eb68379c3.

I'd accidentally missed to rename PG_FORCE_NULL to BKI_FORCE_NULL in one
place.

Author: Jeevan Chalke
Discussion: CAM2+6=VPoow5PqgqiTjPX4QNeokb7op8aD_8Zg3QnHZMvvU0GQ@mail.gmail.com

9 years agoRemove obsolete FORCE option from REINDEX.
Fujii Masao [Thu, 9 Apr 2015 02:31:42 +0000 (11:31 +0900)]
Remove obsolete FORCE option from REINDEX.

FORCE option has been marked "obsolete" since very old version 7.4
but existed for backwards compatibility. Per discussion on pgsql-hackers,
we concluded that it's no longer worth keeping supporting the option.

9 years agoChange SQLSTATE for event triggers "wrong context" message
Alvaro Herrera [Wed, 8 Apr 2015 18:26:50 +0000 (15:26 -0300)]
Change SQLSTATE for event triggers "wrong context" message

When certain event-trigger-only functions are called when not in the
wrong context, they were reporting the "feature not supported" SQLSTATE,
which is somewhat misleading.  Create a new custom error code for such
uses instead.

Not backpatched since it may be seen as an undesirable behavioral
change.

Author: Michael Paquier
Discussion: https://www.postgresql.org/message-id/CAB7nPqQ-5NAkHQHh_NOm7FPep37NCiLKwPoJ2Yxb8TDoGgbYYA@mail.gmail.com

9 years agoFix autovacuum launcher shutdown sequence
Alvaro Herrera [Wed, 8 Apr 2015 16:19:49 +0000 (13:19 -0300)]
Fix autovacuum launcher shutdown sequence

It was previously possible to have the launcher re-execute its main loop
before shutting down if some other signal was received or an error
occurred after getting SIGTERM, as reported by Qingqing Zhou.

While investigating, Tom Lane further noticed that if autovacuum had
been disabled in the config file, it would misbehave by trying to start
a new worker instead of bailing out immediately -- it would consider
itself as invoked in emergency mode.

Fix both problems by checking the shutdown flag in a few more places.
These problems have existed since autovacuum was introduced, so
backpatch all the way back.

9 years agolibpq: add newlines to SSPI error messages
Bruce Momjian [Wed, 8 Apr 2015 14:28:47 +0000 (10:28 -0400)]
libpq:  add newlines to SSPI error messages

Report by Tom Lane

9 years agolibpq: issue clear error message for nested service files
Bruce Momjian [Wed, 8 Apr 2015 14:26:21 +0000 (10:26 -0400)]
libpq:  issue clear error message for nested service files

Previously an odd error message was generated.  Nested service files are
not supported.

Report by David Johnston

9 years agoFix typo in comment.
Fujii Masao [Wed, 8 Apr 2015 11:55:43 +0000 (20:55 +0900)]
Fix typo in comment.

9 years agoAdd file_ops.c to GETTEXT_FILES in nls.mk.
Fujii Masao [Wed, 8 Apr 2015 04:46:58 +0000 (13:46 +0900)]
Add file_ops.c to GETTEXT_FILES in nls.mk.

Since file_ops.c contains translatable strings, it should have been listed
in GETTEXT_FILES.

9 years agoMake trace_sort control abbreviation debug output for the text opclass.
Robert Haas [Wed, 8 Apr 2015 02:45:17 +0000 (22:45 -0400)]
Make trace_sort control abbreviation debug output for the text opclass.

This is consistent with what the new numeric suppor for abbreviated keys
now does, and seems much more convenient than having a separate compiler
define to control this debug output.

Peter Geoghegan

9 years agoMark the second argument of pg_log as the translatable string in nls.mk.
Fujii Masao [Wed, 8 Apr 2015 02:06:25 +0000 (11:06 +0900)]
Mark the second argument of pg_log as the translatable string in nls.mk.

9 years agoFix assorted inconsistent function declarations.
Tom Lane [Tue, 7 Apr 2015 20:56:21 +0000 (16:56 -0400)]
Fix assorted inconsistent function declarations.

While gcc doesn't complain if you declare a function "static" and then
define it not-static, other compilers do; and in any case the code is
highly misleading this way.  Add the missing "static" keywords to a
couple of recent patches.  Per buildfarm member pademelon.

9 years agoFix reporting of missing or invalid command line arguments in pg_rewind.
Heikki Linnakangas [Tue, 7 Apr 2015 20:28:28 +0000 (23:28 +0300)]
Fix reporting of missing or invalid command line arguments in pg_rewind.

pg_fatal never returns, so a multi-line message cannot be printed by
calling it twice.

Michael Paquier and Fujii Masao

9 years agoRemove variable shadowing
Alvaro Herrera [Tue, 7 Apr 2015 20:14:00 +0000 (17:14 -0300)]
Remove variable shadowing

Commit a2e35b53 should have removed the variable declaration in the
inner block, but didn't.  As a result, the returned address might end up
not being what was intended.

9 years agoFix process startup in pg_rewind.
Heikki Linnakangas [Tue, 7 Apr 2015 20:04:25 +0000 (23:04 +0300)]
Fix process startup in pg_rewind.

Don't allow pg_rewind to run as root on Unix platforms, as any new or
replaced files in the data directory would become owned by root. On Windows,
it can run under a user that has Administrator rights, but a restricted
token needs to be used. This is the same we do e.g. in pg_resetxlog.

Also, add missing set_pglocale_pgservice() call, to fix localization.

Michael Paquier and Fujii Masao

9 years agoFix spelling of author's name
Simon Riggs [Tue, 7 Apr 2015 18:04:29 +0000 (14:04 -0400)]
Fix spelling of author's name

9 years agopg_event_trigger_dropped_objects: add is_temp column
Alvaro Herrera [Mon, 6 Apr 2015 14:40:55 +0000 (11:40 -0300)]
pg_event_trigger_dropped_objects: add is_temp column

It now also reports temporary objects dropped that are local to the
backend.  Previously we weren't reporting any temp objects because it
was deemed unnecessary; but as it turns out, it is necessary if we want
to keep close track of DDL command execution inside one session.  Temp
objects are reported as living in schema pg_temp, which works because
such a schema-qualification always refers to the temp objects of the
current session.

9 years agoFix object identities for pg_conversion objects
Alvaro Herrera [Mon, 6 Apr 2015 14:15:13 +0000 (11:15 -0300)]
Fix object identities for pg_conversion objects

This was already fixed in 0d906798f, but I failed to update the
array-formatted case.  This is not backpatched, since this only affects
the code path introduced by commit a676201490c.

9 years agoFix typo in libpq.sgml.
Fujii Masao [Mon, 6 Apr 2015 03:15:20 +0000 (12:15 +0900)]
Fix typo in libpq.sgml.

Back-patch to all supported versions.

Michael Paquier

9 years agoSuppress clang's unhelpful gripes about -pthread switch being unused.
Tom Lane [Sun, 5 Apr 2015 17:01:55 +0000 (13:01 -0400)]
Suppress clang's unhelpful gripes about -pthread switch being unused.

Considering the number of cases in which "unused" command line arguments
are silently ignored by compilers, it's fairly astonishing that anybody
thought this warning was useful; it's certainly nothing but an annoyance
when building Postgres.  One such case is that neither gcc nor clang
complain about unrecognized -Wno-foo switches, making it more difficult
to figure out whether the switch does anything than one could wish.

Back-patch to 9.3, which is as far back as the patch applies conveniently
(we'd have to back-patch PGAC_PROG_CC_VAR_OPT to go further, and it doesn't
seem worth that).

9 years agoRemove extraneous >
Simon Riggs [Sun, 5 Apr 2015 16:35:24 +0000 (12:35 -0400)]
Remove extraneous >

9 years agoAdd new test files for lock level patch
Simon Riggs [Sun, 5 Apr 2015 16:03:58 +0000 (12:03 -0400)]
Add new test files for lock level patch

9 years agoEnable float8-byval as the default for 64 bit MSVC builds
Andrew Dunstan [Sun, 5 Apr 2015 15:49:49 +0000 (11:49 -0400)]
Enable float8-byval as the default for 64 bit MSVC builds

This is a long-standing inconsistency that was probably just missed when
we got 64 bit MSVC builds. This brings the platform into line with all
other systems.

9 years agoReduce lock levels of some trigger DDL and add FKs
Simon Riggs [Sun, 5 Apr 2015 15:37:08 +0000 (11:37 -0400)]
Reduce lock levels of some trigger DDL and add FKs

Reduce lock levels to ShareRowExclusive for the following SQL
 CREATE TRIGGER (but not DROP or ALTER)
 ALTER TABLE ENABLE TRIGGER
 ALTER TABLE DISABLE TRIGGER
 ALTER TABLE … ADD CONSTRAINT FOREIGN KEY

Original work by Simon Riggs, extracted and refreshed by Andreas Karlsson
New test cases added by Andreas Karlsson
Reviewed by Noah Misch, Andres Freund, Michael Paquier and Simon Riggs

9 years agoFix incorrect matching of subexpressions in outer-join plan nodes.
Tom Lane [Sat, 4 Apr 2015 23:55:15 +0000 (19:55 -0400)]
Fix incorrect matching of subexpressions in outer-join plan nodes.

Previously we would re-use input subexpressions in all expression trees
attached to a Join plan node.  However, if it's an outer join and the
subexpression appears in the nullable-side input, this is potentially
incorrect for apparently-matching subexpressions that came from above
the outer join (ie, targetlist and qpqual expressions), because the
executor will treat the subexpression value as NULL when maybe it should
not be.

The case is fairly hard to hit because (a) you need a non-strict
subexpression (else NULL is correct), and (b) we don't usually compute
expressions in the outputs of non-toplevel plan nodes.  But we might do
so if the expressions are sort keys for a mergejoin, for example.

Probably in the long run we should make a more explicit distinction between
Vars appearing above and below an outer join, but that will be a major
planner redesign and not at all back-patchable.  For the moment, just hack
set_join_references so that it will not match any non-Var expressions
coming from nullable inputs to expressions that came from above the join.
(This is somewhat overkill, in that a strict expression could still be
matched, but it doesn't seem worth the effort to check that.)

Per report from Qingqing Zhou.  The added regression test case is based
on his example.

This has been broken for a very long time, so back-patch to all active
branches.

9 years agoFix TAP tests to use only standard command-line argument ordering.
Tom Lane [Sat, 4 Apr 2015 17:34:23 +0000 (13:34 -0400)]
Fix TAP tests to use only standard command-line argument ordering.

Some of the TAP tests were supposing that PG programs would accept switches
after non-switch arguments on their command lines.  While GNU getopt_long()
does allow that, our own implementation does not, and it's nowhere
suggested in our documentation that such cases should work.  Adjust the
tests to use only the documented syntax.

Back-patch to 9.4, since without this the TAP tests fail when run with
src/port's getopt_long() implementation.

Michael Paquier

9 years agoFix numeric abbreviation for --disable-float8-byval.
Robert Haas [Sat, 4 Apr 2015 02:34:37 +0000 (22:34 -0400)]
Fix numeric abbreviation for --disable-float8-byval.

When committing abd94bcac4582903765be7be959d1dbc121df0d0, I tried to make
it decide what kind of abbreviation to use based only on SIZEOF_DATUM,
without regard to USE_FLOAT8_BYVAL.  That attempt was a few bricks short
of a load, so try to fix it, and add a comment explaining what we're
about.

Patch by me; review (but not a full endorsement) by Andrew Gierth.

9 years agoRemove unnecessary variables in _hash_splitbucket().
Tom Lane [Fri, 3 Apr 2015 20:49:11 +0000 (16:49 -0400)]
Remove unnecessary variables in _hash_splitbucket().

Commit ed9cc2b5df59fdbc50cce37399e26b03ab2c1686 made it unnecessary to pass
start_nblkno to _hash_splitbucket(), and for that matter unnecessary to
have the internal nblkno variable either.  My compiler didn't complain
about that, but some did.  I also rearranged the use of oblkno a bit to
make that case more parallel.

Report and initial patch by Petr Jelinek, rearranged a bit by me.
Back-patch to all branches, like the previous patch.

9 years agoTransform ALTER TABLE/SET TYPE/USING expr during parse analysis
Alvaro Herrera [Fri, 3 Apr 2015 20:33:05 +0000 (17:33 -0300)]
Transform ALTER TABLE/SET TYPE/USING expr during parse analysis

This lets later stages have access to the transformed expression; in
particular it allows DDL-deparsing code during event triggers to pass
the transformed expression to ruleutils.c, so that the complete command
can be deparsed.

This shuffles the timing of the transform calls a bit: previously,
nothing was transformed during parse analysis, and only the
RELKIND_RELATION case was being handled during execution.  After this
patch, all expressions are transformed during parse analysis (including
those for relkinds other than RELATION), and the error for other
relation kinds is thrown only during execution.  So we do more work than
before to reject some bogus cases.  That seems acceptable.

9 years agoAdd log_min_autovacuum_duration per-table option
Alvaro Herrera [Fri, 3 Apr 2015 14:55:50 +0000 (11:55 -0300)]
Add log_min_autovacuum_duration per-table option

This is useful to control autovacuum log volume, for situations where
monitoring only a set of tables is necessary.

Author: Michael Paquier
Reviewed by: A team led by Naoya Anzai (also including Akira Kurosawa,
Taiki Kondo, Huong Dangminh), Fujii Masao.

9 years agoHave autovacuum workers listen to SIGHUP, too
Alvaro Herrera [Fri, 3 Apr 2015 14:52:55 +0000 (11:52 -0300)]
Have autovacuum workers listen to SIGHUP, too

They have historically ignored it, but it's been said to be useful at
times to change their settings mid-flight.

Author: Michael Paquier

9 years agoFix error handling of XLogReaderAllocate in case of OOM
Fujii Masao [Fri, 3 Apr 2015 12:55:37 +0000 (21:55 +0900)]
Fix error handling of XLogReaderAllocate in case of OOM

Similarly to previous fix 9b8d478, commit 2c03216 has switched
XLogReaderAllocate() to use a set of palloc calls instead of malloc,
causing any callers of this function to fail with an error instead of
receiving a NULL pointer in case of out-of-memory error. Fix this by
using palloc_extended with MCXT_ALLOC_NO_OOM that will safely return
NULL in case of an OOM.

Michael Paquier, slightly modified by me.

9 years agoChange the way we decide whether to give up on abbreviated text keys.
Robert Haas [Fri, 3 Apr 2015 12:32:05 +0000 (08:32 -0400)]
Change the way we decide whether to give up on abbreviated text keys.

Be more aggressive about aborting early on if it looks like it's not
helping, but be less aggressive about aborting later on, since it's
more expensive at that point, and also since we're currently aborting
in some cases where abbreviation can still deliver a substantial win.

Peter Geoghegan. Extensive testing by Tomas Vondra.

9 years agoRework handling of OOM when allocating record buffer in XLOG reader.
Fujii Masao [Fri, 3 Apr 2015 09:29:38 +0000 (18:29 +0900)]
Rework handling of OOM when allocating record buffer in XLOG reader.

Commit 2c03216 changed allocate_recordbuf() so that it uses a palloc to
allocate the read buffer and fails immediately when an out-of-memory error
shows up, even though its callers still expect that NULL is returned in that
case. This bug is fixed making allocate_recordbuf() use a palloc_extended
with MCXT_ALLOC_NO_OOM flag and return NULL in OOM case.

Michael Paquier

9 years agoAdd palloc_extended for frontend and backend.
Fujii Masao [Fri, 3 Apr 2015 08:36:12 +0000 (17:36 +0900)]
Add palloc_extended for frontend and backend.

This commit also adds pg_malloc_extended for frontend. These interfaces
can be used to control at a lower level memory allocation using an interface
similar to MemoryContextAllocExtended. For example, the callers can specify
MCXT_ALLOC_NO_OOM if they want to suppress the "out of memory" error while
allocating the memory and handle a NULL return value.

Michael Paquier, reviewed by me.

9 years agoFix rare startup failure induced by MVCC-catalog-scans patch.
Tom Lane [Fri, 3 Apr 2015 04:07:29 +0000 (00:07 -0400)]
Fix rare startup failure induced by MVCC-catalog-scans patch.

While a new backend nominally participates in sinval signaling starting
from the SharedInvalBackendInit call near the top of InitPostgres, it
cannot recognize sinval messages for unshared catalogs of its database
until it has set up MyDatabaseId.  This is not problematic for the catcache
or relcache, which by definition won't have loaded any data from or about
such catalogs before that point.  However, commit 568d4138c646cd7c
introduced a mechanism for re-using MVCC snapshots for catalog scans, and
made invalidation of those depend on recognizing relevant sinval messages.
So it's possible to establish a catalog snapshot to read pg_authid and
pg_database, then before we set MyDatabaseId, receive sinval messages that
should result in invalidating that snapshot --- but do not, because we
don't realize they are for our database.  This mechanism explains the
intermittent buildfarm failures we've seen since commit 31eae6028eca4365.
That commit was not itself at fault, but it introduced a new regression
test that does reconnections concurrently with the "vacuum full pg_am"
command in vacuum.sql.  This allowed the pre-existing error to be exposed,
given just the right timing, because we'd fail to update our information
about how to access pg_am.  In principle any VACUUM FULL on a system
catalog could have created a similar hazard for concurrent incoming
connections.  Perhaps there are more subtle failure cases as well.

To fix, force invalidation of the catalog snapshot as soon as we've
set MyDatabaseId.

Back-patch to 9.4 where the error was introduced.

9 years agoAdd markup for replaceable parameters to pg_rewind doc.
Fujii Masao [Fri, 3 Apr 2015 03:21:16 +0000 (12:21 +0900)]
Add markup for replaceable parameters to pg_rewind doc.

9 years agoImprove pgbench error reporting.
Robert Haas [Thu, 2 Apr 2015 20:26:49 +0000 (16:26 -0400)]
Improve pgbench error reporting.

This would have been worth doing on general principle anyway, but the
recent addition of an expression syntax to pgbench makes it an even
better idea than it would have been otherwise.

Fabien Coelho

9 years agoRepair stupid mistake in preprocessor directive.
Robert Haas [Thu, 2 Apr 2015 19:57:17 +0000 (15:57 -0400)]
Repair stupid  mistake in preprocessor directive.

9 years agoAfter a crash, don't restart workers with BGW_NEVER_RESTART.
Robert Haas [Thu, 2 Apr 2015 18:38:06 +0000 (14:38 -0400)]
After a crash, don't restart workers with BGW_NEVER_RESTART.

Amit Khandekar

9 years agoUse abbreviated keys for faster sorting of numeric datums.
Robert Haas [Thu, 2 Apr 2015 18:02:55 +0000 (14:02 -0400)]
Use abbreviated keys for faster sorting of numeric datums.

Andrew Gierth, reviewed by Peter Geoghegan, with further tweaks by me.

9 years agoautovacuum: Fix polarity of "wraparound" variable
Alvaro Herrera [Thu, 2 Apr 2015 16:34:50 +0000 (13:34 -0300)]
autovacuum: Fix polarity of "wraparound" variable

Commit 0d831389749a3 inadvertently reversed the meaning of the
wraparound variable.  This causes vacuums which are not required for
wraparound to wait for locks to be acquired, and what is worse, it
allows wraparound vacuums to skip locked pages.

Bug reported by Jeff Janes in
http://www.postgresql.org/message-id/CAMkU=1xmTEiaY=5oMHsSQo5vd9V1Ze4kNLL0qN2eH0P_GXOaYw@mail.gmail.com
Analysis and patch by Kyotaro HORIGUCHI

9 years agoAdd missing calls to DatumGetUInt32.
Robert Haas [Thu, 2 Apr 2015 15:57:35 +0000 (11:57 -0400)]
Add missing calls to DatumGetUInt32.

These were inadvertently ommitted from the commit that introduced
abbreviated keys, commit 4ea51cdfe85ceef8afabceb03c446574daa0ac23.

Peter Geoghegan

9 years agoDefine integer limits independently from the system definitions.
Andres Freund [Thu, 2 Apr 2015 15:43:35 +0000 (17:43 +0200)]
Define integer limits independently from the system definitions.

In 83ff1618 we defined integer limits iff they're not provided by the
system. That turns out not to be the greatest idea because there's
different ways some datatypes can be represented. E.g. on OSX PG's 64bit
datatype will be a 'long int', but OSX unconditionally uses 'long
long'. That disparity then can lead to warnings, e.g. around printf
formats.

One way to fix that would be to back int64 using stdint.h's
int64_t. While a good idea it's not that easy to implement. We would
e.g. need to include stdint.h in our external headers, which we don't
today. Also computing the correct int64 printf formats in that case is
nontrivial.

Instead simply prefix the integer limits with PG_ and define them
unconditionally. I've adjusted all the references to them in code, but
not the ones in comments; the latter seems unnecessary to me.

Discussion: 20150331141423.GK4878@alap3.anarazel.de

9 years agopsql: fix \connect with URIs and conninfo strings
Alvaro Herrera [Thu, 2 Apr 2015 15:30:57 +0000 (12:30 -0300)]
psql: fix \connect with URIs and conninfo strings

This is the second try at this, after fcef1617295 failed miserably and
had to be reverted: as it turns out, libpq cannot depend on libpgcommon
after all. Instead of shuffling code in the master branch, make that one
just like 9.4 and accept the duplication.  (This was all my own mistake,
not the patch submitter's).

psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.

Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments.  Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.

There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts.  Therefore this is backpatched all the way back to 9.0.

Author: David Fetter, Andrew Dunstan.  Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.

9 years agoFix another bug in DSM_CREATE_NULL_IF_MAXSEGMENTS handling.
Robert Haas [Thu, 2 Apr 2015 14:39:24 +0000 (10:39 -0400)]
Fix another bug in DSM_CREATE_NULL_IF_MAXSEGMENTS handling.

Amit Kapila

9 years agoRevert "psql: fix \connect with URIs and conninfo strings"
Robert Haas [Thu, 2 Apr 2015 14:10:22 +0000 (10:10 -0400)]
Revert "psql: fix \connect with URIs and conninfo strings"

This reverts commit fcef1617295c074f2684c887627184d2fc26ac04, about
which both the buildfarm and my local machine are very unhappy.

9 years agoCorrect comment to use RS_EPHEMERAL
Simon Riggs [Thu, 2 Apr 2015 11:45:19 +0000 (07:45 -0400)]
Correct comment to use RS_EPHEMERAL

9 years agopsql: fix \connect with URIs and conninfo strings
Alvaro Herrera [Wed, 1 Apr 2015 23:00:07 +0000 (20:00 -0300)]
psql: fix \connect with URIs and conninfo strings

psql was already accepting conninfo strings as the first parameter in
\connect, but the way it worked wasn't sane; some of the other
parameters would get the previous connection's values, causing it to
connect to a completely unexpected server or, more likely, not finding
any server at all because of completely wrong combinations of
parameters.

Fix by explicitely checking for a conninfo-looking parameter in the
dbname position; if one is found, use its complete specification rather
than mix with the other arguments.  Also, change tab-completion to not
try to complete conninfo/URI-looking "dbnames" and document that
conninfos are accepted as first argument.

There was a weak consensus to backpatch this, because while the behavior
of using the dbname as a conninfo is nowhere documented for \connect, it
is reasonable to expect that it works because it does work in many other
contexts.  Therefore this is backpatched all the way back to 9.0.

To implement this, routines previously private to libpq have been
duplicated so that psql can decide what looks like a conninfo/URI
string.  In back branches, just duplicate the same code all the way back
to 9.2, where URIs where introduced; 9.0 and 9.1 have a simpler version.
In master, the routines are moved to src/common and renamed.

Author: David Fetter, Andrew Dunstan.  Some editorialization by me
(probably earning a Gierth's "Sloppy" badge in the process.)
Reviewers: Andrew Gierth, Erik Rijkers, Pavel Stěhule, Stephen Frost,
Robert Haas, Andrew Dunstan.

9 years agopg_upgrade: call 'postgres' binary to get data directory location
Bruce Momjian [Wed, 1 Apr 2015 22:25:45 +0000 (18:25 -0400)]
pg_upgrade:  call 'postgres' binary to get data directory location

This matches the binary 'pg_ctl' calls.  Previously we called the
'postmaster'.

Report by Christoph Berg

9 years agoProvide real selectivity estimators for inet/cidr operators.
Tom Lane [Wed, 1 Apr 2015 21:11:21 +0000 (17:11 -0400)]
Provide real selectivity estimators for inet/cidr operators.

This patch fills in the formerly-stub networksel() and networkjoinsel()
estimation functions.  Those are used for << <<= >> >>= and && operators
on inet/cidr types.  The estimation is not perfect, certainly, because
we rely on the existing statistics collected for the inet btree operators.
But it's a long way better than nothing, and it's not clear that asking
ANALYZE to collect separate stats for these operators would be a win.

Emre Hasegeli, with reviews from Dilip Kumar and Heikki Linnakangas,
and some further hacking by me

9 years agoMove inet/cidr GiST opclass functions to correct place in header file.
Heikki Linnakangas [Wed, 1 Apr 2015 16:16:35 +0000 (19:16 +0300)]
Move inet/cidr GiST opclass functions to correct place in header file.

They were accidentally placed under the GIN heading.

Andreas Karlsson

9 years agoFix incorrect markup in documentation of window frame clauses.
Tom Lane [Wed, 1 Apr 2015 00:02:40 +0000 (20:02 -0400)]
Fix incorrect markup in documentation of window frame clauses.

You're required to write either RANGE or ROWS to start a frame clause,
but the documentation incorrectly implied this is optional.  Noted by
David Johnston.

9 years agoMake pg_ctl use SIGINT as a default shutdown signal.
Fujii Masao [Tue, 31 Mar 2015 17:10:24 +0000 (02:10 +0900)]
Make pg_ctl use SIGINT as a default shutdown signal.

The commit 0badb06 changed the default shutdown mode from smart to fast,
but forgot to change the default shutdown signal from SIGTERM to SIGINT.

9 years agoinitdb: remove unnecessary VACUUM FULL
Bruce Momjian [Tue, 31 Mar 2015 15:51:39 +0000 (11:51 -0400)]
initdb:  remove unnecessary VACUUM FULL

Report by Peter Eisentraut

9 years agopg_ctl: change default shutdown mode from 'smart' to 'fast'
Bruce Momjian [Tue, 31 Mar 2015 15:46:27 +0000 (11:46 -0400)]
pg_ctl:  change default shutdown mode from 'smart' to 'fast'

Retain the order of the options in the documentation.

9 years agopsql: add asciidoc output format
Bruce Momjian [Tue, 31 Mar 2015 15:33:25 +0000 (11:33 -0400)]
psql:  add asciidoc output format

Patch by Szymon Guz, adjustments by me

Testing by Michael Paquier, Pavel Stehule

9 years agobtree_gin: properly call DirectFunctionCall1()
Bruce Momjian [Tue, 31 Mar 2015 14:26:45 +0000 (10:26 -0400)]
btree_gin:  properly call DirectFunctionCall1()

Previously we called DirectFunctionCall3() with dummy arguments.  Fixed
version of previous patch.

Report by Jon Nelson

9 years agoRemove spurious semicolons.
Heikki Linnakangas [Tue, 31 Mar 2015 12:12:27 +0000 (15:12 +0300)]
Remove spurious semicolons.

Petr Jelinek

9 years agoRun pg_upgrade and pg_resetxlog with restricted token on Windows
Andrew Dunstan [Mon, 30 Mar 2015 21:07:52 +0000 (17:07 -0400)]
Run pg_upgrade and pg_resetxlog with restricted token on Windows

As with initdb these programs need to run with a restricted token, and
if they don't pg_upgrade will fail when run as a user with Adminstrator
privileges.

Backpatch to all live branches. On the development branch the code is
reorganized so that the restricted token code is now in a single
location. On the stable bramches a less invasive change is made by
simply copying the relevant code to pg_upgrade.c and pg_resetxlog.c.

Patches and bug report from Muhammad Asif Naeem, reviewed by Michael
Paquier, slightly edited by me.

9 years agoFix bogus concurrent use of _hash_getnewbuf() in bucket split code.
Tom Lane [Mon, 30 Mar 2015 20:40:05 +0000 (16:40 -0400)]
Fix bogus concurrent use of _hash_getnewbuf() in bucket split code.

_hash_splitbucket() obtained the base page of the new bucket by calling
_hash_getnewbuf(), but it held no exclusive lock that would prevent some
other process from calling _hash_getnewbuf() at the same time.  This is
contrary to _hash_getnewbuf()'s API spec and could in fact cause failures.
In practice, we must only call that function while holding write lock on
the hash index's metapage.

An additional problem was that we'd already modified the metapage's bucket
mapping data, meaning that failure to extend the index would leave us with
a corrupt index.

Fix both issues by moving the _hash_getnewbuf() call to just before we
modify the metapage in _hash_expandtable().

Unfortunately there's still a large problem here, which is that we could
also incur ENOSPC while trying to get an overflow page for the new bucket.
That would leave the index corrupt in a more subtle way, namely that some
index tuples that should be in the new bucket might still be in the old
one.  Fixing that seems substantially more difficult; even preallocating as
many pages as we could possibly need wouldn't entirely guarantee that the
bucket split would complete successfully.  So for today let's just deal
with the base case.

Per report from Antonin Houska.  Back-patch to all active branches.

9 years agoChange array_offset to return subscripts, not offsets
Alvaro Herrera [Mon, 30 Mar 2015 19:13:21 +0000 (16:13 -0300)]
Change array_offset to return subscripts, not offsets

... and rename it and its sibling array_offsets to array_position and
array_positions, to account for the changed behavior.

Having the functions return subscripts better matches existing practice,
and is better suited to using the result value as a subscript into the
array directly.  For one-based arrays, the new definition is identical
to what was originally committed.

(We use the term "subscript" in the documentation, which is what we use
whenever we talk about arrays; but the functions themselves are named
using the word "position" to match the standard-defined POSITION()
functions.)

Author: Pavel Stěhule
Behavioral problem noted by Dean Rasheed.

9 years agoFix lost persistence setting during REINDEX INDEX
Alvaro Herrera [Mon, 30 Mar 2015 19:01:44 +0000 (16:01 -0300)]
Fix lost persistence setting during REINDEX INDEX

ReindexIndex() trusts a parser-built RangeVar with the persistence to
use for the new copy of the index; but the parser naturally does not
know what's the persistence of the original index.  To find out the
correct persistence, grab it from relcache.

This bug was introduced by commit 85b506bbfc2937c9, and therefore no
backpatch is necessary.

Bug reported by Thom Brown, analysis and patch by Michael Paquier; test
case provided by Fabrízio de Royes Mello.

9 years agoBe more careful about printing constants in ruleutils.c.
Tom Lane [Mon, 30 Mar 2015 18:59:49 +0000 (14:59 -0400)]
Be more careful about printing constants in ruleutils.c.

The previous coding in get_const_expr() tried to avoid quoting integer,
float, and numeric literals if at all possible.  While that looks nice,
it means that dumped expressions might re-parse to something that's
semantically equivalent but not the exact same parsetree; for example
a FLOAT8 constant would re-parse as a NUMERIC constant with a cast to
FLOAT8.  Though the result would be the same after constant-folding,
this is problematic in certain contexts.  In particular, Jeff Davis
pointed out that this could cause unexpected failures in ALTER INHERIT
operations because of child tables having not-exactly-equivalent CHECK
expressions.  Therefore, favor correctness over legibility and dump
such constants in quotes except in the limited cases where they'll
be interpreted as the same type even without any casting.

This results in assorted small changes in the regression test outputs,
and will affect display of user-defined views and rules similarly.
The odds of that causing problems in the field seem non-negligible;
given the lack of previous complaints, it seems best not to change
this in the back branches.

9 years agoFix rare core dump in BackendIdGetTransactionIds().
Tom Lane [Mon, 30 Mar 2015 17:05:27 +0000 (13:05 -0400)]
Fix rare core dump in BackendIdGetTransactionIds().

BackendIdGetTransactionIds() neglected the possibility that the PROC
pointer in a ProcState array entry is null.  In current usage, this could
only crash if the other backend had exited since pgstat_read_current_status
saw it as active, which is a pretty narrow window.  But it's reachable in
the field, per bug #12918 from Vladimir Borodin.

Back-patch to 9.4 where the faulty code was introduced.

9 years agoAdd index-only scan support to range type GiST opclass.
Heikki Linnakangas [Mon, 30 Mar 2015 10:21:43 +0000 (13:21 +0300)]
Add index-only scan support to range type GiST opclass.

Andreas Karlsson

9 years agoClean up all the cruft after a pg_rewind test run.
Tom Lane [Mon, 30 Mar 2015 00:54:37 +0000 (20:54 -0400)]
Clean up all the cruft after a pg_rewind test run.

regress_log temp directory was properly .gitignore'd, which may explain
why it got left out of the "make clean" action.

9 years agoFix multiple bugs and infelicities in pg_rewind.
Tom Lane [Mon, 30 Mar 2015 00:02:14 +0000 (20:02 -0400)]
Fix multiple bugs and infelicities in pg_rewind.

Bugs all spotted by Coverity, including wrong realloc() size request
and memory leaks.  Cosmetic improvements by me.

The usage of the global variable "filemap" here is still pretty awful,
but at least I got rid of the gratuitous aliasing in several routines
(which was helping to annoy Coverity, as well as being a bug risk).

9 years agoAdd vacuum_delay_point call in compute_index_stats's per-sample-row loop.
Tom Lane [Sun, 29 Mar 2015 19:04:09 +0000 (15:04 -0400)]
Add vacuum_delay_point call in compute_index_stats's per-sample-row loop.

Slow functions in index expressions might cause this loop to take long
enough to make it worth being cancellable.  Probably it would be enough
to call CHECK_FOR_INTERRUPTS here, but for consistency with other
per-sample-row loops in this file, let's use vacuum_delay_point.

Report and patch by Jeff Janes.  Back-patch to all supported branches.

9 years agoMake ginbuild's funcCtx be independent of its tmpCtx.
Tom Lane [Sun, 29 Mar 2015 18:02:58 +0000 (14:02 -0400)]
Make ginbuild's funcCtx be independent of its tmpCtx.

Previously the funcCtx was a child of the tmpCtx, but that was broken
by commit eaa5808e8ec4e82ce1a87103a6b6f687666e4e4c, which made
MemoryContextReset() delete, not reset, child contexts.  The behavior of
having a tmpCtx reset also clear the other context seems rather dubious
anyway, so let's just disentangle them.  Per report from Erik Rijkers.

In passing, fix badly-inaccurate comments about these contexts.

9 years agoRemove a couple other vestigial yylex() declarations.
Tom Lane [Sun, 29 Mar 2015 17:12:28 +0000 (13:12 -0400)]
Remove a couple other vestigial yylex() declarations.

These were workarounds for a long-gone flex bug; all supported versions
of flex emit an extern declaration as expected.

9 years agoMinor code cleanups in pgbench expression support.
Tom Lane [Sun, 29 Mar 2015 17:06:59 +0000 (13:06 -0400)]
Minor code cleanups in pgbench expression support.

Get rid of unnecessary expr_yylex declaration (we haven't supported
flex 2.5.4 in a long time, and even if we still did, the declaration in
pgbench.h makes this one unnecessary and inappropriate).  Fix copyright
dates, improve some layout choices, etc.

9 years agoBetter fix for misuse of Float8GetDatumFast().
Tom Lane [Sat, 28 Mar 2015 17:56:37 +0000 (13:56 -0400)]
Better fix for misuse of Float8GetDatumFast().

We can use that macro as long as we put the value into a local variable.
Commit 735cd6128 was not wrong on its own terms, but I think this way
looks nicer, and it should save a few cycles on 32-bit machines.

9 years agoAdd a pager_min_lines setting to psql
Andrew Dunstan [Sat, 28 Mar 2015 15:07:41 +0000 (11:07 -0400)]
Add a pager_min_lines setting to psql

If set, the pager will not be used unless this many lines are to be
displayed, even if that is more than the screen depth. Default is zero,
meaning it's disabled.

There is probably more work to be done in giving the user control over
when the pager is used, particularly when wide output forces use of the
pager regardless of how many lines there are, but this is a start.

9 years agoUse standard librart sqrt function in pg_stat_statements
Andrew Dunstan [Sat, 28 Mar 2015 13:22:51 +0000 (09:22 -0400)]
Use standard librart sqrt function in pg_stat_statements

The stddev calculation included a faster but unportable sqrt function.
This is not worth the extra effort, and won't work everywhere. If the
standard library function is good enough for the SQL function it
should be good enough here too.

9 years agoAdd index-only scan support to inet GiST opclass.
Heikki Linnakangas [Sat, 28 Mar 2015 13:11:53 +0000 (15:11 +0200)]
Add index-only scan support to inet GiST opclass.

Andreas Karlsson