]> granicus.if.org Git - postgresql/log
postgresql
9 years agodoc: Update installation instructions for new shared libperl/libpython handling
Peter Eisentraut [Tue, 5 May 2015 18:41:39 +0000 (14:41 -0400)]
doc: Update installation instructions for new shared libperl/libpython handling

9 years agoAdd geometry/range functions to support BRIN inclusion
Alvaro Herrera [Tue, 5 May 2015 18:22:24 +0000 (15:22 -0300)]
Add geometry/range functions to support BRIN inclusion

This commit adds the following functions:
    box(point) -> box
    bound_box(box, box) -> box
    inet_same_family(inet, inet) -> bool
    inet_merge(inet, inet) -> cidr
    range_merge(anyrange, anyrange) -> anyrange

The first of these is also used to implement a new assignment cast from
point to box.

These functions are the first part of a base to implement an "inclusion"
operator class for BRIN, for multidimensional data types.

Author: Emre Hasegeli
Reviewed by: Andreas Karlsson

9 years agoFix some problems with patch to fsync the data directory.
Robert Haas [Tue, 5 May 2015 12:30:28 +0000 (08:30 -0400)]
Fix some problems with patch to fsync the data directory.

pg_win32_is_junction() was a typo for pgwin32_is_junction().  open()
was used not only in a two-argument form, which breaks on Windows,
but also where BasicOpenFile() should have been used.

Per reports from Andrew Dunstan and David Rowley.

9 years agohstore_plpython: Support tests on Python 2.3
Peter Eisentraut [Tue, 5 May 2015 02:30:21 +0000 (22:30 -0400)]
hstore_plpython: Support tests on Python 2.3

Python 2.3 does not have the sorted() function, so do it the long way.

9 years agoFix typos
Peter Eisentraut [Tue, 5 May 2015 00:40:19 +0000 (20:40 -0400)]
Fix typos

Author: Erik Rijkers <er@xs4all.nl>

9 years agoUse outerPlanState macro instead of referring to leffttree.
Robert Haas [Mon, 4 May 2015 20:13:07 +0000 (16:13 -0400)]
Use outerPlanState macro instead of referring to leffttree.

This makes the executor code more consistent.  It also removes
an apparently superfluous NULL test in nodeGroup.c.

Qingqing Zhou, reviewed by Tom Lane, and further revised by me.

9 years agoImprove procost estimates for some text search functions.
Tom Lane [Mon, 4 May 2015 19:38:57 +0000 (15:38 -0400)]
Improve procost estimates for some text search functions.

The text search functions that involve parsing raw text into lexemes are
remarkably CPU-intensive, so estimating them at the same cost as most other
built-in functions seems like a mistake; moreover, doing so turns out to
discourage the optimizer from using functional indexes on these functions.
After some debate, we've agreed to raise procost from 1 to 100 for
to_tsvector(), plainto_tsvector(), to_tsquery(), ts_headline(),
ts_match_tt(), and ts_match_tq(), which are all the text search functions
that parse raw text.

Also increase procost for the 2-argument form of ts_rewrite()
(tsquery_rewrite_query); while this function doesn't do text parsing,
it does execute a user-supplied SQL query, so its previous procost of 1 is
clearly a drastic underestimate.  It seems reasonable to assign it the same
cost we assign to PL functions by default, so 100 is the number here too.

I did not bother bumping catversion for this change, since it does not
break catalog compatibility with the server executable nor result in
any regression test changes.

Per complaint from Andrew Gierth and subsequent discussion.

9 years agoRecursively fsync() the data directory after a crash.
Robert Haas [Mon, 4 May 2015 18:13:53 +0000 (14:13 -0400)]
Recursively fsync() the data directory after a crash.

Otherwise, if there's another crash, some writes from after the first
crash might make it to disk while writes from before the crash fail
to make it to disk.  This could lead to data corruption.

Back-patch to all supported versions.

Abhijit Menon-Sen, reviewed by Andres Freund and slightly revised
by me.

9 years agoFix the same-rel optimization when creating WAL records.
Heikki Linnakangas [Mon, 4 May 2015 17:58:42 +0000 (20:58 +0300)]
Fix the same-rel optimization when creating WAL records.

prev_regbuf was never set, and therefore the same-rel flag was never set on
WAL records.

Report and fix by Zhanq Zq

9 years agoFix two small bugs in json's populate_record_worker
Andrew Dunstan [Mon, 4 May 2015 16:38:58 +0000 (12:38 -0400)]
Fix two small bugs in json's populate_record_worker

The first bug is not releasing a tupdesc when doing an early return out
of the function. The second bug is a logic error in choosing when to do
an early return if given an empty jsonb object.

Bug reports from Pavel Stehule and Tom Lane respectively.

Backpatch to 9.4 where these were introduced.

9 years agoSecond try at fixing warnings caused by commit 9b43d73b3f9bef27.
Tom Lane [Mon, 4 May 2015 03:44:52 +0000 (23:44 -0400)]
Second try at fixing warnings caused by commit 9b43d73b3f9bef27.

Commit ef3f9e642d2b2bba suppressed one cause of warnings here, but
recent clang on OS X is still unhappy because we're passing a "long"
to abs().  The fact that tm_gmtoff is declared as long is no doubt a
hangover from days when int might be only 16 bits; but Postgres has
never been able to run on such machines, so we can just cast it to int
with no worries.  For consistency, also cast to int in the other
uses of tm_gmtoff in this stanza.

Note: this code is still broken on machines that don't follow C99
integer-division-truncates-towards-zero rules.  Given the lack of
complaints about it, I don't feel a large desire to complicate things
enough to cope with the pre-C99 rules.

9 years agoFix overlooked relcache invalidation in ALTER TABLE ... ALTER CONSTRAINT.
Tom Lane [Sun, 3 May 2015 15:30:24 +0000 (11:30 -0400)]
Fix overlooked relcache invalidation in ALTER TABLE ... ALTER CONSTRAINT.

When altering the deferredness state of a foreign key constraint, we
correctly updated the catalogs and then invalidated the relcache state for
the target relation ... but that's not the only relation with relevant
triggers.  Must invalidate the other table as well, or the state change
fails to take effect promptly for operations triggered on the other table.
Per bug #13224 from Christian Ullrich.

In passing, reorganize regression test case for this feature so that it
isn't randomly injected into the middle of an unrelated test sequence.

Oversight in commit f177cbfe676dc2c7ca2b206c54d6bf819feeea8b.  Back-patch
to 9.4 where the faulty code was added.

9 years agofix escaping of brackets for m4 broken in b6b2149e48aa61981ae0199c963d5145a37c258c
Andrew Dunstan [Sun, 3 May 2015 13:37:15 +0000 (09:37 -0400)]
fix escaping of brackets for m4 broken in b6b2149e48aa61981ae0199c963d5145a37c258c

9 years agoEnable transforms modules to build and run with Mingw builds.
Andrew Dunstan [Sun, 3 May 2015 13:10:47 +0000 (09:10 -0400)]
Enable transforms modules to build and run with Mingw builds.

These modules were all missing essential Windows scaffolding, including
resources files and descriptions, and links to the relevant library
import files. This latter item means that the modules can't be built
with pgxs on Windows, as we don't install the import files. If we ever
decide to install them this restriction could probably be removed.

Also, as with plperl we need to make sure that perl's CORE directory is
last on the include list, as on Windows it appears to contain some
headers with names that clash with names of some headers we include.

9 years agoFix python_includespec on Windows at configure time
Andrew Dunstan [Sun, 3 May 2015 12:17:04 +0000 (08:17 -0400)]
Fix python_includespec on Windows at configure time

By converting to using forward slashes at configure time we avoid
having to repeat the logic anywhere that this is needed, such as
in transforms modules for plpython.

9 years agoCombine initdb tests that successfully create a data directory.
Noah Misch [Sat, 2 May 2015 20:47:28 +0000 (16:47 -0400)]
Combine initdb tests that successfully create a data directory.

This eliminates many seconds of test duration and the cause to invoke
"rm -rf", which is typically unavailable on Windows.

Michael Paquier and Noah Misch

9 years agoFix one more TAP test to use standard command-line argument ordering.
Noah Misch [Sat, 2 May 2015 20:46:52 +0000 (16:46 -0400)]
Fix one more TAP test to use standard command-line argument ordering.

Commit c67a86f7da90c30b81f91957023fb752f06f0598 caught most of these,
but this negative test escaped notice.  The test did pass, for the wrong
reason, under affected configurations.

Michael Paquier

9 years agoRename coerce_type() local variable.
Noah Misch [Sat, 2 May 2015 20:46:23 +0000 (16:46 -0400)]
Rename coerce_type() local variable.

coerce_type() has local variables named targetTypeId, baseTypeId, and
targetType.  targetType has been the Type structure for baseTypeId, so
rename it to baseType.

9 years agoWindows also needs an override of the shared libpython detection
Peter Eisentraut [Sat, 2 May 2015 17:23:16 +0000 (13:23 -0400)]
Windows also needs an override of the shared libpython detection

9 years agohstore_plperl: Move port-specific parts to later in the makefile
Peter Eisentraut [Sat, 2 May 2015 12:03:47 +0000 (08:03 -0400)]
hstore_plperl: Move port-specific parts to later in the makefile

PORTNAME isn't set until the global makefiles have been included.

9 years agoFix shared libpython detection on OS X
Peter Eisentraut [Sat, 2 May 2015 03:12:45 +0000 (23:12 -0400)]
Fix shared libpython detection on OS X

Apparently, looking for an appropriately named file doesn't work on some
older versions, so put the back the explicit platform detection.

9 years agoMake hstore_plperl's build even more like plperl's
Peter Eisentraut [Sat, 2 May 2015 02:16:58 +0000 (22:16 -0400)]
Make hstore_plperl's build even more like plperl's

Combine the two places that set CPPFLAGS into one.  Also, some settings
should be restricted to Windows only.  More precisely, -Wno-comment is
a GCC-only option, but Windows in a makefile implies GCC at the moment.

Also, since -Wno-comment is more properly a preprocessor option, move it
to CPPFLAGS to simplify things a bit.

9 years agoMove interpreter shared library detection to configure
Peter Eisentraut [Sat, 2 May 2015 01:38:21 +0000 (21:38 -0400)]
Move interpreter shared library detection to configure

For building PL/Perl, PL/Python, and PL/Tcl, we need a shared library of
libperl, libpython, and libtcl, respectively.  Previously, this was
checked in the makefiles, skipping the PL build with a warning if no
shared library was available.  Now this is checked in configure, with an
error if no shared library is available.

The previous situation arose because in the olden days, the configure
options --with-perl, --with-python, and --with-tcl controlled whether
frontend interfaces for those languages would be built.  The procedural
languages were added later, and shared libraries were often not
available in the beginning.  So it was decided skip the builds of the
procedural languages in those cases.  The frontend interfaces have since
been removed from the tree, and shared libraries are now available most
of the time, so that setup makes much less sense now.

Also, the new setup allows contrib modules and pgxs users to rely on the
respective PLs being available based on configure flags.

9 years agoMake hstore_plperl's build more like plperl's
Andrew Dunstan [Fri, 1 May 2015 19:36:44 +0000 (15:36 -0400)]
Make hstore_plperl's build more like plperl's

This involves moving perl's CORE library to the end of the include list,
and adding other compilation settings that plperl uses. This won't
completely fix the breakage currently being seen by gcc builds on
Windows, but it will let the build get further, and should be wholly
benign, if not beneficial, on *nix.

9 years agoMark views created from tables as replication identity 'nothing'
Bruce Momjian [Fri, 1 May 2015 17:03:23 +0000 (13:03 -0400)]
Mark views created from tables as replication identity 'nothing'

pg_dump turns tables into views using a method that was not setting
pg_class.relreplident properly.

Patch by Marko Tiikkaja

Backpatch through 9.4

9 years agoDeparse named arguments to use the new => operator instead of :=
Robert Haas [Fri, 1 May 2015 13:37:10 +0000 (09:37 -0400)]
Deparse named arguments to use the new => operator instead of :=

Tom Lane pointed out that this wasn't done, and asked whether that was
intentional.  Subsequent discussion was in favor of making the change,
so here we go.

9 years agoAllow FDWs and custom scan providers to replace joins with scans.
Robert Haas [Fri, 1 May 2015 12:50:35 +0000 (08:50 -0400)]
Allow FDWs and custom scan providers to replace joins with scans.

Foreign data wrappers can use this capability for so-called "join
pushdown"; that is, instead of executing two separate foreign scans
and then joining the results locally, they can generate a path which
performs the join on the remote server and then is scanned locally.
This commit does not extend postgres_fdw to take advantage of this
capability; it just provides the infrastructure.

Custom scan providers can use this in a similar way.  Previously,
it was only possible for a custom scan provider to scan a single
relation.  Now, it can scan an entire join tree, provided of course
that it knows how to produce the same results that the join would
have produced if executed normally.

KaiGai Kohei, reviewed by Shigeru Hanada, Ashutosh Bapat, and me.

9 years agoCopy editing of the replication origins patch.
Andres Freund [Fri, 1 May 2015 10:22:13 +0000 (12:22 +0200)]
Copy editing of the replication origins patch.

Michael Paquier and myself.

9 years agoFix unaligned memory access in xlog parsing due to replication origin patch.
Andres Freund [Fri, 1 May 2015 09:36:14 +0000 (11:36 +0200)]
Fix unaligned memory access in xlog parsing due to replication origin patch.

ParseCommitRecord() accessed xl_xact_origin directly. But the chunks in
the commit record's data only have 4 byte alignment, whereas
xl_xact_origin's members require 8 byte alignment on some
platforms. Update comments to make not of that and copy the record to
stack local storage before reading.

With help from Stefan Kaltenbrunner in pinning down the buildfarm and
verifying the fix.

9 years agoFix pg_rewind regression failure after "fast promotion"
Heikki Linnakangas [Fri, 1 May 2015 04:57:18 +0000 (21:57 -0700)]
Fix pg_rewind regression failure after "fast promotion"

pg_rewind looks at the control file to determine the server's timeline. If
the standby performs a "fast promotion", the timeline ID in the control
file is not updated until the next checkpoint. The startup process requests
a checkpoint immediately after promotion, so this is unlikely to be an
issue in the real world, but the regression suite ran pg_rewind so quickly
after promotion that the checkpoint had not yet completed.

Reported by Stephen Frost

9 years agoFix up some loose ends for CURRENT_USER as RoleSpec
Alvaro Herrera [Thu, 30 Apr 2015 19:57:05 +0000 (16:57 -0300)]
Fix up some loose ends for CURRENT_USER as RoleSpec

In commit 31eae6028eca4, some documents were not updated to show the new
capability; fix that.  Also, the error message you get when CURRENT_USER
and SESSION_USER are used in a context that doesn't accept them could be
clearer about it being a problem only in those contexts; so add the
word "here".

Author: Kyotaro HORIGUCHI

His patch submission also included changes to GRANT/REVOKE, but those
seemed more controversial, so I left them out.  We can reconsider these
changes later.

9 years agoCreate an infrastructure for parallel computation in PostgreSQL.
Robert Haas [Thu, 30 Apr 2015 19:02:14 +0000 (15:02 -0400)]
Create an infrastructure for parallel computation in PostgreSQL.

This does four basic things.  First, it provides convenience routines
to coordinate the startup and shutdown of parallel workers.  Second,
it synchronizes various pieces of state (e.g. GUCs, combo CID
mappings, transaction snapshot) from the parallel group leader to the
worker processes.  Third, it prohibits various operations that would
result in unsafe changes to that state while parallelism is active.
Finally, it propagates events that would result in an ErrorResponse,
NoticeResponse, or NotifyResponse message being sent to the client
from the parallel workers back to the master, from which they can then
be sent on to the client.

Robert Haas, Amit Kapila, Noah Misch, Rushabh Lathia, Jeevan Chalke.
Suggestions and review from Andres Freund, Heikki Linnakangas, Noah
Misch, Simon Riggs, Euler Taveira, and Jim Nasby.

9 years agoFix pg_upgrade's multixact handling (again)
Alvaro Herrera [Thu, 30 Apr 2015 16:55:06 +0000 (13:55 -0300)]
Fix pg_upgrade's multixact handling (again)

We need to create the pg_multixact/offsets file deleted by pg_upgrade
much earlier than we originally were: it was in TrimMultiXact(), which
runs after we exit recovery, but it actually needs to run earlier than
the first call to SetMultiXactIdLimit (before recovery), because that
routine already wants to read the first offset segment.

Per pg_upgrade trouble report from Jeff Janes.

While at it, silence a compiler warning about a pointless assert that an
unsigned variable was being tested non-negative.  This was a signed
constant in Thomas Munro's patch which I changed to unsigned before
commit.  Pointed out by Andres Freund.

9 years agoFix typo
Magnus Hagander [Thu, 30 Apr 2015 07:52:34 +0000 (09:52 +0200)]
Fix typo

Amit Langote

9 years agoFix parallel make risk with new check temp-install setup
Peter Eisentraut [Thu, 30 Apr 2015 00:34:22 +0000 (20:34 -0400)]
Fix parallel make risk with new check temp-install setup

The "check" target no longer needs to depend on "all", because it now
runs "install" directly, which in turn depends on "all".  Doing both
will cause problems with parallel make, because two builds will run next
to each other.

Also remove the redirection of the temp-install output into a log file.
This was appropriate when this was done from within pg_regress, but now
it's just a regular make run, and especially with the above changes this
will now take the place of running the "all" target before the test
suites.

problem report by Jeff Janes, patch in part by Michael Paquier

9 years agoCorrect replication origin's use of UINT16_MAX to PG_UINT16_MAX.
Andres Freund [Wed, 29 Apr 2015 22:19:36 +0000 (00:19 +0200)]
Correct replication origin's use of UINT16_MAX to PG_UINT16_MAX.

We can't rely on UINT16_MAX being present, which is why we introduced
PG_UINT16_MAX...

Buildfarm animal bowerbird via Andrew Gierth.

9 years agoAdd <literal> markup, for consistency.
Robert Haas [Wed, 29 Apr 2015 22:03:18 +0000 (18:03 -0400)]
Add <literal> markup, for consistency.

This file isn't entirely consistent about whether "on" and "off"
should be marked up with <literal>, but it doesn't make much sense
to be inconsistent within a single sentence.

Etsuro Fujita

9 years agoUpdate .gitignore for new rmgr, changed paths.
Robert Haas [Wed, 29 Apr 2015 19:53:00 +0000 (15:53 -0400)]
Update .gitignore for new rmgr, changed paths.

9 years agoRemove enum-related special cases for catalog scans.
Robert Haas [Wed, 29 Apr 2015 19:48:44 +0000 (15:48 -0400)]
Remove enum-related special cases for catalog scans.

When this code was written, catalog scans were normally performed using
SnapshotNow, making special handling necessary here.  Now, however, all
catalog scans use MVCC snapshots, so we can change these cases to look
more like what we do for catalog scans elsewhere in the code.

Per discussion with Tom Lane and a reminder from Bruce Momjian.

9 years agoAttempt to fix some compiler warnings.
Robert Haas [Wed, 29 Apr 2015 18:02:01 +0000 (14:02 -0400)]
Attempt to fix some compiler warnings.

9 years agoEnable transforms tests for python 2 on MSVC builds
Andrew Dunstan [Wed, 29 Apr 2015 17:49:24 +0000 (13:49 -0400)]
Enable transforms tests for python 2 on MSVC builds

Currently regression tests for python 3 are disabled on MSVC, and these
tests fail with python 3, too, so we have some work to do to enable
both. Meanwhile, all the buildfarm hosts seem to be building with python
2 anyway, so this at least gets us some coverage.

Original patch from Michael Paquier, significantly modified by me.

9 years agoIntroduce replication progress tracking infrastructure.
Andres Freund [Wed, 29 Apr 2015 17:30:53 +0000 (19:30 +0200)]
Introduce replication progress tracking infrastructure.

When implementing a replication solution ontop of logical decoding, two
related problems exist:
* How to safely keep track of replication progress
* How to change replication behavior, based on the origin of a row;
  e.g. to avoid loops in bi-directional replication setups

The solution to these problems, as implemented here, consist out of
three parts:

1) 'replication origins', which identify nodes in a replication setup.
2) 'replication progress tracking', which remembers, for each
   replication origin, how far replay has progressed in a efficient and
   crash safe manner.
3) The ability to filter out changes performed on the behest of a
   replication origin during logical decoding; this allows complex
   replication topologies. E.g. by filtering all replayed changes out.

Most of this could also be implemented in "userspace", e.g. by inserting
additional rows contain origin information, but that ends up being much
less efficient and more complicated.  We don't want to require various
replication solutions to reimplement logic for this independently. The
infrastructure is intended to be generic enough to be reusable.

This infrastructure also replaces the 'nodeid' infrastructure of commit
timestamps. It is intended to provide all the former capabilities,
except that there's only 2^16 different origins; but now they integrate
with logical decoding. Additionally more functionality is accessible via
SQL.  Since the commit timestamp infrastructure has also been introduced
in 9.5 (commit 73c986add) changing the API is not a problem.

For now the number of origins for which the replication progress can be
tracked simultaneously is determined by the max_replication_slots
GUC. That GUC is not a perfect match to configure this, but there
doesn't seem to be sufficient reason to introduce a separate new one.

Bumps both catversion and wal page magic.

Author: Andres Freund, with contributions from Petr Jelinek and Craig Ringer
Reviewed-By: Heikki Linnakangas, Petr Jelinek, Robert Haas, Steve Singer
Discussion: 20150216002155.GI15326@awork2.anarazel.de,
    20140923182422.GA15776@alap3.anarazel.de,
    20131114172632.GE7522@alap2.anarazel.de

9 years agopsql: Improve tab completion for ALTER FOREIGN TABLE.
Robert Haas [Wed, 29 Apr 2015 16:49:10 +0000 (12:49 -0400)]
psql: Improve tab completion for ALTER FOREIGN TABLE.

Etsuro Fujita

9 years agoto_char(): have format 'OF' only show the leading negative sign
Bruce Momjian [Wed, 29 Apr 2015 01:02:57 +0000 (21:02 -0400)]
to_char():  have format 'OF' only show the leading negative sign

Previously both hours and minutes displayed as negative.

Report by David Pozsar

9 years agodoc: recommend use of GUC server_version_num for version checks
Bruce Momjian [Wed, 29 Apr 2015 00:31:08 +0000 (20:31 -0400)]
doc:  recommend use of GUC server_version_num for version checks

Patch by Craig Ringer

9 years agopg_basebackup: canonicalize old and new tablespace paths
Bruce Momjian [Wed, 29 Apr 2015 00:12:10 +0000 (20:12 -0400)]
pg_basebackup:  canonicalize old and new tablespace paths

This avoids problems with double-slash-specified paths.

Patch by Ian Barwick

9 years agoWarn about tablespace creation in PGDATA
Bruce Momjian [Tue, 28 Apr 2015 21:35:12 +0000 (17:35 -0400)]
Warn about tablespace creation in PGDATA

Also add warning to pg_upgrade

Report by Josh Berkus

9 years agoFix another test for RELKIND_RELATION that should allow foreign tables now.
Tom Lane [Tue, 28 Apr 2015 19:34:35 +0000 (12:34 -0700)]
Fix another test for RELKIND_RELATION that should allow foreign tables now.

I thought I'd gone through all of these before, but a fresh review found
this one too.  (Perhaps it would be better to just delete this test and
let the failure occur later, but for the moment I'll preserve the logic.)

The case that this was rejecting is like
CREATE FOREIGN TABLE ft (f1 int ...) ...;
CREATE TABLE c1 (UNIQUE(f1)) INHERITS(ft);

9 years agoFix ATSimpleRecursion() to allow recursion from a foreign table.
Tom Lane [Tue, 28 Apr 2015 19:25:00 +0000 (12:25 -0700)]
Fix ATSimpleRecursion() to allow recursion from a foreign table.

This is necessary in view of the changes to allow foreign tables to be
full members of inheritance hierarchies, but I (tgl) unaccountably missed
it in commit cb1ca4d800621dcae67ca6c799006de99fa4f0a5.

Noted by Amit Langote, patch by Etsuro Fujita

9 years agoCode review for multixact bugfix
Alvaro Herrera [Tue, 28 Apr 2015 17:52:29 +0000 (14:52 -0300)]
Code review for multixact bugfix

Reword messages, rename a confusingly named function.

Per Robert Haas.

9 years agoFix MSVC builds for contrib transforms modules.
Andrew Dunstan [Tue, 28 Apr 2015 15:47:08 +0000 (11:47 -0400)]
Fix MSVC builds for contrib transforms modules.

With this patch the MSVC build and installation will work correctly with
the transforms. However the python transform tests for hstore and ltree
are still disabled pending some further adjustments.

Michael Paquier with some tweaks from me.

9 years agoProtect against multixact members wraparound
Alvaro Herrera [Tue, 28 Apr 2015 14:32:53 +0000 (11:32 -0300)]
Protect against multixact members wraparound

Multixact member files are subject to early wraparound overflow and
removal: if the average multixact size is above a certain threshold (see
note below) the protections against offset overflow are not enough:
during multixact truncation at checkpoint time, some
pg_multixact/members files would be removed because the server considers
them to be old and not needed anymore.  This leads to loss of files that
are critical to interpret existing tuples's Xmax values.

To protect against this, since we don't have enough info in pg_control
and we can't modify it in old branches, we maintain shared memory state
about the oldest value that we need to keep; we use this during new
multixact creation to abort if an old still-needed file would get
overwritten.  This value is kept up to date by checkpoints, which makes
it not completely accurate but should be good enough.  We start emitting
warnings sometime earlier, so that the eventual multixact-shutdown
doesn't take DBAs completely by surprise (more precisely: once 20
members SLRU segments are remaining before shutdown.)

On troublesome average multixact size: The threshold size depends on the
multixact freeze parameters. The oldest age is related to the greater of
multixact_freeze_table_age and multixact_freeze_min_age: anything
older than that should be removed promptly by autovacuum.  If autovacuum
is keeping up with multixact freezing, the troublesome multixact average
size is
(2^32-1) / Max(freeze table age, freeze min age)
or around 28 members per multixact.  Having an average multixact size
larger than that will eventually cause new multixact data to overwrite
the data area for older multixacts.  (If autovacuum is not able to keep
up, or there are errors in vacuuming, the actual maximum is
multixact_freeeze_max_age instead, at which point multixact generation
is stopped completely.  The default value for this limit is 400 million,
which means that the multixact size that would cause trouble is about 10
members).

Initial bug report by Timothy Garnett, bug #12990
Backpatch to 9.3, where the problem was introduced.

Authors: Álvaro Herrera, Thomas Munro
Reviews: Thomas Munro, Amit Kapila, Robert Haas, Kevin Grittner

9 years agoUse a fd opened for read/write when syncing slots during startup.
Andres Freund [Mon, 27 Apr 2015 22:12:38 +0000 (00:12 +0200)]
Use a fd opened for read/write when syncing slots during startup.

Some operating systems, including the reporter's windows, return EBADFD
or similar when fsync() is invoked on a O_RDONLY file descriptor.
Unfortunately RestoreSlotFromDisk() does exactly that; which causes
failures after restarts in at least some scenarios.

If you hit the bug the error message will be something like
ERROR: could not fsync file "pg_replslot/$name/state": Bad file descriptor

Simply use O_RDWR instead of O_RDONLY when opening the relevant file
descriptor to fix the bug.  Unfortunately I have no way of verifying the
fix, but we've seen similar problems in the past.

This bug goes back to 9.4 where slots were introduced. Backpatch
accordingly.

Reported-By: Patrice Drolet
Bug: #13143:
Discussion: 20150424101006.2556.60897@wrigleys.postgresql.org

9 years agoImprove qual pushdown for RLS and SB views
Stephen Frost [Mon, 27 Apr 2015 16:29:42 +0000 (12:29 -0400)]
Improve qual pushdown for RLS and SB views

The original security barrier view implementation, on which RLS is
built, prevented all non-leakproof functions from being pushed down to
below the view, even when the function was not receiving any data from
the view.  This optimization improves on that situation by, instead of
checking strictly for non-leakproof functions, it checks for Vars being
passed to non-leakproof functions and allows functions which do not
accept arguments or whose arguments are not from the current query level
(eg: constants can be particularly useful) to be pushed down.

As discussed, this does mean that a function which is pushed down might
gain some idea that there are rows meeting a certain criteria based on
the number of times the function is called, but this isn't a
particularly new issue and the documentation in rules.sgml already
addressed similar covert-channel risks.  That documentation is updated
to reflect that non-leakproof functions may be pushed down now, if
they meet the above-described criteria.

Author: Dean Rasheed, with a bit of rework to make things clearer,
along with comment and documentation updates from me.

9 years agoFix vcbuild failures and chkpass dependency caused by 854adb8
Andrew Dunstan [Mon, 27 Apr 2015 14:50:46 +0000 (10:50 -0400)]
Fix vcbuild failures and chkpass dependency caused by 854adb8

Switching the Windows build scripts to use forward slashes instead of
backslashes has caused a couple of issues in VC builds:
- The file tree list was not correctly generated, build script
  generating vcproj file missing tree dependencies when listing items in
  Filter.
- VC builds do not accept file paths with forward slashes, perhaps it
  could be possible to use a Condition but it seems safer to simply
  enforce the file paths to use backslashes in the vcproj files.
- chkpass had an unneeded dependency with libpgport and libpgcommon to
  make build succeed but actually it is not necessary as crypt.c is
  already listed for this project and should be replaced with a fake name
  as it is a unique file.

Michael Paquier

9 years agoFix hstore_plperl regression tests on some platforms
Peter Eisentraut [Sun, 26 Apr 2015 20:09:22 +0000 (16:09 -0400)]
Fix hstore_plperl regression tests on some platforms

On some platforms, plperl and plperlu cannot be loaded at the same
time.  So split the test into two separate test files.

9 years agoAlso correct therefor to therefore.
Andres Freund [Sun, 26 Apr 2015 17:05:39 +0000 (19:05 +0200)]
Also correct therefor to therefore.

Since both forms are arguably legal I wasn't sure about changing
this. But then Tom argued for 'therefore'...

Author: Dmitriy Olshevskiy
Discussion: 34789.1430067832@sss.pgh.pa.us

9 years agoFix various typos and grammar errors in comments.
Andres Freund [Sun, 26 Apr 2015 16:42:31 +0000 (18:42 +0200)]
Fix various typos and grammar errors in comments.

Author: Dmitriy Olshevskiy
Discussion: 553D00A6.4090205@bk.ru

9 years agoFix possible division by zero in pg_xlogdump.
Andres Freund [Sun, 26 Apr 2015 16:02:32 +0000 (18:02 +0200)]
Fix possible division by zero in pg_xlogdump.

When displaying stats it was possible that a floating point division by
zero occured when no FPIs were issued for a type of record.

Author: Abhijit Menon-Sen
Discussion: 20150417091811.GA14008@toroid.org

9 years agoAdd transforms feature
Peter Eisentraut [Sun, 26 Apr 2015 14:33:14 +0000 (10:33 -0400)]
Add transforms feature

This provides a mechanism for specifying conversions between SQL data
types and procedural languages.  As examples, there are transforms
for hstore and ltree for PL/Perl and PL/Python.

reviews by Pavel Stěhule and Andres Freund

9 years agoFix typo in linux startup script.
Tom Lane [Sun, 26 Apr 2015 13:43:15 +0000 (09:43 -0400)]
Fix typo in linux startup script.

Missed a "$" in what was meant to be a variable substitution.  Careless
mistake in commit f23425fa950fec3aff458de117037c9caadbc35c.

9 years agoAdd comments warning against generalizing default_with_oids.
Tom Lane [Sun, 26 Apr 2015 01:37:39 +0000 (21:37 -0400)]
Add comments warning against generalizing default_with_oids.

pg_dump has historically assumed that default_with_oids affects only plain
tables and not other relkinds.  Conceivably we could make it apply to some
newly invented relkind if we did so from the get-go, but changing the
behavior for existing object types will break existing dump scripts.
Add code comments warning about this interaction.

Also, make sure that default_with_oids doesn't cause parse_utilcmd.c to
think that CREATE FOREIGN TABLE will create an OID column.  I think this is
only a latent bug right now, since we don't allow UNIQUE/PKEY constraints
in CREATE FOREIGN TABLE, but it's better to be consistent and future-proof.

9 years agoTry to unbreak some MSVC builds following forward slash change.
Andrew Dunstan [Sun, 26 Apr 2015 01:28:02 +0000 (21:28 -0400)]
Try to unbreak some MSVC builds following forward slash change.

Michael Paquier.

9 years agoRevert: Honor OID status of CREATE LIKE'd tables
Bruce Momjian [Sun, 26 Apr 2015 01:10:45 +0000 (21:10 -0400)]
Revert:  Honor OID status of CREATE LIKE'd tables

Reverts d992f8a8961c09ec219373ffe2b5e6473febd065

Report by Tom Lane

9 years agoDon't overwrite EXTRA_INSTALL
Peter Eisentraut [Sun, 26 Apr 2015 00:57:58 +0000 (20:57 -0400)]
Don't overwrite EXTRA_INSTALL

The temp-install target sets EXTRA_INSTALL to install the current
directory.  But when doing so, it should append instead of overwrite,
otherwise settings of EXTRA_INSTALL from a makefile won't take effect.
This would cause the earthdistance test to fail when called directly,
because it would miss installing the cube module.

9 years agoPrevent improper reordering of antijoins vs. outer joins.
Tom Lane [Sat, 25 Apr 2015 20:44:27 +0000 (16:44 -0400)]
Prevent improper reordering of antijoins vs. outer joins.

An outer join appearing within the RHS of an antijoin can't commute with
the antijoin, but somehow I missed teaching make_outerjoininfo() about
that.  In Teodor Sigaev's recent trouble report, this manifests as a
"could not find RelOptInfo for given relids" error within eqjoinsel();
but I think silently wrong query results are possible too, if the planner
misorders the joins and doesn't happen to trigger any internal consistency
checks.  It's broken as far back as we had antijoins, so back-patch to all
supported branches.

9 years agoReplace backslashes by forward slashes in MSVC build code
Peter Eisentraut [Sat, 25 Apr 2015 12:52:03 +0000 (08:52 -0400)]
Replace backslashes by forward slashes in MSVC build code

This makes it possible to run some stages of these build scripts on
non-Windows systems.  That way, we can more easily test whether file
moves or makefile changes might break the MSVC build.

Peter Eisentraut and Michael Paquier

9 years agoFix file comment for test_rls_hooks.c
Stephen Frost [Sat, 25 Apr 2015 00:44:53 +0000 (20:44 -0400)]
Fix file comment for test_rls_hooks.c

The file-level comment wasn't updated when it was copied from the shared
memory queue test module.  Fixed.

Noted by Dean Rasheed.

9 years agoPerform RLS WITH CHECK before constraints, etc
Stephen Frost [Sat, 25 Apr 2015 00:34:26 +0000 (20:34 -0400)]
Perform RLS WITH CHECK before constraints, etc

The RLS capability is built on top of the WITH CHECK OPTION
system which was added for auto-updatable views, however, unlike
WCOs on views (which are mandated by the SQL spec to not fire until
after all other constraints and checks are done), it makes much more
sense for RLS checks to happen earlier than constraint and uniqueness
checks.

This patch reworks the structure which holds the WCOs a bit to be
explicitly either VIEW or RLS checks and the RLS-related checks are
done prior to the constraint and uniqueness checks.  This also allows
better error reporting as we are now reporting when a violation is due
to a WITH CHECK OPTION and when it's due to an RLS policy violation,
which was independently noted by Craig Ringer as being confusing.

The documentation is also updated to include a paragraph about when RLS
WITH CHECK handling is performed, as there have been a number of
questions regarding that and the documentation was previously silent on
the matter.

Author: Dean Rasheed, with some kabitzing and comment changes by me.

9 years agoRemove obsolete -I options from ECPG library compilation.
Noah Misch [Fri, 24 Apr 2015 23:29:09 +0000 (19:29 -0400)]
Remove obsolete -I options from ECPG library compilation.

The MSVC build system already omitted these.

9 years agoRemove superfluous -DFRONTEND.
Noah Misch [Fri, 24 Apr 2015 23:29:05 +0000 (19:29 -0400)]
Remove superfluous -DFRONTEND.

The majority practice is to add -DFRONTEND in directories building files
that are, at other times, built for the backend.  Some directories
lacking that property added a noise -DFRONTEND in one build system.
Remove the excess flags, for consistency.

9 years agoBuild every ECPG library with -DFRONTEND.
Noah Misch [Fri, 24 Apr 2015 23:29:02 +0000 (19:29 -0400)]
Build every ECPG library with -DFRONTEND.

Each of the libraries incorporates src/port files, which often check
FRONTEND.  Build systems disagreed on whether to build libpgtypes this
way.  Only libecpg incorporates files that rely on it today.  Back-patch
to 9.0 (all supported versions) to forestall surprises.

9 years agoFix up .gitignore and cleanup actions in some src/test/ subdirectories.
Tom Lane [Fri, 24 Apr 2015 21:13:06 +0000 (17:13 -0400)]
Fix up .gitignore and cleanup actions in some src/test/ subdirectories.

examples/, locale/, and thread/ lacked .gitignore files and were also
not connected up to top-level "make clean" etc.  This had escaped notice
because none of those directories are built in normal scenarios.  Still,
they have working Makefiles, so if someone does a "make" in one of these
directories it would be good if (a) git doesn't bleat about the product
files and (b) cleaning up removes them.

This is a longstanding oversight, but since this behavior is probably
only of interest to developers, there seems no need for back-patching.

Michael Paquier and Tom Lane

9 years agoFix obsolete comment in set_rel_size().
Tom Lane [Fri, 24 Apr 2015 19:18:07 +0000 (15:18 -0400)]
Fix obsolete comment in set_rel_size().

The cross-reference to set_append_rel_pathlist() was obsoleted by
commit e2fa76d80ba571d4de8992de6386536867250474, which split what
had been set_rel_pathlist() and child routines into two sets of
functions.  But I (tgl) evidently missed updating this comment.

Back-patch to 9.2 to avoid unnecessary divergence among branches.

Amit Langote

9 years agoAdd comments explaining how unique and exclusion constraints are enforced.
Heikki Linnakangas [Fri, 24 Apr 2015 18:12:32 +0000 (21:12 +0300)]
Add comments explaining how unique and exclusion constraints are enforced.

9 years agodoc: Move ALTER TABLE IF EXISTS description to better place
Peter Eisentraut [Fri, 24 Apr 2015 17:22:18 +0000 (13:22 -0400)]
doc: Move ALTER TABLE IF EXISTS description to better place

It was previously mixed in with the description of ALTER TABLE
subcommands.  Move it to the Parameters section, which is where it is on
other reference pages.

pointed out by Amit Langote

9 years agoFix misspellings
Peter Eisentraut [Fri, 24 Apr 2015 16:00:49 +0000 (12:00 -0400)]
Fix misspellings

Amit Langote and Thom Brown

9 years agoCopy the relation name for error reporting in WCOs
Stephen Frost [Fri, 24 Apr 2015 13:38:10 +0000 (09:38 -0400)]
Copy the relation name for error reporting in WCOs

In get_row_security_policies(), we need to make a copy of the relation
name when building the WithCheckOptions structure, since
RelationGetRelationName just returns a pointer into the local Relation
structure.  The relation name in the WCO structure is only used for
error reporting.

Pointed out by Robert and Christian Ullrich, who noted that the
buildfarm members with -DCLOBBER_CACHE_ALWAYS were failing.

9 years agoMove functions related to index maintenance to separate source file.
Heikki Linnakangas [Fri, 24 Apr 2015 06:33:23 +0000 (09:33 +0300)]
Move functions related to index maintenance to separate source file.

There is enough code here to deserve a file of their own, not be buried
in the middle of execUtils.c.

9 years agoFix deadlock at startup, if max_prepared_transactions is too small.
Heikki Linnakangas [Thu, 23 Apr 2015 18:25:44 +0000 (21:25 +0300)]
Fix deadlock at startup, if max_prepared_transactions is too small.

When the startup process recovers transactions by scanning pg_twophase
directory, it should clear MyLockedGxact after it's done processing each
transaction. Like we do during normal operation, at PREPARE TRANSACTION.
Otherwise, if the startup process exits due to an error, it will try to
clear the locking_backend field of the last recovered transaction. That's
usually harmless, but if the error happens in MarkAsPreparing, while
holding TwoPhaseStateLock, the shmem-exit hook will try to acquire
TwoPhaseStateLock again, and deadlock with itself.

This fixes bug #13128 reported by Grant McAlister. The bug was introduced
by commit bb38fb0d, so backpatch to all supported versions like that
commit.

9 years agoFix shell error on Solaris
Peter Eisentraut [Thu, 23 Apr 2015 17:09:18 +0000 (13:09 -0400)]
Fix shell error on Solaris

Apparently, the Bourne shell on Solaris doesn't like "for" loops with an
empty list, so have "make" skip the loop in that case.

9 years agoImprove speed of make check-world
Peter Eisentraut [Thu, 23 Apr 2015 12:59:52 +0000 (08:59 -0400)]
Improve speed of make check-world

Before, make check-world would create a new temporary installation for
each test suite, which is slow and wasteful.  Instead, we now create one
test installation that is used by all test suites that are part of a
make run.

The management of the temporary installation is removed from pg_regress
and handled in the makefiles.  This allows for better control, and
unifies the code with that of test suites not run through pg_regress.

review and msvc support by Michael Paquier <michael.paquier@gmail.com>

more review by Fabien Coelho <coelho@cri.ensmp.fr>

9 years agoUse the right type OID after creating a shell type
Alvaro Herrera [Wed, 22 Apr 2015 19:23:02 +0000 (16:23 -0300)]
Use the right type OID after creating a shell type

Commit a2e35b53c39b2a neglected to update the type OID to use further
down in DefineType when TypeShellMake was changed to return
ObjectAddress instead of OID (it got it right in DefineRange, however.)
This resulted in an internal error message being issued when looking up
I/O functions.

Author: Michael Paquier

Also add Asserts() to a couple of other places to ensure that the type
OID being used is as expected.

9 years agoFix installcheck for test_rls_hooks
Stephen Frost [Wed, 22 Apr 2015 16:43:57 +0000 (12:43 -0400)]
Fix installcheck for test_rls_hooks

As pointed out by the buildfarm, test_rls_hooks wasn't functioning
properly with a clean installcheck.  test_rls_hooks needs to explicitly
load the library with the hooks in it, to allow installcheck to work;
using the --temp-config doesn't help since that isn't used when running
installcheck and it isn't exactly fair to the buildfarm to modify the
installed config prior to calling installcheck.

Also, have test_rls_hooks clean up after itself.

9 years agoRLS fixes, new hooks, and new test module
Stephen Frost [Wed, 22 Apr 2015 16:01:06 +0000 (12:01 -0400)]
RLS fixes, new hooks, and new test module

In prepend_row_security_policies(), defaultDeny was always true, so if
there were any hook policies, the RLS policies on the table would just
get discarded.  Fixed to start off with defaultDeny as false and then
properly set later if we detect that only the default deny policy exists
for the internal policies.

The infinite recursion detection in fireRIRrules() didn't properly
manage the activeRIRs list in the case of WCOs, so it would incorrectly
report infinite recusion if the same relation with RLS appeared more
than once in the rtable, for example "UPDATE t ... FROM t ...".

Further, the RLS expansion code in fireRIRrules() was handling RLS in
the main loop through the rtable, which lead to RTEs being visited twice
if they contained sublink subqueries, which
prepend_row_security_policies() attempted to handle by exiting early if
the RTE already had securityQuals.  That doesn't work, however, since
if the query involved a security barrier view on top of a table with
RLS, the RTE would already have securityQuals (from the view) by the
time fireRIRrules() was invoked, and so the table's RLS policies would
be ignored.  This is fixed in fireRIRrules() by handling RLS in a
separate loop at the end, after dealing with any other sublink
subqueries, thus ensuring that each RTE is only visited once for RLS
expansion.

The inheritance planner code didn't correctly handle non-target
relations with RLS, which would get turned into subqueries during
planning. Thus an update of the form "UPDATE t1 ... FROM t2 ..." where
t1 has inheritance and t2 has RLS quals would fail.  Fix by making sure
to copy in and update the securityQuals when they exist for non-target
relations.

process_policies() was adding WCOs to non-target relations, which is
unnecessary, and could lead to a lot of wasted time in the rewriter and
the planner. Fix by only adding WCO policies when working on the result
relation.  Also in process_policies, we should be copying the USING
policies to the WITH CHECK policies on a per-policy basis, fix by moving
the copying up into the per-policy loop.

Lastly, as noted by Dean, we were simply adding policies returned by the
hook provided to the list of quals being AND'd, meaning that they would
actually restrict records returned and there was no option to have
internal policies and hook-based policies work together permissively (as
all internal policies currently work).  Instead, explicitly add support
for both permissive and restrictive policies by having a hook for each
and combining the results appropriately.  To ensure this is all done
correctly, add a new test module (test_rls_hooks) to test the various
combinations of internal, permissive, and restrictive hook policies.

Largely from Dean Rasheed (thanks!):

CAEZATCVmFUfUOwwhnBTcgi6AquyjQ0-1fyKd0T3xBWJvn+xsFA@mail.gmail.com

Author: Dean Rasheed, though I added the new hooks and test module.

9 years agoPull in tableoid for inheiritance with rowMarks
Stephen Frost [Wed, 22 Apr 2015 15:29:35 +0000 (11:29 -0400)]
Pull in tableoid for inheiritance with rowMarks

As noted by Etsuro Fujita [1] and Dean Rasheed[2],
cb1ca4d800621dcae67ca6c799006de99fa4f0a5 changed ExecBuildAuxRowMark()
to always look for the tableoid in the target list, but didn't also
change preprocess_targetlist() to always include the tableoid.  This
resulted in errors with soon-to-be-added RLS with inheritance tests,
and errors when using inheritance with foreign tables.

Authors: Etsuro Fujita and Dean Rasheed (independently)

Minor word-smithing on the comments by me.

[1] 552CF0B6.8010006@lab.ntt.co.jp
[2] CAEZATCVmFUfUOwwhnBTcgi6AquyjQ0-1fyKd0T3xBWJvn+xsFA@mail.gmail.com

9 years agoMake the pg_rewind regression tests more robust on slow systems.
Heikki Linnakangas [Wed, 22 Apr 2015 11:28:37 +0000 (14:28 +0300)]
Make the pg_rewind regression tests more robust on slow systems.

There were a couple of hard-coded sleeps in the tests: to wait for standby
to catch up with master, and to wait for promotion with "pg_ctl promote"
to complete. Instead of a fixed, hard-coded sleep, poll the server with a
query once a second. This isn't ideal either, and I wish we had a better
solution for real-world applications too, but this should fix the
immediate problem.

Patch by Michael Paquier, with some editing by me.

9 years agoRename pg_replication_slot's new active_in to active_pid.
Andres Freund [Wed, 22 Apr 2015 07:42:36 +0000 (09:42 +0200)]
Rename pg_replication_slot's new active_in to active_pid.

In d811c037ce active_in was added but discussion since showed that
active_pid is preferred as a name.

Discussion: CAMsr+YFKgZca5_7_ouaMWxA5PneJC9LNViPzpDHusaPhU9pA7g@mail.gmail.com

9 years agoDon't leave 'tmp_check' directory behind in pg_rewind regression tests.
Heikki Linnakangas [Wed, 22 Apr 2015 07:14:44 +0000 (10:14 +0300)]
Don't leave 'tmp_check' directory behind in pg_rewind regression tests.

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

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
9 years agoUpdate FDW docs to reflect existence of CHECK constraints.
Robert Haas [Tue, 21 Apr 2015 21:46:47 +0000 (17:46 -0400)]
Update FDW docs to reflect existence of CHECK constraints.

Generalize the remarks previously made about NOT NULL constraints to
CHECK constraints.

Etsuro Fujita

9 years agoAdd missing installcheck target to pg_rewind's Makefile
Heikki Linnakangas [Tue, 21 Apr 2015 11:09:25 +0000 (14:09 +0300)]
Add missing installcheck target to pg_rewind's Makefile

Michael Paquier

9 years agoAdd 'active_in' column to pg_replication_slots.
Andres Freund [Tue, 21 Apr 2015 09:51:06 +0000 (11:51 +0200)]
Add 'active_in' column to pg_replication_slots.

Right now it is visible whether a replication slot is active in any
session, but not in which.  Adding the active_in column, containing the
pid of the backend having acquired the slot, makes it much easier to
associate pg_replication_slots entries with the corresponding
pg_stat_replication/pg_stat_activity row.

This should have been done from the start, but I (Andres) dropped the
ball there somehow.

Author: Craig Ringer, revised by me Discussion:
CAMsr+YFKgZca5_7_ouaMWxA5PneJC9LNViPzpDHusaPhU9pA7g@mail.gmail.com

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

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
9 years agoHonor OID status of CREATE LIKE'd tables
Bruce Momjian [Mon, 20 Apr 2015 20:11:25 +0000 (16:11 -0400)]
Honor OID status of CREATE LIKE'd tables

Previously, tables created by CREATE LIKE never had OIDs.

Report by Tom Lane

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

Reviewed-by: Michael Paquier <michael.paquier@gmail.com>
9 years agopg_upgrade: binary_upgrade_create_empty_extension() is strict
Bruce Momjian [Sat, 18 Apr 2015 00:08:42 +0000 (20:08 -0400)]
pg_upgrade:  binary_upgrade_create_empty_extension() is strict

Was broken by commit 30982be4e5019684e1772dd9170aaa53f5a8e894.

Patch by Jeff Janes

9 years agoFix typo in relcache's equalPolicy()
Stephen Frost [Fri, 17 Apr 2015 20:37:11 +0000 (16:37 -0400)]
Fix typo in relcache's equalPolicy()

The USING policies were not being checked for differences as the same
policy was being passed in to both sides of the equal().  This could
result in backends not realizing that a policy had been changed, if
none of the other attributes had been changed.

Fix by passing to equal() the policy1 and policy2 using quals for
comparison.

No need to back-patch as this is not yet released.  Noticed while
testing changes to RLS proposed by Dean Rasheed.

9 years agoAdd new target modulescheck in vcregress.pl
Alvaro Herrera [Fri, 17 Apr 2015 02:39:52 +0000 (23:39 -0300)]
Add new target modulescheck in vcregress.pl

This allows an MSVC build to run regression tests related to modules in
src/test/modules.

Author: Michael Paquier
Reviewed by: Andrew Dunstan

9 years agopg_upgrade: document need for text search files to be copied
Bruce Momjian [Thu, 16 Apr 2015 23:51:12 +0000 (19:51 -0400)]
pg_upgrade:  document need for text search files to be copied

Report by CJ Estel

Backpatch through 9.4