Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab2b0b5

Browse files
author
Karina Litskevich
committed
[PGPRO-11556] Fixes after review
1 parent738c8b7 commitab2b0b5

File tree

3 files changed

+40
-36
lines changed

3 files changed

+40
-36
lines changed

‎expected/array.out

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -854,27 +854,28 @@ DROP INDEX idx_array;
854854
/*
855855
* Check ordering using distance operator
856856
*
857-
* The idea of the test:
858-
* We want to check that index scan provides as correct ordering by distance
857+
* We want to check that index scan provides us correct ordering by distance
859858
* operator. File 'data/rum_array.data' contains two arrays that statisfy
860859
* i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
861-
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'. When
862-
* ordering by distance the order of this bunch of arrays with infinite
860+
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
861+
*
862+
* When ordering by distance the order of this bunch of arrays with infinite
863863
* distance is not determined and may depend of PostgreSQL version and system.
864-
* Adding another sort expression to ORDER BY may cause another plan that
865-
* doesn't use ordering provided by index.
866-
* That's why we use the query you see below. We substitute 'Infinity' distance
867-
* value with -1 because 'Infinity' are printed differently in output in
868-
* different PostgreSQL versions. We substitute arrays that have infinite
869-
* distance with {-1} because their order is undefined and we wnat to determine
870-
* the test output.
864+
* We don't add another sort expression to ORDER BY because that might cause
865+
* the planner to avoid using the index. Instead, we replace arrays that have
866+
* infinite distance with {-1} to unambiguously determine the test output.
867+
*
868+
* 'Infinity' is printed differently in the output in different PostgreSQL
869+
* versions, so we replace it with -1.
871870
*/
872871
CREATE TABLE test_array_order (
873872
i int2[]
874873
);
875874
\copy test_array_order(i) from 'data/rum_array.data';
876875
CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
877-
/* Check that plan of the query uses ordering provided by index scan */
876+
/*
877+
* Check that plan of the query uses ordering provided by index scan
878+
*/
878879
EXPLAIN (COSTS OFF)
879880
SELECT
880881
CASE WHEN distance = 'Infinity' THEN '{-1}'

‎expected/array_1.out

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -847,27 +847,28 @@ DROP INDEX idx_array;
847847
/*
848848
* Check ordering using distance operator
849849
*
850-
* The idea of the test:
851-
* We want to check that index scan provides as correct ordering by distance
850+
* We want to check that index scan provides us correct ordering by distance
852851
* operator. File 'data/rum_array.data' contains two arrays that statisfy
853852
* i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
854-
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'. When
855-
* ordering by distance the order of this bunch of arrays with infinite
853+
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
854+
*
855+
* When ordering by distance the order of this bunch of arrays with infinite
856856
* distance is not determined and may depend of PostgreSQL version and system.
857-
* Adding another sort expression to ORDER BY may cause another plan that
858-
* doesn't use ordering provided by index.
859-
* That's why we use the query you see below. We substitute 'Infinity' distance
860-
* value with -1 because 'Infinity' are printed differently in output in
861-
* different PostgreSQL versions. We substitute arrays that have infinite
862-
* distance with {-1} because their order is undefined and we wnat to determine
863-
* the test output.
857+
* We don't add another sort expression to ORDER BY because that might cause
858+
* the planner to avoid using the index. Instead, we replace arrays that have
859+
* infinite distance with {-1} to unambiguously determine the test output.
860+
*
861+
* 'Infinity' is printed differently in the output in different PostgreSQL
862+
* versions, so we replace it with -1.
864863
*/
865864
CREATE TABLE test_array_order (
866865
i int2[]
867866
);
868867
\copy test_array_order(i) from 'data/rum_array.data';
869868
CREATE INDEX idx_array_order ON test_array_order USING rum (i rum_anyarray_ops);
870-
/* Check that plan of the query uses ordering provided by index scan */
869+
/*
870+
* Check that plan of the query uses ordering provided by index scan
871+
*/
871872
EXPLAIN (COSTS OFF)
872873
SELECT
873874
CASE WHEN distance = 'Infinity' THEN '{-1}'

‎sql/array.sql

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -211,20 +211,19 @@ DROP INDEX idx_array;
211211
/*
212212
* Check ordering using distance operator
213213
*
214-
* The idea of the test:
215-
* We want to check that index scan provides as correct ordering by distance
214+
* We want to check that index scan provides us correct ordering by distance
216215
* operator. File 'data/rum_array.data' contains two arrays that statisfy
217216
* i @> '{23,20}' and have finite distance i <=> '{51}', and a bunch of arrays
218-
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'. When
219-
* ordering by distance the order of this bunch of arrays with infinite
217+
* that statisfy i @> '{23,20}' and have infinite distance i <=> '{51}'.
218+
*
219+
* When ordering by distance the order of this bunch of arrays with infinite
220220
* distance is not determined and may depend of PostgreSQL version and system.
221-
* Adding another sort expression to ORDER BY may cause another plan that
222-
* doesn't use ordering provided by index.
223-
* That's why we use the query you see below. We substitute 'Infinity' distance
224-
* value with -1 because 'Infinity' are printed differently in output in
225-
* different PostgreSQL versions. We substitute arrays that have infinite
226-
* distance with {-1} because their order is undefined and we wnat to determine
227-
* the test output.
221+
* We don't add another sort expression to ORDER BY because that might cause
222+
* the planner to avoid using the index. Instead, we replace arrays that have
223+
* infinite distance with {-1} to unambiguously determine the test output.
224+
*
225+
* 'Infinity' is printed differently in the output in different PostgreSQL
226+
* versions, so we replace it with -1.
228227
*/
229228

230229
CREATETABLEtest_array_order (
@@ -234,7 +233,10 @@ CREATE TABLE test_array_order (
234233

235234
CREATEINDEXidx_array_orderON test_array_order USING rum (i rum_anyarray_ops);
236235

237-
/* Check that plan of the query uses ordering provided by index scan*/
236+
/*
237+
* Check that plan of the query uses ordering provided by index scan
238+
*/
239+
238240
EXPLAIN (COSTS OFF)
239241
SELECT
240242
CASE WHEN distance='Infinity' THEN'{-1}'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp