postgres-xl.git
9 years agoFix an oversight in a5b53b0dda52 where we failed to track whether parameter
Pavan Deolasee [Tue, 4 Oct 2016 07:50:45 +0000 (13:20 +0530)]
Fix an oversight in a5b53b0dda52 where we failed to track whether parameter
value has been computed or not at all places

Report and test case by Agoston David

9 years agoCorrectly initialise coordMaxWALSenders and datanodeMaxWALSenders while adding
Pavan Deolasee [Tue, 4 Oct 2016 05:27:00 +0000 (10:57 +0530)]
Correctly initialise coordMaxWALSenders and datanodeMaxWALSenders while adding
new nodes via pgxc_ctl

9 years agoAllow COMMIT/ROLLBACK PREPARED xact to succeed on the local coordinator even if
Pavan Deolasee [Fri, 30 Sep 2016 10:17:36 +0000 (15:47 +0530)]
Allow COMMIT/ROLLBACK PREPARED xact to succeed on the local coordinator even if
the GTM no longer has state information for the transaction when
xc_maintenance_mode is active.

Information on the GTM is important for explicit prepared transactions because
GTM tracks the participants nodes in that case and the COMMIT/ROLLBACK PREPARED
commands can then to forwarded to those participants. So when
xc_maintenance_mode is active, we only cleanup prepared transaction on the
local node (or remote when used with EXECUTE DIRECT). So it seems ok not to
guarantee the GTM to have the state information.

9 years agoHandle remote parameters correctly by sending then down to the remote nodes in
Pavan Deolasee [Thu, 29 Sep 2016 05:27:19 +0000 (10:57 +0530)]
Handle remote parameters correctly by sending then down to the remote nodes in
the correct order and correction position

Per report and test-case by Daniel Bunford-Jones

9 years agoMake another attempt to fix vpath build for pgxc_ctl contrib module
Pavan Deolasee [Fri, 16 Sep 2016 07:07:04 +0000 (12:37 +0530)]
Make another attempt to fix vpath build for pgxc_ctl contrib module

9 years agoFix VPATH build for contrib/pgxc_ctl
Pavan Deolasee [Thu, 15 Sep 2016 09:09:57 +0000 (14:39 +0530)]
Fix VPATH build for contrib/pgxc_ctl

9 years agoProperly quote database name while dropping it on remote node
Pavan Deolasee [Wed, 7 Sep 2016 04:55:52 +0000 (10:25 +0530)]
Properly quote database name while dropping it on remote node

Per bug report by Răzvan-Sebastian Botez

9 years agoRevert a change accidentally got checked in during merge bbf2fec2. Regressions
Pavan Deolasee [Tue, 6 Sep 2016 05:29:55 +0000 (10:59 +0530)]
Revert a change accidentally got checked in during merge bbf2fec2. Regressions
show no additional failures.

Thanks Tomas Vondra for spotting this.

9 years agorename adjustSubplanDistribution() to adjust_subplan_distribution()
Tomas Vondra [Sun, 28 Aug 2016 11:16:17 +0000 (13:16 +0200)]
rename adjustSubplanDistribution() to adjust_subplan_distribution()

A cosmetic change to so that the whole file uses the same naming style.

9 years agoremove enable_remotejoin and enable_remotegroup C variables
Tomas Vondra [Sun, 28 Aug 2016 03:10:55 +0000 (05:10 +0200)]
remove enable_remotejoin and enable_remotegroup C variables

None of those variables was referenced in C code, and there are
no GUC variables matching them, so it's a dead code.

Those variables are still referenced in three sets of regression
tests - rangefuncs, xc_limit and xc_sort.

For rangefuncs the reference is however only in one of multiple
possible outputs (and apparently we pick another one), and the
other two regression tests are not part of any test schedule.

9 years agoremove unused functions from pgxcpath.c
Tomas Vondra [Sun, 28 Aug 2016 02:53:49 +0000 (04:53 +0200)]
remove unused functions from pgxcpath.c

The following three functions defined in pgxcpath.c were not referenced
from anywhere, so let's remove them

- create_plainrel_rqpath
- create_joinrel_rqpath
- pgxc_find_remotequery_path

Both create_* functions were external, but none of them was listed in
any header file, so there's no chance they migh be called from some
external tool (also, if we have no callers, we can't test the code).

9 years agoadd an assert to create_remotequery_path for RELOPT_BASEREL case
Tomas Vondra [Sun, 28 Aug 2016 02:48:11 +0000 (04:48 +0200)]
add an assert to create_remotequery_path for RELOPT_BASEREL case

Make sure that for base relations, both the paths (left and right)
and join restrictlist are NULL (or NIL for the list). I'm not sure
if this is true for RELOPT_OTHER_MEMBER_REL also, so only do this
for RELOPT_BASEREL.

Perhaps we should also convert the inverse condition (for join
relations) to an assert - currently it's an if condition:

  if (rel->reloptkind == RELOPT_JOINREL && (!leftpath || !rightpath))
    ...

but I've left that alone for now.

9 years agominor create_remotequery_path improvement, rename RemoteQueryPath fields
Tomas Vondra [Sun, 28 Aug 2016 02:39:32 +0000 (04:39 +0200)]
minor create_remotequery_path improvement, rename RemoteQueryPath fields

The RemoteQueryPath structure includes three flags tracking features of
the path - originally, those were called

- rqhas_unshippable_qual
- rqhas_temp_rel
- rqhas_unshippable_tlist

which is a bit awkward because we already know it's part of RemoteQuery,
so the 'rq' prefix is redundant. So I've renamed them to

- has_unshippable_qual
- has_temp_rel
- has_unshippable_tlist

Also, reformat/reword the comment a bit.

9 years agofix pgxcpath.c header comment
Tomas Vondra [Sun, 28 Aug 2016 02:27:04 +0000 (04:27 +0200)]
fix pgxcpath.c header comment

9 years agochange tts_tupleDescriptor/tts_datarow checks into asserts
Tomas Vondra [Sat, 27 Aug 2016 23:32:44 +0000 (01:32 +0200)]
change tts_tupleDescriptor/tts_datarow checks into asserts

The following check at the beginning of slot_deform_datarow

    if (slot->tts_tupleDescriptor == NULL || slot->tts_datarow == NULL)
        return;

was replaced with two asserts, enforcing the same conditions (except
that instead of silently returning it'll cause failure).

Silently ignoring such condition seems quite suspicious, and likely
only masks other errors - for example why should it be OK to call
this function without a data row?

This change seems safe, because all current callers already access
tts_tupleDescriptor - for example in the fastpath checks - and so
this field can't ever be NULL here. Also, we only call this function
after explicitly checking tts_datarow, so that can't be NULL either.

9 years agominor fixes in slot_deform_datarow - comment and attnum/natts rename
Tomas Vondra [Sat, 27 Aug 2016 23:13:27 +0000 (01:13 +0200)]
minor fixes in slot_deform_datarow - comment and attnum/natts rename

Added a comment explaining possible optimization when deforming
a DataRow message. Also renamed 'attnum' to 'natts' to more clearly
show the intent (attribute number vs. number of attributes).

9 years agoremove genbki.sh shell script
Tomas Vondra [Sun, 28 Aug 2016 00:26:14 +0000 (02:26 +0200)]
remove genbki.sh shell script

It was replaced with genbki.pl for all catalogs.

9 years agoremove unnecessary header changes from indexam.c
Tomas Vondra [Sun, 28 Aug 2016 00:04:41 +0000 (02:04 +0200)]
remove unnecessary header changes from indexam.c

9 years agoremove get_parsed_hba() - not needed after removing contrib/pghba
Tomas Vondra [Sun, 28 Aug 2016 20:30:27 +0000 (22:30 +0200)]
remove get_parsed_hba() - not needed after removing contrib/pghba

contrib/pghba was the sole used of the function. After removing it,
both hba.c and hba.h are clean copies from upstream, so also remove
the copyright notice from the .c file.

9 years agoadd pgxc_monitor to Makefile
Tomas Vondra [Wed, 24 Aug 2016 10:12:24 +0000 (12:12 +0200)]
add pgxc_monitor to Makefile

The pgxc_monitor contrib module was not included in the Makefile, thus
vulnerable to undetected compile breakage. That's not desiable, so add
it to the Makefile.

9 years agoremove pghba contrib module
Tomas Vondra [Wed, 24 Aug 2016 10:05:24 +0000 (12:05 +0200)]
remove pghba contrib module

The purpose of the module is unknown, and it does not even compile
for quite some time, so apparently no one uses it. Instead of fixing
it, let's remove it - if someone realizes it's useful, we can get
it from history.

9 years agoremove unused copy of gtm_opt_handler.c in src/gtm/config
Tomas Vondra [Wed, 24 Aug 2016 12:08:34 +0000 (14:08 +0200)]
remove unused copy of gtm_opt_handler.c in src/gtm/config

There's another copy of the file(s) in src/gtm/common.

9 years agoremove pgxc/pool/postgresql_fdw.c as is_immutable_func() is unused
Tomas Vondra [Wed, 24 Aug 2016 11:12:40 +0000 (13:12 +0200)]
remove pgxc/pool/postgresql_fdw.c as is_immutable_func() is unused

There was only a single function in this module, and it was not
referenced from anywhere. So remove the module and all references
to it (e.g. includes of the header).

In createplan.c, this is a bit more difficult, because it got
getpid() through this file, so include the pgxcnode.h instead,
as it uncludes unistd.h.

9 years agoremove stormutils, containing only stormdb_promote_standby() function
Tomas Vondra [Wed, 24 Aug 2016 10:40:05 +0000 (12:40 +0200)]
remove stormutils, containing only stormdb_promote_standby() function

Although stormdb_promote_standby() is a function visible from SQL,
it does not seem mentioned anywhere (e.g. in the docs etc.). So
let's get rid of it, as it's apparently not needed.

9 years agoadd barrierdesc.c to gitignore in pg_xlogdump
Tomas Vondra [Tue, 23 Aug 2016 16:49:33 +0000 (18:49 +0200)]
add barrierdesc.c to gitignore in pg_xlogdump

9 years agorefactor DoRefreshRemoteHandles a bit to get rid of compiler warnings
Tomas Vondra [Tue, 23 Aug 2016 12:47:14 +0000 (14:47 +0200)]
refactor DoRefreshRemoteHandles a bit to get rid of compiler warnings

As written originally, the branching confused the compiler enough to
emit warning about using uninitialized allOids variable. Refactor the
code a bit to make it clear that's not really possible, and also move
a number of variable declarations from the function scope to a block
level.

Note: I think the function would deserve more documentation - both
about the intent in general, and about the meaning of the return
value ('res' is quite unclear name).

9 years agorework GetPoolManagerHandle a bit to get rid of compiler warnings
Tomas Vondra [Tue, 23 Aug 2016 13:43:04 +0000 (15:43 +0200)]
rework GetPoolManagerHandle a bit to get rid of compiler warnings

Under rare conditions (missing support for unix sockets or empty
Unix_socket_directories) the fdsocket variable remained unitialized.
Handle this case explicitly, and also fix a few minor annoyances
(remove extra braces around a single-line block).

9 years agorefactor agent_handle_input() by splitting it into smaller pieces
Tomas Vondra [Tue, 23 Aug 2016 14:25:33 +0000 (16:25 +0200)]
refactor agent_handle_input() by splitting it into smaller pieces

When handling of a message type requires more than a few lines,
move it to a separate function. This makes the code flow much
cleaner, and it also issues with reusing shared variables
(originally defined at the function scope).

Also differentiate between EOF and protocol violation, if only
to log the protocol violation.

Note: The for(;;) loop checks for EOF on two places - once in the
switch, and then at the very end (using pool_pollbyte). There's
a subtle difference - the second place does not do agent_destroy.
Not sure if this is intentional, but perhaps that's a bug?

9 years agominor PgxcNodeListAndCount() refactoring to fix compiler warnings
Tomas Vondra [Tue, 23 Aug 2016 16:36:13 +0000 (18:36 +0200)]
minor PgxcNodeListAndCount() refactoring to fix compiler warnings

While tweaking the code, I've noticed this is the only place using
NodeHealthStatus, apparently attempting to save a few bytes. That
seems rather pointless given how little memory this will need and
how short-lived the memory is (and also how AllocSet doubles the
allocation sizes anyway), so I got rid of this. This makes copying
the old state easier (a simple memcpy instead of for loops).

Note: The PgxcNodeListAndCount() seems a bit unfortunate, as the
name suggests to list and count nodes, but in practice it refreshes
the status of nodes from catalog, while keeping the health status.

9 years agoRemove a portion of remote query deparsing code which is not used in XL anymore
Pavan Deolasee [Fri, 26 Aug 2016 11:27:59 +0000 (16:57 +0530)]
Remove a portion of remote query deparsing code which is not used in XL anymore

9 years agocast contain_mutable_functions() parameters to (Node*)
Tomas Vondra [Tue, 23 Aug 2016 15:57:57 +0000 (17:57 +0200)]
cast contain_mutable_functions() parameters to (Node*)

When calling the function for a target list, the compiler complains
because it expects (Node*) but gets (List*). So fix that simply by
casting to (Node*).

Also fix a trivial typo in preprocess_rowmarks() - double semicolon,
triggering warning about mixed declarations and code.

9 years agoinitialize 'pids' variable explicitly in agent_handle_input
Tomas Vondra [Tue, 23 Aug 2016 13:48:41 +0000 (15:48 +0200)]
initialize 'pids' variable explicitly in agent_handle_input

Otherwise the agent_acquire_connections() might bail out before
actually setting pids to anything, leaving the pointer set to
some random garbade, causing segfault at pfree() time.

9 years agocast connection to (PGconn*) in grow_pool() to fix compiler warning
Tomas Vondra [Tue, 23 Aug 2016 13:47:22 +0000 (15:47 +0200)]
cast connection to (PGconn*) in grow_pool() to fix compiler warning

9 years agosimplify slot_deform_datarow by using VARSIZE_ANY
Tomas Vondra [Tue, 23 Aug 2016 08:45:16 +0000 (10:45 +0200)]
simplify slot_deform_datarow by using VARSIZE_ANY

Replace the slightly complex branching with VARSIZE_ANY, which does
exactly the same thing. Also, ditch the pointless '#ifdef PGXC'
around the function.

9 years agofix type mismatch in slot_deform_datarow (void* vs. Datum)
Tomas Vondra [Tue, 23 Aug 2016 08:39:02 +0000 (10:39 +0200)]
fix type mismatch in slot_deform_datarow (void* vs. Datum)

The pfree() expects void*, but was getting pointer packed as a Datum.
So instead use 'val' with the Datum converted as a pointer, and also
ditch the pointless null check (we're doing memcpy from the pointer
so we'd get segfault anyway).

9 years agoinitialize saved_gxid and saved_global_gxid in GTM_RestoreTxnInfo
Tomas Vondra [Tue, 23 Aug 2016 08:26:36 +0000 (10:26 +0200)]
initialize saved_gxid and saved_global_gxid in GTM_RestoreTxnInfo

Without the control file (ctlf==NULL), the two gxid variables were
not initialized. Set them both to InvalidGlobalTransactionId.

9 years agoreduce the size of shippability API
Tomas Vondra [Mon, 22 Aug 2016 21:47:49 +0000 (23:47 +0200)]
reduce the size of shippability API

A significant part of the shippability API defined in pgxcship.h was
actually used only from within pgxcship.c, so make as many functions
static (instead of extern) as possible:

- pgxc_is_func_shippable
- pgxc_find_dist_equijoin_qual
- pgxc_merge_exec_nodes
- pgxc_query_has_distcolgrouping

This also shown that two functions are indeed unused:

- pgxc_check_index_shippability
- pgxc_check_fk_shippability

so remove them entirely.

9 years agoremove unused shippability definitions from planner.h
Tomas Vondra [Mon, 22 Aug 2016 21:38:31 +0000 (23:38 +0200)]
remove unused shippability definitions from planner.h

The ShippabilityStat type and shippability walker/test functions are not
really needed outside pgxcship.c.

9 years agoremove unused GUC options - strict_statement_checking and enforce_two_phase_commit
Tomas Vondra [Mon, 22 Aug 2016 22:05:24 +0000 (00:05 +0200)]
remove unused GUC options - strict_statement_checking and enforce_two_phase_commit

These two options were ineffective - defined and listed in the sample
configuration file, but attached to unreferenced variables.

9 years agofix transposed parameters when calling memset in gtm_utils.c
Tomas Vondra [Mon, 22 Aug 2016 22:09:37 +0000 (00:09 +0200)]
fix transposed parameters when calling memset in gtm_utils.c

The intent of the memset() call apparently was to zaro the memory,
but as the third parameter was 0 by mistake, it failed to do so.

9 years agoStamp Postgres-XL 9.5r1.3 XL9_5_R1_3
Pavan Deolasee [Tue, 16 Aug 2016 07:01:45 +0000 (12:31 +0530)]
Stamp Postgres-XL 9.5r1.3

9 years agoDraft release notes for Postgres-XL 9.5r1.3 release
Pavan Deolasee [Tue, 16 Aug 2016 05:05:07 +0000 (10:35 +0530)]
Draft release notes for Postgres-XL 9.5r1.3 release

9 years agoMake adjustments to the expected output of 'brin' test case
Pavan Deolasee [Tue, 16 Aug 2016 04:06:46 +0000 (09:36 +0530)]
Make adjustments to the expected output of 'brin' test case

9 years agoMake sure ON COMMIT actions are invoked only when transaction is still valid
Pavan Deolasee [Tue, 16 Aug 2016 04:01:29 +0000 (09:31 +0530)]
Make sure ON COMMIT actions are invoked only when transaction is still valid

Per report by Agoston David

9 years agoCorrect aggregation function for "money" data type.
Pavan Deolasee [Fri, 12 Aug 2016 09:49:46 +0000 (15:19 +0530)]
Correct aggregation function for "money" data type.

Per report by Sergio Hernández Martínez

9 years agoDisallow FOR UPDATE/SHARE for queries using SQL JOIN syntax.
Pavan Deolasee [Fri, 12 Aug 2016 09:32:29 +0000 (15:02 +0530)]
Disallow FOR UPDATE/SHARE for queries using SQL JOIN syntax.

Shaun Thomas had reported the original and our last attempt to block FOR
UPDATE/SHARE when invoked on more than one table wasn't enough. Hopefully
this takes care of all such occurances of the query. But we now allow FOR
UPDATE/SHARE if all tables involved in the query are replicated tables

9 years agoQuote default_transaction_isolation parameter while sending down to the remote
Pavan Deolasee [Thu, 11 Aug 2016 04:28:12 +0000 (09:58 +0530)]
Quote default_transaction_isolation parameter while sending down to the remote
nodes

Per report by Arun T K

9 years agoHonour WITH NO DATA clause of CREATE TABLE AS
Pavan Deolasee [Thu, 11 Aug 2016 03:45:36 +0000 (09:15 +0530)]
Honour WITH NO DATA clause of CREATE TABLE AS

9 years agoMerge remote-tracking branch 'remotes/PGSQL/REL9_5_STABLE' into XL9_5_STABLE
Pavan Deolasee [Thu, 11 Aug 2016 05:07:13 +0000 (10:37 +0530)]
Merge remote-tracking branch 'remotes/PGSQL/REL9_5_STABLE' into XL9_5_STABLE

9 years agoFix typo
Peter Eisentraut [Tue, 9 Aug 2016 23:07:24 +0000 (19:07 -0400)]
Fix typo

9 years agoDoc: clarify description of CREATE/ALTER FUNCTION ... SET FROM CURRENT.
Tom Lane [Tue, 9 Aug 2016 17:39:24 +0000 (13:39 -0400)]
Doc: clarify description of CREATE/ALTER FUNCTION ... SET FROM CURRENT.

Per discussion with David Johnston.

9 years agoStamp 9.5.4.
Tom Lane [Mon, 8 Aug 2016 20:27:53 +0000 (16:27 -0400)]
Stamp 9.5.4.

9 years agoLast-minute updates for release notes.
Tom Lane [Mon, 8 Aug 2016 15:56:10 +0000 (11:56 -0400)]
Last-minute updates for release notes.

Security: CVE-2016-5423, CVE-2016-5424

9 years agoFix several one-byte buffer over-reads in to_number
Peter Eisentraut [Mon, 8 Aug 2016 15:12:59 +0000 (11:12 -0400)]
Fix several one-byte buffer over-reads in to_number

Several places in NUM_numpart_from_char(), which is called from the SQL
function to_number(text, text), could accidentally read one byte past
the end of the input buffer (which comes from the input text datum and
is not null-terminated).

1. One leading space character would be skipped, but there was no check
   that the input was at least one byte long.  This does not happen in
   practice, but for defensiveness, add a check anyway.

2. Commit 4a3a1e2cf apparently accidentally doubled that code that skips
   one space character (so that two spaces might be skipped), but there
   was no overflow check before skipping the second byte.  Fix by
   removing that duplicate code.

3. A logic error would allow a one-byte over-read when looking for a
   trailing sign (S) placeholder.

In each case, the extra byte cannot be read out directly, but looking at
it might cause a crash.

The third item was discovered by Piotr Stefaniak, the first two were
found and analyzed by Tom Lane and Peter Eisentraut.

9 years agoTranslation updates
Peter Eisentraut [Mon, 8 Aug 2016 15:02:52 +0000 (11:02 -0400)]
Translation updates

Source-Git-URL: git://git.postgresql.org/git/pgtranslation/messages.git
Source-Git-Hash: f1a1631efd7a51f9b1122f22cf688a3124bf1342

9 years agoFix two errors with nested CASE/WHEN constructs.
Tom Lane [Mon, 8 Aug 2016 14:33:46 +0000 (10:33 -0400)]
Fix two errors with nested CASE/WHEN constructs.

ExecEvalCase() tried to save a cycle or two by passing
&econtext->caseValue_isNull as the isNull argument to its sub-evaluation of
the CASE value expression.  If that subexpression itself contained a CASE,
then *isNull was an alias for econtext->caseValue_isNull within the
recursive call of ExecEvalCase(), leading to confusion about whether the
inner call's caseValue was null or not.  In the worst case this could lead
to a core dump due to dereferencing a null pointer.  Fix by not assigning
to the global variable until control comes back from the subexpression.
Also, avoid using the passed-in isNull pointer transiently for evaluation
of WHEN expressions.  (Either one of these changes would have been
sufficient to fix the known misbehavior, but it's clear now that each of
these choices was in itself dangerous coding practice and best avoided.
There do not seem to be any similar hazards elsewhere in execQual.c.)

Also, it was possible for inlining of a SQL function that implements the
equality operator used for a CASE comparison to result in one CASE
expression's CaseTestExpr node being inserted inside another CASE
expression.  This would certainly result in wrong answers since the
improperly nested CaseTestExpr would be caused to return the inner CASE's
comparison value not the outer's.  If the CASE values were of different
data types, a crash might result; moreover such situations could be abused
to allow disclosure of portions of server memory.  To fix, teach
inline_function to check for "bare" CaseTestExpr nodes in the arguments of
a function to be inlined, and avoid inlining if there are any.

Heikki Linnakangas, Michael Paquier, Tom Lane

Report: https://github.com/greenplum-db/gpdb/pull/327
Report: <4DDCEEB8[email protected]>
Security: CVE-2016-5423

9 years agoObstruct shell, SQL, and conninfo injection via database and role names.
Noah Misch [Mon, 8 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Obstruct shell, SQL, and conninfo injection via database and role names.

Due to simplistic quoting and confusion of database names with conninfo
strings, roles with the CREATEDB or CREATEROLE option could escalate to
superuser privileges when a superuser next ran certain maintenance
commands.  The new coding rule for PQconnectdbParams() calls, documented
at conninfo_array_parse(), is to pass expand_dbname=true and wrap
literal database names in a trivial connection string.  Escape
zero-length values in appendConnStrVal().  Back-patch to 9.1 (all
supported versions).

Nathan Bossart, Michael Paquier, and Noah Misch.  Reviewed by Peter
Eisentraut.  Reported by Nathan Bossart.

Security: CVE-2016-5424

9 years agoPromote pg_dumpall shell/connstr quoting functions to src/fe_utils.
Noah Misch [Mon, 8 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Promote pg_dumpall shell/connstr quoting functions to src/fe_utils.

Rename these newly-extern functions with terms more typical of their new
neighbors.  No functional changes; a subsequent commit will use them in
more places.  Back-patch to 9.1 (all supported versions).  Back branches
lack src/fe_utils, so instead rename the functions in place; the
subsequent commit will copy them into the other programs using them.

Security: CVE-2016-5424

9 years agoFix Windows shell argument quoting.
Noah Misch [Mon, 8 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Fix Windows shell argument quoting.

The incorrect quoting may have permitted arbitrary command execution.
At a minimum, it gave broader control over the command line to actors
supposed to have control over a single argument.  Back-patch to 9.1 (all
supported versions).

Security: CVE-2016-5424

9 years agoReject, in pg_dumpall, names containing CR or LF.
Noah Misch [Mon, 8 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Reject, in pg_dumpall, names containing CR or LF.

These characters prematurely terminate Windows shell command processing,
causing the shell to execute a prefix of the intended command.  The
chief alternative to rejecting these characters was to bypass the
Windows shell with CreateProcess(), but the ability to use such names
has little value.  Back-patch to 9.1 (all supported versions).

This change formally revokes support for these characters in database
names and roles names.  Don't document this; the error message is
self-explanatory, and too few users would benefit.  A future major
release may forbid creation of databases and roles so named.  For now,
check only at known weak points in pg_dumpall.  Future commits will,
without notice, reject affected names from other frontend programs.

Also extend the restriction to pg_dumpall --dbname=CONNSTR arguments and
--file arguments.  Unlike the effects on role name arguments and
database names, this does not reflect a broad policy change.  A
migration to CreateProcess() could lift these two restrictions.

Reviewed by Peter Eisentraut.

Security: CVE-2016-5424

9 years agoField conninfo strings throughout src/bin/scripts.
Noah Misch [Mon, 8 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Field conninfo strings throughout src/bin/scripts.

These programs nominally accepted conninfo strings, but they would
proceed to use the original dbname parameter as though it were an
unadorned database name.  This caused "reindexdb dbname=foo" to issue an
SQL command that always failed, and other programs printed a conninfo
string in error messages that purported to print a database name.  Fix
both problems by using PQdb() to retrieve actual database names.
Continue to print the full conninfo string when reporting a connection
failure.  It is informative there, and if the database name is the sole
problem, the server-side error message will include the name.  Beyond
those user-visible fixes, this allows a subsequent commit to synthesize
and use conninfo strings without that implementation detail leaking into
messages.  As a side effect, the "vacuuming database" message now
appears after, not before, the connection attempt.  Back-patch to 9.1
(all supported versions).

Reviewed by Michael Paquier and Peter Eisentraut.

Security: CVE-2016-5424

9 years agoIntroduce a psql "\connect -reuse-previous=on|off" option.
Noah Misch [Mon, 8 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Introduce a psql "\connect -reuse-previous=on|off" option.

The decision to reuse values of parameters from a previous connection
has been based on whether the new target is a conninfo string.  Add this
means of overriding that default.  This feature arose as one component
of a fix for security vulnerabilities in pg_dump, pg_dumpall, and
pg_upgrade, so back-patch to 9.1 (all supported versions).  In 9.3 and
later, comment paragraphs that required update had already-incorrect
claims about behavior when no connection is open; fix those problems.

Security: CVE-2016-5424

9 years agoSort out paired double quotes in \connect, \password and \crosstabview.
Noah Misch [Mon, 8 Aug 2016 14:07:46 +0000 (10:07 -0400)]
Sort out paired double quotes in \connect, \password and \crosstabview.

In arguments, these meta-commands wrongly treated each pair as closing
the double quoted string.  Make the behavior match the documentation.
This is a compatibility break, but I more expect to find software with
untested reliance on the documented behavior than software reliant on
today's behavior.  Back-patch to 9.1 (all supported versions).

Reviewed by Tom Lane and Peter Eisentraut.

Security: CVE-2016-5424

9 years agoRelease notes for 9.5.4, 9.4.9, 9.3.14, 9.2.18, 9.1.23.
Tom Lane [Mon, 8 Aug 2016 01:31:01 +0000 (21:31 -0400)]
Release notes for 9.5.4, 9.4.9, 9.3.14, 9.2.18, 9.1.23.

9 years agoFix misestimation of n_distinct for a nearly-unique column with many nulls.
Tom Lane [Sun, 7 Aug 2016 22:52:02 +0000 (18:52 -0400)]
Fix misestimation of n_distinct for a nearly-unique column with many nulls.

If ANALYZE found no repeated non-null entries in its sample, it set the
column's stadistinct value to -1.0, intending to indicate that the entries
are all distinct.  But what this value actually means is that the number
of distinct values is 100% of the table's rowcount, and thus it was
overestimating the number of distinct values by however many nulls there
are.  This could lead to very poor selectivity estimates, as for example
in a recent report from Andreas Joseph Krogh.  We should discount the
stadistinct value by whatever we've estimated the nulls fraction to be.
(That is what will happen if we choose to use a negative stadistinct for
a column that does have repeated entries, so this code path was just
inconsistent.)

In addition to fixing the stadistinct entries stored by several different
ANALYZE code paths, adjust the logic where get_variable_numdistinct()
forces an "all distinct" estimate on the basis of finding a relevant unique
index.  Unique indexes don't reject nulls, so there's no reason to assume
that the null fraction doesn't apply.

Back-patch to all supported branches.  Back-patching is a bit of a judgment
call, but this problem seems to affect only a few users (else we'd have
identified it long ago), and it's bad enough when it does happen that
destabilizing plan choices in a worse direction seems unlikely.

Patch by me, with documentation wording suggested by Dean Rasheed

Report: <VisenaEmail.26.df42f82acae38a58.156463942b8@tc7-visena>
Discussion: <16143.1470350371@sss.pgh.pa.us>

9 years agoDon't propagate a null subtransaction snapshot up to parent transaction.
Tom Lane [Sun, 7 Aug 2016 17:15:55 +0000 (13:15 -0400)]
Don't propagate a null subtransaction snapshot up to parent transaction.

This oversight could cause logical decoding to fail to decode an outer
transaction containing changes, if a subtransaction had an XID but no
actual changes.  Per bug #14279 from Marko Tiikkaja.  Patch by Marko
based on analysis by Andrew Gierth.

Discussion: <20160804191757[email protected]>

9 years agoIn B-tree page deletion, clean up properly after page deletion failure.
Tom Lane [Sat, 6 Aug 2016 18:28:37 +0000 (14:28 -0400)]
In B-tree page deletion, clean up properly after page deletion failure.

In _bt_unlink_halfdead_page(), we might fail to find an immediate left
sibling of the target page, perhaps because of corruption of the page
sibling links.  The code intends to cope with this by just abandoning
the deletion attempt; but what actually happens is that it fails outright
due to releasing the same buffer lock twice.  (And error recovery masks
a second problem, which is possible leakage of a pin on another page.)
Seems to have been introduced by careless refactoring in commit efada2b8e.
Since there are multiple cases to consider, let's make releasing the buffer
lock in the failure case the responsibility of _bt_unlink_halfdead_page()
not its caller.

Also, avoid fetching the leaf page's left-link again after we've dropped
lock on the page.  This is probably harmless, but it's not exactly good
coding practice.

Per report from Kyotaro Horiguchi.  Back-patch to 9.4 where the faulty code
was introduced.

Discussion: <20160803.173116.111915228[email protected]>

9 years agoTeach libpq to decode server version correctly from future servers.
Tom Lane [Fri, 5 Aug 2016 22:58:12 +0000 (18:58 -0400)]
Teach libpq to decode server version correctly from future servers.

Beginning with the next development cycle, PG servers will report two-part
not three-part version numbers.  Fix libpq so that it will compute the
correct numeric representation of such server versions for reporting by
PQserverVersion().  It's desirable to get this into the field and
back-patched ASAP, so that older clients are more likely to understand the
new server version numbering by the time any such servers are in the wild.

(The results with an old client would probably not be catastrophic anyway
for a released server; for example "10.1" would be interpreted as 100100
which would be wrong in detail but would not likely cause an old client to
misbehave badly.  But "10devel" or "10beta1" would result in sversion==0
which at best would result in disabling all use of modern features.)

Extracted from a patch by Peter Eisentraut; comments added by me

Patch: <802ec140-635d-ad86-5fdf-d3af0e260c22@2ndquadrant.com>

9 years agoAdd note about unused arguments for pg_replication_origin_xact_reset() in docs.
Fujii Masao [Fri, 5 Aug 2016 18:23:41 +0000 (03:23 +0900)]
Add note about unused arguments for pg_replication_origin_xact_reset() in docs.

In 9.5, two arguments were introduced into pg_replication_origin_xact_reset()
by mistake while they are actually not used at all. We cannot fix this issue
for 9.5 anymore because it needs a catalog version bump. Instead, we add
a note about those unused arguments into the document.

Reviewed-By: Andres Freund
9 years agoUpdate time zone data files to tzdata release 2016f.
Tom Lane [Fri, 5 Aug 2016 16:58:17 +0000 (12:58 -0400)]
Update time zone data files to tzdata release 2016f.

DST law changes in Kemerovo and Novosibirsk.  Historical corrections for
Azerbaijan, Belarus, and Morocco.  Asia/Novokuznetsk and Asia/Novosibirsk
now use numeric time zone abbreviations instead of invented ones.  Zones
for Antarctic bases and other locations that have been uninhabited for
portions of the time span known to the tzdata database now report "-00"
rather than "zzz" as the zone abbreviation for those time spans.

Also, I decided to remove some of the timezone/data/ files that we don't
use.  At one time that subdirectory was a complete copy of what IANA
distributes in the tzdata tarballs, but that hasn't been true for a long
time.  There seems no good reason to keep shipping those specific files
but not others; they're just bloating our tarballs.

9 years agoReport execution stats for each step of redistribution and also call
Pavan Deolasee [Fri, 5 Aug 2016 05:37:07 +0000 (11:07 +0530)]
Report execution stats for each step of redistribution and also call
tuplestore_end() at the end instead of just tuplestore_clear() which neither
frees up resources nor prints the stats

9 years agoFix bogus coding in WaitForBackgroundWorkerShutdown().
Tom Lane [Thu, 4 Aug 2016 20:06:14 +0000 (16:06 -0400)]
Fix bogus coding in WaitForBackgroundWorkerShutdown().

Some conditions resulted in "return" directly out of a PG_TRY block,
which left the exception stack dangling, and to add insult to injury
failed to restore the state of set_latch_on_sigusr1.

This is a bug only in 9.5; in HEAD it was accidentally fixed by commit
db0f6cad4, which removed the surrounding PG_TRY block.  However, I (tgl)
chose to apply the patch to HEAD as well, because the old coding was
gratuitously different from WaitForBackgroundWorkerStartup(), and there
would indeed have been no bug if it were done like that to start with.

Dmitry Ivanov

Discussion: <1637882.WfYN5gPf1A@abook>

9 years agodoc: Remove documentation of nonexistent information schema columns
Peter Eisentraut [Wed, 3 Aug 2016 17:45:55 +0000 (13:45 -0400)]
doc: Remove documentation of nonexistent information schema columns

These were probably copied in by accident.

From: Clément Prévost <[email protected]>

9 years agoRemove duplicate InitPostmasterChild() call while starting a bgworker.
Tom Lane [Tue, 2 Aug 2016 22:39:14 +0000 (18:39 -0400)]
Remove duplicate InitPostmasterChild() call while starting a bgworker.

This is apparently harmless on Windows, but on Unix it results in an
assertion failure.  We'd not noticed because this code doesn't get
used on Unix unless you build with -DEXEC_BACKEND.  Bug was evidently
introduced by sloppy refactoring in commit 31c453165.

Thomas Munro

Discussion: <CAEepm=1VOnbVx4wsgQFvj94hu9jVt2nVabCr7QiooUSvPJXkgQ@mail.gmail.com>

9 years agodoc: OS collation changes can break indexes
Bruce Momjian [Tue, 2 Aug 2016 21:13:10 +0000 (17:13 -0400)]
doc:  OS collation changes can break indexes

Discussion: 20160702155517[email protected]

Reviewed-by: Christoph Berg
Backpatch-through: 9.1

9 years agoBlock interrupts during HandleParallelMessages().
Tom Lane [Tue, 2 Aug 2016 20:39:16 +0000 (16:39 -0400)]
Block interrupts during HandleParallelMessages().

As noted by Alvaro, there are CHECK_FOR_INTERRUPTS() calls in the shm_mq.c
functions called by HandleParallelMessages().  I believe they're all
unreachable since we always pass nowait = true, but it doesn't seem like
a great idea to assume that no such call will ever be reachable from
HandleParallelMessages().  If that did happen, there would be a risk of a
recursive call to HandleParallelMessages(), which it does not appear to be
designed for --- for example, there's nothing that would prevent
out-of-order processing of received messages.  And certainly such cases
cannot easily be tested.  So let's prevent it by holding off interrupts for
the duration of the function.  Back-patch to 9.5 which contains identical
code.

Discussion: <14869.1470083848@sss.pgh.pa.us>

9 years agoSync 9.5 version of access/transam/parallel.c with HEAD.
Tom Lane [Tue, 2 Aug 2016 20:09:09 +0000 (16:09 -0400)]
Sync 9.5 version of access/transam/parallel.c with HEAD.

This back-patches commit a5fe473ad (notably, marking ParallelMessagePending
as volatile, which is not particularly optional).  I also back-patched some
previous cosmetic changes to remove unnecessary diffs between the two
branches.  I'm unsure how much of this code is actually reachable in 9.5,
but to the extent that it is reachable, it needs to be maintained, and
minimizing cross-branch diffs will make that easier.

9 years agoFix pg_dump's handling of public schema with both -c and -C options.
Tom Lane [Tue, 2 Aug 2016 16:48:51 +0000 (12:48 -0400)]
Fix pg_dump's handling of public schema with both -c and -C options.

Since -c plus -C requests dropping and recreating the target database
as a whole, not dropping individual objects in it, we should assume that
the public schema already exists and need not be created.  The previous
coding considered only the state of the -c option, so it would emit
"CREATE SCHEMA public" anyway, leading to an unexpected error in restore.

Back-patch to 9.2.  Older versions did not accept -c with -C so the
issue doesn't arise there.  (The logic being patched here dates to 8.0,
cf commit 2193121fa, so it's not really wrong that it didn't consider
the case at the time.)

Note that versions before 9.6 will still attempt to emit REVOKE/GRANT
on the public schema; but that happens without -c/-C too, and doesn't
seem to be the focus of this complaint.  I considered extending this
stanza to also skip the public schema's ACL, but that would be a
misfeature, as it'd break cases where users intentionally changed that
ACL.  The real fix for this aspect is Stephen Frost's work to not dump
built-in ACLs, and that's not going to get back-ported.

Per bugs #13804 and #14271.  Solution found by David Johnston and later
rediscovered by me.

Report: <20151207163520[email protected]>
Report: <20160801021955[email protected]>

9 years agodoc: Whitespace fixes in man pages
Peter Eisentraut [Tue, 2 Aug 2016 16:35:35 +0000 (12:35 -0400)]
doc: Whitespace fixes in man pages

9 years agoEnsure that the statistics about all-visible pages in fetched from remote
Pavan Deolasee [Tue, 2 Aug 2016 03:20:38 +0000 (08:50 +0530)]
Ensure that the statistics about all-visible pages in fetched from remote
datanodes and updated at the coordinator for better planning.

We seemed to have missed fetching relallvisible all along and that can lead to
some bad planning at the coordinator. In particular, it may not use Index Only
scans where its possible. This is a long standing bug, but some other stats
collection (such as 8ca720f90f7) bug might have masked this problem until now.

Per report by Sergio Hernández Martínez, with investigation and patch by me.

9 years agoDon't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch.
Tom Lane [Mon, 1 Aug 2016 19:13:53 +0000 (15:13 -0400)]
Don't CHECK_FOR_INTERRUPTS between WaitLatch and ResetLatch.

This coding pattern creates a race condition, because if an interesting
interrupt happens after we've checked InterruptPending but before we reset
our latch, the latch-setting done by the signal handler would get lost,
and then we might block at WaitLatch in the next iteration without ever
noticing the interrupt condition.  You can put the CHECK_FOR_INTERRUPTS
before WaitLatch or after ResetLatch, but not between them.

Aside from fixing the bugs, add some explanatory comments to latch.h
to perhaps forestall the next person from making the same mistake.

In HEAD, also replace gather_readnext's direct call of
HandleParallelMessages with CHECK_FOR_INTERRUPTS.  It does not seem clean
or useful for this one caller to bypass ProcessInterrupts and go straight
to HandleParallelMessages; not least because that fails to consider the
InterruptPending flag, resulting in useless work both here
(if InterruptPending isn't set) and in the next CHECK_FOR_INTERRUPTS call
(if it is).

This thinko seems to have been introduced in the initial coding of
storage/ipc/shm_mq.c (commit ec9037df2), and then blindly copied into all
the subsequent parallel-query support logic.  Back-patch relevant hunks
to 9.4 to extirpate the error everywhere.

Discussion: <1661.1469996911@sss.pgh.pa.us>

9 years agoFixed array checking code for "unsigned long long" datatypes in libecpg.
Michael Meskes [Mon, 1 Aug 2016 04:36:27 +0000 (06:36 +0200)]
Fixed array checking code for "unsigned long long" datatypes in libecpg.

9 years agoFix pg_basebackup so that it accepts 0 as a valid compression level.
Fujii Masao [Mon, 1 Aug 2016 08:36:14 +0000 (17:36 +0900)]
Fix pg_basebackup so that it accepts 0 as a valid compression level.

The help message for pg_basebackup specifies that the numbers 0 through 9
are accepted as valid values of -Z option. But, previously -Z 0 was rejected
as an invalid compression level.

Per discussion, it's better to make pg_basebackup treat 0 as valid
compression level meaning no compression, like pg_dump.

Back-patch to all supported versions.

Reported-By: Jeff Janes
Reviewed-By: Amit Kapila
Discussion: CAMkU=1x+GwjSayc57v6w87ij6iRGFWt=hVfM0B64b1_bPVKRqg@mail.gmail.com

9 years agoDoc: remove claim that hash index creation depends on effective_cache_size.
Tom Lane [Sun, 31 Jul 2016 22:32:34 +0000 (18:32 -0400)]
Doc: remove claim that hash index creation depends on effective_cache_size.

This text was added by commit ff213239c, and not long thereafter obsoleted
by commit 4adc2f72a (which made the test depend on NBuffers instead); but
nobody noticed the need for an update.  Commit 9563d5b5e adds some further
dependency on maintenance_work_mem, but the existing verbiage seems to
cover that with about as much precision as we really want here.  Let's
just take it all out rather than leaving ourselves open to more errors of
omission in future.  (That solution makes this change back-patchable, too.)

Noted by Peter Geoghegan.

Discussion: <CAM3SWZRVANbj9GA9j40fAwheQCZQtSwqTN1GBTVwRrRbmSf7cg@mail.gmail.com>

9 years agopgbench docs: fix incorrect "last two" fields text
Bruce Momjian [Sat, 30 Jul 2016 20:59:34 +0000 (16:59 -0400)]
pgbench docs: fix incorrect "last two" fields text

Reported-by: Alexander Law
Discussion: 5786638C.8080508@gmail.com

Backpatch-through: 9.4

9 years agodoc: apply hypen fix that was not backpatched
Bruce Momjian [Sat, 30 Jul 2016 18:52:17 +0000 (14:52 -0400)]
doc:  apply hypen fix that was not backpatched

Head patch was 42ec6c2da699e8e0b1774988fa97297a2cdf716c.

Reported-by: Alexander Law
Discussion: 5785FBE7.7060508@gmail.com

Backpatch-through: 9.1

9 years agoFix pq_putmessage_noblock() to not block.
Tom Lane [Fri, 29 Jul 2016 16:52:57 +0000 (12:52 -0400)]
Fix pq_putmessage_noblock() to not block.

An evident copy-and-pasteo in commit 2bd9e412f broke the non-blocking
aspect of pq_putmessage_noblock(), causing it to behave identically to
pq_putmessage().  That function is nowadays used only in walsender.c,
so that the net effect was to cause walsenders to hang up waiting for
the receiver in situations where they should not.

Kyotaro Horiguchi

Patch: <20160728.185228.58375982[email protected]>

9 years agoGuard against empty buffer in gets_fromFile()'s check for a newline.
Tom Lane [Thu, 28 Jul 2016 22:57:24 +0000 (18:57 -0400)]
Guard against empty buffer in gets_fromFile()'s check for a newline.

Per the fgets() specification, it cannot return without reading some data
unless it reports EOF or error.  So the code here assumed that the data
buffer would necessarily be nonempty when we go to check for a newline
having been read.  However, Agostino Sarubbo noticed that this could fail
to be true if the first byte of the data is a NUL (\0).  The fgets() API
doesn't really work for embedded NULs, which is something I don't feel
any great need for us to worry about since we generally don't allow NULs
in SQL strings anyway.  But we should not access off the end of our own
buffer if the case occurs.  Normally this would just be a harmless read,
but if you were unlucky the byte before the buffer would contain '\n'
and we'd overwrite it with '\0', and if you were really unlucky that
might be valuable data and psql would crash.

Agostino reported this to pgsql-security, but after discussion we concluded
that it isn't worth treating as a security bug; if you can control the
input to psql you can do far more interesting things than just maybe-crash
it.  Nonetheless, it is a bug, so back-patch to all supported versions.

9 years agoFix assorted fallout from IS [NOT] NULL patch.
Tom Lane [Thu, 28 Jul 2016 20:09:15 +0000 (16:09 -0400)]
Fix assorted fallout from IS [NOT] NULL patch.

Commits 4452000f3 et al established semantics for NullTest.argisrow that
are a bit different from its initial conception: rather than being merely
a cache of whether we've determined the input to have composite type,
the flag now has the further meaning that we should apply field-by-field
testing as per the standard's definition of IS [NOT] NULL.  If argisrow
is false and yet the input has composite type, the construct instead has
the semantics of IS [NOT] DISTINCT FROM NULL.  Update the comments in
primnodes.h to clarify this, and fix ruleutils.c and deparse.c to print
such cases correctly.  In the case of ruleutils.c, this merely results in
cosmetic changes in EXPLAIN output, since the case can't currently arise
in stored rules.  However, it represents a live bug for deparse.c, which
would formerly have sent a remote query that had semantics different
from the local behavior.  (From the user's standpoint, this means that
testing a remote nested-composite column for null-ness could have had
unexpected recursive behavior much like that fixed in 4452000f3.)

In a related but somewhat independent fix, make plancat.c set argisrow
to false in all NullTest expressions constructed to represent "attnotnull"
constructs.  Since attnotnull is actually enforced as a simple null-value
check, this is a more accurate representation of the semantics; we were
previously overpromising what it meant for composite columns, which might
possibly lead to incorrect planner optimizations.  (It seems that what the
SQL spec expects a NOT NULL constraint to mean is an IS NOT NULL test, so
arguably we are violating the spec and should fix attnotnull to do the
other thing.  If we ever do, this part should get reverted.)

Back-patch, same as the previous commit.

Discussion: <10682.1469566308@sss.pgh.pa.us>

9 years agoImprove documentation about CREATE TABLE ... LIKE.
Tom Lane [Thu, 28 Jul 2016 17:26:59 +0000 (13:26 -0400)]
Improve documentation about CREATE TABLE ... LIKE.

The docs failed to explain that LIKE INCLUDING INDEXES would not preserve
the names of indexes and associated constraints.  Also, it wasn't mentioned
that EXCLUDE constraints would be copied by this option.  The latter
oversight seems enough of a documentation bug to justify back-patching.

In passing, do some minor copy-editing in the same area, and add an entry
for LIKE under "Compatibility", since it's not exactly a faithful
implementation of the standard's feature.

Discussion: <20160728151154.AABE64016B@smtp.hushmail.com>

9 years agoRegister atexit hook only once in pg_upgrade.
Tom Lane [Thu, 28 Jul 2016 15:39:10 +0000 (11:39 -0400)]
Register atexit hook only once in pg_upgrade.

start_postmaster() registered stop_postmaster_atexit as an atexit(3)
callback each time through, although the obvious intention was to do
so only once per program run.  The extra registrations were harmless,
so long as we didn't exceed ATEXIT_MAX, but still it's a bug.

Artur Zakirov, with bikeshedding by Kyotaro Horiguchi and me

Discussion: <d279e817-02b5-caa6-215f-cfb05dce109a@postgrespro.ru>

9 years agoFix incorrect description of udt_privileges view in documentation.
Fujii Masao [Thu, 28 Jul 2016 13:34:42 +0000 (22:34 +0900)]
Fix incorrect description of udt_privileges view in documentation.

The description of udt_privileges view contained an incorrect copy-pasted word.

Back-patch to 9.2 where udt_privileges view was added.

Author: Alexander Law

9 years agoAdd test case for Issue #57
Pallavi Sontakke [Thu, 28 Jul 2016 07:59:48 +0000 (13:29 +0530)]
Add test case for Issue #57
When distribution column is changed for a table, we don't check for dependecies such as UNIQUE indexes

9 years agoAdd test case for Issue #27
Pallavi Sontakke [Thu, 28 Jul 2016 06:23:10 +0000 (11:53 +0530)]
Add test case for Issue #27
Distribution column can be dropped for MODULO distribution tables.

9 years agoAdd test case for Issue #6
Pallavi Sontakke [Thu, 28 Jul 2016 05:14:32 +0000 (10:44 +0530)]
Add test case for Issue #6
REFRESH MATERIALISED VIEW CONCURRENTLY gives error

9 years agoStamp Postgres-XL 9.5r1.2 XL9_5_R1_2
Pavan Deolasee [Wed, 27 Jul 2016 08:12:22 +0000 (13:42 +0530)]
Stamp Postgres-XL 9.5r1.2

9 years agoCorrect target release date for 9.5r1.2 release
Pavan Deolasee [Wed, 27 Jul 2016 08:11:48 +0000 (13:41 +0530)]
Correct target release date for 9.5r1.2 release

9 years agoAdd test case for Issue #74
Pallavi Sontakke [Wed, 27 Jul 2016 09:51:39 +0000 (15:21 +0530)]
Add test case for Issue #74
SQL error codes are not correctly sent back to
the client when dealing with error on COPY protocol

9 years agoAdd test case for Issue #70
Pallavi Sontakke [Wed, 27 Jul 2016 05:59:25 +0000 (11:29 +0530)]
Add test case for Issue #70
Role concurrently dropped error

9 years agoFix constant-folding of ROW(...) IS [NOT] NULL with composite fields.
Tom Lane [Tue, 26 Jul 2016 19:25:02 +0000 (15:25 -0400)]
Fix constant-folding of ROW(...) IS [NOT] NULL with composite fields.

The SQL standard appears to specify that IS [NOT] NULL's tests of field
nullness are non-recursive, ie, we shouldn't consider that a composite
field with value ROW(NULL,NULL) is null for this purpose.
ExecEvalNullTest got this right, but eval_const_expressions did not,
leading to weird inconsistencies depending on whether the expression
was such that the planner could apply constant folding.

Also, adjust the docs to mention that IS [NOT] DISTINCT FROM NULL can be
used as a substitute test if a simple null check is wanted for a rowtype
argument.  That motivated reordering things so that IS [NOT] DISTINCT FROM
is described before IS [NOT] NULL.  In HEAD, I went a bit further and added
a table showing all the comparison-related predicates.

Per bug #14235.  Back-patch to all supported branches, since it's certainly
undesirable that constant-folding should change the semantics.

Report and patch by Andrew Gierth; assorted wordsmithing and revised
regression test cases by me.

Report: <20160708024746[email protected]>