pgsql: Clean up grammar a bit

2020-06-29 Thread Peter Eisentraut
Clean up grammar a bit Simplify the grammar specification of substring() and overlay() a bit, simplify and update some comments. Reviewed-by: Pavel Stehule Reviewed-by: Vik Fearing Reviewed-by: Fabien COELHO Discussion: https://www.postgresql.org/message-id/flat/a15db31c-d0f8-8ce0-9039-578a31

pgsql: Add current substring regular expression syntax

2020-06-29 Thread Peter Eisentraut
Add current substring regular expression syntax SQL:1999 had syntax SUBSTRING(text FROM pattern FOR escapechar) but this was replaced in SQL:2003 by the more clear SUBSTRING(text SIMILAR pattern ESCAPE escapechar) but this was never implemented in PostgreSQL. This patch adds that new

pgsql: Avoid using %c printf format for potentially non-ASCII character

2020-06-29 Thread Tom Lane
Avoid using %c printf format for potentially non-ASCII characters. Since %c only passes a C "char" to printf, it's incapable of dealing with multibyte characters. Passing just the first byte of such a character leads to an output string that is visibly not correctly encoded, resulting in undesira

pgsql: nbtree: Correct inaccurate split location comment.

2020-06-29 Thread Peter Geoghegan
nbtree: Correct inaccurate split location comment. Minor oversight in commit fab25024338. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/f7a476f0d656bbc673474b9165cd05fa548c18c9 Modified Files -- src/backend/access/nbtree/nbtsplitloc.c | 2 +- 1 file ch

pgsql: Mop up some no-longer-necessary hacks around printf %.*s format.

2020-06-29 Thread Tom Lane
Mop up some no-longer-necessary hacks around printf %.*s format. Commit 54cd4f045 added some kluges to work around an old glibc bug, namely that %.*s could misbehave if glibc thought any characters in the supplied string were incorrectly encoded. Now that we use our own snprintf.c implementation,

pgsql: Remove support for timezone "posixrules" file.

2020-06-29 Thread Tom Lane
Remove support for timezone "posixrules" file. The IANA tzcode library has a feature to read a time zone file named "posixrules" and apply the daylight-savings transition dates and times therein, when it is given a POSIX-style time zone specification that lacks an explicit transition rule. Howeve

pgsql: Remove support for timezone "posixrules" file.

2020-06-29 Thread Tom Lane
Remove support for timezone "posixrules" file. The IANA tzcode library has a feature to read a time zone file named "posixrules" and apply the daylight-savings transition dates and times therein, when it is given a POSIX-style time zone specification that lacks an explicit transition rule. Howeve

pgsql: pgstattuple: Have pgstattuple_approx accept TOAST tables

2020-06-29 Thread Peter Eisentraut
pgstattuple: Have pgstattuple_approx accept TOAST tables TOAST tables have a visibility map and a free space map, so they can be supported by pgstattuple_approx just fine. Add test cases to show how various pgstattuple functions accept TOAST tables. Also add similar tests to pg_visibility, which

pgsql: Prevent compilation of frontend-only files in src/common/ with b

2020-06-29 Thread Michael Paquier
Prevent compilation of frontend-only files in src/common/ with backend Any frontend-only file of src/common/ should include a protection to prevent such code to be included in the backend compilation. fe_memutils.c and restricted_token.c have been doing that, while file_utils.c (since bf5bb2e) and