Merge upto PostgreSQL 9.5.3 (ba37ac217791dfdf2b327c4b75e7083b6b03a2f5)
authorPavan Deolasee <[email protected]>
Tue, 10 May 2016 06:07:16 +0000 (11:37 +0530)
committerPavan Deolasee <[email protected]>
Tue, 10 May 2016 06:07:16 +0000 (11:37 +0530)
27 files changed:
1  2 
configure
configure.in
doc/bug.template
doc/src/sgml/catalogs.sgml
doc/src/sgml/func.sgml
doc/src/sgml/high-availability.sgml
doc/src/sgml/indices.sgml
doc/src/sgml/ref/pgbench.sgml
doc/src/sgml/ref/postgres-ref.sgml
src/backend/commands/tablecmds.c
src/backend/commands/tablespace.c
src/backend/executor/spi.c
src/backend/optimizer/util/relnode.c
src/backend/parser/parse_expr.c
src/backend/replication/logical/decode.c
src/backend/utils/adt/ruleutils.c
src/backend/utils/misc/guc.c
src/bin/pg_dump/pg_dump.c
src/include/pg_config.h.win32
src/include/postgres.h
src/interfaces/libpq/fe-auth.c
src/test/regress/expected/create_view.out
src/test/regress/expected/join.out
src/test/regress/expected/replica_identity.out
src/test/regress/pg_regress.c
src/test/regress/sql/create_view.sql
src/test/regress/sql/join.sql

diff --cc configure
index 98c09e528e6bc6b5087b6f2cd729dc19d8e5cc6c,adee3688a89898f69c021fd629131aa7c3278628..93b2de40857b7c7b6497f0551badcf01648d4acc
+++ b/configure
@@@ -1,8 -1,8 +1,8 @@@
  #! /bin/sh
  # Guess values for system-dependent variables and create Makefiles.
- # Generated by GNU Autoconf 2.69 for PostgreSQL 9.5.2 (Postgres-XL 9.5r1).
 -# Generated by GNU Autoconf 2.69 for PostgreSQL 9.5.3.
++# Generated by GNU Autoconf 2.69 for PostgreSQL 9.5.3 (Postgres-XL 9.5r1).
  #
 -# Report bugs to <pgsql-bugs@postgresql.org>.
 +# Report bugs to <bugs@postgres-xl.org>.
  #
  #
  # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@@ -582,10 -582,9 +582,10 @@@ MAKEFLAGS
  # Identity of this package.
  PACKAGE_NAME='PostgreSQL'
  PACKAGE_TARNAME='postgresql'
- PACKAGE_VERSION='9.5.2 (Postgres-XL 9.5r1)'
 -PACKAGE_VERSION='9.5.3'
 -PACKAGE_STRING='PostgreSQL 9.5.3'
 -PACKAGE_BUGREPORT='[email protected]'
++PACKAGE_VERSION='9.5.3 (Postgres-XL 9.5r1)'
 +PACKAGE_XC_VERSION='9.5r1'
- PACKAGE_STRING='PostgreSQL 9.5.2 (Postgres-XL 9.5r1)'
++PACKAGE_STRING='PostgreSQL 9.5.3 (Postgres-XL 9.5r1)'
 +PACKAGE_BUGREPORT='[email protected]'
  PACKAGE_URL=''
  
  ac_unique_file="src/backend/access/common/heaptuple.c"
@@@ -1399,7 -1395,7 +1399,7 @@@ if test "$ac_init_help" = "long"; the
    # Omit some internal or obsolete options to make the list less imposing.
    # This message is too long to be a string in the A/UX 3.1 sh.
    cat <<_ACEOF
- \`configure' configures PostgreSQL 9.5.2 (Postgres-XL 9.5r1) to adapt to many kinds of systems.
 -\`configure' configures PostgreSQL 9.5.3 to adapt to many kinds of systems.
++\`configure' configures PostgreSQL 9.5.3 (Postgres-XL 9.5r1) to adapt to many kinds of systems.
  
  Usage: $0 [OPTION]... [VAR=VALUE]...
  
  
  if test -n "$ac_init_help"; then
    case $ac_init_help in
-      short | recursive ) echo "Configuration of PostgreSQL 9.5.2 (Postgres-XL 9.5r1):";;
 -     short | recursive ) echo "Configuration of PostgreSQL 9.5.3:";;
++     short | recursive ) echo "Configuration of PostgreSQL 9.5.3 (Postgres-XL 9.5r1):";;
     esac
    cat <<\_ACEOF
  
  test -n "$ac_init_help" && exit $ac_status
  if $ac_init_version; then
    cat <<\_ACEOF
- PostgreSQL configure 9.5.2 (Postgres-XL 9.5r1)
 -PostgreSQL configure 9.5.3
++PostgreSQL configure 9.5.3 (Postgres-XL 9.5r1)
  generated by GNU Autoconf 2.69
  
  Copyright (C) 2012 Free Software Foundation, Inc.
@@@ -2325,7 -2321,7 +2325,7 @@@ cat >config.log <<_ACEO
  This file contains any messages produced by compilers while
  running configure, to aid debugging if configure makes a mistake.
  
- It was created by PostgreSQL $as_me 9.5.2 (Postgres-XL 9.5r1), which was
 -It was created by PostgreSQL $as_me 9.5.3, which was
++It was created by PostgreSQL $as_me 9.5.3 (Postgres-XL 9.5r1), which was
  generated by GNU Autoconf 2.69.  Invocation command line was
  
    $ $0 $@
@@@ -16245,7 -16195,7 +16245,7 @@@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wr
  # report actual input values of CONFIG_FILES etc. instead of their
  # values after options handling.
  ac_log="
- This file was extended by PostgreSQL $as_me 9.5.2 (Postgres-XL 9.5r1), which was
 -This file was extended by PostgreSQL $as_me 9.5.3, which was
++This file was extended by PostgreSQL $as_me 9.5.3 (Postgres-XL 9.5r1), which was
  generated by GNU Autoconf 2.69.  Invocation command line was
  
    CONFIG_FILES    = $CONFIG_FILES
@@@ -16315,7 -16265,7 +16315,7 @@@ _ACEO
  cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
  ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
  ac_cs_version="\\
- PostgreSQL config.status 9.5.2 (Postgres-XL 9.5r1)
 -PostgreSQL config.status 9.5.3
++PostgreSQL config.status 9.5.3 (Postgres-XL 9.5r1)
  configured by $0, generated by GNU Autoconf 2.69,
    with options \\"\$ac_cs_config\\"
  
diff --cc configure.in
index b57e23bd20de3a43ed7d004a0dde15bde852212b,50257980f62b3232b6a33164b43231d353e51873..b6f0200d196e1cd4894f46308fed572b942c7207
@@@ -17,7 -17,7 +17,7 @@@ dnl Read the Autoconf manual for detail
  dnl
  m4_pattern_forbid(^PGAC_)dnl to catch undefined macros
  
- AC_INIT([PostgreSQL], [9.5.2 (Postgres-XL 9.5r1)], [[email protected]])
 -AC_INIT([PostgreSQL], [9.5.3], [[email protected]])
++AC_INIT([PostgreSQL], [9.5.3 (Postgres-XL 9.5r1)], [[email protected]])
  
  m4_if(m4_defn([m4_PACKAGE_VERSION]), [2.69], [], [m4_fatal([Autoconf version 2.69 is required.
  Untested combinations of 'autoconf' and PostgreSQL versions are not
index da0c6282a83a97da8dc03617e29b14b9dbbd4db9,85d7385629cae538ead19478d0e8740f4c6e62f9..69c4745e40dcb50c927510c4b32b3739abb4d01a
@@@ -27,7 -27,7 +27,7 @@@ System Configuration
  
    Operating System (example: Linux 2.4.18)    :
  
-   PostgreSQL version (example: PostgreSQL 9.5.2):  Postgres-XL 9.5r1
 -  PostgreSQL version (example: PostgreSQL 9.5.3):  PostgreSQL 9.5.3
++  PostgreSQL version (example: PostgreSQL 9.5.3):  Postgres-XL 9.5r1
  
    Compiler used (example: gcc 3.3.5)          :
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 9dc602024cae3584efc41c2f1814273a9420d8a1,4568e9c34291202b9ed48a4207fd0c1e2232e75b..5423a39e899a7b0b63167385a201a64d63044cbc
  #define MEMSET_LOOP_LIMIT 1024
  
  /* Define to the address where bug reports for this package should be sent. */
 -#define PACKAGE_BUGREPORT "p[email protected]"
 +#define PACKAGE_BUGREPORT "p[email protected]"
  
  /* Define to the full name of this package. */
 -#define PACKAGE_NAME "PostgreSQL"
 +#define PACKAGE_NAME "Postgres-XL"
  
  /* Define to the full name and version of this package. */
 -#define PACKAGE_STRING "PostgreSQL 9.5.3"
 +#define PACKAGE_STRING "Postgres-XL 9.5r1"
  
  /* Define to the version of this package. */
- #define PACKAGE_VERSION "9.5.2"
+ #define PACKAGE_VERSION "9.5.3"
  
  /* Define to the name of a signed 128-bit integer type. */
  #undef PG_INT128_TYPE
  #define PG_INT64_TYPE long long int
  
  /* PostgreSQL version as a string */
- #define PG_VERSION "9.5.2"
+ #define PG_VERSION "9.5.3"
  
  /* PostgreSQL version as a number */
- #define PG_VERSION_NUM 90502
+ #define PG_VERSION_NUM 90503
  
  /* Define to the one symbol short name of this package. */
 -#define PACKAGE_TARNAME "postgresql"
 +#define PACKAGE_TARNAME "postgres-xl"
 +
 +/* Postgres-XC version as a string */
 +#define PGXC_VERSION "1.1devel"
 +
 +/* Postgres-XC version as a number */
 +#define PGXC_VERSION_NUM 10100
  
  /* Define to the name of the default PostgreSQL service principal in Kerberos.
     (--with-krb-srvnam=NAME) */
Simple merge
Simple merge
index a1e3728fb7898c72e113869cbd40bb0e7a890ff4,81b4e8d42bb95ba31435be7af6dbd42c21b3ffb1..d78d7793d1663e704c29449a1a380e81f25b1a9d
@@@ -1495,14 -1495,41 +1495,42 @@@ select pg_get_viewdef('tt18v', true)
  (1 row)
  
  explain (costs off) select * from tt18v;
 -                                         QUERY PLAN                                         
 ---------------------------------------------------------------------------------------------
 - Append
 -   ->  Seq Scan on int8_tbl xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 -   ->  Seq Scan on int8_tbl xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_1
 -(3 rows)
 +                                            QUERY PLAN                                            
 +--------------------------------------------------------------------------------------------------
 + Remote Subquery Scan on all (datanode_1)
 +   ->  Append
 +         ->  Seq Scan on int8_tbl xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 +         ->  Seq Scan on int8_tbl xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx_1
 +(4 rows)
  
+ -- check display of ScalarArrayOp with a sub-select
+ select 'foo'::text = any(array['abc','def','foo']::text[]);
+  ?column? 
+ ----------
+  t
+ (1 row)
+ select 'foo'::text = any((select array['abc','def','foo']::text[]));  -- fail
+ ERROR:  operator does not exist: text = text[]
+ LINE 1: select 'foo'::text = any((select array['abc','def','foo']::t...
+                            ^
+ HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
+ select 'foo'::text = any((select array['abc','def','foo']::text[])::text[]);
+  ?column? 
+ ----------
+  t
+ (1 row)
+ create view tt19v as
+ select 'foo'::text = any(array['abc','def','foo']::text[]) c1,
+        'foo'::text = any((select array['abc','def','foo']::text[])::text[]) c2;
+ select pg_get_viewdef('tt19v', true);
+                                                pg_get_viewdef                                               
+ ------------------------------------------------------------------------------------------------------------
+   SELECT 'foo'::text = ANY (ARRAY['abc'::text, 'def'::text, 'foo'::text]) AS c1,                           +
+      'foo'::text = ANY ((( SELECT ARRAY['abc'::text, 'def'::text, 'foo'::text] AS "array"))::text[]) AS c2;
+ (1 row)
  -- clean up all the random objects we made above
  set client_min_messages = warning;
  DROP SCHEMA temp_view_test CASCADE;
index adedcd8b422de8c6dd4c5b6945c877b3bb242881,c33acc562e4549e0ff928f06209c5f8a26ff77b7..fafa5ec20030880334a09352c7f93467ef11a5b7
@@@ -2274,6 -2236,38 +2274,39 @@@ where t4.thousand = t5.unique1 and ss.x
    1000
  (1 row)
  
 -                                                      QUERY PLAN                                                       
 ------------------------------------------------------------------------------------------------------------------------
 - Nested Loop
 -   ->  Aggregate
 -         ->  Seq Scan on int4_tbl i4b
+ --
+ -- regression test: check a case where we formerly missed including an EC
+ -- enforcement clause because it was expected to be handled at scan level
+ --
+ explain (costs off)
+ select a.f1, b.f1, t.thousand, t.tenthous from
+   tenk1 t,
+   (select sum(f1)+1 as f1 from int4_tbl i4a) a,
+   (select sum(f1) as f1 from int4_tbl i4b) b
+ where b.f1 = t.thousand and a.f1 = b.f1 and (a.f1+b.f1+999) = t.tenthous;
 -         Join Filter: ((sum(i4b.f1)) = ((sum(i4a.f1) + 1)))
++                                                         QUERY PLAN                                                          
++-----------------------------------------------------------------------------------------------------------------------------
++ Remote Subquery Scan on all (datanode_1,datanode_2)
+    ->  Nested Loop
 -               ->  Seq Scan on int4_tbl i4a
 -         ->  Index Only Scan using tenk1_thous_tenthous on tenk1 t
 -               Index Cond: ((thousand = (sum(i4b.f1))) AND (tenthous = ((((sum(i4a.f1) + 1)) + (sum(i4b.f1))) + 999)))
 -(9 rows)
+          ->  Aggregate
++               ->  Seq Scan on int4_tbl i4b
++         ->  Nested Loop
++               Join Filter: ((sum(i4b.f1)) = ((sum(i4a.f1) + 1)))
++               ->  Aggregate
++                     ->  Seq Scan on int4_tbl i4a
++               ->  Index Only Scan using tenk1_thous_tenthous on tenk1 t
++                     Index Cond: ((thousand = (sum(i4b.f1))) AND (tenthous = ((((sum(i4a.f1) + 1)) + (sum(i4b.f1))) + 999)))
++(10 rows)
+ select a.f1, b.f1, t.thousand, t.tenthous from
+   tenk1 t,
+   (select sum(f1)+1 as f1 from int4_tbl i4a) a,
+   (select sum(f1) as f1 from int4_tbl i4b) b
+ where b.f1 = t.thousand and a.f1 = b.f1 and (a.f1+b.f1+999) = t.tenthous;
+  f1 | f1 | thousand | tenthous 
+ ----+----+----------+----------
+ (0 rows)
  --
  -- Clean up
  --
@@@ -4021,6 -3833,37 +4054,38 @@@ where ss1.c2 = 0
  ----+----+----+----+----+----
  (0 rows)
  
 -              QUERY PLAN               
 ----------------------------------------
+ --
+ -- test successful handling of full join underneath left join (bug #14105)
+ --
+ explain (costs off)
+ select * from
+   (select 1 as id) as xx
+   left join
+     (tenk1 as a1 full join (select 1 as id) as yy on (a1.unique1 = yy.id))
+   on (xx.id = coalesce(yy.id));
 -         ->  Seq Scan on tenk1 a1
++                           QUERY PLAN                            
++-----------------------------------------------------------------
+  Nested Loop Left Join
+    Join Filter: ((1) = COALESCE((1)))
+    ->  Result
+    ->  Hash Full Join
+          Hash Cond: (a1.unique1 = (1))
 -(8 rows)
++         ->  Remote Subquery Scan on all (datanode_1,datanode_2)
++               ->  Seq Scan on tenk1 a1
+          ->  Hash
+                ->  Result
++(9 rows)
+ select * from
+   (select 1 as id) as xx
+   left join
+     (tenk1 as a1 full join (select 1 as id) as yy on (a1.unique1 = yy.id))
+   on (xx.id = coalesce(yy.id));
+  id | unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4 | id 
+ ----+---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------+----
+   1 |       1 |    2838 |   1 |    1 |   1 |      1 |       1 |        1 |           1 |         1 |        1 |   2 |    3 | BAAAAA   | EFEAAA   | OOOOxx  |  1
+ (1 row)
  --
  -- test ability to push constants through outer join clauses
  --
index f2356d460e49403175301184f814218b551d5cf3,eb7145c55a2ed1e9e40c26b758edf31d56703585..d80b9f49b70dec47454dea61f1811f5db2ffe9fc
@@@ -172,8 -178,7 +178,9 @@@ Indexes
      "test_replica_identity_hash" hash (nonkey)
      "test_replica_identity_keyab" btree (keya, keyb)
  Replica Identity: FULL
+ Has OIDs: yes
 +Distribute By: REPLICATION
 +Location Nodes: ALL DATANODES
  
  ALTER TABLE test_replica_identity REPLICA IDENTITY NOTHING;
  SELECT relreplident FROM pg_class WHERE oid = 'test_replica_identity'::regclass;
index ec1871770ce5af035e4169c09415386ddf3139bd,311ebb5da2a94c239528d227bded80bf67b8d678..0bbd14514b5f3e995ad91a772cb17a1913b3f8b1
@@@ -3013,9 -2184,9 +3013,11 @@@ regression_main(int argc, char *argv[]
  
        if (temp_instance)
        {
 +#ifndef PGXC
                FILE       *pg_conf;
 +#endif
+               const char *env_wait;
+               int                     wait_seconds;
  
                /*
                 * Prepare the temp instance
                                        progname, strerror(errno));
                        exit(2);
                }
 +#endif
  
                /*
-                * Wait till postmaster is able to accept connections (normally only a
-                * second or so, but Cygwin is reportedly *much* slower).  Don't wait
-                * forever, however.
+                * Wait till postmaster is able to accept connections; normally this
+                * is only a second or so, but Cygwin is reportedly *much* slower, and
+                * test builds using Valgrind or similar tools might be too.  Hence,
+                * allow the default timeout of 60 seconds to be overridden from the
+                * PGCTLTIMEOUT environment variable.
                 */
-               for (i = 0; i < 60; i++)
+               env_wait = getenv("PGCTLTIMEOUT");
+               if (env_wait != NULL)
+               {
+                       wait_seconds = atoi(env_wait);
+                       if (wait_seconds <= 0)
+                               wait_seconds = 60;
+               }
+               else
+                       wait_seconds = 60;
+               for (i = 0; i < wait_seconds; i++)
                {
 +
 +#ifdef PGXC
 +                      /* Done if psql succeeds for each node */
 +                      if (check_node_running(PGXC_COORD_1) &&
 +                              check_node_running(PGXC_COORD_2) &&
 +                              check_node_running(PGXC_DATANODE_1) &&
 +                              check_node_running(PGXC_DATANODE_2))
 +                              break;
 +
 +                      /* Check node failure */
 +                      check_node_fail(PGXC_COORD_1);
 +                      check_node_fail(PGXC_COORD_2);
 +                      check_node_fail(PGXC_DATANODE_1);
 +                      check_node_fail(PGXC_DATANODE_2);
 +#else
                        /* Done if psql succeeds */
                        if (system(buf2) == 0)
                                break;
  
                        pg_usleep(1000000L);
                }
-               if (i >= 60)
+               if (i >= wait_seconds)
                {
-                       fprintf(stderr, _("\n%s: postmaster did not respond within 60 seconds\nExamine %s/log/postmaster.log for the reason\n"), progname, outputdir);
 +#ifdef PGXC
 +                      /* If one node fails, all fail */
 +                      kill_node(PGXC_COORD_1);
 +                      kill_node(PGXC_COORD_2);
 +                      kill_node(PGXC_DATANODE_1);
 +                      kill_node(PGXC_DATANODE_2);
 +#else
+                       fprintf(stderr, _("\n%s: postmaster did not respond within %d seconds\nExamine %s/log/postmaster.log for the reason\n"),
+                                       progname, wait_seconds, outputdir);
  
                        /*
                         * If we get here, the postmaster is probably wedged somewhere in
Simple merge
Simple merge