pgsql: Fix hypothetical bug in heap backward scans

2021-01-24 Thread David Rowley
Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: 
https://postgr.es/m/caaphdvpgc9h0_ovd2ctgbcxcs1n-qdyzsebrnuh+0cwja9c...@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
--
REL9_5_STABLE

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

Modified Files
--
src/backend/access/heap/heapam.c | 20 
1 file changed, 16 insertions(+), 4 deletions(-)



pgsql: Fix hypothetical bug in heap backward scans

2021-01-24 Thread David Rowley
Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: 
https://postgr.es/m/caaphdvpgc9h0_ovd2ctgbcxcs1n-qdyzsebrnuh+0cwja9c...@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/317de9c45d88dd67718b4e411e2918ffbc96f5ae

Modified Files
--
src/backend/access/heap/heapam.c | 20 
1 file changed, 16 insertions(+), 4 deletions(-)



pgsql: Fix hypothetical bug in heap backward scans

2021-01-24 Thread David Rowley
Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: 
https://postgr.es/m/caaphdvpgc9h0_ovd2ctgbcxcs1n-qdyzsebrnuh+0cwja9c...@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/34eeebbb03037e60606e5f6748c46a789eecd308

Modified Files
--
src/backend/access/heap/heapam.c | 20 
1 file changed, 16 insertions(+), 4 deletions(-)



pgsql: Fix hypothetical bug in heap backward scans

2021-01-24 Thread David Rowley
Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: 
https://postgr.es/m/caaphdvpgc9h0_ovd2ctgbcxcs1n-qdyzsebrnuh+0cwja9c...@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/06cdfe21d3233e3010d5332d60f27886c28b1a25

Modified Files
--
src/backend/access/heap/heapam.c | 20 
1 file changed, 16 insertions(+), 4 deletions(-)



pgsql: Fix hypothetical bug in heap backward scans

2021-01-24 Thread David Rowley
Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: 
https://postgr.es/m/caaphdvpgc9h0_ovd2ctgbcxcs1n-qdyzsebrnuh+0cwja9c...@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/7632ef5a71af0bef8384ceaa44d5486d555d8394

Modified Files
--
src/backend/access/heap/heapam.c | 20 
1 file changed, 16 insertions(+), 4 deletions(-)



pgsql: Fix hypothetical bug in heap backward scans

2021-01-24 Thread David Rowley
Fix hypothetical bug in heap backward scans

Both heapgettup() and heapgettup_pagemode() incorrectly set the first page
to scan in a backward scan in which the number of pages to scan was
specified by heap_setscanlimits().  The code incorrectly started the scan
at the end of the relation when startBlk was 0, or otherwise at
startBlk - 1, neither of which is correct when only scanning a subset of
pages.

The fix here checks if heap_setscanlimits() has changed the number of
pages to scan and if so we set the first page to scan as the final page in
the specified range during backward scans.

Proper adjustment of this code was forgotten when heap_setscanlimits() was
added in 7516f5259 back in 9.5.  However, practice, nowhere in core code
performs backward scans after having used heap_setscanlimits(), yet, it is
possible an extension uses the heap functions in this way, hence
backpatch.

An upcoming patch does use heap_setscanlimits() with backward scans, so
this must be fixed before that can go in.

Author: David Rowley
Discussion: 
https://postgr.es/m/caaphdvpgc9h0_ovd2ctgbcxcs1n-qdyzsebrnuh+0cwja9c...@mail.gmail.com
Backpatch-through: 9.5, all supported versions

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/16dfe253e31f75b60e93acc0c2b5bbf19936c074

Modified Files
--
src/backend/access/heap/heapam.c | 20 
1 file changed, 16 insertions(+), 4 deletions(-)



pgsql: Fix ALTER PUBLICATION...DROP TABLE behavior.

2021-01-24 Thread Amit Kapila
Fix ALTER PUBLICATION...DROP TABLE behavior.

Commit 69bd60672 fixed the initialization of streamed transactions for
RelationSyncEntry. It forgot to initialize the publication actions while
invalidating the RelationSyncEntry due to which even though the relation
is dropped from a particular publication we still publish its changes. Fix
it by initializing pubactions when entry got invalidated.

Author: Japin Li and Bharath Rupireddy
Reviewed-by: Amit Kapila
Discussion: 
https://postgr.es/m/calj2acv+0ufpczs5czygbpujm9p0hg1qdozai_43ou7bqhu...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/40ab64c1ec1cb9bd73695f519cf66ddbb97d8144

Modified Files
--
src/backend/replication/pgoutput/pgoutput.c | 11 
src/test/subscription/t/001_rep_changes.pl  | 95 -
2 files changed, 105 insertions(+), 1 deletion(-)



pgsql: Make storage/standby.h compile standalone again.

2021-01-24 Thread Tom Lane
Make storage/standby.h compile standalone again.

This file has failed headerscheck/cpluspluscheck verification since
commit 0650ff230, as a result of referencing typedef TimestampTz
without including the appropriate header.

Branch
--
master

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

Modified Files
--
src/include/storage/standby.h | 1 +
1 file changed, 1 insertion(+)



pgsql: Update time zone data files to tzdata release 2021a.

2021-01-24 Thread Tom Lane
Update time zone data files to tzdata release 2021a.

DST law changes in Russia (Volgograd zone) and South Sudan.
Historical corrections for Australia, Bahamas, Belize, Bermuda,
Ghana, Israel, Kenya, Nigeria, Palestine, Seychelles, and Vanuatu.
Notably, the Australia/Currie zone has been corrected to the point
where it is identical to Australia/Hobart.

Branch
--
master

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

Modified Files
--
src/timezone/Makefile   |   3 +-
src/timezone/data/tzdata.zi | 226 +---
2 files changed, 133 insertions(+), 96 deletions(-)



pgsql: Update time zone data files to tzdata release 2021a.

2021-01-24 Thread Tom Lane
Update time zone data files to tzdata release 2021a.

DST law changes in Russia (Volgograd zone) and South Sudan.
Historical corrections for Australia, Bahamas, Belize, Bermuda,
Ghana, Israel, Kenya, Nigeria, Palestine, Seychelles, and Vanuatu.
Notably, the Australia/Currie zone has been corrected to the point
where it is identical to Australia/Hobart.

Branch
--
REL_11_STABLE

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

Modified Files
--
src/timezone/data/tzdata.zi | 226 +---
1 file changed, 131 insertions(+), 95 deletions(-)



pgsql: Update time zone data files to tzdata release 2021a.

2021-01-24 Thread Tom Lane
Update time zone data files to tzdata release 2021a.

DST law changes in Russia (Volgograd zone) and South Sudan.
Historical corrections for Australia, Bahamas, Belize, Bermuda,
Ghana, Israel, Kenya, Nigeria, Palestine, Seychelles, and Vanuatu.
Notably, the Australia/Currie zone has been corrected to the point
where it is identical to Australia/Hobart.

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/58a545344147c870845adccc284443f990a43b65

Modified Files
--
src/timezone/Makefile   |   3 +-
src/timezone/data/tzdata.zi | 226 +---
2 files changed, 133 insertions(+), 96 deletions(-)



pgsql: Update time zone data files to tzdata release 2021a.

2021-01-24 Thread Tom Lane
Update time zone data files to tzdata release 2021a.

DST law changes in Russia (Volgograd zone) and South Sudan.
Historical corrections for Australia, Bahamas, Belize, Bermuda,
Ghana, Israel, Kenya, Nigeria, Palestine, Seychelles, and Vanuatu.
Notably, the Australia/Currie zone has been corrected to the point
where it is identical to Australia/Hobart.

Branch
--
REL9_5_STABLE

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

Modified Files
--
src/timezone/data/tzdata.zi | 226 +---
1 file changed, 131 insertions(+), 95 deletions(-)



pgsql: Update time zone data files to tzdata release 2021a.

2021-01-24 Thread Tom Lane
Update time zone data files to tzdata release 2021a.

DST law changes in Russia (Volgograd zone) and South Sudan.
Historical corrections for Australia, Bahamas, Belize, Bermuda,
Ghana, Israel, Kenya, Nigeria, Palestine, Seychelles, and Vanuatu.
Notably, the Australia/Currie zone has been corrected to the point
where it is identical to Australia/Hobart.

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/728971d5f10e8baaf6cd7c32ad95e577893abb77

Modified Files
--
src/timezone/data/tzdata.zi | 226 +---
1 file changed, 131 insertions(+), 95 deletions(-)



pgsql: Update time zone data files to tzdata release 2021a.

2021-01-24 Thread Tom Lane
Update time zone data files to tzdata release 2021a.

DST law changes in Russia (Volgograd zone) and South Sudan.
Historical corrections for Australia, Bahamas, Belize, Bermuda,
Ghana, Israel, Kenya, Nigeria, Palestine, Seychelles, and Vanuatu.
Notably, the Australia/Currie zone has been corrected to the point
where it is identical to Australia/Hobart.

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/7e078675168befe07b40b472a315de5423c2600a

Modified Files
--
src/timezone/data/tzdata.zi | 226 +---
1 file changed, 131 insertions(+), 95 deletions(-)



pgsql: Add a simple test for contrib/auto_explain.

2021-01-24 Thread Tom Lane
Add a simple test for contrib/auto_explain.

This module formerly had zero test coverage.

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

Branch
--
master

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

Modified Files
--
contrib/auto_explain/.gitignore|  4 +++
contrib/auto_explain/Makefile  |  2 ++
contrib/auto_explain/t/001_auto_explain.pl | 52 ++
3 files changed, 58 insertions(+)



pgsql: Remove make_diff set of tools

2021-01-24 Thread Magnus Hagander
Remove make_diff set of tools

These are mostly obsoleted by the switch to git, and it's easier to
remove them than to update the incorrect documentation.

Discussion: 
https://postgr.es/m/cabuevewmasmn4wrj6ragbx43sj10ctfmhcma_-7ka3pdymw...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/8a337b0ed21c654521da137159b8b9327a5cb971

Modified Files
--
src/tools/make_diff/README   | 39 ---
src/tools/make_diff/cporig   | 11 ---
src/tools/make_diff/difforig | 14 --
src/tools/make_diff/rmorig   |  9 -
4 files changed, 73 deletions(-)