|
| 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 | +create function mydouble(int) returns int strict immutable parallel safe |
| 10 | +begin atomic select $1 * 2; end; |
| 11 | +create collation mycollation from "POSIX"; |
| 12 | +create table pt (category int, sdata seg, tdata text) |
| 13 | + partition by list (category); |
| 14 | +-- pre-existing partition |
| 15 | +create table pt12 partition of pt for values in (1,2); |
| 16 | +insert into pt values(1, '0 .. 1'::seg, 'zed'); |
| 17 | +-- expression references object in public schema |
| 18 | +create index pti1 on pt ((mydouble(category) + 1)); |
| 19 | +-- opclass in public schema |
| 20 | +create index pti2 on pt (sdata seg_ops); |
| 21 | +-- collation in public schema |
| 22 | +create index pti3 on pt (tdata collate mycollation); |
| 23 | +-- new partition |
| 24 | +create table pt34 partition of pt for values in (3,4); |
| 25 | +insert into pt values(4, '-1 .. 1'::seg, 'foo'); |
| 26 | +\d+ pt |
| 27 | + Partitioned table "public.pt" |
| 28 | + Column | Type | Collation | Nullable | Default | Storage | Stats target | Description |
| 29 | +----------+---------+-----------+----------+---------+----------+--------------+------------- |
| 30 | + category | integer | | | | plain | | |
| 31 | + sdata | seg | | | | plain | | |
| 32 | + tdata | text | | | | extended | | |
| 33 | +Partition key: LIST (category) |
| 34 | +Indexes: |
| 35 | + "pti1" btree ((mydouble(category) + 1)) |
| 36 | + "pti2" btree (sdata) |
| 37 | + "pti3" btree (tdata COLLATE mycollation) |
| 38 | +Partitions: pt12 FOR VALUES IN (1, 2), |
| 39 | + pt34 FOR VALUES IN (3, 4) |
| 40 | + |
| 41 | +\d+ pt12 |
| 42 | + Table "public.pt12" |
| 43 | + Column | Type | Collation | Nullable | Default | Storage | Stats target | Description |
| 44 | +----------+---------+-----------+----------+---------+----------+--------------+------------- |
| 45 | + category | integer | | | | plain | | |
| 46 | + sdata | seg | | | | plain | | |
| 47 | + tdata | text | | | | extended | | |
| 48 | +Partition of: pt FOR VALUES IN (1, 2) |
| 49 | +Partition constraint: ((category IS NOT NULL) AND (category = ANY (ARRAY[1, 2]))) |
| 50 | +Indexes: |
| 51 | + "pt12_expr_idx" btree ((mydouble(category) + 1)) |
| 52 | + "pt12_sdata_idx" btree (sdata) |
| 53 | + "pt12_tdata_idx" btree (tdata COLLATE mycollation) |
| 54 | + |
0 commit comments