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

Commit9043ef3

Browse files
committed
Don't warn about creating temporary or unlogged hash indexes.
Warning people that no WAL-logging will be done doesn't make sensein this case.Michael Paquier
1 parent91118f1 commit9043ef3

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

‎src/backend/commands/indexcmds.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ DefineIndex(Oid relationId,
490490
accessMethodId=HeapTupleGetOid(tuple);
491491
accessMethodForm= (Form_pg_am)GETSTRUCT(tuple);
492492

493-
if (strcmp(accessMethodName,"hash")==0)
493+
if (strcmp(accessMethodName,"hash")==0&&
494+
RelationNeedsWAL(rel))
494495
ereport(WARNING,
495496
(errmsg("hash indexes are not WAL-logged and their use is discouraged")));
496497

‎src/test/regress/expected/create_index.out

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2342,6 +2342,9 @@ CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops);
23422342
WARNING: hash indexes are not WAL-logged and their use is discouraged
23432343
CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops);
23442344
WARNING: hash indexes are not WAL-logged and their use is discouraged
2345+
CREATE UNLOGGED TABLE unlogged_hash_table (id int4);
2346+
CREATE INDEX unlogged_hash_index ON unlogged_hash_table USING hash (id int4_ops);
2347+
DROP TABLE unlogged_hash_table;
23452348
-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);
23462349
--
23472350
-- Test functional index

‎src/test/regress/sql/create_index.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,10 @@ CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops);
684684

685685
CREATEINDEXhash_f8_indexON hash_f8_heap USING hash (random float8_ops);
686686

687+
CREATE UNLOGGED TABLE unlogged_hash_table (id int4);
688+
CREATEINDEXunlogged_hash_indexON unlogged_hash_table USING hash (id int4_ops);
689+
DROPTABLE unlogged_hash_table;
690+
687691
-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);
688692

689693

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp