]> granicus.if.org Git - postgresql/log
postgresql
8 years agoUse LOCKBIT_ON() instead of a bit shift in a few places.
Robert Haas [Mon, 28 Sep 2015 14:57:15 +0000 (10:57 -0400)]
Use LOCKBIT_ON() instead of a bit shift in a few places.

We do this mostly everywhere, so it seems just as well to do it here,
too.

Thomas Munro

8 years agoDon't try to create a temp install without abs_top_builddir.
Robert Haas [Mon, 28 Sep 2015 14:47:05 +0000 (10:47 -0400)]
Don't try to create a temp install without abs_top_builddir.

Otherwise, we effectively act as if abs_top_builddir were the root
directory, which is quite dangerous if the user happens to have
permissions to do things there.  This can crop up in PGXS builds,
for example.

Report by Sandro Santilli, patch by me, review by Noah Misch.

8 years agopg_dump: Fix some messages
Peter Eisentraut [Mon, 28 Sep 2015 00:29:40 +0000 (20:29 -0400)]
pg_dump: Fix some messages

Make quoting style match existing style.  Improve plural support.

8 years agoreindexdb: Fix mistake in help output
Peter Eisentraut [Sun, 27 Sep 2015 15:22:16 +0000 (11:22 -0400)]
reindexdb: Fix mistake in help output

8 years agopg_ctl: Improve help formatting and order
Peter Eisentraut [Sun, 27 Sep 2015 01:09:52 +0000 (21:09 -0400)]
pg_ctl: Improve help formatting and order

8 years agodoc: Tweak "cube" index entry
Peter Eisentraut [Sun, 27 Sep 2015 01:00:59 +0000 (21:00 -0400)]
doc: Tweak "cube" index entry

With the arrival of the CUBE key word/feature, the index entries for the
cube extension and the CUBE feature were collapsed into one.  Tweak the
entry for the cube extension so they are separate entries.

8 years agoRemove legacy multixact truncation support.
Andres Freund [Sat, 26 Sep 2015 17:04:25 +0000 (19:04 +0200)]
Remove legacy multixact truncation support.

In 9.5 and master there is no need to support legacy truncation. This is
just committed separately to make it easier to backpatch the WAL logged
multixact truncation to 9.3 and 9.4 if we later decide to do so.

I bumped master's magic from 0xD086 to 0xD088 and 9.5's from 0xD085 to
0xD087 to avoid 9.5 reusing a value that has been in use on master while
keeping the numbers increasing between major versions.

Discussion: 20150621192409.GA4797@alap3.anarazel.de
Backpatch: 9.5

8 years agoRework the way multixact truncations work.
Andres Freund [Sat, 26 Sep 2015 17:04:25 +0000 (19:04 +0200)]
Rework the way multixact truncations work.

The fact that multixact truncations are not WAL logged has caused a fair
share of problems. Amongst others it requires to do computations during
recovery while the database is not in a consistent state, delaying
truncations till checkpoints, and handling members being truncated, but
offset not.

We tried to put bandaids on lots of these issues over the last years,
but it seems time to change course. Thus this patch introduces WAL
logging for multixact truncations.

This allows:
1) to perform the truncation directly during VACUUM, instead of delaying it
   to the checkpoint.
2) to avoid looking at the offsets SLRU for truncation during recovery,
   we can just use the master's values.
3) simplify a fair amount of logic to keep in memory limits straight,
   this has gotten much easier

During the course of fixing this a bunch of additional bugs had to be
fixed:
1) Data was not purged from memory the member's SLRU before deleting
   segments. This happened to be hard or impossible to hit due to the
   interlock between checkpoints and truncation.
2) find_multixact_start() relied on SimpleLruDoesPhysicalPageExist - but
   that doesn't work for offsets that haven't yet been flushed to
   disk. Add code to flush the SLRUs to fix. Not pretty, but it feels
   slightly safer to only make decisions based on actual on-disk state.
3) find_multixact_start() could be called concurrently with a truncation
   and thus fail. Via SetOffsetVacuumLimit() that could lead to a round
   of emergency vacuuming. The problem remains in
   pg_get_multixact_members(), but that's quite harmless.

For now this is going to only get applied to 9.5+, leaving the issues in
the older branches in place. It is quite possible that we need to
backpatch at a later point though.

For the case this gets backpatched we need to handle that an updated
standby may be replaying WAL from a not-yet upgraded primary. We have to
recognize that situation and use "old style" truncation (i.e. looking at
the SLRUs) during WAL replay. In contrast to before, this now happens in
the startup process, when replaying a checkpoint record, instead of the
checkpointer. Doing truncation in the restartpoint is incorrect, they
can happen much later than the original checkpoint, thereby leading to
wraparound.  To avoid "multixact_redo: unknown op code 48" errors
standbys would have to be upgraded before primaries.

A later patch will bump the WAL page magic, and remove the legacy
truncation codepaths. Legacy truncation support is just included to make
a possible future backpatch easier.

Discussion: 20150621192409.GA4797@alap3.anarazel.de
Reviewed-By: Robert Haas, Alvaro Herrera, Thomas Munro
Backpatch: 9.5 for now

8 years agoSecond try at fixing O(N^2) problem in foreign key references.
Tom Lane [Fri, 25 Sep 2015 17:16:30 +0000 (13:16 -0400)]
Second try at fixing O(N^2) problem in foreign key references.

This replaces ill-fated commit 5ddc72887a012f6a8b85707ef27d85c274faf53d,
which was reverted because it broke active uses of FK cache entries.  In
this patch, we still do nothing more to invalidatable cache entries than
mark them as needing revalidation, so we won't break active uses.  To keep
down the overhead of InvalidateConstraintCacheCallBack(), keep a list of
just the currently-valid cache entries.  (The entries are large enough that
some added space for list links doesn't seem like a big problem.)  This
would still be O(N^2) when there are many valid entries, though, so when
the list gets too long, just force the "sinval reset" behavior to remove
everything from the list.  I set the threshold at 1000 entries, somewhat
arbitrarily.  Possibly that could be fine-tuned later.  Another item for
future study is whether it's worth adding reference counting so that we
could safely remove invalidated entries.  As-is, problem cases are likely
to end up with large and mostly invalid FK caches.

Like the previous attempt, backpatch to 9.3.

Jan Wieck and Tom Lane

8 years agoFurther fix for psql's code for locale-aware formatting of numeric output.
Tom Lane [Fri, 25 Sep 2015 16:20:45 +0000 (12:20 -0400)]
Further fix for psql's code for locale-aware formatting of numeric output.

(Third time's the charm, I hope.)

Additional testing disclosed that this code could mangle already-localized
output from the "money" datatype.  We can't very easily skip applying it
to "money" values, because the logic is tied to column right-justification
and people expect "money" output to be right-justified.  Short of
decoupling that, we can fix it in what should be a safe enough way by
testing to make sure the string doesn't contain any characters that would
not be expected in plain numeric output.

8 years agoFurther fix for psql's code for locale-aware formatting of numeric output.
Tom Lane [Fri, 25 Sep 2015 04:00:33 +0000 (00:00 -0400)]
Further fix for psql's code for locale-aware formatting of numeric output.

On closer inspection, those seemingly redundant atoi() calls were not so
much inefficient as just plain wrong: the author of this code either had
not read, or had not understood, the POSIX specification for localeconv().
The grouping field is *not* a textual digit string but separate integers
encoded as chars.

We'll follow the existing code as well as the backend's cash.c in only
honoring the first group width, but let's at least honor it correctly.

This doesn't actually result in any behavioral change in any of the
locales I have installed on my Linux box, which may explain why nobody's
complained; grouping width 3 is close enough to universal that it's barely
worth considering other cases.  Still, wrong is wrong, so back-patch.

8 years agoFix psql's code for locale-aware formatting of numeric output.
Tom Lane [Fri, 25 Sep 2015 03:01:04 +0000 (23:01 -0400)]
Fix psql's code for locale-aware formatting of numeric output.

This code did the wrong thing entirely for numbers with an exponent
but no decimal point (e.g., '1e6'), as reported by Jeff Janes in
bug #13636.  More generally, it made lots of unverified assumptions
about what the input string could possibly look like.  Rearrange so
that it only fools with leading digits that it's directly verified
are there, and an immediately adjacent decimal point.  While at it,
get rid of some useless inefficiencies, like converting the grouping
count string to integer over and over (and over).

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

8 years agoAllow planner to use expression-index stats for function calls in WHERE.
Tom Lane [Thu, 24 Sep 2015 22:35:46 +0000 (18:35 -0400)]
Allow planner to use expression-index stats for function calls in WHERE.

Previously, a function call appearing at the top level of WHERE had a
hard-wired selectivity estimate of 0.3333333, a kludge conveniently dated
in the source code itself to July 1992.  The expectation at the time was
that somebody would soon implement estimator support functions analogous
to those for operators; but no such code has appeared, nor does it seem
likely to in the near future.  We do have an alternative solution though,
at least for immutable functions on single relations: creating an
expression index on the function call will allow ANALYZE to gather stats
about the function's selectivity.  But the code in clause_selectivity()
failed to make use of such data even if it exists.

Refactor so that that will happen.  I chose to make it try this technique
for any clause type for which clause_selectivity() doesn't have a special
case, not just functions.  To avoid adding unnecessary overhead in the
common case where we don't learn anything new, make selfuncs.c provide an
API that hooks directly to examine_variable() and then var_eq_const(),
rather than the previous coding which laboriously constructed an OpExpr
only so that it could be expensively deconstructed again.

I preserved the behavior that the default estimate for a function call
is 0.3333333.  (For any other expression node type, it's 0.5, as before.)
I had originally thought to make the default be 0.5 across the board, but
changing a default estimate that's survived for twenty-three years seems
like something not to do without a lot more testing than I care to put
into it right now.

Per a complaint from Jehan-Guillaume de Rorthais.  Back-patch into 9.5,
but not further, at least for the moment.

8 years agoImprove handling of collations in contrib/postgres_fdw.
Tom Lane [Thu, 24 Sep 2015 16:47:29 +0000 (12:47 -0400)]
Improve handling of collations in contrib/postgres_fdw.

If we have a local Var of say varchar type with default collation, and
we apply a RelabelType to convert that to text with default collation, we
don't want to consider that as creating an FDW_COLLATE_UNSAFE situation.
It should be okay to compare that to a remote Var, so long as the remote
Var determines the comparison collation.  (When we actually ship such an
expression to the remote side, the local Var would become a Param with
default collation, meaning the remote Var would in fact control the
comparison collation, because non-default implicit collation overrides
default implicit collation in parse_collate.c.)  To fix, be more precise
about what FDW_COLLATE_NONE means: it applies either to a noncollatable
data type or to a collatable type with default collation, if that collation
can't be traced to a remote Var.  (When it can, FDW_COLLATE_SAFE is
appropriate.)  We were essentially using that interpretation already at
the Var/Const/Param level, but we weren't bubbling it up properly.

An alternative fix would be to introduce a separate FDW_COLLATE_DEFAULT
value to describe the second situation, but that would add more code
without changing the actual behavior, so it didn't seem worthwhile.

Also, since we're clarifying the rule to be that we care about whether
operator/function input collations match, there seems no need to fail
immediately upon seeing a Const/Param/non-foreign-Var with nondefault
collation.  We only have to reject if it appears in a collation-sensitive
context (for example, "var IS NOT NULL" is perfectly safe from a collation
standpoint, whatever collation the var has).  So just set the state to
UNSAFE rather than failing immediately.

Per report from Jeevan Chalke.  This essentially corrects some sloppy
thinking in commit ed3ddf918b59545583a4b374566bc1148e75f593, so back-patch
to 9.3 where that logic appeared.

8 years agoDon't zero opfuncid when reading nodes.
Robert Haas [Thu, 24 Sep 2015 15:27:20 +0000 (11:27 -0400)]
Don't zero opfuncid when reading nodes.

The comments here stated that this was just in case we ever had an
ALTER OPERATOR command that could remap an operator to a different
function.  But those comments have been here for a long time, and no
such command has come about.  In the absence of such a feature,
forcing the pg_proc OID to be looked up again each time we reread a
stored rule or similar is just a waste of cycles.  Moreover, parallel
query needs a way to reread the exact same node tree that was written
out, not one that has been slightly stomped on.  So just get rid of
this for now.

Per discussion with Tom Lane.

8 years agoMake pg_controldata report newest XID with valid commit timestamp
Fujii Masao [Thu, 24 Sep 2015 14:31:17 +0000 (23:31 +0900)]
Make pg_controldata report newest XID with valid commit timestamp

Previously pg_controldata didn't report newestCommitTs and this was
an oversight in commit 73c986a.

Also this patch changes pg_resetxlog so that it uses the same sentences
as pg_controldata does, regarding oldestCommitTs and newestCommitTs,
for the sake of consistency.

Back-patch to 9.5 where track_commit_timestamp was added.

Euler Taveira

8 years agoLower *_freeze_max_age minimum values.
Andres Freund [Thu, 24 Sep 2015 12:53:32 +0000 (14:53 +0200)]
Lower *_freeze_max_age minimum values.

The old minimum values are rather large, making it time consuming to
test related behaviour. Additionally the current limits, especially for
multixacts, can be problematic in space-constrained systems. 10000000
multixacts can contain a lot of members.

Since there's no good reason for the current limits, lower them a good
bit. Setting them to 0 would be a bad idea, triggering endless vacuums,
so still retain a limit.

While at it fix autovacuum_multixact_freeze_max_age to refer to
multixact.c instead of varsup.c.

Reviewed-By: Robert Haas
Discussion: CA+TgmoYmQPHcrc3GSs7vwvrbTkbcGD9Gik=OztbDGGrovkkEzQ@mail.gmail.com
Backpatch: back to 9.0 (in parts)

8 years agoMake ANALYZE compute basic statistics even for types with no "=" operator.
Tom Lane [Wed, 23 Sep 2015 22:26:49 +0000 (18:26 -0400)]
Make ANALYZE compute basic statistics even for types with no "=" operator.

Previously, ANALYZE simply ignored columns of datatypes that have neither
a btree nor hash opclass (which means they have no recognized equality
operator).  Without a notion of equality, we can't identify most-common
values nor estimate the number of distinct values.  But we can still
count nulls and compute the average physical column width, and those
stats might be of value.  Moreover there are some tools out there that
don't work so well if rows are missing from pg_statistic.  So let's
add suitable logic for this case.

While this is arguably a bug fix, it also has the potential to change
query plans, and the gain seems not worth taking a risk of that in
stable branches.  So back-patch into 9.5 but not further.

Oleksandr Shulgin, rewritten a bit by me.

8 years agoAdd readfuncs.c support for plan nodes.
Robert Haas [Wed, 23 Sep 2015 15:51:50 +0000 (11:51 -0400)]
Add readfuncs.c support for plan nodes.

For parallel query, we need to be able to pass a Plan to a worker, so
that it knows what it's supposed to do.  We could invent our own way
of serializing plans for that purpose, but piggybacking on the
existing node infrastructure seems like a much better idea.

Initially, we'll probably only support a limited number of nodes
within parallel workers, but this commit adds support for everything
in plannodes.h except CustomScan, because doing it all at once seems
easier than doing it piecemeal, and it makes testing this code easier,
too.  CustomScan is excluded because making that work requires a
larger rework of that facility.

Amit Kapila, reviewed and slightly revised by me.

8 years agoPrint a MergeJoin's mergeNullsFirst array as bool, not int.
Robert Haas [Wed, 23 Sep 2015 14:53:29 +0000 (10:53 -0400)]
Print a MergeJoin's mergeNullsFirst array as bool, not int.

It's declared as being an array of bool, but it's printed
differently from the way bool and arrays of bool are handled
elsewhere.

Patch by Amit Kapila.  Anomaly noted independently by Amit Kapila
and KaiGai Kohei.

8 years agoAllow autoanalyze to add pages deleted from pending list to FSM
Teodor Sigaev [Wed, 23 Sep 2015 12:33:51 +0000 (15:33 +0300)]
Allow autoanalyze to add pages deleted from pending list to FSM

Commit e95680832854cf300e64c10de9cc2f586df558e8 introduces adding pages
to FSM for ordinary insert, but autoanalyze was able just cleanup
pending list without adding to FSM.

Also fix double call of IndexFreeSpaceMapVacuum() during ginvacuumcleanup()

Report from Fujii Masao
Patch by me
Review by Jeff Janes

8 years agoTeach planstate_tree_walker about custom scans.
Robert Haas [Wed, 23 Sep 2015 01:42:00 +0000 (21:42 -0400)]
Teach planstate_tree_walker about custom scans.

This logic was missing from ExplainPreScanNode, from which I derived
planstate_tree_walker.  But it shouldn't be missing, especially not
from a generic walker function, so add it.

KaiGai Kohei

8 years agoDocs: fix typo in to_char() example.
Tom Lane [Tue, 22 Sep 2015 14:40:25 +0000 (10:40 -0400)]
Docs: fix typo in to_char() example.

Per bug #13631 from KOIZUMI Satoru.

8 years agotest_decoding: Protect against rare spurious test failures.
Andres Freund [Tue, 22 Sep 2015 13:33:30 +0000 (15:33 +0200)]
test_decoding: Protect against rare spurious test failures.

A bunch of tests missed specifying that empty transactions shouldn't be
displayed. That causes problems when e.g. autovacuum runs in an
unfortunate moment. The tests in question only run for a very short
time, making this quite unlikely.

Reported-By: Buildfarm member axolotl
Backpatch: 9.4, where logical decoding was introduced

8 years agoCorrect value of LW_SHARED_MASK.
Andres Freund [Tue, 22 Sep 2015 09:05:48 +0000 (11:05 +0200)]
Correct value of LW_SHARED_MASK.

The previous wrong value lead to wrong LOCK_DEBUG output, never showing
any shared lock holders.

Reported-By: Alexander Korotkov
Discussion: CAPpHfdsPmWqz9FB0AnxJrwp1=KLF0n=-iB+QvR0Q8GSmpFVdUQ@mail.gmail.com
Backpatch: 9.5, where the bug was introduced.

8 years agoAdd some notes about coding conventions do the docs.
Andres Freund [Fri, 11 Sep 2015 19:33:17 +0000 (21:33 +0200)]
Add some notes about coding conventions do the docs.

This deserves to be greatly expanded and improved, but it's a start.

Discussion: 20150827145219.GI2435@awork2.anarazel.de

8 years agodoc: Tweak synopsis indentation for consistency
Peter Eisentraut [Tue, 22 Sep 2015 03:31:43 +0000 (23:31 -0400)]
doc: Tweak synopsis indentation for consistency

8 years agoUse gender-neutral language in documentation
Peter Eisentraut [Tue, 22 Sep 2015 02:57:29 +0000 (22:57 -0400)]
Use gender-neutral language in documentation

Based on patch by Thomas Munro <thomas.munro@enterprisedb.com>, although
I rephrased most of the initial work.

8 years agoFix whitespace
Peter Eisentraut [Mon, 21 Sep 2015 17:39:34 +0000 (13:39 -0400)]
Fix whitespace

8 years agoFix possible internal overflow in numeric multiplication.
Tom Lane [Mon, 21 Sep 2015 16:11:32 +0000 (12:11 -0400)]
Fix possible internal overflow in numeric multiplication.

mul_var() postpones propagating carries until it risks overflow in its
internal digit array.  However, the logic failed to account for the
possibility of overflow in the carry propagation step, allowing wrong
results to be generated in corner cases.  We must slightly reduce the
when-to-propagate-carries threshold to avoid that.

Discovered and fixed by Dean Rasheed, with small adjustments by me.

This has been wrong since commit d72f6c75038d8d37e64a29a04b911f728044d83b,
so back-patch to all supported branches.

8 years agoRemove the SECURITY_ROW_LEVEL_DISABLED security context bit.
Noah Misch [Mon, 21 Sep 2015 00:47:17 +0000 (20:47 -0400)]
Remove the SECURITY_ROW_LEVEL_DISABLED security context bit.

This commit's parent made superfluous the bit's sole usage.  Referential
integrity checks have long run as the subject table's owner, and that
now implies RLS bypass.  Safe use of the bit was tricky, requiring
strict control over the SQL expressions evaluating therein.  Back-patch
to 9.5, where the bit was introduced.

Based on a patch by Stephen Frost.

8 years agoRemove the row_security=force GUC value.
Noah Misch [Mon, 21 Sep 2015 00:45:41 +0000 (20:45 -0400)]
Remove the row_security=force GUC value.

Every query of a single ENABLE ROW SECURITY table has two meanings, with
the row_security GUC selecting between them.  With row_security=force
available, every function author would have been advised to either set
the GUC locally or test both meanings.  Non-compliance would have
threatened reliability and, for SECURITY DEFINER functions, security.
Authors already face an obligation to account for search_path, and we
should not mimic that example.  With this change, only BYPASSRLS roles
need exercise the aforementioned care.  Back-patch to 9.5, where the
row_security GUC was introduced.

Since this narrows the domain of pg_db_role_setting.setconfig and
pg_proc.proconfig, one might bump catversion.  A row_security=force
setting in one of those columns will elicit a clear message, so don't.

8 years agoRestrict file mode creation mask during tmpfile().
Noah Misch [Mon, 21 Sep 2015 00:42:27 +0000 (20:42 -0400)]
Restrict file mode creation mask during tmpfile().

Per Coverity.  Back-patch to 9.0 (all supported versions).

Michael Paquier, reviewed (in earlier versions) by Heikki Linnakangas.

8 years agoBe more wary about partially-valid LOCALLOCK data in RemoveLocalLock().
Tom Lane [Sun, 20 Sep 2015 20:48:44 +0000 (16:48 -0400)]
Be more wary about partially-valid LOCALLOCK data in RemoveLocalLock().

RemoveLocalLock() must consider the possibility that LockAcquireExtended()
failed to palloc the initial space for a locallock's lockOwners array.
I had evidently meant to cope with this hazard when the code was originally
written (commit 1785acebf2ed14fd66955e2d9a55d77a025f418d), but missed that
the pfree needed to be protected with an if-test.  Just to make sure things
are left in a clean state, reset numLockOwners as well.

Per low-memory testing by Andreas Seltenreich.  Back-patch to all supported
branches.

8 years agoSimplify GETTEXT_FILES list
Peter Eisentraut [Sat, 19 Sep 2015 02:40:41 +0000 (22:40 -0400)]
Simplify GETTEXT_FILES list

8 years agoAdd missing serial comma
Peter Eisentraut [Sat, 19 Sep 2015 02:40:10 +0000 (22:40 -0400)]
Add missing serial comma

8 years agoRemove trailing slashes from directories in find command
Peter Eisentraut [Sat, 19 Sep 2015 02:03:42 +0000 (22:03 -0400)]
Remove trailing slashes from directories in find command

BSD find is not very smart and ends up writing double slashes into the
output in those cases.  Also, xgettext is not very smart and splits the
file names incorrectly in those cases, resulting in slightly incorrect
file names being written into the POT file.

8 years agoGlue layer to connect the executor to the shm_mq mechanism.
Robert Haas [Sat, 19 Sep 2015 01:10:08 +0000 (21:10 -0400)]
Glue layer to connect the executor to the shm_mq mechanism.

The shm_mq mechanism was built to send error (and notice) messages and
tuples between backends.  However, shm_mq itself only deals in raw
bytes.  Since commit 2bd9e412f92bc6a68f3e8bcb18e04955cc35001d, we have
had infrastructure for one message to redirect protocol messages to a
queue and for another backend to parse them and do useful things with
them.  This commit introduces a somewhat analogous facility for tuples
by adding a new type of DestReceiver, DestTupleQueue, which writes
each tuple generated by a query into a shm_mq, and a new
TupleQueueFunnel facility which reads raw tuples out of the queue and
reconstructs the HeapTuple format expected by the executor.

The TupleQueueFunnel abstraction supports reading from multiple tuple
streams at the same time, but only in round-robin fashion.  Someone
could imaginably want other policies, but this should be good enough
to meet our short-term needs related to parallel query, and we can
always extend it later.

This also makes one minor addition to the shm_mq API that didn'
seem worth breaking out as a separate patch.

Extracted from Amit Kapila's parallel sequential scan patch.  This
code was originally written by me, and then it was revised by Amit,
and then it was revised some more by me.

8 years agoCache argument type information in json(b) aggregate functions.
Andrew Dunstan [Fri, 18 Sep 2015 18:39:39 +0000 (14:39 -0400)]
Cache argument type information in json(b) aggregate functions.

These functions have been looking up type info for every row they
process. Instead of doing that we only look them up the first time
through and stash the information in the aggregate state object.

Affects json_agg, json_object_agg, jsonb_agg and jsonb_object_agg.

There is plenty more work to do in making these more efficient,
especially the jsonb functions, but this is a virtually cost free
improvement that can be done right away.

Backpatch to 9.5 where the jsonb variants were introduced.

8 years agoFix low-probability memory leak in regex execution.
Tom Lane [Fri, 18 Sep 2015 17:55:17 +0000 (13:55 -0400)]
Fix low-probability memory leak in regex execution.

After an internal failure in shortest() or longest() while pinning down the
exact location of a match, find() forgot to free the DFA structure before
returning.  This is pretty unlikely to occur, since we just successfully
ran the "search" variant of the DFA; but it could happen, and it would
result in a session-lifespan memory leak since this code uses malloc()
directly.  Problem seems to have been aboriginal in Spencer's library,
so back-patch all the way.

In passing, correct a thinko in a comment I added awhile back about the
meaning of the "ntree" field.

I happened across these issues while comparing our code to Tcl's version
of the library.

8 years agoAdd header forgotten in 213335c14529a8d5e2007ec0c256f4cf64d62d3b
Teodor Sigaev [Fri, 18 Sep 2015 11:32:09 +0000 (14:32 +0300)]
Add header forgotten in 213335c14529a8d5e2007ec0c256f4cf64d62d3b

Report from Peter Eisentraut

8 years agoOrder some new options on man pages more sensibly, minor improvements
Peter Eisentraut [Fri, 18 Sep 2015 00:56:58 +0000 (20:56 -0400)]
Order some new options on man pages more sensibly, minor improvements

8 years agoFix oversight in tsearch type check
Teodor Sigaev [Thu, 17 Sep 2015 16:50:51 +0000 (19:50 +0300)]
Fix oversight in tsearch type check

Use IsBinaryCoercible() method instead of custom
is_expected_type/is_text_type functions which was introduced when tsearch2
was moved into core.

Per report by David E. Wheeler
Analysis by Tom Lane
Patch by me

8 years agoHonour TEMP_CONFIG when testing pg_upgrade
Andrew Dunstan [Thu, 17 Sep 2015 15:57:00 +0000 (11:57 -0400)]
Honour TEMP_CONFIG when testing pg_upgrade

This setting contains extra configuration for the temp instance, as used
in pg_regress' --temp-config flag.

Backpatch to 9.2 where test.sh was introduced.

8 years agoAdd new function planstate_tree_walker.
Robert Haas [Thu, 17 Sep 2015 15:24:49 +0000 (11:24 -0400)]
Add new function planstate_tree_walker.

ExplainPreScanNode knows how to iterate over a generic tree of plan
states; factor that logic out into a separate walker function so that
other code, such as upcoming patches for parallel query, can also use
it.

Patch by me, reviewed by Tom Lane.

8 years agoLet compiler handle size calculation of bool types.
Michael Meskes [Thu, 17 Sep 2015 13:41:04 +0000 (15:41 +0200)]
Let compiler handle size calculation of bool types.

Back in the day this did not work, but modern compilers should handle it themselves.

8 years agoFix bug introduced by microvacuum for GiST
Teodor Sigaev [Thu, 17 Sep 2015 11:22:37 +0000 (14:22 +0300)]
Fix bug introduced by microvacuum for GiST

Commit 013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7 introduces microvacuum for
GiST, deletetion of tuple marked LP_DEAD uses IndexPageMultiDelete while
recovery code uses IndexPageTupleDelete in loop. This causes a difference
in offset numbers of tuples to delete. Patch introduces usage of
IndexPageMultiDelete in GiST except gistplacetopage() where only one tuple is
deleted at once. That also slightly improve performance, because
IndexPageMultiDelete is more effective.

Patch changes WAL format, so bump wal page magic.

Bug report from Jeff Janes
Diagnostic and patch by Anastasia Lubennikova and me

8 years agoDetermine whether it's safe to attempt a parallel plan for a query.
Robert Haas [Wed, 16 Sep 2015 19:38:47 +0000 (15:38 -0400)]
Determine whether it's safe to attempt a parallel plan for a query.

Commit 924bcf4f16d54c55310b28f77686608684734f42 introduced a framework
for parallel computation in PostgreSQL that makes most but not all
built-in functions safe to execute in parallel mode.  In order to have
parallel query, we'll need to be able to determine whether that query
contains functions (either built-in or user-defined) that cannot be
safely executed in parallel mode.  This requires those functions to be
labeled, so this patch introduces an infrastructure for that.  Some
functions currently labeled as safe may need to be revised depending on
how pending issues related to heavyweight locking under paralllelism
are resolved.

Parallel plans can't be used except for the case where the query will
run to completion.  If portal execution were suspended, the parallel
mode restrictions would need to remain in effect during that time, but
that might make other queries fail.  Therefore, this patch introduces
a framework that enables consideration of parallel plans only when it
is known that the plan will be run to completion.  This probably needs
some refinement; for example, at bind time, we do not know whether a
query run via the extended protocol will be execution to completion or
run with a limited fetch count.  Having the client indicate its
intentions at bind time would constitute a wire protocol break.  Some
contexts in which parallel mode would be safe are not adjusted by this
patch; the default is not to try parallel plans except from call sites
that have been updated to say that such plans are OK.

This commit doesn't introduce any parallel paths or plans; it just
provides a way to determine whether they could potentially be used.
I'm committing it on the theory that the remaining parallel sequential
scan patches will also get committed to this release, hopefully in the
not-too-distant future.

Robert Haas and Amit Kapila.  Reviewed (in earlier versions) by Noah
Misch.

8 years agoSync regex code with Tcl 8.6.4.
Tom Lane [Wed, 16 Sep 2015 19:25:25 +0000 (15:25 -0400)]
Sync regex code with Tcl 8.6.4.

Sync our regex code with upstream changes since last time we did this,
which was Tcl 8.5.11 (see commit 08fd6ff37f71485e2fc04bc6ce07d2a483c36702).

The only functional change here is to disbelieve that an octal escape is
three digits long if it would exceed \377.  That's a bug fix, but it's
a minor one and could change the interpretation of working regexes, so
don't back-patch.

In addition to that, s/INFINITY/DUPINF/ to eliminate the risk of collisions
with <math.h>'s macro, and s/LOCAL/NOPROP/ because that also seems like
an unnecessarily collision-prone macro name.

There were some other cosmetic changes in their copy that I did not adopt,
notably a rather half-hearted attempt at renaming some of the C functions
in a more verbose style.  (I'm not necessarily against the concept, but
renaming just a few functions in the package is not an improvement.)

8 years agoFix documentation of regular expression character-entry escapes.
Tom Lane [Wed, 16 Sep 2015 18:50:12 +0000 (14:50 -0400)]
Fix documentation of regular expression character-entry escapes.

The docs claimed that \uhhhh would be interpreted as a Unicode value
regardless of the database encoding, but it's never been implemented
that way: \uhhhh and \xhhhh actually mean exactly the same thing, namely
the character that pg_mb2wchar translates to 0xhhhh.  Moreover we were
falsely dismissive of the usefulness of Unicode code points above FFFF.
Fix that.

It's been like this for ages, so back-patch to all supported branches.

8 years agoDon't use "#" as an abbreviation for "number" in PL/Tcl error messages.
Tom Lane [Wed, 16 Sep 2015 16:08:57 +0000 (12:08 -0400)]
Don't use "#" as an abbreviation for "number" in PL/Tcl error messages.

Also, rewrite one error message to make it follow our message style
guidelines better.

Euler Taveira and Tom Lane

8 years agoRemove no-longer-used T_PrivGrantee node tag.
Tom Lane [Wed, 16 Sep 2015 14:48:11 +0000 (10:48 -0400)]
Remove no-longer-used T_PrivGrantee node tag.

Oversight in commit 31eae6028eca4365e7165f5f33fee1ed0486aee0, which
replaced PrivGrantee nodes with RoleSpec nodes.  Spotted by Yugo Nagata.

8 years agopgbench progress with timestamp
Teodor Sigaev [Wed, 16 Sep 2015 14:24:53 +0000 (17:24 +0300)]
pgbench progress with timestamp

This patch adds an option to replace the "time since pgbench run
started" with a Unix epoch timestamp in the progress report so that,
for instance, it is easier to compare timelines with pgsql log

Fabien COELHO <coelho@cri.ensmp.fr>

8 years agoReview program help output for wording and formatting
Peter Eisentraut [Wed, 16 Sep 2015 04:37:39 +0000 (00:37 -0400)]
Review program help output for wording and formatting

8 years agoEnforce ALL/SELECT policies in RETURNING for RLS
Stephen Frost [Tue, 15 Sep 2015 19:49:31 +0000 (15:49 -0400)]
Enforce ALL/SELECT policies in RETURNING for RLS

For the UPDATE/DELETE RETURNING case, filter the records which are not
visible to the user through ALL or SELECT policies from those considered
for the UPDATE or DELETE.  This is similar to how the GRANT system
works, which prevents RETURNING unless the caller has SELECT rights on
the relation.

Per discussion with Robert, Dean, Tom, and Kevin.

Back-patch to 9.5 where RLS was introduced.

8 years agoRLS refactoring
Stephen Frost [Tue, 15 Sep 2015 19:49:31 +0000 (15:49 -0400)]
RLS refactoring

This refactors rewrite/rowsecurity.c to simplify the handling of the
default deny case (reducing the number of places where we check for and
add the default deny policy from three to one) by splitting up the
retrival of the policies from the application of them.

This also allowed us to do away with the policy_id field.  A policy_name
field was added for WithCheckOption policies and is used in error
reporting, when available.

Patch by Dean Rasheed, with various mostly cosmetic changes by me.

Back-patch to 9.5 where RLS was introduced to avoid unnecessary
differences, since we're still in alpha, per discussion with Robert.

8 years agoFix whitespace
Peter Eisentraut [Tue, 15 Sep 2015 19:20:13 +0000 (15:20 -0400)]
Fix whitespace

8 years agoRevert "Fix an O(N^2) problem in foreign key references".
Tom Lane [Tue, 15 Sep 2015 15:08:56 +0000 (11:08 -0400)]
Revert "Fix an O(N^2) problem in foreign key references".

Commit 5ddc72887a012f6a8b85707ef27d85c274faf53d does not actually work
because it will happily blow away ri_constraint_cache entries that are
in active use in outer call levels.  In any case, it's a very ugly,
brute-force solution to the problem of limiting the cache size.
Revert until it can be redesigned.

8 years agoAdd POLICY to COMMENT documentation
Stephen Frost [Tue, 15 Sep 2015 14:56:29 +0000 (10:56 -0400)]
Add POLICY to COMMENT documentation

COMMENT supports POLICY but the documentation hadn't caught up with
that fact.

Patch by Charles Clavadetscher

Back-patch to 9.5 where POLICY was added.

8 years agoFix comment regarding the meaning of infinity for timeline history entry
Fujii Masao [Tue, 15 Sep 2015 14:38:01 +0000 (23:38 +0900)]
Fix comment regarding the meaning of infinity for timeline history entry

Michael Paquier

8 years agoImprove log messages related to tablespace_map file
Fujii Masao [Tue, 15 Sep 2015 14:21:51 +0000 (23:21 +0900)]
Improve log messages related to tablespace_map file

This patch changes the log message which is logged when the server
successfully renames backup_label file to *.old but fails to rename
tablespace_map file during the shutdown. Previously the WARNING
message "online backup mode was not canceled" was logged in that case.
However this message is confusing because the backup mode is treated
as canceled whenever backup_label is successfully renamed. So this
commit makes the server log the message "online backup mode canceled"
in that case.

Also this commit changes errdetail messages so that they follow the
error message style guide.

Back-patch to 9.5 where tablespace_map file is introduced.

Original patch by Amit Kapila, heavily modified by me.

8 years agoFix wrong comment in commit d02426029b133ee2bbe492a038642359bce3c527
Teodor Sigaev [Tue, 15 Sep 2015 06:33:22 +0000 (09:33 +0300)]
Fix wrong comment in commit d02426029b133ee2bbe492a038642359bce3c527

Per gripe from Robert Haas

8 years agoCheck existency of table/schema for -t/-n option (pg_dump/pg_restore)
Teodor Sigaev [Mon, 14 Sep 2015 13:19:49 +0000 (16:19 +0300)]
Check existency of table/schema for -t/-n option (pg_dump/pg_restore)

Patch provides command line option --strict-names which requires that at
least one table/schema should present for each -t/-n option.

Pavel Stehule <pavel.stehule@gmail.com>

8 years agoAdd noreturn attribute
Peter Eisentraut [Sun, 13 Sep 2015 22:47:56 +0000 (18:47 -0400)]
Add noreturn attribute

per gcc -Wsuggest-attribute=noreturn

8 years agoFix the fastpath rule for jsonb_concat with an empty operand.
Andrew Dunstan [Sun, 13 Sep 2015 21:06:45 +0000 (17:06 -0400)]
Fix the fastpath rule for jsonb_concat with an empty operand.

To prevent perverse results, we now only return the other operand if
it's not scalar, and if both operands are of the same kind (array or
object).

Original bug complaint and patch from Oskari Saarenmaa, extended by me
to cover the cases of different kinds of jsonb.

Backpatch to 9.5 where jsonb_concat was introduced.

8 years agodoc: Remove dead links
Peter Eisentraut [Sun, 13 Sep 2015 03:49:11 +0000 (23:49 -0400)]
doc: Remove dead links

The web pages of Andy Dong at Berkeley don't exist anymore, and he is no
longer there.

8 years agoFix typo in create_policy.sgml
Stephen Frost [Sat, 12 Sep 2015 21:17:00 +0000 (17:17 -0400)]
Fix typo in create_policy.sgml

WTIH -> WITH

Pointed out by Dmitriy Olshevskiy

Backpatch to 9.5 where create_policy.sgml was added.

8 years agoUpdate SQL features list
Peter Eisentraut [Sat, 12 Sep 2015 04:07:56 +0000 (00:07 -0400)]
Update SQL features list

8 years agoInstall lwlocknames.h even in vpath builds.
Robert Haas [Fri, 11 Sep 2015 20:45:41 +0000 (16:45 -0400)]
Install lwlocknames.h even in vpath builds.

Per buildfarm member crake.

8 years agopg_dump, pg_upgrade: allow postgres/template1 tablespace moves
Bruce Momjian [Fri, 11 Sep 2015 19:51:11 +0000 (15:51 -0400)]
pg_dump, pg_upgrade:  allow postgres/template1 tablespace moves

Modify pg_dump to restore postgres/template1 databases to non-default
tablespaces by switching out of the database to be moved, then switching
back.

Also, to fix potentially cases where the old/new tablespaces might not
match, fix pg_upgrade to process new/old tablespaces separately in all
cases.

Report by Marti Raudsepp

Patch by Marti Raudsepp, me

Backpatch through 9.0

8 years agoFix build problems in commit aa65de042f5828968f2f6cd65f45c543a40cc3e6.
Robert Haas [Fri, 11 Sep 2015 18:53:41 +0000 (14:53 -0400)]
Fix build problems in commit aa65de042f5828968f2f6cd65f45c543a40cc3e6.

The previous way didn't work for vpath builds, and make distprep was
busted too.

Reported off-list by Andres Freund.

8 years agoAdd missing ReleaseBuffer call in BRIN revmap code
Alvaro Herrera [Fri, 11 Sep 2015 18:29:46 +0000 (15:29 -0300)]
Add missing ReleaseBuffer call in BRIN revmap code

I think this particular branch is actually dead, but the analysis to
prove that is not trivial, so instead take the weasel way.

Reported by Jinyu Zhang
Backpatch to 9.5, where BRIN was introduced.

8 years agoFix an O(N^2) problem in foreign key references.
Kevin Grittner [Fri, 11 Sep 2015 18:06:51 +0000 (13:06 -0500)]
Fix an O(N^2) problem in foreign key references.

Commit 45ba424f improved foreign key lookups during bulk updates
when the FK value does not change.  When restoring a schema dump
from a database with many (say 100,000) foreign keys, this cache
would grow very big and every ALTER TABLE command was causing an
InvalidateConstraintCacheCallBack(), which uses a sequential hash
table scan.  This could cause a severe performance regression in
restoring a schema dump (including during pg_upgrade).

The patch uses a heuristic method of detecting when the hash table
should be destroyed and recreated.
InvalidateConstraintCacheCallBack() adds the current size of the
hash table to a counter.  When that sum reaches 1,000,000, the hash
table is flushed.  This fixes the regression without noticeable
harm to the bulk update use case.

Jan Wieck
Backpatch to 9.3 where the performance regression was introduced.

8 years agoWhen trace_lwlocks is used, identify individual lwlocks by name.
Robert Haas [Fri, 11 Sep 2015 17:58:28 +0000 (13:58 -0400)]
When trace_lwlocks is used, identify individual lwlocks by name.

Naming the individual lwlocks seems like something that may be useful
for other types of debugging, monitoring, or instrumentation output,
but this commit just implements it for the specific case of
trace_lwlocks.

Patch by me, reviewed by Amit Kapila and Kyotaro Horiguchi

8 years agoCorrect description of PageHeaderData layout in documentation
Fujii Masao [Fri, 11 Sep 2015 04:02:15 +0000 (13:02 +0900)]
Correct description of PageHeaderData layout in documentation

Back-patch to 9.3 where PageHeaderData layout was changed.

Michael Paquier

8 years agodoc: Spell checking
Peter Eisentraut [Fri, 11 Sep 2015 01:22:21 +0000 (21:22 -0400)]
doc: Spell checking

8 years agoFix setrefs.c comment properly.
Tom Lane [Thu, 10 Sep 2015 14:23:56 +0000 (10:23 -0400)]
Fix setrefs.c comment properly.

The "typo" alleged in commit 1e460d4bd was actually a comment that was
correct when written, but I missed updating it in commit b5282aa89.
Use a slightly less specific (and hopefully more future-proof) description
of what is collected.  Back-patch to 9.2 where that commit appeared, and
revert the comment to its then-entirely-correct state before that.

8 years agoFix typo in setrefs.c
Stephen Frost [Thu, 10 Sep 2015 13:22:03 +0000 (09:22 -0400)]
Fix typo in setrefs.c

We're adding OIDs, not TIDs, to invalItems.

Pointed out by Etsuro Fujita.

Back-patch to all supported branches.

8 years agoFix minor bug in regexp makesearch() function.
Tom Lane [Thu, 10 Sep 2015 00:14:58 +0000 (20:14 -0400)]
Fix minor bug in regexp makesearch() function.

The list-wrangling here was done wrong, allowing the same state to get
put into the list twice.  The following loop then would clone it twice.
The second clone would wind up with no inarcs, so that there was no
observable misbehavior AFAICT, but a useless state in the finished NFA
isn't an especially good thing.

8 years agoFix oversight in 013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7 commit
Teodor Sigaev [Wed, 9 Sep 2015 16:21:16 +0000 (19:21 +0300)]
Fix oversight in 013ebc0a7b7ea9c1b1ab7a3d4dd75ea121ea8ba7 commit

Declaration of varibale inside ÓÝ×Õ

8 years agoMicrovacuum for GIST
Teodor Sigaev [Wed, 9 Sep 2015 15:43:37 +0000 (18:43 +0300)]
Microvacuum for GIST

Mark index tuple as dead if it's pointed by kill_prior_tuple during
ordinary (search) scan and remove it during insert process if there is no
enough space for new tuple to insert. This improves select performance
because index will not return tuple marked as dead and improves insert
performance because it reduces number of page split.

Anastasia Lubennikova <a.lubennikova@postgrespro.ru> with
 minor editorialization by me

8 years agoRemove files signaling a standby promotion request at postmaster startup
Fujii Masao [Wed, 9 Sep 2015 13:51:44 +0000 (22:51 +0900)]
Remove files signaling a standby promotion request at postmaster startup

This commit makes postmaster forcibly remove the files signaling
a standby promotion request. Otherwise, the existence of those files
can trigger a promotion too early, whether a user wants that or not.

This removal of files is usually unnecessary because they can exist
only during a few moments during a standby promotion. However
there is a race condition: if pg_ctl promote is executed and creates
the files during a promotion, the files can stay around even after
the server is brought up to new master. Then, if new standby starts
by using the backup taken from that master, the files can exist
at the server startup and should be removed in order to avoid
an unexpected promotion.

Back-patch to 9.1 where promote signal file was introduced.

Problem reported by Feike Steenbergen.
Original patch by Michael Paquier, modified by me.

Discussion: 20150528100705.4686.91426@wrigleys.postgresql.org

8 years agoLock all relations referred to in updatable views
Stephen Frost [Tue, 8 Sep 2015 21:02:49 +0000 (17:02 -0400)]
Lock all relations referred to in updatable views

Even views considered "simple" enough to be automatically updatable may
have mulitple relations involved (eg: in a where clause).  We need to
make sure and lock those relations when rewriting the query.

Back-patch to 9.3 where updatable views were added.

Pointed out by Andres, patch thanks to Dean Rasheed.

8 years agopsql: Generic tab completion support for enum and bool GUCs.
Andres Freund [Tue, 8 Sep 2015 18:57:35 +0000 (20:57 +0200)]
psql: Generic tab completion support for enum and bool GUCs.

Author: Pavel Stehule
Reviewed-By: Andres Freund
Discussion: 5594FE7A.5050205@iki.fi

8 years agoAdd gin_fuzzy_search_limit to postgresql.conf.sample.
Fujii Masao [Tue, 8 Sep 2015 17:25:50 +0000 (02:25 +0900)]
Add gin_fuzzy_search_limit to postgresql.conf.sample.

This was forgotten in 8a3631f (commit that originally added the parameter)
and 0ca9907 (commit that added the documentation later that year).

Back-patch to all supported versions.

8 years agoImprove tab-completion for GRANT and REVOKE.
Fujii Masao [Tue, 8 Sep 2015 16:58:29 +0000 (01:58 +0900)]
Improve tab-completion for GRANT and REVOKE.

Thomas Munro, reviewed by Michael Paquier, modified by me.

8 years agoAllow per-tablespace effective_io_concurrency
Alvaro Herrera [Tue, 8 Sep 2015 15:51:42 +0000 (12:51 -0300)]
Allow per-tablespace effective_io_concurrency

Per discussion, nowadays it is possible to have tablespaces that have
wildly different I/O characteristics from others.  Setting different
effective_io_concurrency parameters for those has been measured to
improve performance.

Author: Julien Rouhaud
Reviewed by: Andres Freund

8 years agoFix error message wording in previous sslinfo commit
Alvaro Herrera [Tue, 8 Sep 2015 14:10:20 +0000 (11:10 -0300)]
Fix error message wording in previous sslinfo commit

8 years agocontrib/sslinfo: add ssl_extension_info SRF
Alvaro Herrera [Tue, 8 Sep 2015 00:24:17 +0000 (21:24 -0300)]
contrib/sslinfo: add ssl_extension_info SRF

This new function provides information about SSL extensions present in
the X509 certificate used for the current connection.

Extension version updated to version 1.1.

Author: Дмитрий Воронин (Dmitry Voronin)
Reviewed by: Michael Paquier, Heikki Linnakangas, Álvaro Herrera

8 years agoIn the pg_rewind test suite, receive WAL fully before promoting.
Noah Misch [Mon, 7 Sep 2015 23:01:00 +0000 (19:01 -0400)]
In the pg_rewind test suite, receive WAL fully before promoting.

If a transaction never reaches the standby, later tests find unexpected
cluster state.  A "tail-copy: query result matches" test failure has
been the usual symptom.  Among the buildfarm members having run this
test suite, most have exhibited that symptom at least once.  Back-patch
to 9.5, where pg_rewind was introduced.

Michael Paquier, reported by Christoph Berg.

8 years agoCoordinate log_line_prefix options 'm' and 'n' to share a timeval.
Jeff Davis [Mon, 7 Sep 2015 22:40:49 +0000 (15:40 -0700)]
Coordinate log_line_prefix options 'm' and 'n' to share a timeval.

Commit f828654e introduced the 'n' option, but it invoked
gettimeofday() independently of the 'm' option. If both options were
in use (or multiple 'n' options), or if 'n' was in use along with
csvlog, then the reported times could be different for the same log
message.

To fix, initialize a global variable with gettimeofday() once per log
message, and use that for both formats.

Don't bother coordinating the time for the 't' option, which has much
lower resolution.

Per complaint by Alvaro Herrera.

8 years agoAdd more sanity checks in contrib/sslinfo
Alvaro Herrera [Mon, 7 Sep 2015 22:18:29 +0000 (19:18 -0300)]
Add more sanity checks in contrib/sslinfo

We were missing a few return checks on OpenSSL calls.  Should be pretty
harmless, since we haven't seen any user reports about problems, and
this is not a high-traffic module anyway; still, a bug is a bug, so
backpatch this all the way back to 9.0.

Author: Michael Paquier, while reviewing another sslinfo patch

8 years agoAdd log_line_prefix option 'n' for Unix epoch.
Jeff Davis [Mon, 7 Sep 2015 20:46:31 +0000 (13:46 -0700)]
Add log_line_prefix option 'n' for Unix epoch.

Prints time as Unix epoch with milliseconds.

Tomas Vondra, reviewed by Fabien Coelho.

8 years agoChange type of DOW/DOY to UNITS
Greg Stark [Mon, 7 Sep 2015 12:35:09 +0000 (13:35 +0100)]
Change type of DOW/DOY to UNITS

8 years agoMake GIN's cleanup pending list process interruptable
Teodor Sigaev [Mon, 7 Sep 2015 14:16:29 +0000 (17:16 +0300)]
Make GIN's cleanup pending list process interruptable

Cleanup process could be called by ordinary insert/update and could take a lot
of time. Add vacuum_delay_point() to make this process interruptable. Under
vacuum this call will also throttle a vacuum process to decrease system load,
called from insert/update it will not throttle, and that reduces a latency.

Backpatch for all supported branches.

Jeff Janes <jeff.janes@gmail.com>

8 years agoAdd pages deleted from pending list to FSM
Teodor Sigaev [Mon, 7 Sep 2015 13:24:01 +0000 (16:24 +0300)]
Add pages deleted from pending list to FSM

Add pages deleted from GIN's pending list during cleanup to free space map
immediately. Clean up process could be initiated by ordinary insert but adding
page to FSM might occur only at vacuum. On some workload like never-vacuumed
insert-only tables it could cause a huge bloat.

Jeff Janes <jeff.janes@gmail.com>

8 years agoUpdate site address of Snowball project
Teodor Sigaev [Mon, 7 Sep 2015 12:20:45 +0000 (15:20 +0300)]
Update site address of Snowball project

8 years agoAdjust sepgsql regression output for recent error context change
Joe Conway [Sun, 6 Sep 2015 18:25:36 +0000 (11:25 -0700)]
Adjust sepgsql regression output for recent error context change

Recent commit 0426f349e changed handling of error context reports
in such a way to have a minor effect on the sepgsql regression
output. Adapt the expected output file to suit. Since that commit
was HEAD only, so is this one.

8 years agoSupport RADIUS passwords up to 128 characters
Magnus Hagander [Sun, 6 Sep 2015 12:26:33 +0000 (14:26 +0200)]
Support RADIUS passwords up to 128 characters

Previous limit was 16 characters, due to lack of support for multiple passes
of encryption.

Marko Tiikkaja

8 years agoAdd ability to reserve WAL upon slot creation via replication protocol.
Andres Freund [Sun, 6 Sep 2015 11:17:23 +0000 (13:17 +0200)]
Add ability to reserve WAL upon slot creation via replication protocol.

Since 6fcd885 it is possible to immediately reserve WAL when creating a
slot via pg_create_physical_replication_slot(). Extend the replication
protocol to allow that as well.

Although, in contrast to the SQL interface, it is possible to update the
reserved location via the replication interface, it is still useful
being able to reserve upon creation there. Otherwise the logic in
ReplicationSlotReserveWal() has to be repeated in slot employing
clients.

Author: Michael Paquier
Discussion: CAB7nPqT0Wc1W5mdYGeJ_wbutbwNN+3qgrFR64avXaQCiJMGaYA@mail.gmail.com