]> granicus.if.org Git - postgresql/log
postgresql
10 years agoRework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE'
Stephen Frost [Thu, 21 Aug 2014 23:06:17 +0000 (19:06 -0400)]
Rework 'MOVE ALL' to 'ALTER .. ALL IN TABLESPACE'

As 'ALTER TABLESPACE .. MOVE ALL' really didn't change the tablespace
but instead changed objects inside tablespaces, it made sense to
rework the syntax and supporting functions to operate under the
'ALTER (TABLE|INDEX|MATERIALIZED VIEW)' syntax and to be in
tablecmds.c.

Pointed out by Alvaro, who also suggested the new syntax.

Back-patch to 9.4.

10 years agoMore regression test cases for json/jsonb extraction operators.
Tom Lane [Wed, 20 Aug 2014 23:05:09 +0000 (19:05 -0400)]
More regression test cases for json/jsonb extraction operators.

Cover some cases I omitted before, such as null and empty-string
elements in the path array.  This exposes another inconsistency:
json_extract_path complains about empty path elements but
jsonb_extract_path does not.

10 years agoFix core dump in jsonb #> operator, and add regression test cases.
Tom Lane [Wed, 20 Aug 2014 20:48:37 +0000 (16:48 -0400)]
Fix core dump in jsonb #> operator, and add regression test cases.

jsonb's #> operator segfaulted (dereferencing a null pointer) if the RHS
was a zero-length array, as reported in bug #11207 from Justin Van Winkle.
json's #> operator returns NULL in such cases, so for the moment let's
make jsonb act likewise.

Also add a bunch of regression test queries memorializing the -> and #>
operators' behavior for this and other corner cases.

There is a good argument for changing some of these behaviors, as they
are not very consistent with each other, and throwing an error isn't
necessarily a desirable behavior for operators that are likely to be
used in indexes.  However, everybody can agree that a core dump is the
Wrong Thing, and we need test cases even if we decide to change their
expected output later.

10 years agoRevert "Fix bug in checking of IDENTIFY_SYSTEM result."
Fujii Masao [Tue, 19 Aug 2014 09:30:38 +0000 (18:30 +0900)]
Revert "Fix bug in checking of IDENTIFY_SYSTEM result."

This reverts commit 083d29c65b7897f90c70e6dc0a4240a5fa75c8f2.

The commit changed the code so that it causes an errors when
IDENTIFY_SYSTEM returns three columns. But which prevents us
from using the replication-related utilities against the server
with older version. This is not what we want. For that
compatibility, we allow the utilities to receive three columns
as the result of IDENTIFY_SYSTEM eventhough it actually returns
four columns in 9.4 or later.

Pointed out by Andres Freund.

10 years agoFix bug in checking of IDENTIFY_SYSTEM result.
Fujii Masao [Tue, 19 Aug 2014 08:26:07 +0000 (17:26 +0900)]
Fix bug in checking of IDENTIFY_SYSTEM result.

5a991ef8692ed0d170b44958a81a6bd70e90585 added new column into
the result of IDENTIFY_SYSTEM command. But it was not reflected into
several codes checking that result. Specifically though the number of
columns in the result was increased to 4, it was still compared with 3
in some replication codes.

Back-patch to 9.4 where the number of columns in IDENTIFY_SYSTEM
result was increased.

Report from Michael Paquier

10 years agoInstall libpq DLL with $(INSTALL_SHLIB).
Noah Misch [Tue, 19 Aug 2014 03:00:38 +0000 (23:00 -0400)]
Install libpq DLL with $(INSTALL_SHLIB).

Programs need execute permission on a DLL file to load it.  MSYS
"install" ignores the mode argument, and our Cygwin build statically
links libpq into programs.  That explains the lack of buildfarm trouble.
Back-patch to 9.0 (all supported versions).

10 years agoMake pg_service.conf sample LDIF more portable.
Noah Misch [Tue, 19 Aug 2014 02:58:57 +0000 (22:58 -0400)]
Make pg_service.conf sample LDIF more portable.

The aboriginal sample placed connection parameters in
groupOfUniqueNames/uniqueMember.  OpenLDAP, at least as early as version
2.4.23, rejects uniqueMember entries that do not conform to the syntax
for a distinguished name.  Use device/description, which is free-form.
Back-patch to 9.4 for web site visibility.

10 years agoDocument new trigger-related forms of ALTER FOREIGN TABLE.
Noah Misch [Tue, 19 Aug 2014 02:58:25 +0000 (22:58 -0400)]
Document new trigger-related forms of ALTER FOREIGN TABLE.

Oversight in commit 7cbe57c34dec4860243e6d0f81738cfbb6e5d069.
Back-patch to 9.4, where that commit first appeared.  In passing,
release-note the FDW API postcondition change from the same commit.

10 years agoAdjust Release Notes to reflect holding off wrapped expanded mode until 9.5 (thanks...
Greg Stark [Mon, 18 Aug 2014 12:59:41 +0000 (13:59 +0100)]
Adjust Release Notes to reflect holding off wrapped expanded mode until 9.5 (thanks Michael Paquier)

10 years agoRevert psql changes to support wrapped expanded mode. That feature is
Greg Stark [Mon, 18 Aug 2014 10:28:57 +0000 (11:28 +0100)]
Revert psql changes to support wrapped expanded mode. That feature is
nice and we'll keep it in 9.5 but it'll take more time to iron out the
collateral damage on other queries and also on tools like
check_postgres.

revert dbe31616c9be7380b8a88cdfbeaa68dbdcdebc36
revert 6513633b94173fc1d9e2b213c43f9422ddbf5faa

10 years agoFix obsolete mention of non-int64 support in CREATE SEQUENCE documentation.
Tom Lane [Mon, 18 Aug 2014 05:17:49 +0000 (01:17 -0400)]
Fix obsolete mention of non-int64 support in CREATE SEQUENCE documentation.

The old text explained what happened if we didn't have working int64
arithmetic.  Since that case has been explicitly rejected by configure
since 8.4.3, documenting it in the 9.x branches can only produce confusion.

10 years agoUse ISO 8601 format for dates converted to JSON, too.
Tom Lane [Mon, 18 Aug 2014 02:57:20 +0000 (22:57 -0400)]
Use ISO 8601 format for dates converted to JSON, too.

Commit f30015b6d794c15d52abbb3df3a65081fbefb1ed made this happen for
timestamp and timestamptz, but it seems pretty inconsistent to not
do it for simple dates as well.

(In passing, I re-pgindent'd json.c.)

10 years agoAdd missing index terms for replication commands in the document.
Fujii Masao [Mon, 18 Aug 2014 02:18:53 +0000 (11:18 +0900)]
Add missing index terms for replication commands in the document.

Previously only CREATE_REPLICATION_SLOT was exposed as an index term.
That's odd and there is no reason not to add index terms for other
replication commands.

Back-patch to 9.4.

10 years agoMake an editorial pass over the 9.4 release notes.
Tom Lane [Mon, 18 Aug 2014 02:26:49 +0000 (22:26 -0400)]
Make an editorial pass over the 9.4 release notes.

Update the notes to include commits through today, and do a lot of
wordsmithing and markup adjustment.  Notably, don't use <link> where <xref>
will do; since we got rid of the text-format HISTORY file, there is no
longer a reason to avoid <xref>.

10 years agoImprove DISCARD documentation.
Tom Lane [Sun, 17 Aug 2014 19:59:06 +0000 (15:59 -0400)]
Improve DISCARD documentation.

The new DISCARD SEQUENCES option was inadequately described, and hadn't
been mentioned at all in the initial Description paragraph.  Rather than
rectifying the latter the hard way, it seemed better to rewrite the
description as a summary, instead of having it basically duplicate
statements made under Parameters.  Be more consistent about the ordering
of the options, too.

10 years agodoc: Work around stylesheet bug for man build
Peter Eisentraut [Sun, 17 Aug 2014 13:10:28 +0000 (09:10 -0400)]
doc: Work around stylesheet bug for man build

The upstream stylesheets for man output insert a *roff comment for an
occurrence of an indexterm, for reasons that have apparently been lost
in history.  This, however, is done incorrectly and causes some
formatting problems.  This hasn't been an issue until now, but the
reorganization of indexterm elements inside variablelists has triggered
this issue.

The upstream fix (http://sourceforge.net/p/docbook/bugs/1340/) is to
drop indexterms altogether in man output, and so we'll do the same here.

10 years agoFix bogus return macros in range_overright_internal().
Tom Lane [Sat, 16 Aug 2014 17:48:43 +0000 (13:48 -0400)]
Fix bogus return macros in range_overright_internal().

PG_RETURN_BOOL() should only be used in functions following the V1 SQL
function API.  This coding accidentally fails to fail since letting the
compiler coerce the Datum representation of bool back to plain bool
does give the right answer; but that doesn't make it a good idea.

Back-patch to older branches just to avoid unnecessary code divergence.

10 years agoFix bogus commutator/negator links for JSONB containment operators.
Tom Lane [Sat, 16 Aug 2014 16:53:57 +0000 (12:53 -0400)]
Fix bogus commutator/negator links for JSONB containment operators.

<@ and @> are each other's commutators, but they were incorrectly marked
as being each other's negators instead.  (This was actually questioned
in a comment in the original commit, but nobody followed through :-(.)
Per bug #11178 from Christian Pronovost.

In passing, fix some JSONB operator descriptions that were randomly
different from the phrasing of every other similar description.

catversion bump for pg_catalog contents change.

10 years agoRemove remnants of a JENTRY_ISFIRST flag bit.
Heikki Linnakangas [Fri, 15 Aug 2014 06:39:38 +0000 (09:39 +0300)]
Remove remnants of a JENTRY_ISFIRST flag bit.

I removed the flag earlier, but missed a few references in jsonb.h.

10 years agoSet shared library path for in-tree TAP tests
Peter Eisentraut [Fri, 15 Aug 2014 04:01:14 +0000 (00:01 -0400)]
Set shared library path for in-tree TAP tests

When the TAP tests are run in-tree (make check), set the shared library
path using the appropriate environment variable, using a logic similar
to pg_regress, so that the right libraries are used.

10 years agoUpdate SysV parameter configuration documentation for FreeBSD.
Tom Lane [Thu, 14 Aug 2014 20:05:49 +0000 (16:05 -0400)]
Update SysV parameter configuration documentation for FreeBSD.

FreeBSD hasn't made any use of kern.ipc.semmap since 1.1, and newer
releases reject attempts to set it altogether; so stop recommending
that it be adjusted.  Per bug #11161.

Back-patch to all supported branches.  Before 9.3, also incorporate
commit 7a42dff47, which touches the same text and for some reason
was not back-patched at the time.

10 years agoFix help message in pg_ctl.
Fujii Masao [Thu, 14 Aug 2014 04:57:52 +0000 (13:57 +0900)]
Fix help message in pg_ctl.

Previously the help message described that -m is an option for
"stop", "restart" and "promote" commands in pg_ctl. But actually
that's not an option for "promote". So this commit fixes that
incorrect description in the help message.

Back-patch to 9.3 where the incorrect description was added.

10 years agoExpose -S option in pg_receivexlog.
Fujii Masao [Wed, 13 Aug 2014 01:45:28 +0000 (10:45 +0900)]
Expose -S option in pg_receivexlog.

This option is equivalent to --slot option which pg_receivexlog has
already supported, which specifies the replication slot to use for
WAL streaming. pg_recvlogical has already supported both options,
and this commit makes pg_receivexlog consistent with pg_recvlogical
regarding the slot option.

Back-patch to 9.4 where the slot option was added.

Michael Paquier

10 years agopg_recvlogical message and code improvements.
Andres Freund [Tue, 12 Aug 2014 09:12:16 +0000 (11:12 +0200)]
pg_recvlogical message and code improvements.

Some error messages complained about --init and --stop being used
whereas the --create and --drop are the correct verbs. Fix that.

Also a XLogRecPtr was tested in a boolean fashion instead of being
compared to InvalidXLogRecPtr.

Backpatch to 9.4 where pg_recvlogical was introduced.

Michael Paquier

10 years agoBe less aggressive in asking for feedback of logical walsender clients.
Andres Freund [Tue, 12 Aug 2014 09:04:50 +0000 (11:04 +0200)]
Be less aggressive in asking for feedback of logical walsender clients.

When doing logical decoding using START_LOGICAL_REPLICATION in a
walsender process the walsender sometimes was sending out keepalive
messages too frequently. Asking for feedback every time.

WalSndWaitForWal() sends out keepalive messages when it's waiting for
new WAL to be generated locally when it sees that the remote side
hasn't yet flushed WAL up to the local position. That generally is
good but causes problems if the remote side only writes but doesn't
flush changes yet. So check for both remote write and flush position.

Additionally we've asked for feedback to the keepalive message which
isn't warranted when waiting for WAL in contrast to preventing
timeouts because of wal_sender_timeout.

Complaint and patch by Steve Singer.

10 years agoChange first call of ProcessConfigFile so as to process only data_directory.
Fujii Masao [Tue, 12 Aug 2014 07:50:09 +0000 (16:50 +0900)]
Change first call of ProcessConfigFile so as to process only data_directory.

When both postgresql.conf and postgresql.auto.conf have their own entry of
the same parameter, PostgreSQL uses the entry in postgresql.auto.conf because
it appears last in the configuration scan. IOW, the other entries which appear
earlier are ignored. But, previously, ProcessConfigFile() detected the invalid
settings of even those unused entries and emitted the error messages
complaining about them, at postmaster startup. Complaining about the entries
to ignore is basically useless.

This problem happened because ProcessConfigFile() was called twice at
postmaster startup and the first call read only postgresql.conf. That is, the
first call could check the entry which might be ignored eventually by
the second call which read both postgresql.conf and postgresql.auto.conf.
To work around the problem, this commit changes ProcessConfigFile so that
its first call processes only data_directory and the second one does all the
entries. It's OK to process data_directory in the first call because it's
ensured that data_directory doesn't exist in postgresql.auto.conf.

Back-patch to 9.4 where postgresql.auto.conf was added.

Patch by me. Review by Amit Kapila

10 years agoFix documentation oversights about pageinspect and initialization fork.
Fujii Masao [Mon, 11 Aug 2014 13:52:16 +0000 (22:52 +0900)]
Fix documentation oversights about pageinspect and initialization fork.

The initialization fork was added in 9.1, but has not been taken into
consideration in documents of get_raw_page function in pageinspect and
storage layout. This commit fixes those oversights.

get_raw_page can read not only a table but also an index, etc. So it
should be documented that the function can read any relation. This commit
also fixes the document of pageinspect that way.

Back-patch to 9.1 where those oversights existed.

Vik Fearing, review by MauMau

10 years agoClarify type resolution behavior for domain types.
Tom Lane [Sun, 10 Aug 2014 20:13:16 +0000 (16:13 -0400)]
Clarify type resolution behavior for domain types.

The user documentation was vague and not entirely accurate about how
we treat domain inputs for ambiguous operators/functions.  Clarify
that, and add an example and some commentary.  Per a recent question
from Adam Mackler.

It's acted like this ever since we added domains, so back-patch
to all supported branches.

10 years agoClean up handling of unknown-type inputs in json_build_object and friends.
Tom Lane [Sat, 9 Aug 2014 21:31:16 +0000 (17:31 -0400)]
Clean up handling of unknown-type inputs in json_build_object and friends.

There's actually no need for any special case for unknown-type literals,
since we only need to push the value through its output function and
unknownout() works fine.  The code that was here was completely bizarre
anyway, and would fail outright in cases that should work, not to mention
suffering from some copy-and-paste bugs.

10 years agoFurther cleanup of JSON-specific error messages.
Tom Lane [Sat, 9 Aug 2014 20:35:32 +0000 (16:35 -0400)]
Further cleanup of JSON-specific error messages.

Fix an obvious typo in json_build_object()'s complaint about invalid
number of arguments, and make the errhint a bit more sensible too.

Per discussion about how to word the improved hint, change the few places
in the documentation that refer to JSON object field names as "names" to
say "keys" instead, since that's what we've said in the vast majority of
places in the docs.  Arguably "name" is more correct, since that's the
terminology used in RFC 7159; but we're stuck with "key" in view of the
naming of json_object_keys() so let's at least be self-consistent.

I adjusted a few code comments to match this as well, and failed to
resist the temptation to clean up some odd whitespace choices in the
same area, as well as a useless duplicate PG_ARGISNULL() check.  There's
still quite a bit of code that uses the phrase "field name" in non-user-
visible ways, so I left those usages alone.

10 years agoReject duplicate column names in foreign key referenced-columns lists.
Tom Lane [Sat, 9 Aug 2014 17:46:38 +0000 (13:46 -0400)]
Reject duplicate column names in foreign key referenced-columns lists.

Such cases are disallowed by the SQL spec, and even if we wanted to allow
them, the semantics seem ambiguous: how should the FK columns be matched up
with the columns of a unique index?  (The matching could be significant in
the presence of opclasses with different notions of equality, so this issue
isn't just academic.)  However, our code did not previously reject such
cases, but instead would either fail to match to any unique index, or
generate a bizarre opclass-lookup error because of sloppy thinking in the
index-matching code.

David Rowley

10 years agoSmall message fixes
Peter Eisentraut [Sat, 9 Aug 2014 04:07:00 +0000 (00:07 -0400)]
Small message fixes

10 years agoFix typo in docs.
Tom Lane [Fri, 8 Aug 2014 00:46:44 +0000 (20:46 -0400)]
Fix typo in docs.

s/XIDs XIDs/XIDs/ in one place in maintenance.sgml.

Guillaume Lelarge

10 years agopg_upgrade: prevent oid conflicts with new-cluster TOAST tables
Bruce Momjian [Thu, 7 Aug 2014 18:56:13 +0000 (14:56 -0400)]
pg_upgrade: prevent oid conflicts with new-cluster TOAST tables

Previously, TOAST tables only required in the new cluster could cause
oid conflicts if they were auto-numbered and a later conflicting oid had
to be assigned.

Backpatch through 9.3

10 years agoFix alternate regression test output file.
Robert Haas [Wed, 6 Aug 2014 15:18:38 +0000 (11:18 -0400)]
Fix alternate regression test output file.

Commit 930e8ad738f5c78abd667626ca86f2553f36356f broke this.

Jeff Janes

10 years agoChange ParseConfigFp() so that it doesn't process unused entry of each parameter.
Fujii Masao [Wed, 6 Aug 2014 05:49:43 +0000 (14:49 +0900)]
Change ParseConfigFp() so that it doesn't process unused entry of each parameter.

When more than one setting entries of same parameter exist in the
configuration file, PostgreSQL uses only entry appearing last in
configuration file scan. Since the other entries are not used,
ParseConfigFp() doesn't need to process them, but previously it did
that. This problematic behavior caused the configuration file scan
to detect invalid settings of unused entries (e.g., existence of
multiple entries of PGC_POSTMASTER parameter) and log the messages
complaining about them.

This commit changes the configuration file scan so that it processes
only last entry of each parameter.

Note that when multiple entries of same parameter exist both in
postgresql.conf and postgresql.auto.conf, unused entries in
postgresql.conf are still processed only at postmaster startup.

The problem has existed since old version, but a user is more likely
to encounter it since 9.4 where ALTER SYSTEM command was introduced.
So back-patch to 9.4.

Amit Kapila, slightly modified by me. Per report from Christoph Berg.

10 years agoImprove some JSON error messages.
Robert Haas [Tue, 5 Aug 2014 16:26:25 +0000 (12:26 -0400)]
Improve some JSON error messages.

These messages are new in 9.4, which hasn't been released yet, so
back-patch to REL9_4_STABLE.

Daniele Varrazzo

10 years agopg_upgrade: remove reference to autovacuum_multixact_freeze_max_age
Bruce Momjian [Mon, 4 Aug 2014 15:45:45 +0000 (11:45 -0400)]
pg_upgrade:  remove reference to autovacuum_multixact_freeze_max_age

autovacuum_multixact_freeze_max_age was added as a pg_ctl start
parameter in 9.3.X to prevent autovacuum from running.  However, only
some 9.3.X releases have autovacuum_multixact_freeze_max_age as it was
added in a minor PG 9.3 release.  It also isn't needed because -b turns
off autovacuum in 9.1+.

Without this fix, trying to upgrade from an early 9.3 release to 9.4
would fail.

Report by EDB

Backpatch through 9.3

10 years agoAdd missing PQclear() calls into pg_receivexlog.
Fujii Masao [Sat, 2 Aug 2014 06:18:09 +0000 (15:18 +0900)]
Add missing PQclear() calls into pg_receivexlog.

Back-patch to 9.3.

10 years agoFix bug in pg_receivexlog --verbose.
Fujii Masao [Sat, 2 Aug 2014 05:57:21 +0000 (14:57 +0900)]
Fix bug in pg_receivexlog --verbose.

In 9.2, pg_receivexlog with verbose option has emitted the messages
at the end of each WAL file. But the commit 0b63291 suppressed such
messages by mistake. This commit fixes the bug so that pg_receivexlog
--verbose outputs such messages again.

Back-patch to 9.3 where the bug was added.

10 years agoFix typo in user manual
Heikki Linnakangas [Fri, 1 Aug 2014 18:13:17 +0000 (21:13 +0300)]
Fix typo in user manual

10 years agoAvoid wholesale autovacuuming when autovacuum is nominally off.
Tom Lane [Wed, 30 Jul 2014 18:41:35 +0000 (14:41 -0400)]
Avoid wholesale autovacuuming when autovacuum is nominally off.

When autovacuum is nominally off, we will still launch autovac workers
to vacuum tables that are at risk of XID wraparound.  But after we'd done
that, an autovac worker would proceed to autovacuum every table in the
targeted database, if they meet the usual thresholds for autovacuuming.
This is at best pretty unexpected; at worst it delays response to the
wraparound threat.  Fix it so that if autovacuum is nominally off, we
*only* do forced vacuums and not any other work.

Per gripe from Andrey Zhidenkov.  This has been like this all along,
so back-patch to all supported branches.

10 years agoFix mishandling of background worker PGPROCs in EXEC_BACKEND builds.
Robert Haas [Wed, 30 Jul 2014 15:25:58 +0000 (11:25 -0400)]
Fix mishandling of background worker PGPROCs in EXEC_BACKEND builds.

InitProcess() relies on IsBackgroundWorker to decide whether the PGPROC
for a new backend should be taken from ProcGlobal's freeProcs or from
bgworkerFreeProcs.  In EXEC_BACKEND builds, InitProcess() is called
sooner than in non-EXEC_BACKEND builds, and IsBackgroundWorker wasn't
getting initialized soon enough.

Report by Noah Misch.  Diagnosis and fix by me.

10 years agodoc: Clean up some recently added PL/pgSQL documentation
Peter Eisentraut [Wed, 30 Jul 2014 03:47:16 +0000 (23:47 -0400)]
doc: Clean up some recently added PL/pgSQL documentation

- Capitalize titles consistently.
- Fix some grammar.
- Group "Obtaining Information About an Error" under "Trapping Errors",
  but make "Obtaining the Call Stack Context Information" its own
  section, since it's not about errors.

10 years agoOops, fix recoveryStopsBefore functions for regular commits.
Heikki Linnakangas [Tue, 29 Jul 2014 14:16:59 +0000 (17:16 +0300)]
Oops, fix recoveryStopsBefore functions for regular commits.

Pointed out by Tom Lane. Backpatch to 9.4, the code was structured
differently in earlier branches and didn't have this mistake.

10 years agoTreat 2PC commit/abort the same as regular xacts in recovery.
Heikki Linnakangas [Tue, 29 Jul 2014 07:33:15 +0000 (10:33 +0300)]
Treat 2PC commit/abort the same as regular xacts in recovery.

There were several oversights in recovery code where COMMIT/ABORT PREPARED
records were ignored:

* pg_last_xact_replay_timestamp() (wasn't updated for 2PC commits)
* recovery_min_apply_delay (2PC commits were applied immediately)
* recovery_target_xid (recovery would not stop if the XID used 2PC)

The first of those was reported by Sergiy Zuban in bug #11032, analyzed by
Tom Lane and Andres Freund. The bug was always there, but was masked before
commit d19bd29f07aef9e508ff047d128a4046cc8bc1e2, because COMMIT PREPARED
always created an extra regular transaction that was WAL-logged.

Backpatch to all supported versions (older versions didn't have all the
features and therefore didn't have all of the above bugs).

10 years agoReword the sentence for pg_logical_slot_peek_changes function.
Fujii Masao [Tue, 29 Jul 2014 03:07:54 +0000 (12:07 +0900)]
Reword the sentence for pg_logical_slot_peek_changes function.

Previously the duplicated paragraphs were used next to each other
in the document to demonstrate that the changes in the stream
were not consumed by pg_logical_slot_peek_changes function.
But some users misunderstood that the duplication of the same
paragraph was just typo. So this commit rewords the sentence in
the latter paragraph for less confusing.

Christoph Moench-Tegeder

10 years agoFix obsolete statement in smgr/README.
Tom Lane [Mon, 28 Jul 2014 20:30:14 +0000 (16:30 -0400)]
Fix obsolete statement in smgr/README.

Since commit 2d00190495b22e0d0ba351b2cda9c95fb2e3d083, fork numbers are
defined in relpath.h not relfilenode.h.

Fabrízio de Royes Mello

10 years agodoc: Fix up ALTER TABLESPACE reference page
Peter Eisentraut [Sun, 27 Jul 2014 03:19:02 +0000 (23:19 -0400)]
doc: Fix up ALTER TABLESPACE reference page

The documentation of ALTER TABLESPACE ... MOVE was added without any
markup, not even paragraph breaks.  Fix that, and clarify the text in a
few places.

10 years agoFix a performance problem in pg_dump's dump order selection logic.
Tom Lane [Fri, 25 Jul 2014 23:48:45 +0000 (19:48 -0400)]
Fix a performance problem in pg_dump's dump order selection logic.

findDependencyLoops() was not bright about cases where there are multiple
dependency paths between the same two dumpable objects.  In most scenarios
this did not hurt us too badly; but since the introduction of section
boundary pseudo-objects in commit a1ef01fe163b304760088e3e30eb22036910a495,
it was possible for this code to take unreasonable amounts of time (tens
of seconds on a database with a couple thousand objects), as reported in
bug #11033 from Joe Van Dyk.  Joe's particular problem scenario involved
"pg_dump -a" mode with long chains of foreign key constraints, but I think
that similar problems could arise with other situations as long as there
were enough objects.  To fix, add a flag array that lets us notice when we
arrive at the same object again while searching from a given start object.
This simple change seems to be enough to eliminate the performance problem.

Back-patch to 9.1, like the patch that introduced section boundary objects.

10 years agoPrevent shm_mq_send from reading uninitialized memory.
Robert Haas [Thu, 24 Jul 2014 13:19:50 +0000 (09:19 -0400)]
Prevent shm_mq_send from reading uninitialized memory.

shm_mq_send_bytes didn't invariably initialize *bytes_written before
returning, which would cause shm_mq_send to read from uninitialized
memory and add the value it found there to mqh->mqh_partial_bytes.
This could cause the next attempt to send a message via the queue to
fail an assertion (if the queue was detached) or copy data from a
garbage pointer value into the queue (if non-blocking mode was in use).

10 years agoFix checkpointer crash in EXEC_BACKEND builds.
Robert Haas [Thu, 24 Jul 2014 13:04:59 +0000 (09:04 -0400)]
Fix checkpointer crash in EXEC_BACKEND builds.

Nothing in the checkpointer calls InitXLOGAccess(), so WALInsertLocks
never got initialized there.  Without EXEC_BACKEND, it works anyway
because the correct value is inherited from the postmaster, but
with EXEC_BACKEND we've got a problem.  The problem appears to have
been introduced by commit 68a2e52bbaf98f136a96b3a0d734ca52ca440a95.

To fix, move the relevant initialization steps from InitXLOGAccess()
to XLOGShmemInit(), making this more parallel to what we do
elsewhere.

Amit Kapila

10 years agoProperly remove ephemeral replication slots after a crash restart.
Andres Freund [Thu, 24 Jul 2014 12:32:34 +0000 (14:32 +0200)]
Properly remove ephemeral replication slots after a crash restart.

Ephemeral slots - slots that shouldn't survive database restarts -
weren't properly cleaned up after a immediate/crash restart. They were
ignored in the sense that they weren't restored into memory and thus
didn't cause unwanted resource retention; but they prevented a new
slot with the same name from being created.

Now ephemeral slots are fully removed during startup.

Backpatch to 9.4 where replication slots where added.

10 years agoAvoid access to already-released lock in LockRefindAndRelease.
Robert Haas [Thu, 24 Jul 2014 12:19:19 +0000 (08:19 -0400)]
Avoid access to already-released lock in LockRefindAndRelease.

Spotted by Tom Lane.

10 years agoFix TAP installcheck tests when current directory name contains spaces
Peter Eisentraut [Thu, 24 Jul 2014 01:41:59 +0000 (21:41 -0400)]
Fix TAP installcheck tests when current directory name contains spaces

This fixes the installcheck part.  The check part has additional
problems that will be addressed in a separate commit.

10 years agoRearrange documentation paragraph describing pg_relation_size().
Tom Lane [Wed, 23 Jul 2014 19:20:34 +0000 (15:20 -0400)]
Rearrange documentation paragraph describing pg_relation_size().

Break the list of available options into an <itemizedlist> instead of
inline sentences.  This is mostly motivated by wanting to ensure that the
cross-references to the FSM and VM docs don't cross page boundaries in PDF
format; but it seems to me to read more easily this way anyway.  I took the
liberty of editorializing a bit further while at it.

Per complaint from Magnus about 9.0.18 docs not building in A4 format.
Patch all active branches so we don't get blind-sided by this particular
issue again in future.

10 years agoReport success when Windows kill() emulation signals an exiting process.
Noah Misch [Wed, 23 Jul 2014 04:35:13 +0000 (00:35 -0400)]
Report success when Windows kill() emulation signals an exiting process.

This is consistent with the POSIX verdict that kill() shall not report
ESRCH for a zombie process.  Back-patch to 9.0 (all supported versions).
Test code from commit d7cdf6ee36adeac9233678fb8f2a112e6678a770 depends
on it, and log messages about kill() reporting "Invalid argument" will
cease to appear for this not-unexpected condition.

10 years agoMSVC: Substitute $(top_builddir) in REGRESS_OPTS.
Noah Misch [Wed, 23 Jul 2014 04:35:07 +0000 (00:35 -0400)]
MSVC: Substitute $(top_builddir) in REGRESS_OPTS.

Commit d7cdf6ee36adeac9233678fb8f2a112e6678a770 introduced a usage
thereof.  Back-patch to 9.0, like that commit.

10 years agoRe-enable error for "SELECT ... OFFSET -1".
Tom Lane [Tue, 22 Jul 2014 17:30:01 +0000 (13:30 -0400)]
Re-enable error for "SELECT ... OFFSET -1".

The executor has thrown errors for negative OFFSET values since 8.4 (see
commit bfce56eea45b1369b7bb2150a150d1ac109f5073), but in a moment of brain
fade I taught the planner that OFFSET with a constant negative value was a
no-op (commit 1a1832eb085e5bca198735e5d0e766a3cb61b8fc).  Reinstate the
former behavior by only discarding OFFSET with a value of exactly 0.  In
passing, adjust a planner comment that referenced the ancient behavior.

Back-patch to 9.3 where the mistake was introduced.

10 years agoCheck block number against the correct fork in get_raw_page().
Tom Lane [Tue, 22 Jul 2014 15:45:50 +0000 (11:45 -0400)]
Check block number against the correct fork in get_raw_page().

get_raw_page tried to validate the supplied block number against
RelationGetNumberOfBlocks(), which of course is only right when
accessing the main fork.  In most cases, the main fork is longer
than the others, so that the check was too weak (allowing a
lower-level error to be reported, but no real harm to be done).
However, very small tables could have an FSM larger than their heap,
in which case the mistake prevented access to some FSM pages.
Per report from Torsten Foertsch.

In passing, make the bad-block-number error into an ereport not elog
(since it's certainly not an internal error); and fix sloppily
maintained comment for RelationGetNumberOfBlocksInFork.

This has been wrong since we invented relation forks, so back-patch
to all supported branches.

10 years agoAllow empty string object keys in json_object().
Andrew Dunstan [Tue, 22 Jul 2014 15:22:47 +0000 (11:22 -0400)]
Allow empty string object keys in json_object().

This makes the behaviour consistent with the json parser, other
json-generating functions, and the JSON standards.

10 years agoDiagnose incompatible OpenLDAP versions during build and test.
Noah Misch [Tue, 22 Jul 2014 15:01:03 +0000 (11:01 -0400)]
Diagnose incompatible OpenLDAP versions during build and test.

With OpenLDAP versions 2.4.24 through 2.4.31, inclusive, PostgreSQL
backends can crash at exit.  Raise a warning during "configure" based on
the compile-time OpenLDAP version number, and test the crash scenario in
the dblink test suite.  Back-patch to 9.0 (all supported versions).

10 years agoUnset some local environment variables in TAP tests
Peter Eisentraut [Tue, 22 Jul 2014 04:42:36 +0000 (00:42 -0400)]
Unset some local environment variables in TAP tests

Unset environment variables that control message language, so that we
can compare some program output with expected strings.  This is very
similar to what pg_regress does.

10 years agogitattributes: Ignore time zone data files for whitespace checks
Peter Eisentraut [Tue, 22 Jul 2014 03:58:18 +0000 (23:58 -0400)]
gitattributes: Ignore time zone data files for whitespace checks

The latest update introduced some funny whitespace, but since they are
externally maintained files, we add them to the list of files to ignore.

10 years agoReject out-of-range numeric timezone specifications.
Tom Lane [Tue, 22 Jul 2014 02:41:23 +0000 (22:41 -0400)]
Reject out-of-range numeric timezone specifications.

In commit 631dc390f49909a5c8ebd6002cfb2bcee5415a9d, we started to handle
simple numeric timezone offsets via the zic library instead of the old
CTimeZone/HasCTZSet kluge.  However, we overlooked the fact that the zic
code will reject UTC offsets exceeding a week (which seems a bit arbitrary,
but not because it's too tight ...).  This led to possibly setting
session_timezone to NULL, which results in crashes in most timezone-related
operations as of 9.4, and crashes in a small number of places even before
that.  So check for NULL return from pg_tzset_offset() and report an
appropriate error message.  Per bug #11014 from Duncan Gillis.

Back-patch to all supported branches, like the previous patch.
(Unfortunately, as of today that no longer includes 8.4.)

10 years agoStamp 9.4beta2. REL9_4_BETA2
Tom Lane [Mon, 21 Jul 2014 19:07:50 +0000 (15:07 -0400)]
Stamp 9.4beta2.

10 years agoRelease notes for 9.3.5, 9.2.9, 9.1.14, 9.0.18, 8.4.22.
Tom Lane [Mon, 21 Jul 2014 18:59:25 +0000 (14:59 -0400)]
Release notes for 9.3.5, 9.2.9, 9.1.14, 9.0.18, 8.4.22.

10 years agoAdjust cutoff points in newly-added sanity tests.
Tom Lane [Mon, 21 Jul 2014 16:58:44 +0000 (12:58 -0400)]
Adjust cutoff points in newly-added sanity tests.

Per recommendation from Andres.

10 years agoDefend against bad relfrozenxid/relminmxid/datfrozenxid/datminmxid values.
Tom Lane [Mon, 21 Jul 2014 15:41:30 +0000 (11:41 -0400)]
Defend against bad relfrozenxid/relminmxid/datfrozenxid/datminmxid values.

In commit a61daa14d56867e90dc011bbba52ef771cea6770, we fixed pg_upgrade so
that it would install sane relminmxid and datminmxid values, but that does
not cure the problem for installations that were already pg_upgraded to
9.3; they'll initially have "1" in those fields.  This is not a big problem
so long as 1 is "in the past" compared to the current nextMultiXact
counter.  But if an installation were more than halfway to the MXID wrap
point at the time of upgrade, 1 would appear to be "in the future" and
that would effectively disable tracking of oldest MXIDs in those
tables/databases, until such time as the counter wrapped around.

While in itself this isn't worse than the situation pre-9.3, where we did
not manage MXID wraparound risk at all, the consequences of premature
truncation of pg_multixact are worse now; so we ought to make some effort
to cope with this.  We discussed advising users to fix the tracking values
manually, but that seems both very tedious and very error-prone.

Instead, this patch adopts two amelioration rules.  First, a relminmxid
value that is "in the future" is allowed to be overwritten with a
full-table VACUUM's actual freeze cutoff, ignoring the normal rule that
relminmxid should never go backwards.  (This essentially assumes that we
have enough defenses in place that wraparound can never occur anymore,
and thus that a value "in the future" must be corrupt.)  Second, if we see
any "in the future" values then we refrain from truncating pg_clog and
pg_multixact.  This prevents loss of clog data until we have cleaned up
all the broken tracking data.  In the worst case that could result in
considerable clog bloat, but in practice we expect that relfrozenxid-driven
freezing will happen soon enough to fix the problem before clog bloat
becomes intolerable.  (Users could do manual VACUUM FREEZEs if not.)

Note that this mechanism cannot save us if there are already-wrapped or
already-truncated-away MXIDs in the table; it's only capable of dealing
with corrupt tracking values.  But that's the situation we have with the
pg_upgrade bug.

For consistency, apply the same rules to relfrozenxid/datfrozenxid.  There
are not known mechanisms for these to get messed up, but if they were, the
same tactics seem appropriate for fixing them.

10 years agoTranslation updates
Peter Eisentraut [Mon, 21 Jul 2014 05:07:36 +0000 (01:07 -0400)]
Translation updates

10 years agoUpdate SQL features list
Peter Eisentraut [Mon, 21 Jul 2014 04:42:32 +0000 (00:42 -0400)]
Update SQL features list

10 years agoFix xreflabel for hot_standby_feedback.
Tom Lane [Sun, 20 Jul 2014 02:20:38 +0000 (22:20 -0400)]
Fix xreflabel for hot_standby_feedback.

Rather remarkable that this has been wrong since 9.1 and nobody noticed.

10 years agoUpdate time zone data files to tzdata release 2014e.
Tom Lane [Sat, 19 Jul 2014 19:00:50 +0000 (15:00 -0400)]
Update time zone data files to tzdata release 2014e.

DST law changes in Crimea, Egypt, Morocco.  New zone Antarctica/Troll
for Norwegian base in Queen Maud Land.

10 years agoPartial fix for dropped columns in functions returning composite.
Tom Lane [Sat, 19 Jul 2014 18:28:25 +0000 (14:28 -0400)]
Partial fix for dropped columns in functions returning composite.

When a view has a function-returning-composite in FROM, and there are
some dropped columns in the underlying composite type, ruleutils.c
printed junk in the column alias list for the reconstructed FROM entry.
Before 9.3, this was prevented by doing get_rte_attribute_is_dropped
tests while printing the column alias list; but that solution is not
currently available to us for reasons I'll explain below.  Instead,
check for empty-string entries in the alias list, which can only exist
if that column position had been dropped at the time the view was made.
(The parser fills in empty strings to preserve the invariant that the
aliases correspond to physical column positions.)

While this is sufficient to handle the case of columns dropped before
the view was made, we have still got issues with columns dropped after
the view was made.  In particular, the view could contain Vars that
explicitly reference such columns!  The dependency machinery really
ought to refuse the column drop attempt in such cases, as it would do
when trying to drop a table column that's explicitly referenced in
views.  However, we currently neglect to store dependencies on columns
of composite types, and fixing that is likely to be too big to be
back-patchable (not to mention that existing views in existing databases
would not have the needed pg_depend entries anyway).  So I'll leave that
for a separate patch.

Pre-9.3, ruleutils would print such Vars normally (with their original
column names) even though it suppressed their entries in the RTE's
column alias list.  This is certainly bogus, since the printed view
definition would fail to reload, but at least it didn't crash.  However,
as of 9.3 the printed column alias list is tightly tied to the names
printed for Vars; so we can't treat columns as dropped for one purpose
and not dropped for the other.  This is why we can't just put back the
get_rte_attribute_is_dropped test: it results in an assertion failure
if the view in fact contains any Vars referencing the dropped column.
Once we've got dependencies preventing such cases, we'll probably want
to do it that way instead of relying on the empty-string test used here.

This fix turned up a very ancient bug in outfuncs/readfuncs, namely
that T_String nodes containing empty strings were not dumped/reloaded
correctly: the node was printed as "<>" which is read as a string
value of <>.  Since (per SQL) we disallow empty-string identifiers,
such nodes don't occur normally, which is why we'd not noticed.
(Such nodes aren't used for literal constants, just identifiers.)

Per report from Marc Schablewski.  Back-patch to 9.3 which is where
the rule printing behavior changed.  The dangling-variable case is
broken all the way back, but that's not what his complaint is about.

10 years agoLimit pg_upgrade authentication advice to always-secure techniques.
Noah Misch [Fri, 18 Jul 2014 20:05:17 +0000 (16:05 -0400)]
Limit pg_upgrade authentication advice to always-secure techniques.

~/.pgpass is a sound choice everywhere, and "peer" authentication is
safe on every platform it supports.  Cease to recommend "trust"
authentication, the safety of which is deeply configuration-specific.
Back-patch to 9.0, where pg_upgrade was introduced.

10 years agoFix two low-probability memory leaks in regular expression parsing.
Tom Lane [Fri, 18 Jul 2014 17:00:27 +0000 (13:00 -0400)]
Fix two low-probability memory leaks in regular expression parsing.

If pg_regcomp failed after having invoked markst/cleanst, it would leak any
"struct subre" nodes it had created.  (We've already detected all regex
syntax errors at that point, so the only likely causes of later failure
would be query cancel or out-of-memory.)  To fix, make sure freesrnode
knows the difference between the pre-cleanst and post-cleanst cleanup
procedures.  Add some documentation of this less-than-obvious point.

Also, newlacon did the wrong thing with an out-of-memory failure from
realloc(), so that the previously allocated array would be leaked.

Both of these are pretty low-probability scenarios, but a bug is a bug,
so patch all the way back.

Per bug #10976 from Arthur O'Dwyer.

10 years agodoc: Spell checking
Peter Eisentraut [Thu, 17 Jul 2014 02:20:15 +0000 (22:20 -0400)]
doc: Spell checking

10 years agoFix bugs in SP-GiST search with range type's -|- (adjacent) operator.
Heikki Linnakangas [Wed, 16 Jul 2014 06:10:54 +0000 (09:10 +0300)]
Fix bugs in SP-GiST search with range type's -|- (adjacent) operator.

The consistent function contained several bugs:

* The "if (which2) { ... }"  block was broken. It compared the  argument's
lower bound against centroid's upper bound, while it was supposed to compare
the argument's upper bound against the centroid's lower bound (the comment
was correct, code was wrong). Also, it cleared bits in the "which1"
variable, while it was supposed to clear bits in "which2".

* If the argument's upper bound was equal to the centroid's lower bound, we
descended to both halves (= all quadrants). That's unnecessary, searching
the right quadrants is sufficient. This didn't lead to incorrect query
results, but was clearly wrong, and slowed down queries unnecessarily.

* In the case that argument's lower bound is adjacent to the centroid's
upper bound, we also don't need to visit all quadrants. Per similar
reasoning as previous point.

* The code where we compare the previous centroid with the current centroid
should match the code where we compare the current centroid with the
argument. The point of that code is to redo the calculation done in the
previous level, to see if we were supposed to traverse left or right (or up
or down), and if we actually did. If we moved in the different direction,
then we know there are no matches for bound.

Refactor the code and adds comments to make it more readable and easier to
reason about.

Backpatch to 9.3 where SP-GiST support for range types was introduced.

10 years agoMove check for SSL_get_current_compression to run on mingw
Magnus Hagander [Tue, 15 Jul 2014 20:00:56 +0000 (22:00 +0200)]
Move check for SSL_get_current_compression to run on mingw

Mingw uses a different header file than msvc, so we don't get the
hardcoded value, so we need the configure test to run.

10 years agodoc: Put new options in right order on reference pages
Peter Eisentraut [Tue, 15 Jul 2014 18:34:33 +0000 (14:34 -0400)]
doc: Put new options in right order on reference pages

10 years agopg_upgrade: Fix spacing in help output
Peter Eisentraut [Tue, 15 Jul 2014 18:33:59 +0000 (14:33 -0400)]
pg_upgrade: Fix spacing in help output

10 years agopg_basebackup: Add more information about --max-rate option to help output
Peter Eisentraut [Tue, 15 Jul 2014 18:32:55 +0000 (14:32 -0400)]
pg_basebackup: Add more information about --max-rate option to help output

It was previously not clear what unit the option argument should have.

10 years agojson_build_object and json_build_array are stable, not immutable.
Andrew Dunstan [Tue, 15 Jul 2014 18:24:47 +0000 (14:24 -0400)]
json_build_object and json_build_array are stable, not immutable.

These functions indirectly invoke output functions, so they can't be
immutable.

Backpatch to 9.4 where they were introduced.

Catalog version bumped.

10 years agoFix REASSIGN OWNED for text search objects
Alvaro Herrera [Tue, 15 Jul 2014 17:24:07 +0000 (13:24 -0400)]
Fix REASSIGN OWNED for text search objects

Trying to reassign objects owned by a user that had text search
dictionaries or configurations used to fail with:
ERROR:  unexpected classid 3600
or
ERROR:  unexpected classid 3602

Fix by adding cases for those object types in a switch in pg_shdepend.c.

Both REASSIGN OWNED and text search objects go back all the way to 8.1,
so backpatch to all supported branches.  In 9.3 the alter-owner code was
made generic, so the required change in recent branches is pretty
simple; however, for 9.2 and older ones we need some additional
reshuffling to enable specifying objects by OID rather than name.

Text search templates and parsers are not owned objects, so there's no
change required for them.

Per bug #9749 reported by Michal Novotný

10 years agoDetect presence of SSL_get_current_compression
Magnus Hagander [Tue, 15 Jul 2014 16:04:43 +0000 (18:04 +0200)]
Detect presence of SSL_get_current_compression

Apparently we still build against OpenSSL so old that it doesn't
have this function, so add an autoconf check for it to make the
buildfarm happy. If the function doesn't exist, always return
that compression is disabled, since presumably the actual
compression functionality is always missing.

For now, hardcode the function as present on MSVC, since we should
hopefully be well beyond those old versions on that platform.

10 years agoAdd missing source files to nls.mk
Peter Eisentraut [Tue, 15 Jul 2014 14:00:53 +0000 (10:00 -0400)]
Add missing source files to nls.mk

These are files under common/ that have been moved around.  Updating
these manually is not satisfactory, but it's the only solution at the
moment.

10 years agoInclude SSL compression status in psql banner and connection logging
Magnus Hagander [Tue, 15 Jul 2014 13:07:38 +0000 (15:07 +0200)]
Include SSL compression status in psql banner and connection logging

Both the psql banner and the connection logging already included
SSL status, cipher and bitlength, this adds the information about
compression being on or off.

10 years agoAdd missing serial commas
Peter Eisentraut [Tue, 15 Jul 2014 12:25:27 +0000 (08:25 -0400)]
Add missing serial commas

Also update one place where the wal_level "logical" was not added to an
error message.

10 years agodoc: small fixes for REINDEX reference page
Peter Eisentraut [Tue, 15 Jul 2014 00:37:00 +0000 (20:37 -0400)]
doc: small fixes for REINDEX reference page

From: Josh Kupershmidt <schmiddy@gmail.com>

10 years agoMove view reloptions into their own varlena struct
Alvaro Herrera [Mon, 14 Jul 2014 21:24:40 +0000 (17:24 -0400)]
Move view reloptions into their own varlena struct

Per discussion after a gripe from me in
http://www.postgresql.org/message-id/20140611194633.GH18688@eldon.alvh.no-ip.org

Jaime Casanova

10 years agoPrevent bitmap heap scans from showing unnecessary block info in EXPLAIN ANALYZE.
Fujii Masao [Mon, 14 Jul 2014 11:40:14 +0000 (20:40 +0900)]
Prevent bitmap heap scans from showing unnecessary block info in EXPLAIN ANALYZE.

EXPLAIN ANALYZE shows the information of the numbers of exact/lossy blocks which
bitmap heap scan processes. But, previously, when those numbers were both zero,
it displayed only the prefix "Heap Blocks:" in TEXT output format. This is strange
and would confuse the users. So this commit suppresses such unnecessary information.

Backpatch to 9.4 where EXPLAIN ANALYZE was changed so that such information was
displayed.

Etsuro Fujita

10 years agoFix decoding of consecutive MULTI_INSERTs emitted by one heap_multi_insert().
Andres Freund [Sat, 12 Jul 2014 12:28:19 +0000 (14:28 +0200)]
Fix decoding of consecutive MULTI_INSERTs emitted by one heap_multi_insert().

Commit 1b86c81d2d fixed the decoding of toasted columns for the rows
contained in one xl_heap_multi_insert record. But that's not actually
enough, because heap_multi_insert() will actually first toast all
passed in rows and then emit several *_multi_insert records; one for
each page it fills with tuples.

Add a XLOG_HEAP_LAST_MULTI_INSERT flag which is set in
xl_heap_multi_insert->flag denoting that this multi_insert record is
the last emitted by one heap_multi_insert() call. Then use that flag
in decode.c to only set clear_toast_afterwards in the right situation.

Expand the number of rows inserted via COPY in the corresponding
regression test to make sure that more than one heap page is filled
with tuples by one heap_multi_insert() call.

Backpatch to 9.4 like the previous commit.

10 years agoAdd autocompletion of locale keywords for CREATE DATABASE
Magnus Hagander [Sat, 12 Jul 2014 12:19:57 +0000 (14:19 +0200)]
Add autocompletion of locale keywords for CREATE DATABASE

Adds support for autocomplete of LC_COLLATE and LC_CTYPE to
the CREATE DATABASE command in psql.

10 years agoFix bug with whole-row references to append subplans.
Tom Lane [Fri, 11 Jul 2014 23:12:38 +0000 (19:12 -0400)]
Fix bug with whole-row references to append subplans.

ExecEvalWholeRowVar incorrectly supposed that it could "bless" the source
TupleTableSlot just once per query.  But if the input is coming from an
Append (or, perhaps, other cases?) more than one slot might be returned
over the query run.  This led to "record type has not been registered"
errors when a composite datum was extracted from a non-blessed slot.

This bug has been there a long time; I guess it escaped notice because when
dealing with subqueries the planner tends to expand whole-row Vars into
RowExprs, which don't have the same problem.  It is possible to trigger
the problem in all active branches, though, as illustrated by the added
regression test.

10 years agoRename logical decoding's pg_llog directory to pg_logical.
Andres Freund [Wed, 2 Jul 2014 19:07:47 +0000 (21:07 +0200)]
Rename logical decoding's pg_llog directory to pg_logical.

The old name wasn't very descriptive as of actual contents of the
directory, which are historical snapshots in the snapshots/
subdirectory and mappingdata for rewritten tuples in
mappings/. There's been a fair amount of discussion what would be a
good name. I'm settling for pg_logical because it's likely that
further data around logical decoding and replication will need saving
in the future.

Also add the missing entry for the directory into storage.sgml's list
of PGDATA contents.

Bumps catversion as the data directories won't be compatible.

Backpatch to 9.4, which I missed to do as Michael Paquier luckily
noticed. As there already has been a catversion bump after 9.4beta1,
there's no reasons for having 9.4 diverge from master.

10 years agoFix whitespace
Peter Eisentraut [Wed, 9 Jul 2014 03:29:09 +0000 (23:29 -0400)]
Fix whitespace

10 years agoUpdate key words table for 9.4
Peter Eisentraut [Tue, 8 Jul 2014 18:54:32 +0000 (14:54 -0400)]
Update key words table for 9.4

10 years agodoc: Link text to table by id
Peter Eisentraut [Tue, 8 Jul 2014 18:14:37 +0000 (14:14 -0400)]
doc: Link text to table by id

10 years agoDon't assume a subquery's output is unique if there's a SRF in its tlist.
Tom Lane [Tue, 8 Jul 2014 18:03:16 +0000 (14:03 -0400)]
Don't assume a subquery's output is unique if there's a SRF in its tlist.

While the x output of "select x from t group by x" can be presumed unique,
this does not hold for "select x, generate_series(1,10) from t group by x",
because we may expand the set-returning function after the grouping step.
(Perhaps that should be re-thought; but considering all the other oddities
involved with SRFs in targetlists, it seems unlikely we'll change it.)
Put a check in query_is_distinct_for() so it's not fooled by such cases.

Back-patch to all supported branches.

David Rowley

10 years agodoc: Fix spacing in verbatim environments
Peter Eisentraut [Tue, 8 Jul 2014 15:39:07 +0000 (11:39 -0400)]
doc: Fix spacing in verbatim environments