Alvaro Herrera [Tue, 8 Apr 2014 21:00:10 +0000 (18:00 -0300)]
bdr: lift restriction on ALTER .. RENAME
Alvaro Herrera [Tue, 8 Apr 2014 20:51:35 +0000 (17:51 -0300)]
bdr: fix idiotic bdr-drops merge mistaek
Alvaro Herrera [Tue, 8 Apr 2014 20:36:31 +0000 (17:36 -0300)]
bdr: lift restriction on DROP
Alvaro Herrera [Fri, 4 Apr 2014 20:16:04 +0000 (17:16 -0300)]
bdr: add DROP support, using stuff from bdr-drops
Andres Freund [Tue, 8 Apr 2014 10:20:18 +0000 (12:20 +0200)]
bdr: Improve buffer and snapshot tracking.
As a preparation for more elaborate conflict handling track tuples
using TupleTableSlots and acquire/release snapshots more granulary.
Andres Freund [Mon, 7 Apr 2014 07:56:11 +0000 (09:56 +0200)]
bdr: Minor code formatting fixes
Craig Ringer [Mon, 7 Apr 2014 08:07:14 +0000 (16:07 +0800)]
bdr: Introduce support for forwarding changes from foreign nodes
Adds the "forward_changesets" option to the bdr_output plugin.
This can be used to cascade changes from one node to another,
potentially allowing cascading logical replication.
It's required to support proper addition of a new node via logical
dump.
Andres Freund [Fri, 4 Apr 2014 12:21:55 +0000 (14:21 +0200)]
bdr: Use sequencer wakeup scheduling code in the apply path as well.
Andres Freund [Fri, 4 Apr 2014 11:07:03 +0000 (13:07 +0200)]
bdr: Improve sequencer wakeup logic.
Schedule a sequencer wakeup at EOXact whenever a sequence is created
or it's setttings are modified. This allows to significantly decrease
the frequency of unneccessary sequencer wakeups and also significantly
reduces the time until a new sequence is initialized.
Andres Freund [Fri, 4 Apr 2014 10:57:08 +0000 (12:57 +0200)]
bdr: Fix some embarrassing oversights in recent commits leading to aborting replay.
Christian Kruse [Wed, 2 Apr 2014 11:15:24 +0000 (13:15 +0200)]
bdr: allow certain types of ALTER TABLE commands
For now we allow:
- ADD COLUMN
- DEFAULT
- CLUSTER ON
- SET WITHOUT CLUSTER
- SET (...)
- RESET (...)
- replace reloption list
Christian Kruse [Mon, 31 Mar 2014 12:16:08 +0000 (14:16 +0200)]
bdr: better error messages for SPI calls
I could be wrong but „blub“ or „blart“ is not a very comprehensible
error message ;-)
Andres Freund [Tue, 1 Apr 2014 22:39:06 +0000 (00:39 +0200)]
bdr: Don't forbid CREATE INDEX CONCURRENTLY anymore.
Andres Freund [Tue, 1 Apr 2014 18:04:31 +0000 (20:04 +0200)]
bdr: Clean up remote update replay code a bit.
Andres Freund [Tue, 1 Apr 2014 17:24:31 +0000 (19:24 +0200)]
bdr: Remove superflous check_sequencer_wakeup() call.
Andres Freund [Tue, 1 Apr 2014 17:22:53 +0000 (19:22 +0200)]
bdr: Simplify logic for generating the primary key during updates.
That hopefully gets rid of compiler warnings on older gccs.
Andres Freund [Tue, 1 Apr 2014 17:21:59 +0000 (19:21 +0200)]
bdr: Try to add bdr_commandfilter.c to windows buildsystem.
Also reorder some sourcefiles into alphabetical order...
Christian Kruse [Wed, 26 Mar 2014 12:03:26 +0000 (13:03 +0100)]
bdr: prevent specific utility commands from being executed
We use a ProcessUtility_hook to prevent some utility commands from being
executed. Currently this contains:
- SECURITY LABEL
- CREATE INDEX CONCURRENTLY
- ALTER TABLE
- ALTER … RENAME TO
- DROP TABLE/VIEW/SEQUENCE/TRIGGER/RULE/EXTENSION/TYPE
- DROP OWNED
- ALTER TYPE … ADD VALUE
Still TODO:
- Prevent replication for CREATE/DROP/ALTER TABLESPACE/ALTER TABLESPACE
MOVE.
- Prevent replication of COMMENT ON for non-local objects.
- Implement a new GUC, bdr.ddl_prevent_replication
Christian Kruse [Mon, 31 Mar 2014 12:08:37 +0000 (14:08 +0200)]
bdr: bugfix: end critical section in „not acquired new“ case as well
Christian Kruse [Mon, 31 Mar 2014 10:26:33 +0000 (12:26 +0200)]
bdr: calling check_sequencer_wakeup() now on UPDATE conflict
After reading code it seems to be no problem calling
check_sequencer_wakeup() on UPDATE conflict; thus we do it.
Christian Kruse [Fri, 28 Mar 2014 14:58:02 +0000 (15:58 +0100)]
bdr: moved apply/log update check code to a dedicated function
Christian Kruse [Fri, 28 Mar 2014 14:57:05 +0000 (15:57 +0100)]
bdr: generated_key wasn't used at all, so drop it
Christian Kruse [Wed, 26 Mar 2014 10:06:53 +0000 (11:06 +0100)]
bdr: refactored use Oids to identify and refer to relations
Andres Freund [Tue, 1 Apr 2014 16:34:14 +0000 (18:34 +0200)]
bdr: Support replication of CONCURRENTLY commands.
To do so ddl replication can no longer user spi as that prohibits
executing commands that execute transaction internally. Do the grunt
work ourselves instead.
Alvaro Herrera [Tue, 1 Apr 2014 15:52:21 +0000 (12:52 -0300)]
bdr: queue CREATE SCHEMA as well
Christian Kruse [Thu, 20 Mar 2014 17:50:39 +0000 (18:50 +0100)]
bdr: Rewrote lookup code for bdr.bdr_queued_commands
Now we're looking up the QueuedDDLCommandsRelid of
bdr.bdr_queued_commands in bdr_maintain_schema() using
get_namespace_oid() as well as get_relname_relid().
Andres Freund [Thu, 20 Mar 2014 21:14:27 +0000 (22:14 +0100)]
bdr: Fix typo causing the wrong tuple format to be sent
Andres Freund [Thu, 20 Mar 2014 21:12:52 +0000 (22:12 +0100)]
bdr: Fix typo causing the send/recv not to be used even though version's match
Found in respond to tests by Christian.
Andres Freund [Sun, 16 Mar 2014 22:27:24 +0000 (23:27 +0100)]
bdr: Fix Windows build by compiling bdr_compat.c
Andres Freund [Sun, 16 Mar 2014 22:22:14 +0000 (23:22 +0100)]
bdr: Properly send timestamps, xlogrecptrs as int64s
Andres Freund [Sun, 16 Mar 2014 21:59:34 +0000 (22:59 +0100)]
bdr: Initial framework for choosing the correct data encoding based on the client.
Andres Freund [Fri, 14 Mar 2014 22:34:52 +0000 (23:34 +0100)]
bdr: Don't perform index insertions for HOT updates
Andres Freund [Fri, 14 Mar 2014 22:31:38 +0000 (23:31 +0100)]
bdr: Use the old local tuple to build the new tuple version for updates.
This allows us to handle unchanged toast columns.
Andres Freund [Fri, 14 Mar 2014 22:07:35 +0000 (23:07 +0100)]
bdr: Send relation information separately from tuple data
Andres Freund [Fri, 14 Mar 2014 20:57:56 +0000 (21:57 +0100)]
bdr: Ugly makefile hack to support make clean
Andres Freund [Fri, 14 Mar 2014 20:53:48 +0000 (21:53 +0100)]
bdr: Initial implementation of a more elaborate tuple wire protocol.
BDR wants to be fast, but it also wants to support replication across
versions and architectures. So far we used to always copy the binary
data as is between sender as receiver. That works well enough for
simple scalar core data types, but it breaks down when oids are
embedded in the disk format.
Instead allow to specify the format on a per-datum format. It's now
supported to send data in binary, send/recv format or text. On the
sending side we select binary if it's a scalar core type, and
otherwise use send/recv. This needs to be extended to support cross
architecture replication, but that's for another commit.
Andres Freund [Fri, 14 Mar 2014 20:10:22 +0000 (21:10 +0100)]
bdr: Don't queue truncate triggers for serials created inside a CREATE TABLE
Alvaro Herrera [Fri, 14 Mar 2014 19:33:22 +0000 (16:33 -0300)]
bdr: add CREATE EXTENSION to set of replicated commands
Andres Freund [Fri, 14 Mar 2014 19:33:21 +0000 (20:33 +0100)]
bdr: Replicat CREATE TYPE
At least CREATE TYPE ... AS ENUM works.
Andres Freund [Wed, 12 Mar 2014 17:26:10 +0000 (18:26 +0100)]
bdr: adjustments for changed output plugin API
Christian Kruse [Tue, 4 Mar 2014 09:24:00 +0000 (10:24 +0100)]
bdr: use correct lock mode when creating extensions
Christian Kruse [Tue, 4 Mar 2014 09:20:44 +0000 (10:20 +0100)]
bdr: code formatting cleanup
Alvaro Herrera [Thu, 6 Mar 2014 23:11:30 +0000 (20:11 -0300)]
bdr: mergme: Also queue ALTER TABLE commands
Alvaro Herrera [Thu, 6 Mar 2014 23:11:10 +0000 (20:11 -0300)]
bdr: mergme: Only add truncate trigger if CREATE TABLE
Andres Freund [Tue, 4 Mar 2014 00:56:33 +0000 (01:56 +0100)]
bdr: avoid race conditions when installing bdr extensions
Previously installing the bdr (and prerequisite) extensions was racy
because only the sequencer installed them. Initially that wasn't much
of a problem since only the sequencer and manual queries needed the
schema, but that's not true anymore.
Instead check whether the schema exists in every started worker and
prevent races by acquiring a suitably strong lock on pg_extension
while checking/creating.
Christian Kruse [Fri, 28 Feb 2014 14:20:44 +0000 (15:20 +0100)]
bdr: enabling CREATE TRIGGER replication
Christian Kruse [Fri, 28 Feb 2014 13:52:37 +0000 (14:52 +0100)]
bdr: implement support for TRUNCATE TABLE replication
Andres Freund [Tue, 25 Feb 2014 12:39:33 +0000 (13:39 +0100)]
bdr: Don't insert commands into bdr_queued_commands during replay.
Andres Freund [Tue, 25 Feb 2014 12:18:21 +0000 (13:18 +0100)]
bdr: formatting fixes for bdr--0.5.sql
Christian Kruse [Mon, 24 Feb 2014 14:57:12 +0000 (15:57 +0100)]
bdr: moved GUCs to one-dot notation
Alvaro Herrera [Thu, 20 Feb 2014 22:18:59 +0000 (19:18 -0300)]
bdr: ignore temp objects when queueing
Alvaro Herrera [Thu, 20 Feb 2014 17:47:55 +0000 (14:47 -0300)]
bdr: Initial DDL replication
This simply accumulates DDL commands in a table, and has the bdr_apply
background worker execute it.
Alvaro Herrera [Thu, 20 Feb 2014 17:46:40 +0000 (14:46 -0300)]
bdr: Initialize bgw_notify_pid to 0
Failure to do this resulted in a bgworker that would not run in some
cases.
Andres Freund [Tue, 18 Feb 2014 19:08:28 +0000 (20:08 +0100)]
bdr: fix nasty typo leading to pkey extraction using the wrong type
Andres Freund [Mon, 9 Dec 2013 12:38:10 +0000 (13:38 +0100)]
bdr: pgbench: delete instead of truncate
Andres Freund [Fri, 17 May 2013 16:15:37 +0000 (18:15 +0200)]
bdr: bdr plugin
Andres Freund, Alvaro Herrera, Abhijit Menon-Sen
Andres Freund [Fri, 3 May 2013 14:53:58 +0000 (16:53 +0200)]
bdr,core: Add database oid to IDENTIFY_SYSTEM
Adjust all IDENTIFY_SYSTEM callers
Abhijit Menon-Sen [Mon, 13 May 2013 09:13:41 +0000 (14:43 +0530)]
bdr,core: isolationtester: Isolationtester with multi-server support
The spec file can now start with declarations like this:
conninfo "cname1" "port=NNNN dbname=XYZ"
conninfo "cname2" "port=MMMM dbname=PQR"
And sessions may include connection declarations like this:
session "s1"
connection "cname1"
Both are optional. If no connection information is explicitly specified,
then the earlier behaviour (use conninfo from commandline or fall back
to "dbname=postgres") is retained.
If connection information is specified, we open one "global" connection
per conninfo (for lock checking) and one connection per session. Setup
SQL is executed only on conns[0], as before (but perhaps it would help
to execute it on all until DDL replication is implemented?).
Includes the rudimentary tests from before, including some failing ones.
Abhijit Menon-Sen [Tue, 11 Jun 2013 21:25:26 +0000 (23:25 +0200)]
wal_decoding: Add pg_xlog_wait_remote_{apply,receive} functions
We want to use these in isolationtester tests, but they're more
generally useful for "inter-node synchronisation".
Craig Ringer [Thu, 27 Mar 2014 06:52:18 +0000 (14:52 +0800)]
core, bdr: Add --snapshot argument to pg_dump, allowing user-specified snapshot to dump
Allows pg_dump to dump from a snapshot that already exists. pg_dump already
supported SET TRANSACTION SNAPSHOT for use in parallel dump, but didn't allow
the user to explicitly specify the snapshot.
This is useful in BDR/UDR, where we want to initialize a new replica
using the state of an existing node from the snapshot automatically
exported by a slot.
Author: Simon Riggs
Andres Freund [Sun, 11 May 2014 14:24:20 +0000 (16:24 +0200)]
wal_decoding: Add (non-)transactional message feature for logical decoding
Andres Freund [Mon, 12 May 2014 22:04:01 +0000 (00:04 +0200)]
core: Hack around function_parse_error_transpose() hack of using portal's query text
Andres Freund [Sun, 16 Mar 2014 23:10:05 +0000 (00:10 +0100)]
core: Add strtoll/strtoull emulation if necessary.
Andres Freund [Mon, 20 May 2013 14:18:35 +0000 (16:18 +0200)]
seqam: v0.2.3
Andres Freund [Fri, 22 Feb 2013 16:43:27 +0000 (17:43 +0100)]
replication_identifiers: v0.3.2
Introduce feature to keep track of replication progress.
Replication identifiers can be used to track & lookup remote nodes identified
via (sysid, tlid, remote_dbid, local_dbid, name) and map that tuple to a local
uint16.
Keyed by that replication identifier the progress of replication from
that system is tracked in a crashsafe manner.
Support for tracking that via output plugins is added as well.
Needs a catversion bump.
Andres Freund [Sun, 8 Dec 2013 18:18:34 +0000 (19:18 +0100)]
committs: v0.4.5
Alvaro Herrera, from
20131022221600.GE4987@eldon.alvh.no-ip.org
Alvaro Herrera [Fri, 25 Apr 2014 17:33:11 +0000 (14:33 -0300)]
core: use PG_FUNCNAME_MACRO to avoid stale name
Alvaro Herrera [Thu, 7 Nov 2013 12:44:23 +0000 (09:44 -0300)]
event_trigger.c: Fix typo in comment
Alvaro Herrera [Fri, 7 Feb 2014 19:42:37 +0000 (16:42 -0300)]
gram.y: more psprintf()
Alvaro Herrera [Fri, 7 Feb 2014 19:43:03 +0000 (16:43 -0300)]
json.c: fix typo
Andres Freund [Thu, 3 Jul 2014 15:39:30 +0000 (17:39 +0200)]
Merge remote-tracking branch '2ndq-bdr/deparse_9_4' into HEAD
* 2ndq-bdr/deparse_9_4: (34 commits)
deparse: support GRANT/REVOKE
deparse: Support ALTER EXTENSION / UPDATE TO
deparse: support ALTER THING OWNER TO
deparse: Support CREATE AGGREGATE
deparse: Initial support for CREATE TEXT SEARCH CONFIGURATION
deparse: Support CREATE TYPE via DefineStmt
deparse: Support CREATE TEXT SEARCH DICTIONARY via DefineStmt
deparse: Support CREATE TEXT SEARCH PARSER via DefineStmt
deparse: Support CREATE TEXT SEARCH TEMPLATE via DefineStmt
deparse: Support CREATE COLLATION via DefineStmt
deparse: Support CREATE OPERATOR via DefineStmt
deparse: Support CREATE CONVERSION
deparse: Support CREATE OPERATOR FAMILY
deparse: initial support for ALTER TABLE
deparse: deparse CREATE FUNCTION
deparse/core: enable deparse of function defaults expr
deparse: support CREATE DOMAIN
deparse: add support for ALTER THING RENAME
deparse: support ALTER TYPE / ADD VALUE (for enums)
deparse: add support for CREATE RULE
...
Andres Freund [Thu, 3 Jul 2014 15:39:19 +0000 (17:39 +0200)]
Merge remote-tracking branch '2ndq-bdr/bdr-drops_9_4' into HEAD
* 2ndq-bdr/bdr-drops_9_4:
bdr-drops: add some docs
bdr-drops: emit empty objnames for amproc/amop objs
bdr-drops: Set "normal" flag when DEPFLAG_REVERSE
bdr-drops: allow extracting objname/args from address
core: fix bizarre skipping logic
Peter Eisentraut [Thu, 3 Jul 2014 01:44:02 +0000 (21:44 -0400)]
Use a separate temporary directory for the Unix-domain socket
Creating the Unix-domain socket in the build directory can run into
name-length limitations. Therefore, create the socket file in the
default temporary directory of the operating system. Keep the temporary
data directory etc. in the build tree.
Peter Eisentraut [Thu, 3 Jul 2014 01:47:07 +0000 (21:47 -0400)]
Support vpath builds in TAP tests
Kevin Grittner [Wed, 2 Jul 2014 20:03:57 +0000 (15:03 -0500)]
Smooth reporting of commit/rollback statistics.
If a connection committed or rolled back any transactions within a
PGSTAT_STAT_INTERVAL pacing interval without accessing any tables,
the reporting of those statistics would be held up until the
connection closed or until it ended a PGSTAT_STAT_INTERVAL interval
in which it had accessed a table. This could result in under-
reporting of transactions for an extended period, followed by a
spike in reported transactions.
While this is arguably a bug, the impact is minimal, primarily
affecting, and being affected by, monitoring software. It might
cause more confusion than benefit to change the existing behavior
in released stable branches, so apply only to master and the 9.4
beta.
Gurjeet Singh, with review and editing by Kevin Grittner,
incorporating suggested changes from Abhijit Menon-Sen and Tom
Lane.
Bruce Momjian [Wed, 2 Jul 2014 19:29:38 +0000 (15:29 -0400)]
pg_upgrade: preserve database and relation minmxid values
Also set these values for pre-9.3 old clusters that don't have values to
preserve.
Analysis by Alvaro
Backpatch through 9.3
Bruce Momjian [Wed, 2 Jul 2014 17:11:05 +0000 (13:11 -0400)]
pg_upgrade: no need to remove "members" files for pre-9.3 upgrades
Per analysis by Alvaro
Backpatch through 9.3
Tom Lane [Wed, 2 Jul 2014 16:31:27 +0000 (12:31 -0400)]
Add some errdetail to checkRuleResultList().
This function wasn't originally thought to be really user-facing,
because converting a table to a view isn't something we expect people
to do manually. So not all that much effort was spent on the error
messages; in particular, while the code will complain that you got
the column types wrong it won't say exactly what they are. But since
we repurposed the code to also check compatibility of rule RETURNING
lists, it's definitely user-facing. It now seems worthwhile to add
errdetail messages showing exactly what the conflict is when there's
a mismatch of column names or types. This is prompted by bug #10836
from Matthias Raffelsieper, which might have been forestalled if the
error message had reported the wrong column type as being "record".
Back-patch to 9.4, but not into older branches where the set of
translatable error strings is supposed to be stable.
Fujii Masao [Wed, 2 Jul 2014 03:42:20 +0000 (12:42 +0900)]
Prevent psql from issuing BEGIN before ALTER SYSTEM when AUTOCOMMIT is off.
The autocommit-off mode works by issuing an implicit BEGIN just before
any command that is not already in a transaction block and is not itself
a BEGIN or other transaction-control command, nor a command that
cannot be executed inside a transaction block. This commit prevents psql
from issuing such an implicit BEGIN before ALTER SYSTEM because it's
not allowed inside a transaction block.
Backpatch to 9.4 where ALTER SYSTEM was added.
Report by Feike Steenbergen
Tom Lane [Tue, 1 Jul 2014 15:22:46 +0000 (11:22 -0400)]
Fix inadequately-sized output buffer in contrib/unaccent.
The output buffer size in unaccent_lexize() was calculated as input string
length times pg_database_encoding_max_length(), which effectively assumes
that replacement strings aren't more than one character. While that was
all that we previously documented it to support, the code actually has
always allowed replacement strings of arbitrary length; so if you tried
to make use of longer strings, you were at risk of buffer overrun. To fix,
use an expansible StringInfo buffer instead of trying to determine the
maximum space needed a-priori.
This would be a security issue if unaccent rules files could be installed
by unprivileged users; but fortunately they can't, so in the back branches
the problem can be labeled as improper configuration by a superuser.
Nonetheless, a memory stomp isn't a nice way of reacting to improper
configuration, so let's back-patch the fix.
Bruce Momjian [Mon, 30 Jun 2014 23:57:47 +0000 (19:57 -0400)]
pg_upgrade: update C comments about pg_dumpall
There were some C comments that hadn't been updated from the switch of
using only pg_dumpall to using pg_dump and pg_dumpall, so update them.
Also, don't bother using --schema-only for pg_dumpall --globals-only.
Backpatch through 9.4
Noah Misch [Mon, 30 Jun 2014 20:59:19 +0000 (16:59 -0400)]
Don't prematurely free the BufferAccessStrategy in pgstat_heap().
This function continued to use it after heap_endscan() freed it. In
passing, don't explicit create a strategy here. Instead, use the one
created by heap_beginscan_strat(), if any. Back-patch to 9.2, where use
of a BufferAccessStrategy here was introduced.
Andres Freund [Sun, 29 Jun 2014 15:08:04 +0000 (17:08 +0200)]
Check interrupts during logical decoding more frequently.
When reading large amounts of preexisting WAL during logical decoding
using the SQL interface we possibly could fail to check interrupts in
due time. Similarly the same could happen on systems with a very high
WAL volume while creating a new logical replication slot, independent
of the used interface.
Previously these checks where only performed in xlogreader's read_page
callbacks, while waiting for new WAL to be produced. That's not
sufficient though, if there's never a need to wait. Walsender's send
loop already contains a interrupt check.
Backpatch to 9.4 where the logical decoding feature was introduced.
Heikki Linnakangas [Mon, 30 Jun 2014 07:23:18 +0000 (10:23 +0300)]
Revert the assertion of no palloc's in critical section.
Per discussion, it still fires too often to be safe to enable in
production. Keep it in master, so that we find the issues, but disable it
in the stable branch.
Tom Lane [Sun, 29 Jun 2014 17:51:02 +0000 (13:51 -0400)]
Remove use_json_as_text options from json_to_record/json_populate_record.
The "false" case was really quite useless since all it did was to throw
an error; a definition not helped in the least by making it the default.
Instead let's just have the "true" case, which emits nested objects and
arrays in JSON syntax. We might later want to provide the ability to
emit sub-objects in Postgres record or array syntax, but we'd be best off
to drive that off a check of the target field datatype, not a separate
argument.
For the functions newly added in 9.4, we can just remove the flag arguments
outright. We can't do that for json_populate_record[set], which already
existed in 9.3, but we can ignore the argument and always behave as if it
were "true". It helps that the flag arguments were optional and not
documented in any useful fashion anyway.
Alvaro Herrera [Fri, 27 Jun 2014 18:43:52 +0000 (14:43 -0400)]
Have multixact be truncated by checkpoint, not vacuum
Instead of truncating pg_multixact at vacuum time, do it only at
checkpoint time. The reason for doing it this way is twofold: first, we
want it to delete only segments that we're certain will not be required
if there's a crash immediately after the removal; and second, we want to
do it relatively often so that older files are not left behind if
there's an untimely crash.
Per my proposal in
http://www.postgresql.org/message-id/
20140626044519.GJ7340@eldon.alvh.no-ip.org
we now execute the truncation in the checkpointer process rather than as
part of vacuum. Vacuum is in only charge of maintaining in shared
memory the value to which it's possible to truncate the files; that
value is stored as part of checkpoints also, and so upon recovery we can
reuse the same value to re-execute truncate and reset the
oldest-value-still-safe-to-use to one known to remain after truncation.
Per bug reported by Jeff Janes in the course of his tests involving
bug #8673.
While at it, update some comments that hadn't been updated since
multixacts were changed.
Backpatch to 9.3, where persistency of pg_multixact files was
introduced by commit
0ac5ad5134f2.
Alvaro Herrera [Fri, 27 Jun 2014 18:43:46 +0000 (14:43 -0400)]
Don't allow relminmxid to go backwards during VACUUM FULL
We were allowing a table's pg_class.relminmxid value to move backwards
when heaps were swapped by VACUUM FULL or CLUSTER. There is a
similar protection against relfrozenxid going backwards, which we
neglected to clone when the multixact stuff was rejiggered by commit
0ac5ad5134f276.
Backpatch to 9.3, where relminmxid was introduced.
As reported by Heikki in
http://www.postgresql.org/message-id/
52401AEA.
9000608@vmware.com
Alvaro Herrera [Fri, 27 Jun 2014 18:43:39 +0000 (14:43 -0400)]
Fix broken Assert() introduced by
8e9a16ab8f7f0e58
Don't assert MultiXactIdIsRunning if the multi came from a tuple that
had been share-locked and later copied over to the new cluster by
pg_upgrade. Doing that causes an error to be raised unnecessarily:
MultiXactIdIsRunning is not open to the possibility that its argument
came from a pg_upgraded tuple, and all its other callers are already
checking; but such multis cannot, obviously, have transactions still
running, so the assert is pointless.
Noticed while investigating the bogus pg_multixact/offsets/0000 file
left over by pg_upgrade, as reported by Andres Freund in
http://www.postgresql.org/message-id/
20140530121631.GE25431@alap3.anarazel.de
Backpatch to 9.3, as the commit that introduced the buglet.
Tom Lane [Fri, 27 Jun 2014 18:08:51 +0000 (11:08 -0700)]
Disallow pushing volatile qual expressions down into DISTINCT subqueries.
A WHERE clause applied to the output of a subquery with DISTINCT should
theoretically be applied only once per distinct row; but if we push it
into the subquery then it will be evaluated at each row before duplicate
elimination occurs. If the qual is volatile this can give rise to
observably wrong results, so don't do that.
While at it, refactor a little bit to allow subquery_is_pushdown_safe
to report more than one kind of restrictive condition without indefinitely
expanding its argument list.
Although this is a bug fix, it seems unwise to back-patch it into released
branches, since it might de-optimize plans for queries that aren't giving
any trouble in practice. So apply to 9.4 but not further back.
Tom Lane [Thu, 26 Jun 2014 23:22:18 +0000 (16:22 -0700)]
Get rid of bogus separate pg_proc entries for json_extract_path operators.
These should not have existed to begin with, but there was apparently some
misunderstanding of the purpose of the opr_sanity regression test item
that checks for operator implementation functions with their own comments.
The idea there is to check for unintentional violations of the rule that
operator implementation functions shouldn't be documented separately
.... but for these functions, that is in fact what we want, since the
variadic option is useful and not accessible via the operator syntax.
Get rid of the extra pg_proc entries and fix the regression test and
documentation to be explicit about what we're doing here.
Tom Lane [Thu, 26 Jun 2014 17:40:55 +0000 (10:40 -0700)]
Forward-patch regression test for "could not find pathkey item to sort".
Commit
a87c729153e372f3731689a7be007bc2b53f1410 already fixed the bug this
is checking for, but the regression test case it added didn't cover this
scenario. Since we managed to miss the fact that there was a bug at all,
it seems like a good idea to propagate the extra test case forward to HEAD.
Fujii Masao [Thu, 26 Jun 2014 05:27:27 +0000 (14:27 +0900)]
Remove obsolete example of CSV log file name from log_filename document.
7380b63 changed log_filename so that epoch was not appended to it
when no format specifier is given. But the example of CSV log file name
with epoch still left in log_filename document. This commit removes
such obsolete example.
This commit also documents the defaults of log_directory and
log_filename.
Backpatch to all supported versions.
Christoph Berg
Tom Lane [Wed, 25 Jun 2014 22:25:26 +0000 (15:25 -0700)]
Rationalize error messages within jsonfuncs.c.
I noticed that the functions in jsonfuncs.c sometimes printed error
messages that claimed I'd called some other function. Investigation showed
that this was from repurposing code into "worker" functions without taking
much care as to whether it would mention the right SQL-level function if it
threw an error. Moreover, there was a weird mismash of messages that
contained a fixed function name, messages that used %s for a function name,
and messages that constructed a function name out of spare parts, like
"json%s_populate_record" (which, quite aside from being ugly as sin, wasn't
even sufficient to cover all the cases). This would put an undue burden on
our long-suffering translators. Standardize on inserting the SQL function
name with %s so as to reduce the number of translatable strings, and pass
function names around as needed to make sure we can report the right one.
Fix up some gratuitous variations in wording, too.
Tom Lane [Wed, 25 Jun 2014 18:22:21 +0000 (11:22 -0700)]
Cosmetic improvements in jsonfuncs.c.
Re-pgindent, remove a lot of random vertical whitespace, remove useless
(if not counterproductive) inline markings, get rid of unnecessary
zero-padding of strings for hashtable searches. No functional changes.
Tom Lane [Wed, 25 Jun 2014 04:22:43 +0000 (21:22 -0700)]
Fix handling of nested JSON objects in json_populate_recordset and friends.
populate_recordset_object_start() improperly created a new hash table
(overwriting the link to the existing one) if called at nest levels
greater than one. This resulted in previous fields not appearing in
the final output, as reported by Matti Hameister in bug #10728.
In 9.4 the problem also affects json_to_recordset.
This perhaps missed detection earlier because the default behavior is to
throw an error for nested objects: you have to pass use_json_as_text = true
to see the problem.
In addition, fix query-lifespan leakage of the hashtable created by
json_populate_record(). This is pretty much the same problem recently
fixed in dblink: creating an intended-to-be-temporary context underneath
the executor's per-tuple context isn't enough to make it go away at the
end of the tuple cycle, because MemoryContextReset is not
MemoryContextResetAndDeleteChildren.
Michael Paquier and Tom Lane
Bruce Momjian [Tue, 24 Jun 2014 20:11:06 +0000 (16:11 -0400)]
pg_upgrade: remove pg_multixact files left by initdb
This fixes a bug that caused vacuum to fail when the '0000' files left
by initdb were accessed as part of vacuum's cleanup of old pg_multixact
files.
Backpatch through 9.3
Heikki Linnakangas [Tue, 24 Jun 2014 09:31:36 +0000 (12:31 +0300)]
Don't allow foreign tables with OIDs.
The syntax doesn't let you specify "WITH OIDS" for foreign tables, but it
was still possible with default_with_oids=true. But the rest of the system,
including pg_dump, isn't prepared to handle foreign tables with OIDs
properly.
Backpatch down to 9.1, where foreign tables were introduced. It's possible
that there are databases out there that already have foreign tables with
OIDs. There isn't much we can do about that, but at least we can prevent
them from being created in the future.
Patch by Etsuro Fujita, reviewed by Hadi Moshayedi.
Fujii Masao [Mon, 23 Jun 2014 18:51:51 +0000 (03:51 +0900)]
Fix typo in replication slot function doc.
Fujii Masao [Mon, 23 Jun 2014 18:25:01 +0000 (03:25 +0900)]
Add missing closing parenthesis into max_replication_slots doc.
Bruce Momjian [Sat, 21 Jun 2014 19:33:22 +0000 (15:33 -0400)]
doc: adjust JSONB GIN index description
Backpatch through 9.4