pgsql: doc: Mention UNION/ORDER BY etc. keywords in section headers.
doc: Mention UNION/ORDER BY etc. keywords in section headers. Most of the section and sub-section headers in the Queries chapter have the keywords literally stated, but neither "Sorting Rows" nor "Combining Rows" did. There's no rule that they must be, but it seems like a good practice. The keywords will ring a bell to anyone with with even a little bit of SQL experience. David G. Johnston, per suggestion by [email protected] Discussion: https://www.postgresql.org/message-id/159981394174.31338.7014519396749859167%40wrigleys.postgresql.org Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8ef2a5afdf8ec9e4c8b28a7042c9508eb6161671 Modified Files -- doc/src/sgml/queries.sgml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
pgsql: Remove pg_collation.collversion.
Remove pg_collation.collversion. This model couldn't be extended to cover the default collation, and didn't have any information about the affected database objects when the version changed. Remove, in preparation for a follow-up commit that will add a new mechanism. Author: Thomas Munro Reviewed-by: Julien Rouhaud Reviewed-by: Peter Eisentraut Discussion: https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/7d1297df0830725d4434ba7dbf71a9e8221ad49e Modified Files -- doc/src/sgml/catalogs.sgml | 11 --- doc/src/sgml/func.sgml | 6 +- doc/src/sgml/ref/alter_collation.sgml| 63 - doc/src/sgml/ref/create_collation.sgml | 21 -- src/backend/catalog/pg_collation.c | 5 -- src/backend/commands/collationcmds.c | 88 src/backend/nodes/copyfuncs.c| 13 src/backend/nodes/equalfuncs.c | 11 --- src/backend/parser/gram.y| 18 + src/backend/tcop/utility.c | 12 src/backend/utils/adt/pg_locale.c| 37 -- src/bin/pg_dump/pg_dump.c| 24 +-- src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_collation.dat | 7 +- src/include/catalog/pg_collation.h | 5 -- src/include/catalog/toasting.h | 1 - src/include/commands/collationcmds.h | 1 - src/include/nodes/parsenodes.h | 11 --- src/test/regress/expected/collate.icu.utf8.out | 3 - src/test/regress/expected/collate.linux.utf8.out | 3 - src/test/regress/sql/collate.icu.utf8.sql| 5 -- src/test/regress/sql/collate.linux.utf8.sql | 5 -- 22 files changed, 8 insertions(+), 344 deletions(-)
pgsql: Track collation versions for indexes.
Track collation versions for indexes. Record the current version of dependent collations in pg_depend when creating or rebuilding an index. When accessing the index later, warn that the index may be corrupted if the current version doesn't match. Thanks to Douglas Doole, Peter Eisentraut, Christoph Berg, Laurenz Albe, Michael Paquier, Robert Haas, Tom Lane and others for very helpful discussion. Author: Thomas Munro Author: Julien Rouhaud Reviewed-by: Peter Eisentraut (earlier versions) Discussion: https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/257836a75585934cc05ed7a80bccf8190d41e056 Modified Files -- doc/src/sgml/catalogs.sgml | 3 +- doc/src/sgml/charset.sgml | 38 + doc/src/sgml/func.sgml | 4 +- doc/src/sgml/ref/alter_index.sgml | 15 ++ doc/src/sgml/ref/pgupgrade.sgml| 15 ++ doc/src/sgml/ref/reindex.sgml | 9 ++ src/backend/catalog/dependency.c | 182 ++ src/backend/catalog/heap.c | 7 +- src/backend/catalog/index.c| 197 ++-- src/backend/catalog/pg_constraint.c| 2 +- src/backend/catalog/pg_depend.c| 46 +- src/backend/catalog/pg_type.c | 60 src/backend/commands/collationcmds.c | 16 +- src/backend/commands/tablecmds.c | 31 src/backend/nodes/copyfuncs.c | 1 + src/backend/optimizer/util/plancat.c | 9 ++ src/backend/parser/gram.y | 8 + src/backend/utils/adt/pg_locale.c | 46 +- src/backend/utils/adt/pg_upgrade_support.c | 1 + src/backend/utils/cache/relcache.c | 2 + src/bin/pg_dump/pg_backup.h| 1 + src/bin/pg_dump/pg_dump.c | 182 +- src/bin/pg_dump/pg_dump.h | 2 + src/bin/pg_upgrade/dump.c | 4 +- src/bin/pg_upgrade/option.c| 7 + src/bin/pg_upgrade/pg_upgrade.h| 1 + src/bin/psql/tab-complete.c| 29 +++- src/include/catalog/catversion.h | 2 +- src/include/catalog/dependency.h | 25 ++- src/include/catalog/index.h| 3 + src/include/catalog/pg_depend.h| 3 +- src/include/catalog/pg_type.h | 2 + src/include/nodes/parsenodes.h | 4 +- src/include/utils/pg_locale.h | 2 +- src/include/utils/rel.h| 1 + src/test/Makefile | 3 +- src/test/locale/.gitignore | 1 + src/test/locale/Makefile | 7 + src/test/locale/t/001_index.pl | 67 + src/test/regress/expected/collate.icu.utf8.out | 201 + src/test/regress/expected/create_index.out | 8 +- src/test/regress/sql/collate.icu.utf8.sql | 132 src/tools/pgindent/typedefs.list | 2 + 43 files changed, 1287 insertions(+), 94 deletions(-)
pgsql: Add pg_depend.refobjversion.
Add pg_depend.refobjversion. Provide a place for the version of referenced database objects to be recorded. A follow-up commit will use this to record dependencies on collation versions for indexes, but similar ideas for other kinds of objects have also been mooted. Author: Thomas Munro Reviewed-by: Julien Rouhaud Reviewed-by: Peter Eisentraut Discussion: https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/cd6f479e79f3a33ef7a919c6b6c0c498c790f154 Modified Files -- doc/src/sgml/catalogs.sgml| 11 +++ src/backend/catalog/dependency.c | 14 ++ src/backend/catalog/pg_depend.c | 14 ++ src/include/catalog/catversion.h | 2 +- src/include/catalog/dependency.h | 1 + src/include/catalog/pg_depend.h | 4 src/include/catalog/toasting.h| 1 + src/test/regress/expected/misc_sanity.out | 4 ++-- 8 files changed, 40 insertions(+), 11 deletions(-)
pgsql: Clarify temporary table name shadowing in CREATE TABLE docs
Clarify temporary table name shadowing in CREATE TABLE docs Author: David Johnston Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/5b3dca096f8e504b73812f68716fb68dd1176d6d Modified Files -- doc/src/sgml/ref/create_table.sgml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
pgsql: Add missing comma in list of SSL versions
Add missing comma in list of SSL versions Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/57fae192f8f7d094159c913f10fcfd11cd827332 Modified Files -- doc/src/sgml/sslinfo.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Add missing comma in list of SSL versions
Add missing comma in list of SSL versions Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/06801aef52f7f734a737cc0763a410fd1ec6e574 Modified Files -- doc/src/sgml/sslinfo.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Add missing comma in list of SSL versions
Add missing comma in list of SSL versions Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/5ba4987a4048f1ad3002bc047279cb633429d7d1 Modified Files -- doc/src/sgml/sslinfo.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Add missing comma in list of SSL versions
Add missing comma in list of SSL versions Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/fc5b2203bfe80a4ac1b3c2c3ff536247514df304 Modified Files -- doc/src/sgml/sslinfo.sgml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
pgsql: Use PG_GETARG_TRANSACTIONID where appropriate
Use PG_GETARG_TRANSACTIONID where appropriate Some places were using PG_GETARG_UINT32 where PG_GETARG_TRANSACTIONID would be more appropriate. (Of course, they are the same internally, so there is no externally visible effect.) To do that, export PG_GETARG_TRANSACTIONID outside of xid.c. We also export PG_RETURN_TRANSACTIONID for symmetry, even though there are currently no external users. Author: Ashutosh Bapat Discussion: https://www.postgresql.org/message-id/flat/d8f6bdd536df403b9b33816e9f7e0b9d@G08CNEXMBPEKD05.g08.fujitsu.local Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/dd26a0ad760b11237d7ea9cda8c1826c2c64 Modified Files -- src/backend/access/transam/commit_ts.c | 4 ++-- src/backend/access/transam/multixact.c | 2 +- src/backend/utils/adt/xid.c| 3 --- src/include/fmgr.h | 2 ++ 4 files changed, 5 insertions(+), 6 deletions(-)
pgsql: Second thoughts on TOAST decompression.
Second thoughts on TOAST decompression. On detecting a corrupted match tag, pglz_decompress() should just summarily return -1. Breaking out of the loop, as I did in dfc797730, doesn't quite guarantee that will happen. Also, we can use unlikely() on that check, just in case it helps. Backpatch to v13, like the previous patch. Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/fd2997565c6f66837440dd57f5e52b56aa964d14 Modified Files -- src/common/pg_lzcompress.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-)
pgsql: Second thoughts on TOAST decompression.
Second thoughts on TOAST decompression. On detecting a corrupted match tag, pglz_decompress() should just summarily return -1. Breaking out of the loop, as I did in dfc797730, doesn't quite guarantee that will happen. Also, we can use unlikely() on that check, just in case it helps. Backpatch to v13, like the previous patch. Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/7957e75c588c0b17210d4379afb50ea2673b0d20 Modified Files -- src/common/pg_lzcompress.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-)
pgsql: Rethink the generation rule for fmgroids.h macros.
Rethink the generation rule for fmgroids.h macros. Traditionally, the names of fmgroids.h macros for pg_proc OIDs have been constructed from the prosrc field. But sometimes the same C function underlies multiple pg_proc entries, forcing us to make an arbitrary choice of which OID to reference; the other entries are then not namable via fmgroids.h. Moreover, we could not have macros at all for pg_proc entries that aren't for C-coded functions. Instead, use the proname field, and append the proargtypes field (replacing inter-argument spaces with underscores) if proname is not unique. Special-casing unique entries such as F_OIDEQ removes the need to change a lot of code. Indeed, I can only find two places in the tree that need to be adjusted; while this changes quite a few existing entries in fmgroids.h, few of them are referenced from C code. With this patch, all entries in pg_proc.dat have macros in fmgroids.h. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8e1f37c07aafd4bb7aa6e1e1982010af11f8b5c7 Modified Files -- src/backend/optimizer/util/clauses.c | 2 +- src/backend/utils/Gen_fmgrtab.pl | 51 ++-- src/backend/utils/adt/ruleutils.c| 2 +- 3 files changed, 28 insertions(+), 27 deletions(-)
pgsql: Remove special checks for pg_rewrite.ev_qual and ev_action being
Remove special checks for pg_rewrite.ev_qual and ev_action being NULL. make_ruledef() and make_viewdef() were coded to cope with possible null-ness of these columns, but they've been marked BKI_FORCE_NOT_NULL for some time. So there's not really any need to do more than what we do for the other columns of pg_rewrite, i.e. just Assert that we got non-null results. (There is a school of thought that says Asserts aren't the thing to do to check for corrupt data, but surely here is not the place to start if we want such a policy.) Also, remove long-dead-if-indeed-it-ever-wasn't-dead handling of an empty actions list in make_ruledef(). That's an error case and should be treated as such. (DO INSTEAD NOTHING is represented by a CMD_NOTHING Query, not an empty list; cf transformRuleStmt.) Kyotaro Horiguchi, some changes by me Discussion: https://postgr.es/m/CAEudQApoA=tmtic6xepyp_hsnz8xttovthk_0x7d_afqyow...@mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e1339bfc7a2fd4629e1c3f8f919ddd05b4745e13 Modified Files -- src/backend/utils/adt/ruleutils.c | 26 +++--- 1 file changed, 11 insertions(+), 15 deletions(-)
pgsql: Fix unportable use of getnameinfo() in pg_hba_file_rules view.
Fix unportable use of getnameinfo() in pg_hba_file_rules view. fill_hba_line() thought it could get away with passing sizeof(struct sockaddr_storage) rather than the actual addrlen previously returned by getaddrinfo(). While that appears to work on many platforms, it does not work on FreeBSD 11: you get back a failure, which leads to the view showing NULL for the address and netmask columns in all rows. The POSIX spec for getnameinfo() is pretty clearly on FreeBSD's side here: you should pass the actual address length. So it seems plausible that there are other platforms where this coding also fails, and we just hadn't noticed. Also, IMO the fact that getnameinfo() failure leads to a NULL output is pretty bogus in itself. Our pg_getnameinfo_all() wrapper is careful to emit "???" on failure, and we should use that in such cases. NULL should only be emitted in rows that don't have IP addresses. Per bug #16695 from Peter Vandivier. Back-patch to v10 where this code was added. Discussion: https://postgr.es/m/[email protected] Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/d3befe9b98d523d7ae04d93c295001385550e4a3 Modified Files -- src/backend/libpq/hba.c | 31 +-- src/include/libpq/hba.h | 6 ++ 2 files changed, 27 insertions(+), 10 deletions(-)
pgsql: Fix unportable use of getnameinfo() in pg_hba_file_rules view.
Fix unportable use of getnameinfo() in pg_hba_file_rules view. fill_hba_line() thought it could get away with passing sizeof(struct sockaddr_storage) rather than the actual addrlen previously returned by getaddrinfo(). While that appears to work on many platforms, it does not work on FreeBSD 11: you get back a failure, which leads to the view showing NULL for the address and netmask columns in all rows. The POSIX spec for getnameinfo() is pretty clearly on FreeBSD's side here: you should pass the actual address length. So it seems plausible that there are other platforms where this coding also fails, and we just hadn't noticed. Also, IMO the fact that getnameinfo() failure leads to a NULL output is pretty bogus in itself. Our pg_getnameinfo_all() wrapper is careful to emit "???" on failure, and we should use that in such cases. NULL should only be emitted in rows that don't have IP addresses. Per bug #16695 from Peter Vandivier. Back-patch to v10 where this code was added. Discussion: https://postgr.es/m/[email protected] Branch -- REL_10_STABLE Details --- https://git.postgresql.org/pg/commitdiff/7827497ba2e64fad80d44841758c2ec101f099f9 Modified Files -- src/backend/libpq/hba.c | 31 +-- src/include/libpq/hba.h | 6 ++ 2 files changed, 27 insertions(+), 10 deletions(-)
pgsql: Fix unportable use of getnameinfo() in pg_hba_file_rules view.
Fix unportable use of getnameinfo() in pg_hba_file_rules view. fill_hba_line() thought it could get away with passing sizeof(struct sockaddr_storage) rather than the actual addrlen previously returned by getaddrinfo(). While that appears to work on many platforms, it does not work on FreeBSD 11: you get back a failure, which leads to the view showing NULL for the address and netmask columns in all rows. The POSIX spec for getnameinfo() is pretty clearly on FreeBSD's side here: you should pass the actual address length. So it seems plausible that there are other platforms where this coding also fails, and we just hadn't noticed. Also, IMO the fact that getnameinfo() failure leads to a NULL output is pretty bogus in itself. Our pg_getnameinfo_all() wrapper is careful to emit "???" on failure, and we should use that in such cases. NULL should only be emitted in rows that don't have IP addresses. Per bug #16695 from Peter Vandivier. Back-patch to v10 where this code was added. Discussion: https://postgr.es/m/[email protected] Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/0a4b34031279d938c2e59df8df7159d6c11e39b5 Modified Files -- src/backend/libpq/hba.c | 31 +-- src/include/libpq/hba.h | 7 ++- 2 files changed, 27 insertions(+), 11 deletions(-)
pgsql: Fix unportable use of getnameinfo() in pg_hba_file_rules view.
Fix unportable use of getnameinfo() in pg_hba_file_rules view. fill_hba_line() thought it could get away with passing sizeof(struct sockaddr_storage) rather than the actual addrlen previously returned by getaddrinfo(). While that appears to work on many platforms, it does not work on FreeBSD 11: you get back a failure, which leads to the view showing NULL for the address and netmask columns in all rows. The POSIX spec for getnameinfo() is pretty clearly on FreeBSD's side here: you should pass the actual address length. So it seems plausible that there are other platforms where this coding also fails, and we just hadn't noticed. Also, IMO the fact that getnameinfo() failure leads to a NULL output is pretty bogus in itself. Our pg_getnameinfo_all() wrapper is careful to emit "???" on failure, and we should use that in such cases. NULL should only be emitted in rows that don't have IP addresses. Per bug #16695 from Peter Vandivier. Back-patch to v10 where this code was added. Discussion: https://postgr.es/m/[email protected] Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/a58a631b4af0c027c07ea7cc4110a60b5f279ddf Modified Files -- src/backend/libpq/hba.c | 31 +-- src/include/libpq/hba.h | 6 ++ 2 files changed, 27 insertions(+), 10 deletions(-)
pgsql: Fix unportable use of getnameinfo() in pg_hba_file_rules view.
Fix unportable use of getnameinfo() in pg_hba_file_rules view. fill_hba_line() thought it could get away with passing sizeof(struct sockaddr_storage) rather than the actual addrlen previously returned by getaddrinfo(). While that appears to work on many platforms, it does not work on FreeBSD 11: you get back a failure, which leads to the view showing NULL for the address and netmask columns in all rows. The POSIX spec for getnameinfo() is pretty clearly on FreeBSD's side here: you should pass the actual address length. So it seems plausible that there are other platforms where this coding also fails, and we just hadn't noticed. Also, IMO the fact that getnameinfo() failure leads to a NULL output is pretty bogus in itself. Our pg_getnameinfo_all() wrapper is careful to emit "???" on failure, and we should use that in such cases. NULL should only be emitted in rows that don't have IP addresses. Per bug #16695 from Peter Vandivier. Back-patch to v10 where this code was added. Discussion: https://postgr.es/m/[email protected] Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/f28b089cbd3541a6df05a7e2907e40b5e516a063 Modified Files -- src/backend/libpq/hba.c | 31 +-- src/include/libpq/hba.h | 6 ++ 2 files changed, 27 insertions(+), 10 deletions(-)
pgsql: Fix typos.
Fix typos. Author: Hou Zhijie Discussion: https://postgr.es/m/855a9421839d402b8b351d273c89a8f8@G08CNEXMBPEKD05.g08.fujitsu.local Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/8c2d8f6cc4848cf9276dff445bb0f2f664083eca Modified Files -- src/backend/storage/ipc/procarray.c | 2 +- src/include/access/xlogreader.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
