From e9f2d3e6334f8e2413dd4c72a504090252d7bfba Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Tue, 11 Jun 2024 08:53:19 +0300 Subject: [PATCH 1/9] PGPRO-10316 Fix compiler error This change fixes compiler error that was introduced by the commit https://github.com/postgres/postgres/commit/6ed83d5fa55cf6e6c9d1be34ec10730c48eba763 --- expected/array.out | 14 +++++++------- sql/array.sql | 2 +- src/rumsort.c | 30 ++++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/expected/array.out b/expected/array.out index 4094d98492..4c53b50f55 100644 --- a/expected/array.out +++ b/expected/array.out @@ -864,20 +864,20 @@ SELECT i, END distance FROM (SELECT *, (i <=> '{51}') AS distance - FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t; + FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}', i) t; i | distance ---------------------+------------------ {20,23,51} | 1.73205080756888 {33,51,20,77,23,65} | 2.44948974278318 - {23,76,34,23,2,20} | -1 - {20,60,45,23,29} | -1 - {23,89,38,20,40,95} | -1 - {23,20,72} | -1 - {73,23,20} | -1 {6,97,20,89,23} | -1 + {18,23,10,90,15,20} | -1 + {20,60,45,23,29} | -1 {20,98,30,23,1,66} | -1 + {23,20,72} | -1 + {23,76,34,23,2,20} | -1 + {23,89,38,20,40,95} | -1 {57,23,39,46,50,20} | -1 + {73,23,20} | -1 {81,20,26,22,23} | -1 - {18,23,10,90,15,20} | -1 (12 rows) diff --git a/sql/array.sql b/sql/array.sql index 11defc9e07..55cbd5a630 100644 --- a/sql/array.sql +++ b/sql/array.sql @@ -216,4 +216,4 @@ SELECT i, END distance FROM (SELECT *, (i <=> '{51}') AS distance - FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t; + FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}', i) t; diff --git a/src/rumsort.c b/src/rumsort.c index b5691301c9..8cf9450c30 100644 --- a/src/rumsort.c +++ b/src/rumsort.c @@ -488,11 +488,22 @@ rum_tuplesort_putrum(RumTuplesortstate *state, RumSortItem *item) { MemoryContext oldcontext; SortTuple stup; - +#if PG_VERSION_NUM >= 170000 + MinimalTuple tuple = (MinimalTuple)item; + Size tuplen; + TuplesortPublic *base = TuplesortstateGetPublic((TuplesortPublic *)state); +#endif oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); copytup_rum(state, &stup, item); -#if PG_VERSION_NUM >= 160000 +#if PG_VERSION_NUM >= 170000 + /* GetMemoryChunkSpace is not supported for bump contexts */ + if (TupleSortUseBumpTupleCxt(base->sortopt)) + tuplen = MAXALIGN(tuple->t_len); + else + tuplen = GetMemoryChunkSpace(tuple); + tuplesort_puttuple_common(state, &stup, false, tuplen); +#elif PG_VERSION_NUM >= 160000 tuplesort_puttuple_common(state, &stup, false); #else puttuple_common(state, &stup); @@ -506,11 +517,22 @@ rum_tuplesort_putrumitem(RumTuplesortstate *state, RumScanItem *item) { MemoryContext oldcontext; SortTuple stup; - +#if PG_VERSION_NUM >= 170000 + MinimalTuple tuple = (MinimalTuple)item; + Size tuplen; + TuplesortPublic *base = TuplesortstateGetPublic((TuplesortPublic *)state); +#endif oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); copytup_rumitem(state, &stup, item); -#if PG_VERSION_NUM >= 160000 +#if PG_VERSION_NUM >= 170000 + /* GetMemoryChunkSpace is not supported for bump contexts */ + if (TupleSortUseBumpTupleCxt(base->sortopt)) + tuplen = MAXALIGN(tuple->t_len); + else + tuplen = GetMemoryChunkSpace(tuple); + tuplesort_puttuple_common(state, &stup, false, tuplen); +#elif PG_VERSION_NUM >= 160000 tuplesort_puttuple_common(state, &stup, false); #else puttuple_common(state, &stup); From 09270feb9ce40c2547038667ac3d90053b260e1d Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Mon, 1 Jul 2024 09:30:36 +0300 Subject: [PATCH 2/9] PGPRO-10316 Fix Travis tests --- travis/docker-compose.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/travis/docker-compose.yml b/travis/docker-compose.yml index 471ab779f2..0544d8597d 100644 --- a/travis/docker-compose.yml +++ b/travis/docker-compose.yml @@ -1,2 +1,3 @@ -tests: +services: + tests: build: . From 07529445e0e4dfe1b69936cec26cf8317e6eba0b Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Thu, 5 Sep 2024 14:29:12 +0300 Subject: [PATCH 3/9] PGPRO-10316 Fix array test on 32 bit systems --- expected/array_1.out | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/expected/array_1.out b/expected/array_1.out index ec3abfb693..9e01f765fd 100644 --- a/expected/array_1.out +++ b/expected/array_1.out @@ -862,15 +862,16 @@ SELECT i, ---------------------+------------------ {20,23,51} | 1.73205080756888 {33,51,20,77,23,65} | 2.44948974278318 + {18,23,10,90,15,20} | -1 {23,76,34,23,2,20} | -1 - {20,60,45,23,29} | -1 + {73,23,20} | -1 {23,89,38,20,40,95} | -1 {23,20,72} | -1 - {73,23,20} | -1 + {20,60,45,23,29} | -1 + {81,20,26,22,23} | -1 {6,97,20,89,23} | -1 {20,98,30,23,1,66} | -1 {57,23,39,46,50,20} | -1 - {81,20,26,22,23} | -1 - {18,23,10,90,15,20} | -1 (12 rows) + From a82ed097ca57d956bb9276ee962aeabf46ebe9f5 Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Mon, 9 Sep 2024 10:16:16 +0300 Subject: [PATCH 4/9] PGPRO-10316 Fix array test --- expected/array.out | 6 +++--- sql/array.sql | 4 +++- src/rumsort.c | 2 ++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/expected/array.out b/expected/array.out index 4c53b50f55..62571a4206 100644 --- a/expected/array.out +++ b/expected/array.out @@ -864,18 +864,18 @@ SELECT i, END distance FROM (SELECT *, (i <=> '{51}') AS distance - FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}', i) t; + FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t ORDER BY i; i | distance ---------------------+------------------ - {20,23,51} | 1.73205080756888 - {33,51,20,77,23,65} | 2.44948974278318 {6,97,20,89,23} | -1 {18,23,10,90,15,20} | -1 + {20,23,51} | 1.73205080756888 {20,60,45,23,29} | -1 {20,98,30,23,1,66} | -1 {23,20,72} | -1 {23,76,34,23,2,20} | -1 {23,89,38,20,40,95} | -1 + {33,51,20,77,23,65} | 2.44948974278318 {57,23,39,46,50,20} | -1 {73,23,20} | -1 {81,20,26,22,23} | -1 diff --git a/sql/array.sql b/sql/array.sql index 55cbd5a630..e21ff348bc 100644 --- a/sql/array.sql +++ b/sql/array.sql @@ -1,3 +1,5 @@ +-- 64 bit output in *.out, 32 bit output in *_1.out + set enable_seqscan=off; set enable_sort=off; @@ -216,4 +218,4 @@ SELECT i, END distance FROM (SELECT *, (i <=> '{51}') AS distance - FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}', i) t; + FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t ORDER BY i; diff --git a/src/rumsort.c b/src/rumsort.c index 8cf9450c30..96784cd192 100644 --- a/src/rumsort.c +++ b/src/rumsort.c @@ -493,6 +493,7 @@ rum_tuplesort_putrum(RumTuplesortstate *state, RumSortItem *item) Size tuplen; TuplesortPublic *base = TuplesortstateGetPublic((TuplesortPublic *)state); #endif + oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); copytup_rum(state, &stup, item); @@ -522,6 +523,7 @@ rum_tuplesort_putrumitem(RumTuplesortstate *state, RumScanItem *item) Size tuplen; TuplesortPublic *base = TuplesortstateGetPublic((TuplesortPublic *)state); #endif + oldcontext = MemoryContextSwitchTo(rum_tuplesort_get_memorycontext(state)); copytup_rumitem(state, &stup, item); From 1d61e3196879b54485b988a2ae9910412e5605ad Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Mon, 9 Sep 2024 10:39:42 +0300 Subject: [PATCH 5/9] PGPRO-10316 Fix array.out --- expected/array.out | 2 ++ 1 file changed, 2 insertions(+) diff --git a/expected/array.out b/expected/array.out index 62571a4206..d7d2e1b460 100644 --- a/expected/array.out +++ b/expected/array.out @@ -1,3 +1,5 @@ +-- 64 bit output in *.out, 32 bit output in *_1.out + set enable_seqscan=off; set enable_sort=off; /* From 1dada997afd6d213a2db6ca9735ef6e9c9ad7e23 Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Mon, 9 Sep 2024 11:03:33 +0300 Subject: [PATCH 6/9] PGPRO-10316 Remove ORDER BY i --- expected/array.out | 21 +++++++++------------ expected/array_1.out | 13 ++++++------- sql/array.sql | 4 +--- 3 files changed, 16 insertions(+), 22 deletions(-) diff --git a/expected/array.out b/expected/array.out index d7d2e1b460..c23400c05f 100644 --- a/expected/array.out +++ b/expected/array.out @@ -1,5 +1,3 @@ --- 64 bit output in *.out, 32 bit output in *_1.out - set enable_seqscan=off; set enable_sort=off; /* @@ -866,20 +864,19 @@ SELECT i, END distance FROM (SELECT *, (i <=> '{51}') AS distance - FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t ORDER BY i; + FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t; i | distance ---------------------+------------------ - {6,97,20,89,23} | -1 - {18,23,10,90,15,20} | -1 {20,23,51} | 1.73205080756888 - {20,60,45,23,29} | -1 - {20,98,30,23,1,66} | -1 - {23,20,72} | -1 - {23,76,34,23,2,20} | -1 - {23,89,38,20,40,95} | -1 {33,51,20,77,23,65} | 2.44948974278318 + {6,97,20,89,23} | -1 + {20,98,30,23,1,66} | -1 {57,23,39,46,50,20} | -1 - {73,23,20} | -1 {81,20,26,22,23} | -1 + {73,23,20} | -1 + {18,23,10,90,15,20} | -1 + {23,76,34,23,2,20} | -1 + {20,60,45,23,29} | -1 + {23,89,38,20,40,95} | -1 + {23,20,72} | -1 (12 rows) - diff --git a/expected/array_1.out b/expected/array_1.out index 9e01f765fd..281e277e23 100644 --- a/expected/array_1.out +++ b/expected/array_1.out @@ -862,16 +862,15 @@ SELECT i, ---------------------+------------------ {20,23,51} | 1.73205080756888 {33,51,20,77,23,65} | 2.44948974278318 + {6,97,20,89,23} | -1 + {20,98,30,23,1,66} | -1 + {57,23,39,46,50,20} | -1 + {81,20,26,22,23} | -1 + {73,23,20} | -1 {18,23,10,90,15,20} | -1 {23,76,34,23,2,20} | -1 - {73,23,20} | -1 + {20,60,45,23,29} | -1 {23,89,38,20,40,95} | -1 {23,20,72} | -1 - {20,60,45,23,29} | -1 - {81,20,26,22,23} | -1 - {6,97,20,89,23} | -1 - {20,98,30,23,1,66} | -1 - {57,23,39,46,50,20} | -1 (12 rows) - diff --git a/sql/array.sql b/sql/array.sql index e21ff348bc..9a1312ae44 100644 --- a/sql/array.sql +++ b/sql/array.sql @@ -1,5 +1,3 @@ --- 64 bit output in *.out, 32 bit output in *_1.out - set enable_seqscan=off; set enable_sort=off; @@ -218,4 +216,4 @@ SELECT i, END distance FROM (SELECT *, (i <=> '{51}') AS distance - FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t ORDER BY i; + FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}'); From ef9653f658b397df30fd94d9bf7f4a41979faa50 Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Mon, 9 Sep 2024 11:23:03 +0300 Subject: [PATCH 7/9] PGPRO-10316 Remove ORDER BY i - 2 --- expected/array.out | 1 + sql/array.sql | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/expected/array.out b/expected/array.out index c23400c05f..7dcf38e32b 100644 --- a/expected/array.out +++ b/expected/array.out @@ -880,3 +880,4 @@ SELECT i, {23,89,38,20,40,95} | -1 {23,20,72} | -1 (12 rows) + diff --git a/sql/array.sql b/sql/array.sql index 9a1312ae44..11defc9e07 100644 --- a/sql/array.sql +++ b/sql/array.sql @@ -216,4 +216,4 @@ SELECT i, END distance FROM (SELECT *, (i <=> '{51}') AS distance - FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}'); + FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t; From 59195736e114a0a4928900e69bfc1fbcc6ea4d02 Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Mon, 9 Sep 2024 11:40:51 +0300 Subject: [PATCH 8/9] PGPRO-10316 Remove ORDER BY i - 3 --- expected/array_1.out | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/expected/array_1.out b/expected/array_1.out index 281e277e23..748d30a5d6 100644 --- a/expected/array_1.out +++ b/expected/array_1.out @@ -860,17 +860,17 @@ SELECT i, FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t; i | distance ---------------------+------------------ - {20,23,51} | 1.73205080756888 - {33,51,20,77,23,65} | 2.44948974278318 - {6,97,20,89,23} | -1 - {20,98,30,23,1,66} | -1 - {57,23,39,46,50,20} | -1 - {81,20,26,22,23} | -1 - {73,23,20} | -1 - {18,23,10,90,15,20} | -1 - {23,76,34,23,2,20} | -1 - {20,60,45,23,29} | -1 - {23,89,38,20,40,95} | -1 - {23,20,72} | -1 + {20,23,51} | 1.73205080756888 + {33,51,20,77,23,65} | 2.44948974278318 + {18,23,10,90,15,20} | -1 + {23,76,34,23,2,20} | -1 + {73,23,20} | -1 + {23,89,38,20,40,95} | -1 + {23,20,72} | -1 + {20,60,45,23,29} | -1 + {81,20,26,22,23} | -1 + {6,97,20,89,23} | -1 + {20,98,30,23,1,66} | -1 + {57,23,39,46,50,20} | -1 (12 rows) From d8ebc802bea04c0a6cf1911b1e83b661c748e571 Mon Sep 17 00:00:00 2001 From: Potapov Alexander Date: Mon, 9 Sep 2024 11:54:00 +0300 Subject: [PATCH 9/9] PGPRO-10316 Remove ORDER BY i - 4 --- expected/array_1.out | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/expected/array_1.out b/expected/array_1.out index 748d30a5d6..5c6e781def 100644 --- a/expected/array_1.out +++ b/expected/array_1.out @@ -860,17 +860,17 @@ SELECT i, FROM test_array_order WHERE i @> '{23,20}' ORDER BY i <=> '{51}') t; i | distance ---------------------+------------------ - {20,23,51} | 1.73205080756888 - {33,51,20,77,23,65} | 2.44948974278318 - {18,23,10,90,15,20} | -1 - {23,76,34,23,2,20} | -1 - {73,23,20} | -1 - {23,89,38,20,40,95} | -1 - {23,20,72} | -1 - {20,60,45,23,29} | -1 - {81,20,26,22,23} | -1 - {6,97,20,89,23} | -1 - {20,98,30,23,1,66} | -1 - {57,23,39,46,50,20} | -1 + {20,23,51} | 1.73205080756888 + {33,51,20,77,23,65} | 2.44948974278318 + {18,23,10,90,15,20} | -1 + {23,76,34,23,2,20} | -1 + {73,23,20} | -1 + {23,89,38,20,40,95} | -1 + {23,20,72} | -1 + {20,60,45,23,29} | -1 + {81,20,26,22,23} | -1 + {6,97,20,89,23} | -1 + {20,98,30,23,1,66} | -1 + {57,23,39,46,50,20} | -1 (12 rows) pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy