pgsql: Add tests for bytea LIKE operator

2021-02-17 Thread Peter Eisentraut
Add tests for bytea LIKE operator

Add test coverage for the following operations, which were previously
not tested at all:

bytea LIKE bytea (bytealike)
bytea NOT LIKE bytea (byteanlike)
ESCAPE clause for the above (like_escape_bytea)

also

name NOT ILIKE text (nameicnlike)

Discussion: 
https://www.postgresql.org/message-id/flat/4d13563a-2c8d-fd91-20d5-e71b7a4eaa87%40enterprisedb.com

Branch
--
master

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

Modified Files
--
src/test/regress/expected/strings.out | 48 +++
src/test/regress/sql/strings.sql  | 12 +
2 files changed, 60 insertions(+)



pgsql: Allow specifying CRL directory

2021-02-17 Thread Peter Eisentraut
Allow specifying CRL directory

Add another method to specify CRLs, hashed directory method, for both
server and client side.  This offers a means for server or libpq to
load only CRLs that are required to verify a certificate.  The CRL
directory is specifed by separate GUC variables or connection options
ssl_crl_dir and sslcrldir, alongside the existing ssl_crl_file and
sslcrl, so both methods can be used at the same time.

Author: Kyotaro Horiguchi 
Discussion: 
https://www.postgresql.org/message-id/flat/20200731.173911.904649928639357911.horikyota@gmail.com

Branch
--
master

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

Modified Files
--
contrib/postgres_fdw/expected/postgres_fdw.out  |  2 +-
doc/src/sgml/config.sgml| 36 -
doc/src/sgml/libpq.sgml | 28 ++-
src/backend/libpq/be-secure-openssl.c   | 26 +++---
src/backend/libpq/be-secure.c   |  1 +
src/backend/utils/misc/guc.c| 10 +++
src/backend/utils/misc/postgresql.conf.sample   |  1 +
src/include/libpq/libpq.h   |  1 +
src/interfaces/libpq/fe-connect.c   |  6 +
src/interfaces/libpq/fe-secure-openssl.c| 24 -
src/interfaces/libpq/libpq-int.h|  1 +
src/test/ssl/Makefile   | 24 -
src/test/ssl/ssl/client-crldir/9bb9e3c3.r0  | 11 
src/test/ssl/ssl/root+client-crldir/9bb9e3c3.r0 | 11 
src/test/ssl/ssl/root+client-crldir/a3d11bff.r0 | 11 
src/test/ssl/ssl/root+server-crldir/a3d11bff.r0 | 11 
src/test/ssl/ssl/root+server-crldir/a836cc2d.r0 | 11 
src/test/ssl/ssl/server-crldir/a836cc2d.r0  | 11 
src/test/ssl/t/001_ssltests.pl  | 32 --
src/test/ssl/t/SSLServer.pm | 14 +-
20 files changed, 255 insertions(+), 17 deletions(-)



pgsql: nbtree README: move VACUUM linear scan section.

2021-02-17 Thread Peter Geoghegan
nbtree README: move VACUUM linear scan section.

Discuss VACUUM's linear scan after discussion of tuple deletion by
VACUUM, but before discussion of page deletion by VACUUM.  This
progression is a lot more natural.

Also tweak the wording a little.  It seems unnecessary to talk about how
it worked prior to PostgreSQL 8.2.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/128dd901a5c87e11c6a8cbe227a806cdc3afd10d

Modified Files
--
src/backend/access/nbtree/README | 55 
1 file changed, 28 insertions(+), 27 deletions(-)



pgsql: Fix pointer type in ExecForeignBatchInsert SGML docs

2021-02-17 Thread Tomas Vondra
Fix pointer type in ExecForeignBatchInsert SGML docs

Reported-by: Ian Barwick
Discussion: https://postgr.es/m/20200628151002.7x5laxwpgvkyiu3q@development

Branch
--
master

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

Modified Files
--
doc/src/sgml/fdwhandler.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix tuple routing to initialize batching only for inserts

2021-02-17 Thread Tomas Vondra
Fix tuple routing to initialize batching only for inserts

A cross-partition update on a partitioned table is implemented as a
delete followed by an insert. With foreign partitions, this was however
causing issues, because the FDW and core may disagree on when to enable
batching.  postgres_fdw was only allowing batching for plain inserts
(CMD_INSERT) while core was trying to batch the insert component of the
cross-partition update.  Fix by restricting core to apply batching only
to plain CMD_INSERT queries.

It's possible to allow batching for cross-partition updates, but that
will require more extensive changes, so better to leave that for a
separate patch.

Author: Amit Langote
Reviewed-by: Tomas Vondra, Takayuki Tsunakawa
Discussion: https://postgr.es/m/20200628151002.7x5laxwpgvkyiu3q@development

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/927f453a941061e3d5884bab206581c34784e45b

Modified Files
--
contrib/postgres_fdw/expected/postgres_fdw.out | 23 ++-
contrib/postgres_fdw/postgres_fdw.c| 13 +++--
contrib/postgres_fdw/sql/postgres_fdw.sql  | 19 ++-
src/backend/executor/execPartition.c   |  3 ++-
4 files changed, 53 insertions(+), 5 deletions(-)



pgsql: Make some minor improvements in the regex code.

2021-02-17 Thread Tom Lane
Make some minor improvements in the regex code.

Push some hopefully-uncontroversial bits extracted from an upcoming
patch series, to remove non-relevant clutter from the main patches.

In compact(), return immediately after setting REG_ASSERT error;
continuing the loop would just lead to assertion failure below.
(Ask me how I know.)

In parseqatom(), remove assertion that moresubs() did its job.
When moresubs actually did its job, this is redundant with that
function's final assert; but when it failed on OOM, this is an
assertion crash.  We could avoid the crash by adding a NOERR()
check before the assertion, but it seems better to subtract code
than add it.  (Note that there's a NOERR exit a few lines further
down, and nothing else between here and there requires moresubs
to have succeeded.  So we don't really need an extra error exit.)
This is a live bug in assert-enabled builds, but given the very
low likelihood of OOM in moresub's tiny allocation, I don't think
it's worth back-patching.

On the other hand, it seems worthwhile to add an assertion that
our intended v->subs[subno] target is still null by the time we
are ready to insert into it, since there's a recursion in between.

In pg_regexec, ensure we fflush any debug output on the way out,
and try to make MDEBUG messages more uniform and helpful.  (In
particular, ensure that all of them are prefixed with the subre's
id number, so one can match up entry and exit reports.)

Add some test cases in test_regex to improve coverage of lookahead
and lookbehind constraints.  Adding these now is mainly to establish
that this is indeed the existing behavior.

Discussion: https://postgr.es/m/1340281.1613018...@sss.pgh.pa.us

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/4e703d67193df0431c0740044d662d1feade73aa

Modified Files
--
src/backend/regex/regc_nfa.c   |  2 +-
src/backend/regex/regcomp.c|  2 +-
src/backend/regex/regexec.c| 61 +-
.../modules/test_regex/expected/test_regex.out | 48 +
src/test/modules/test_regex/sql/test_regex.sql | 13 +
5 files changed, 99 insertions(+), 27 deletions(-)



pgsql: Routine usage information schema tables

2021-02-17 Thread Peter Eisentraut
Routine usage information schema tables

Several information schema views track dependencies between
functions/procedures and objects used by them.  These had not been
implemented so far because PostgreSQL doesn't track objects used in a
function body.  However, formally, these also show dependencies used
in parameter default expressions, which PostgreSQL does support and
track.  So for the sake of completeness, we might as well add these.
If dependency tracking for function bodies is ever implemented, these
views will automatically work correctly.

Reviewed-by: Erik Rijkers 
Discussion: 
https://www.postgresql.org/message-id/flat/ac80fc74-e387-8950-9a31-2560778fc1e3%40enterprisedb.com

Branch
--
master

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

Modified Files
--
doc/src/sgml/information_schema.sgml| 443 
src/backend/catalog/information_schema.sql  | 100 +-
src/backend/catalog/sql_features.txt|   2 +-
src/include/catalog/catversion.h|   2 +-
src/test/regress/expected/create_function_3.out |  38 ++
src/test/regress/sql/create_function_3.sql  |  24 ++
6 files changed, 603 insertions(+), 6 deletions(-)



pgsql: Fix typo

2021-02-17 Thread Magnus Hagander
Fix typo

Author: Daniel Gustafsson 
Discussion: https://postgr.es/m/0cf087fc-bead-4010-8bb9-3cdd74dc9...@yesql.se

Branch
--
REL_13_STABLE

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

Modified Files
--
doc/src/sgml/ref/create_table.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo

2021-02-17 Thread Magnus Hagander
Fix typo

Author: Daniel Gustafsson 
Discussion: https://postgr.es/m/0cf087fc-bead-4010-8bb9-3cdd74dc9...@yesql.se

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6a31b48ec88ae506c6f115948c86f61abb89a89a

Modified Files
--
doc/src/sgml/ref/create_table.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo

2021-02-17 Thread Magnus Hagander
Fix typo

Author: Daniel Gustafsson 
Discussion: https://postgr.es/m/0cf087fc-bead-4010-8bb9-3cdd74dc9...@yesql.se

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/5d319ce86f13d1b0e7fb911408fe012723259723

Modified Files
--
doc/src/sgml/ref/create_table.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix typo

2021-02-17 Thread Magnus Hagander
Fix typo

Author: Daniel Gustafsson 
Discussion: https://postgr.es/m/0cf087fc-bead-4010-8bb9-3cdd74dc9...@yesql.se

Branch
--
master

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

Modified Files
--
doc/src/sgml/ref/create_table.sgml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Use errmsg_internal for debug messages

2021-02-17 Thread Peter Eisentraut
Use errmsg_internal for debug messages

An inconsistent set of debug-level messages was not using
errmsg_internal(), thus uselessly exposing the messages to translation
work.  Fix those.

Branch
--
master

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

Modified Files
--
contrib/amcheck/verify_nbtree.c| 12 ++--
contrib/pg_prewarm/autoprewarm.c   |  2 +-
src/backend/access/transam/multixact.c |  6 +++---
src/backend/access/transam/slru.c  |  2 +-
src/backend/access/transam/varsup.c|  2 +-
src/backend/access/transam/xlog.c  | 24 
src/backend/catalog/dependency.c   |  2 +-
src/backend/catalog/index.c|  6 ++
src/backend/commands/indexcmds.c   |  2 +-
src/backend/commands/subscriptioncmds.c|  4 ++--
src/backend/commands/tablecmds.c   | 12 ++--
src/backend/jit/llvm/llvmjit.c |  2 +-
src/backend/libpq/be-secure.c  |  2 +-
src/backend/parser/parse_utilcmd.c |  2 +-
src/backend/partitioning/partbounds.c  |  4 ++--
src/backend/port/win32_shmem.c |  4 ++--
src/backend/postmaster/autovacuum.c|  6 +++---
src/backend/postmaster/bgworker.c  |  6 +++---
src/backend/postmaster/checkpointer.c  |  2 +-
src/backend/postmaster/postmaster.c|  2 +-
src/backend/postmaster/syslogger.c |  2 +-
src/backend/replication/logical/launcher.c |  4 ++--
src/backend/replication/syncrep.c  |  2 +-
src/backend/replication/walsender.c|  2 +-
src/backend/storage/lmgr/predicate.c   |  2 +-
src/backend/storage/lmgr/proc.c|  4 ++--
src/backend/storage/smgr/md.c  |  2 +-
src/backend/storage/sync/sync.c|  2 +-
src/backend/tcop/postgres.c| 12 ++--
src/backend/utils/init/miscinit.c  |  2 +-
30 files changed, 68 insertions(+), 70 deletions(-)