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

Commit6ccd052

Browse files
committed
[PGPRO-9026] Added check for attached column
1 parent61258f4 commit6ccd052

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

‎expected/rum_validate.out

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,9 +114,19 @@ SET enable_indexscan=on;
114114
SELECT a
115115
FROM test_rum
116116
WHERE a @@ to_tsquery('pg_catalog.english', 'bar')
117-
ORDER BY a <=> (to_tsquery('pg_catalog.english', 'bar'),0)
117+
ORDER BY a <=> (to_tsquery('pg_catalog.english', 'bar'),0);
118118
a
119119
------------------------------
120120
'bar':2,8 'foo':1,3,6 'qq':7
121121
(1 row)
122122

123+
-- PGPRO-9026: column and attached column cannot be the same
124+
CREATE TABLE test_array (i int2[]);
125+
CREATE INDEX idx_array ON test_array USING rum (i rum_anyarray_addon_ops) WITH (attach = 'i', to = 'i');
126+
ERROR: column "i" and attached column cannot be the same
127+
SELECT * FROM test_array WHERE i && '{1}';
128+
i
129+
---
130+
(0 rows)
131+
132+
DROP TABLE test_array;

‎sql/rum_validate.sql

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,10 @@ SET enable_indexscan=on;
5858
SELECT a
5959
FROM test_rum
6060
WHERE a @@ to_tsquery('pg_catalog.english','bar')
61-
ORDER BY a<=> (to_tsquery('pg_catalog.english','bar'),0)
61+
ORDER BY a<=> (to_tsquery('pg_catalog.english','bar'),0);
62+
63+
-- PGPRO-9026: column and attached column cannot be the same
64+
CREATETABLEtest_array (i int2[]);
65+
CREATEINDEXidx_arrayON test_array USING rum (i rum_anyarray_addon_ops) WITH (attach='i', to='i');
66+
SELECT*FROM test_arrayWHERE i &&'{1}';
67+
DROPTABLE test_array;

‎src/rumutil.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ initRumState(RumState * state, Relation index)
211211

212212
if (!AttributeNumberIsValid(state->attrnAddToColumn))
213213
elog(ERROR,"attribute \"%s\" is not found in index",colname);
214+
215+
if (state->attrnAddToColumn==state->attrnAttachColumn)
216+
elog(ERROR,"column \"%s\" and attached column cannot be the same",colname);
214217
}
215218

216219
if (!(AttributeNumberIsValid(state->attrnAttachColumn)&&

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp