mirror of
https://github.com/postgres/postgres.git
synced 2025-05-02 11:44:50 +03:00
Add some minimal exercising of functional-index feature to regression
tests.
This commit is contained in:
parent
c92b450891
commit
7d66bf261c
@ -68,3 +68,16 @@ CREATE INDEX hash_name_index ON hash_name_heap USING hash (random name_ops);
|
|||||||
CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops);
|
CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops);
|
||||||
CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops);
|
CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops);
|
||||||
-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);
|
-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);
|
||||||
|
--
|
||||||
|
-- Test functional index
|
||||||
|
--
|
||||||
|
CREATE TABLE func_index_heap (f1 text, f2 text);
|
||||||
|
CREATE UNIQUE INDEX func_index_index on func_index_heap (textcat(f1,f2));
|
||||||
|
INSERT INTO func_index_heap VALUES('ABC','DEF');
|
||||||
|
INSERT INTO func_index_heap VALUES('AB','CDEFG');
|
||||||
|
INSERT INTO func_index_heap VALUES('QWE','RTY');
|
||||||
|
-- this should fail because of unique index:
|
||||||
|
INSERT INTO func_index_heap VALUES('ABCD', 'EF');
|
||||||
|
ERROR: Cannot insert a duplicate key into unique index func_index_index
|
||||||
|
-- but this shouldn't:
|
||||||
|
INSERT INTO func_index_heap VALUES('QWERTY');
|
||||||
|
@ -15,6 +15,7 @@ SELECT relname, relhasindex
|
|||||||
bt_name_heap | t
|
bt_name_heap | t
|
||||||
bt_txt_heap | t
|
bt_txt_heap | t
|
||||||
fast_emp4000 | t
|
fast_emp4000 | t
|
||||||
|
func_index_heap | t
|
||||||
hash_f8_heap | t
|
hash_f8_heap | t
|
||||||
hash_i4_heap | t
|
hash_i4_heap | t
|
||||||
hash_name_heap | t
|
hash_name_heap | t
|
||||||
@ -58,5 +59,5 @@ SELECT relname, relhasindex
|
|||||||
shighway | t
|
shighway | t
|
||||||
tenk1 | t
|
tenk1 | t
|
||||||
tenk2 | t
|
tenk2 | t
|
||||||
(48 rows)
|
(49 rows)
|
||||||
|
|
||||||
|
@ -599,6 +599,7 @@ SELECT user_relns() AS user_relns
|
|||||||
fast_emp4000
|
fast_emp4000
|
||||||
float4_tbl
|
float4_tbl
|
||||||
float8_tbl
|
float8_tbl
|
||||||
|
func_index_heap
|
||||||
hash_f8_heap
|
hash_f8_heap
|
||||||
hash_i4_heap
|
hash_i4_heap
|
||||||
hash_name_heap
|
hash_name_heap
|
||||||
@ -653,7 +654,7 @@ SELECT user_relns() AS user_relns
|
|||||||
toyemp
|
toyemp
|
||||||
varchar_tbl
|
varchar_tbl
|
||||||
xacttest
|
xacttest
|
||||||
(90 rows)
|
(91 rows)
|
||||||
|
|
||||||
--SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))) AS equip_name;
|
--SELECT name(equipment(hobby_construct(text 'skywalking', text 'mer'))) AS equip_name;
|
||||||
SELECT hobbies_by_name('basketball');
|
SELECT hobbies_by_name('basketball');
|
||||||
|
@ -90,3 +90,17 @@ CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops);
|
|||||||
|
|
||||||
-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);
|
-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);
|
||||||
|
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Test functional index
|
||||||
|
--
|
||||||
|
CREATE TABLE func_index_heap (f1 text, f2 text);
|
||||||
|
CREATE UNIQUE INDEX func_index_index on func_index_heap (textcat(f1,f2));
|
||||||
|
|
||||||
|
INSERT INTO func_index_heap VALUES('ABC','DEF');
|
||||||
|
INSERT INTO func_index_heap VALUES('AB','CDEFG');
|
||||||
|
INSERT INTO func_index_heap VALUES('QWE','RTY');
|
||||||
|
-- this should fail because of unique index:
|
||||||
|
INSERT INTO func_index_heap VALUES('ABCD', 'EF');
|
||||||
|
-- but this shouldn't:
|
||||||
|
INSERT INTO func_index_heap VALUES('QWERTY');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user