Debian Codegraph @

contrib/seg/sql/partition.sql

raw
1 --
2 -- Test that partitioned-index operations cope with objects that are
3 -- not in the secure search path. (This has little to do with seg,
4 -- but we need an opclass that isn't in pg_catalog, and the base system
5 -- has no such opclass.) Note that we need to test propagation of the
6 -- partitioned index's properties both to partitions that pre-date it
7 -- and to partitions created later.
8 --
9
10 create function mydouble(int) returns int strict immutable parallel safe
11 begin atomic select $1 * 2; end;
12
13 create collation mycollation from "POSIX";
14
15 create table pt (category int, sdata seg, tdata text)
16 partition by list (category);
17
18 -- pre-existing partition
19 create table pt12 partition of pt for values in (1,2);
20
21 insert into pt values(1, '0 .. 1'::seg, 'zed');
22
23 -- expression references object in public schema
24 create index pti1 on pt ((mydouble(category) + 1));
25 -- opclass in public schema
26 create index pti2 on pt (sdata seg_ops);
27 -- collation in public schema
28 create index pti3 on pt (tdata collate mycollation);
29
30 -- new partition
31 create table pt34 partition of pt for values in (3,4);
32
33 insert into pt values(4, '-1 .. 1'::seg, 'foo');
34
35 \d+ pt
36 \d+ pt12