2 * No.1-1 CREATE EXTENSION
5 CREATE EXTENSION pg_dbms_stats;
7 DROP EXTENSION pg_dbms_stats;
8 CREATE EXTENSION pg_dbms_stats;
9 -- create no superuser and superuser
10 SET client_min_messages = warning;
11 DROP ROLE IF EXISTS regular_user;
12 CREATE ROLE regular_user LOGIN;
13 SET client_min_messages = fatal;
14 CREATE ROLE postgres SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
16 CREATE TABLE pt0(id integer, day date);
17 CREATE INDEX pt0_idx ON pt0(id);
18 CREATE TABLE st0(id integer, name char(5));
19 CREATE INDEX st0_idx ON st0(id);
20 CREATE TABLE st1(val integer, str text);
22 CREATE TABLE s0.st0(id integer, num integer);
23 CREATE INDEX st0_idx ON s0.st0(id);
24 CREATE TABLE s0.st1() INHERITS(s0.st0);
25 CREATE INDEX st1_idx ON s0.st1(id);
26 CREATE TABLE s0.st2(id integer, txt text);
27 CREATE INDEX st2_idx ON s0.st2(id);
29 SELECT st0.id, st0.num, st2.txt
30 FROM s0.st0 st0, s0.st2 st2
31 WHERE st0.id = st2.id;
32 CREATE TYPE s0.sc0 AS (num integer, txt text);
33 CREATE SEQUENCE s0.ss0 START 1;
35 CREATE TABLE s1.st0(id integer, num integer);
37 GRANT USAGE ON SCHEMA s0 TO regular_user;
38 GRANT SELECT ON TABLE s0.st2 TO regular_user;
39 CREATE TYPE complex AS (
43 CREATE FUNCTION inform(VARIADIC arr text[]) RETURNS int AS $$
45 str text := 'arguments are ';
48 FOR count IN SELECT i FROM generate_subscripts($1, 1) g(i) LOOP
52 IF $1[count] IS NULL THEN
53 str := str || '<NULL>';
55 str := str || $1[count];
58 RAISE NOTICE '%', str;
62 CREATE VIEW lockd_io AS
63 SELECT relname, heap_blks_read hbr, heap_blks_hit hbh,
64 idx_blks_read ibr, idx_blks_hit ibh
65 FROM pg_statio_user_tables
66 WHERE schemaname = 'dbms_stats'
67 AND relname LIKE '%stats_locked'
70 INSERT INTO st0 VALUES (1, 'test'), (2, 'test');
71 INSERT INTO st1 SELECT i % 3, i % 3 FROM generate_series(1, 10000) t(i);
72 INSERT INTO s0.st0 VALUES (1, 10), (2, 20);
73 INSERT INTO s0.st1 VALUES (4, 40), (5, 50), (6, 60);
74 INSERT INTO s0.st2 VALUES (1, '1'), (2, 'test'), (3, 'comment');
75 INSERT INTO s1.st0 VALUES (1, 15), (2, 25), (3, 35), (4, 45);
76 CREATE INDEX st1_idx ON st1 (val);
77 CREATE INDEX st1_exp ON st1 (lower(str));