Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-14 Thread Thomas Munro
On Thu, Jul 15, 2021 at 4:07 AM Tom Lane  wrote:
> I've tested the attached on the GCC farm's Solaris machine (which
> I believe is the same machine wrasse runs on), and it seems OK.
> I think it's ready to go.

Pushed.  Thanks!




pgsql: Portability fixes for sigwait.

2021-07-14 Thread Thomas Munro
Portability fixes for sigwait.

Build farm animals running ancient HPUX and Solaris have a non-standard
sigwait() from draft versions of POSIX, so they didn't like commit
7c09d279.  To avoid the problem in general, only try to use sigwait() if
it's declared by  and matches the expected declaration.  To
select the modern declaration on Solaris (even in non-threaded
programs), move -D_POSIX_PTHREAD_SEMANTICS into the right place to
affect all translation units.

Also fix the error checking.  Modern sigwait() doesn't set errno.

Thanks to Tom Lane for help with this.

Discussion: https://postgr.es/m/3187588.1626136248%40sss.pgh.pa.us

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5865e064abfbbe11ebfc09881be009c0f69b4dc2

Modified Files
--
config/thread_test.c   |  4 ---
configure  | 75 ++
configure.ac   | 38 +--
src/bin/psql/command.c | 13 
src/bin/psql/startup.c |  4 +--
src/include/pg_config.h.in |  7 +
src/tools/msvc/Solution.pm |  2 ++
7 files changed, 122 insertions(+), 21 deletions(-)



pgsql: Fix some nonstandard C code indentation in grammar file

2021-07-14 Thread Peter Eisentraut
Fix some nonstandard C code indentation in grammar file

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9aa8268faa0ec2904f55e85be5ec7b365c98edd1

Modified Files
--
src/backend/parser/gram.y | 44 ++--
1 file changed, 22 insertions(+), 22 deletions(-)



pgsql: Copy a Param's location field when replacing it with a Const.

2021-07-14 Thread Tom Lane
Copy a Param's location field when replacing it with a Const.

This allows Param substitution to produce just the same result
as writing a constant value literally would have done.  While
it hardly matters so far as the current core code is concerned,
extensions might take more interest in node location fields.

Julien Rouhaud

Discussion: https://postgr.es/m/20170311220932.GJ15188@nol.local

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/be850f1822e4b54d1d570eefa8a7242788011634

Modified Files
--
src/backend/optimizer/util/clauses.c | 17 ++---
1 file changed, 10 insertions(+), 7 deletions(-)



Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-14 Thread Tom Lane
Thomas Munro  writes:
> I decided to try to make it work properly on that OS instead of the
> hacky solution now that I have access.  I took your last patch, moved
> -D_POSIX_PTHREAD_SEMANTICS into CFLAGS in src/template/solaris,

Aha!  Yeah, just defining _POSIX_PTHREAD_SEMANTICS unconditionally
on Solaris seems like a good idea.  However, messing with the template
file is not the best way to inject that, because if the user specifies
CFLAGS then the template file's setting is ignored.  It's better to
handle it in the part of configure.ac that automatically adds flags
onto whatever the user or template file gave.  Also, being a -D
switch, it really oughta go into CPPFLAGS not CFLAGS.

I've tested the attached on the GCC farm's Solaris machine (which
I believe is the same machine wrasse runs on), and it seems OK.
I think it's ready to go.

> I can't find any evidence on the 'net that any other OS
> cares about _POSIX_PTHREAD_SEMANTICS (every reference says it's a
> Solaris thing) so this should just remove some useless clutter,

Agreed; if we do find any other platforms that need it, we can extend
the PORTNAME check used here.

> Another thing
> I noticed is that config/ax_pthread.m4 (something from autoconf that
> we don't want to modify) will add another copy of
> -D_POSIX_PTHREAD_SEMANTICS, but that's already the case.

Ah, yeah, I see:

$ grep POSIX src/Makefile.global
PTHREAD_CFLAGS = -D_POSIX_PTHREAD_SEMANTICS -pthread -D_REENTRANT -D_THREAD_SAFE
CPPFLAGS =  -D_POSIX_PTHREAD_SEMANTICS 
Seems pretty harmless, and anyway we have to make sure this gets in there
whether or not --enable-thread-safety is given.

regards, tom lane

diff --git a/config/thread_test.c b/config/thread_test.c
index 784f4fe8ce..e2a9e62f49 100644
--- a/config/thread_test.c
+++ b/config/thread_test.c
@@ -43,10 +43,6 @@
 #include 
 #endif
 
-/* Test for POSIX.1c 2-arg sigwait() and fail on single-arg version */
-#include 
-int			sigwait(const sigset_t *set, int *sig);
-
 
 #define		TEMP_FILENAME_1 "thread_test.1"
 #define		TEMP_FILENAME_2 "thread_test.2"
diff --git a/configure b/configure
index 1ea28a0d67..c85eb1bf55 100755
--- a/configure
+++ b/configure
@@ -7194,6 +7194,12 @@ $as_echo "#define PROFILE_PID_DIR 1" >>confdefs.h
   fi
 fi
 
+# On Solaris, we need this #define to get POSIX-conforming versions
+# of many interfaces (sigwait, getpwuid_r, ...).
+if test "$PORTNAME" = "solaris"; then
+  CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+fi
+
 # We already have this in Makefile.win32, but configure needs it too
 if test "$PORTNAME" = "win32"; then
   CPPFLAGS="$CPPFLAGS -I$srcdir/src/include/port/win32"
@@ -11296,9 +11302,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 	# set thread flags
 
 # Some platforms use these, so just define them.  They can't hurt if they
-# are not supported.  For example, on Solaris -D_POSIX_PTHREAD_SEMANTICS
-# enables 5-arg getpwuid_r, among other things.
-PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
+# are not supported.
+PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE"
 
 # Check for *_r functions
 _CFLAGS="$CFLAGS"
@@ -15861,9 +15866,11 @@ $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
 fi
 
 
-# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
-# by calling it, 2009-04-02
-# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
+# Make sure there's a declaration for sigwait(), then make sure
+# that it conforms to the POSIX standard (there seem to still be
+# some platforms out there with pre-POSIX sigwait()).  On Solaris,
+# _POSIX_PTHREAD_SEMANTICS affects the result, but we already
+# added that to CPPFLAGS.
 # The Clang compiler raises a warning for an undeclared identifier that matches
 # a compiler builtin function.  All extant Clang versions are affected, as of
 # Clang 3.6.0.  Test a builtin known to every version.  This problem affects the
@@ -15952,6 +15959,62 @@ case $ac_cv_c_decl_report in
   *) ac_c_decl_warn_flag= ;;
 esac
 
+ac_fn_c_check_decl "$LINENO" "sigwait" "ac_cv_have_decl_sigwait" "#include 
+"
+if test "x$ac_cv_have_decl_sigwait" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SIGWAIT $ac_have_decl
+_ACEOF
+
+if test "x$ac_cv_have_decl_sigwait" = xyes; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: checking for POSIX-conforming sigwait declaration" >&5
+$as_echo_n "checking for POSIX-conforming sigwait declaration... " >&6; }
+if ${pgac_cv_have_posix_decl_sigwait+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+  #include 
+  int sigwait(const sigset_t *set, int *sig);
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+  pgac_cv_have_posix_decl_sigwait=yes
+else
+  pgac_cv_have_posix_decl_sigwait=no
+fi
+rm -f core conftest.err 

pgsql: Remove unused function parameter in get_qual_from_partbound

2021-07-14 Thread John Naylor
Remove unused function parameter in get_qual_from_partbound

Commit 0563a3a8b changed how partition constraints were generated such
that this function no longer computes the mapping of parent attnos to
child attnos.

This is an external function that extensions could use, so this is
potentially a breaking change. No external callers are known, however,
and this will make it simpler to write such callers in the future.

Author: Hou Zhijie
Reviewed-by: David Rowley, Michael Paquier, Soumyadeep Chakraborty
Discussion: 
https://www.postgresql.org/message-id/flat/os0pr01mb5716a75a45be46101a1b489894...@os0pr01mb5716.jpnprd01.prod.outlook.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c203dcddf99718bc574a60313f3437e35af9

Modified Files
--
src/backend/commands/tablecmds.c  | 2 +-
src/backend/partitioning/partbounds.c | 3 +--
src/backend/utils/cache/partcache.c   | 2 +-
src/include/partitioning/partbounds.h | 2 +-
4 files changed, 4 insertions(+), 5 deletions(-)



Re: pgsql: Add PSQL_WATCH_PAGER for psql's \watch command.

2021-07-14 Thread Thomas Munro
On Wed, Jul 14, 2021 at 4:08 PM Thomas Munro  wrote:
> On Wed, Jul 14, 2021 at 6:17 AM Tom Lane  wrote:
> > (I suppose a hacky solution might be to never define USE_SIGWAIT
> > on Solaris.)
>
> Yeah I was thinking about that.  I've just got a shell on an illumos
> VM and will try a couple of ideas out if I can remember how to drive
> this thing... more soon.

I decided to try to make it work properly on that OS instead of the
hacky solution now that I have access.  I took your last patch, moved
-D_POSIX_PTHREAD_SEMANTICS into CFLAGS in src/template/solaris,
removed the special flags and libs from the new configure check where
you had them, and then used HAVE_POSIX_SIGWAIT directly without the
c.h change.  I can't find any evidence on the 'net that any other OS
cares about _POSIX_PTHREAD_SEMANTICS (every reference says it's a
Solaris thing) so this should just remove some useless clutter, and
it's not like we want POSIX draft 6 behaviour anywhere.  (It's a bit
weird to define a macro that has PTHREAD in the name when building
things that aren't multi-threaded, but that was their choice).

Do you see any problems with this approach?  The main thing I can
think of is that people who are using a custom CFLAGS on that OS will
need to update the value they're using, but that seems OK (they'll
likely see the new error and be alerted to the change).  Another thing
I noticed is that config/ax_pthread.m4 (something from autoconf that
we don't want to modify) will add another copy of
-D_POSIX_PTHREAD_SEMANTICS, but that's already the case.
From 899621ea9131ad5819dbf86c363f51b6f60fb332 Mon Sep 17 00:00:00 2001
From: Thomas Munro 
Date: Wed, 14 Jul 2021 10:32:15 +
Subject: [PATCH v3 1/2] Portability fixes for sigwait.

Build farm animals running ancient HPUX and Solaris have a non-standard
sigwait() from draft versions of POSIX, so they didn't like commit
7c09d279.  To avoid the problem in general, only try to use sigwait() if
it's declared by  and matches the expected declaration.  To
select the modern declaration on Solaris (even in non-threaded
programs), move -D_POSIX_PTHREAD_SEMANTICS from PTHREAD_CFLAGS into
CFLAGS on Solaris only.

Also fix the error checking.  Modern sigwait() doesn't set errno.

Thanks to Tom Lane for help with this.

Discussion: https://postgr.es/m/3187588.1626136248%40sss.pgh.pa.us
---
 config/thread_test.c   |  4 ---
 configure  | 70 ++
 configure.ac   | 33 --
 src/bin/psql/command.c | 13 +++
 src/bin/psql/startup.c |  4 +--
 src/include/pg_config.h.in |  7 
 src/template/solaris   |  5 ++-
 src/tools/msvc/Solution.pm |  2 ++
 8 files changed, 116 insertions(+), 22 deletions(-)

diff --git a/config/thread_test.c b/config/thread_test.c
index 784f4fe8ce..e2a9e62f49 100644
--- a/config/thread_test.c
+++ b/config/thread_test.c
@@ -43,10 +43,6 @@
 #include 
 #endif
 
-/* Test for POSIX.1c 2-arg sigwait() and fail on single-arg version */
-#include 
-int			sigwait(const sigset_t *set, int *sig);
-
 
 #define		TEMP_FILENAME_1 "thread_test.1"
 #define		TEMP_FILENAME_2 "thread_test.2"
diff --git a/configure b/configure
index 1ea28a0d67..e6c85d48e3 100755
--- a/configure
+++ b/configure
@@ -11296,9 +11296,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 	# set thread flags
 
 # Some platforms use these, so just define them.  They can't hurt if they
-# are not supported.  For example, on Solaris -D_POSIX_PTHREAD_SEMANTICS
-# enables 5-arg getpwuid_r, among other things.
-PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS"
+# are not supported.
+PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE"
 
 # Check for *_r functions
 _CFLAGS="$CFLAGS"
@@ -15861,9 +15860,11 @@ $as_echo "#define HAVE_FSEEKO 1" >>confdefs.h
 fi
 
 
-# posix_fadvise() is a no-op on Solaris, so don't incur function overhead
-# by calling it, 2009-04-02
-# http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/posix_fadvise.c
+# Make sure there's a declaration for sigwait(), then make sure
+# that it conforms to the POSIX standard (there seem to still be
+# some platforms out there with pre-POSIX sigwait()).  On Solaris,
+# _POSIX_PTHREAD_SEMANTICS affects the result, but we defined it
+# in CFLAGS.
 # The Clang compiler raises a warning for an undeclared identifier that matches
 # a compiler builtin function.  All extant Clang versions are affected, as of
 # Clang 3.6.0.  Test a builtin known to every version.  This problem affects the
@@ -15952,6 +15953,63 @@ case $ac_cv_c_decl_report in
   *) ac_c_decl_warn_flag= ;;
 esac
 
+ac_fn_c_check_decl "$LINENO" "sigwait" "ac_cv_have_decl_sigwait" "#include 
+"
+if test "x$ac_cv_have_decl_sigwait" = xyes; then :
+  ac_have_decl=1
+else
+  ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SIGWAIT $ac_have_decl
+_ACEOF
+
+if test "x$ac_cv_have_decl_sigwait" = xyes; then
+  { $as_echo 

pgsql: In psql \copy from, send data to server in larger chunks.

2021-07-14 Thread Heikki Linnakangas
In psql \copy from, send data to server in larger chunks.

Previously, we would send each line as a separate CopyData message.
That's pretty wasteful if the table is narrow, as each CopyData message
has 5 bytes of overhead. For efficiency, buffer up and pack 8 kB of
input data into each CopyData message.

The server also sends each line as a separate CopyData message in COPY TO
STDOUT, and that's similarly wasteful. But that's documented in the FE/BE
protocol description, so changing that would be a wire protocol break.

Reviewed-by: Aleksander Alekseev
Discussion: 
https://www.postgresql.org/message-id/40b2cec0-d0fb-3191-2ae1-9a3fe16a7e48%40iki.fi

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/eec57115e4c866f26bdc8bcbe3e2e7be4c6d0450

Modified Files
--
src/bin/psql/copy.c | 99 ++---
1 file changed, 56 insertions(+), 43 deletions(-)



pgsql: Clarify description of pg_stat_statements columns

2021-07-14 Thread Magnus Hagander
Clarify description of pg_stat_statements columns

Reported-By: Peter Eisentraut
Backpatch-through: 14
Discussion: 
https://postgr.es/m/8f5e63b8-e8ed-0f80-d8c4-68222624c...@enterprisedb.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/b4deefc39b933b9808645667117f2d8208092794

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)



pgsql: Clarify description of pg_stat_statements columns

2021-07-14 Thread Magnus Hagander
Clarify description of pg_stat_statements columns

Reported-By: Peter Eisentraut
Backpatch-through: 14
Discussion: 
https://postgr.es/m/8f5e63b8-e8ed-0f80-d8c4-68222624c...@enterprisedb.com

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/3b57d5af7435d0d21bdec392dc1ce7c13871df8b

Modified Files
--
doc/src/sgml/pgstatstatements.sgml | 7 ---
1 file changed, 4 insertions(+), 3 deletions(-)



pgsql: Add support for prepared transactions to built-in logical replic

2021-07-14 Thread Amit Kapila
Add support for prepared transactions to built-in logical replication.

To add support for streaming transactions at prepare time into the
built-in logical replication, we need to do the following things:

* Modify the output plugin (pgoutput) to implement the new two-phase API
callbacks, by leveraging the extended replication protocol.

* Modify the replication apply worker, to properly handle two-phase
transactions by replaying them on prepare.

* Add a new SUBSCRIPTION option "two_phase" to allow users to enable
two-phase transactions. We enable the two_phase once the initial data sync
is over.

We however must explicitly disable replication of two-phase transactions
during replication slot creation, even if the plugin supports it. We
don't need to replicate the changes accumulated during this phase,
and moreover, we don't have a replication connection open so we don't know
where to send the data anyway.

The streaming option is not allowed with this new two_phase option. This
can be done as a separate patch.

We don't allow to toggle two_phase option of a subscription because it can
lead to an inconsistent replica. For the same reason, we don't allow to
refresh the publication once the two_phase is enabled for a subscription
unless copy_data option is false.

Author: Peter Smith, Ajin Cherian and Amit Kapila based on previous work by 
Nikhil Sontakke and Stas Kelvich
Reviewed-by: Amit Kapila, Sawada Masahiko, Vignesh C, Dilip Kumar, Takamichi 
Osumi, Greg Nancarrow
Tested-By: Haiying Tang
Discussion: 
https://postgr.es/m/02da5f5e-cece-4d9c-8b4b-418077e2c...@postgrespro.ru
Discussion: 
https://postgr.es/m/CAA4eK1+opiV4aFTmWWUF9h_32=hfpow9vzashart0ua5obr...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/a8fd13cab0ba815e9925dc9676e6309f699b5f72

Modified Files
--
contrib/test_decoding/test_decoding.c  |  12 +-
doc/src/sgml/catalogs.sgml |  12 +
doc/src/sgml/protocol.sgml | 291 -
doc/src/sgml/ref/alter_subscription.sgml   |   5 +
doc/src/sgml/ref/create_subscription.sgml  |  37 +++
doc/src/sgml/ref/pg_dump.sgml  |   7 +-
src/backend/access/transam/twophase.c  |  68 
src/backend/catalog/pg_subscription.c  |  34 ++
src/backend/catalog/system_views.sql   |   2 +-
src/backend/commands/subscriptioncmds.c| 131 +++-
.../libpqwalreceiver/libpqwalreceiver.c|  10 +-
src/backend/replication/logical/decode.c   |  11 +-
src/backend/replication/logical/logical.c  |  31 +-
src/backend/replication/logical/origin.c   |   7 +-
src/backend/replication/logical/proto.c| 217 -
src/backend/replication/logical/reorderbuffer.c|  25 +-
src/backend/replication/logical/snapbuild.c|  33 +-
src/backend/replication/logical/tablesync.c| 197 +--
src/backend/replication/logical/worker.c   | 347 +++-
src/backend/replication/pgoutput/pgoutput.c| 201 +---
src/backend/replication/slot.c |   1 +
src/backend/replication/walreceiver.c  |   2 +-
src/bin/pg_dump/pg_dump.c  |  20 +-
src/bin/pg_dump/pg_dump.h  |   1 +
src/bin/psql/describe.c|   8 +-
src/bin/psql/tab-complete.c|   2 +-
src/include/access/twophase.h  |   2 +
src/include/catalog/catversion.h   |   2 +-
src/include/catalog/pg_subscription.h  |  11 +
src/include/catalog/pg_subscription_rel.h  |   1 +
src/include/replication/logical.h  |  10 +
src/include/replication/logicalproto.h |  73 -
src/include/replication/pgoutput.h |   1 +
src/include/replication/reorderbuffer.h|   8 +-
src/include/replication/slot.h |   7 +-
src/include/replication/snapbuild.h|   5 +-
src/include/replication/walreceiver.h  |   7 +-
src/include/replication/worker_internal.h  |   3 +
src/test/regress/expected/subscription.out | 109 ---
src/test/regress/sql/subscription.sql  |  25 ++
src/test/subscription/t/021_twophase.pl| 359 +
src/test/subscription/t/022_twophase_cascade.pl| 235 ++
src/tools/pgindent/typedefs.list   |   3 +
43 files changed, 2382 insertions(+), 191 deletions(-)



pgsql: Fix unexpected error messages for various flavors of ALTER TABLE

2021-07-14 Thread Michael Paquier
Fix unexpected error messages for various flavors of ALTER TABLE

Some commands of ALTER TABLE could fail with the following error:
ERROR:  "tab" is of the wrong type

This error is unexpected, as all the code paths leading to
ATWrongRelkindError() should use a supported set of relkinds to generate
correct error messages.  This commit closes the gap with such mistakes,
by adding all the missing relkind combinations.  Tests are added to
check all the problems found.  Note that some combinations are not used,
but these are left around as it could have an impact on applications
relying on this code.

2ed532e has done a much larger refactoring on HEAD to make such error
messages easier to manage in the long-term, so nothing is needed there.

Author: Kyotaro Horiguchi
Reviewed-by: Peter Eisentraut, Ahsan Hadi, Michael Paquier
Discussion: 
https://postgr.es/m/20210216.181415.368926598204753659.horikyota@gmail.com
Backpatch-through: 11

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/85a8c3a4b60f430ba30d58427558f1686251b8b5

Modified Files
--
src/backend/commands/tablecmds.c   | 6 ++
src/test/regress/expected/alter_table.out  | 5 +
src/test/regress/expected/foreign_data.out | 2 ++
src/test/regress/sql/alter_table.sql   | 5 +
src/test/regress/sql/foreign_data.sql  | 1 +
5 files changed, 19 insertions(+)



pgsql: Fix unexpected error messages for various flavors of ALTER TABLE

2021-07-14 Thread Michael Paquier
Fix unexpected error messages for various flavors of ALTER TABLE

Some commands of ALTER TABLE could fail with the following error:
ERROR:  "tab" is of the wrong type

This error is unexpected, as all the code paths leading to
ATWrongRelkindError() should use a supported set of relkinds to generate
correct error messages.  This commit closes the gap with such mistakes,
by adding all the missing relkind combinations.  Tests are added to
check all the problems found.  Note that some combinations are not used,
but these are left around as it could have an impact on applications
relying on this code.

2ed532e has done a much larger refactoring on HEAD to make such error
messages easier to manage in the long-term, so nothing is needed there.

Author: Kyotaro Horiguchi
Reviewed-by: Peter Eisentraut, Ahsan Hadi, Michael Paquier
Discussion: 
https://postgr.es/m/20210216.181415.368926598204753659.horikyota@gmail.com
Backpatch-through: 11

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/5226243459f11e0029c803674aabfb3bc25192f7

Modified Files
--
src/backend/commands/tablecmds.c   |  9 +
src/test/regress/expected/alter_table.out  | 10 ++
src/test/regress/expected/foreign_data.out |  2 ++
src/test/regress/sql/alter_table.sql   |  9 +
src/test/regress/sql/foreign_data.sql  |  1 +
5 files changed, 31 insertions(+)



pgsql: Fix unexpected error messages for various flavors of ALTER TABLE

2021-07-14 Thread Michael Paquier
Fix unexpected error messages for various flavors of ALTER TABLE

Some commands of ALTER TABLE could fail with the following error:
ERROR:  "tab" is of the wrong type

This error is unexpected, as all the code paths leading to
ATWrongRelkindError() should use a supported set of relkinds to generate
correct error messages.  This commit closes the gap with such mistakes,
by adding all the missing relkind combinations.  Tests are added to
check all the problems found.  Note that some combinations are not used,
but these are left around as it could have an impact on applications
relying on this code.

2ed532e has done a much larger refactoring on HEAD to make such error
messages easier to manage in the long-term, so nothing is needed there.

Author: Kyotaro Horiguchi
Reviewed-by: Peter Eisentraut, Ahsan Hadi, Michael Paquier
Discussion: 
https://postgr.es/m/20210216.181415.368926598204753659.horikyota@gmail.com
Backpatch-through: 11

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/0c83eb2e0edb42f54a37fdeac85fb80eb5de2cca

Modified Files
--
src/backend/commands/tablecmds.c   |  9 +
src/test/regress/expected/alter_table.out  | 10 ++
src/test/regress/expected/foreign_data.out |  2 ++
src/test/regress/sql/alter_table.sql   |  9 +
src/test/regress/sql/foreign_data.sql  |  1 +
5 files changed, 31 insertions(+)



pgsql: Fix lack of message pluralization

2021-07-14 Thread Peter Eisentraut
Fix lack of message pluralization

Branch
--
REL_14_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/b4842a8d085e970ff24667954c0d861e911e16c1

Modified Files
--
src/backend/storage/ipc/signalfuncs.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)



pgsql: Fix lack of message pluralization

2021-07-14 Thread Peter Eisentraut
Fix lack of message pluralization

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/55b2a2340758da8ff11357d719d169f264ac7112

Modified Files
--
src/backend/storage/ipc/signalfuncs.c | 6 --
1 file changed, 4 insertions(+), 2 deletions(-)