1997-04-05 23:26:00 +02:00
|
|
|
--
|
2000-01-05 18:32:29 +01:00
|
|
|
-- CREATE_TABLE
|
1997-04-05 23:26:00 +02:00
|
|
|
--
|
|
|
|
|
|
|
|
--
|
|
|
|
-- CLASS DEFINITIONS
|
|
|
|
--
|
|
|
|
CREATE TABLE hobbies_r (
|
2010-11-23 21:27:50 +01:00
|
|
|
name text,
|
1997-04-05 23:26:00 +02:00
|
|
|
person text
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE equipment_r (
|
|
|
|
name text,
|
|
|
|
hobby text
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE onek (
|
|
|
|
unique1 int4,
|
|
|
|
unique2 int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
two int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
four int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
ten int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
twenty int4,
|
|
|
|
hundred int4,
|
|
|
|
thousand int4,
|
|
|
|
twothousand int4,
|
|
|
|
fivethous int4,
|
|
|
|
tenthous int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
odd int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
even int4,
|
1998-04-26 06:12:15 +02:00
|
|
|
stringu1 name,
|
|
|
|
stringu2 name,
|
|
|
|
string4 name
|
1997-04-05 23:26:00 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE tenk1 (
|
|
|
|
unique1 int4,
|
|
|
|
unique2 int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
two int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
four int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
ten int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
twenty int4,
|
|
|
|
hundred int4,
|
|
|
|
thousand int4,
|
|
|
|
twothousand int4,
|
|
|
|
fivethous int4,
|
|
|
|
tenthous int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
odd int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
even int4,
|
1998-04-26 06:12:15 +02:00
|
|
|
stringu1 name,
|
|
|
|
stringu2 name,
|
|
|
|
string4 name
|
2005-01-22 06:12:33 +01:00
|
|
|
) WITH OIDS;
|
1997-04-05 23:26:00 +02:00
|
|
|
|
|
|
|
CREATE TABLE tenk2 (
|
|
|
|
unique1 int4,
|
|
|
|
unique2 int4,
|
|
|
|
two int4,
|
|
|
|
four int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
ten int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
twenty int4,
|
|
|
|
hundred int4,
|
|
|
|
thousand int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
twothousand int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
fivethous int4,
|
|
|
|
tenthous int4,
|
2000-01-05 18:32:29 +01:00
|
|
|
odd int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
even int4,
|
1998-04-26 06:12:15 +02:00
|
|
|
stringu1 name,
|
|
|
|
stringu2 name,
|
|
|
|
string4 name
|
1997-04-05 23:26:00 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE person (
|
|
|
|
name text,
|
2000-01-05 18:32:29 +01:00
|
|
|
age int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
location point
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE emp (
|
|
|
|
salary int4,
|
1998-04-26 06:12:15 +02:00
|
|
|
manager name
|
2005-01-22 06:12:33 +01:00
|
|
|
) INHERITS (person) WITH OIDS;
|
1997-04-05 23:26:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE student (
|
|
|
|
gpa float8
|
|
|
|
) INHERITS (person);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE stud_emp (
|
|
|
|
percent int4
|
|
|
|
) INHERITS (emp, student);
|
|
|
|
|
|
|
|
|
|
|
|
CREATE TABLE city (
|
1998-04-26 06:12:15 +02:00
|
|
|
name name,
|
1997-04-05 23:26:00 +02:00
|
|
|
location box,
|
|
|
|
budget city_budget
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE dept (
|
1998-04-26 06:12:15 +02:00
|
|
|
dname name,
|
1997-04-05 23:26:00 +02:00
|
|
|
mgrname text
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE slow_emp4000 (
|
|
|
|
home_base box
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE fast_emp4000 (
|
|
|
|
home_base box
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE road (
|
|
|
|
name text,
|
|
|
|
thepath path
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE ihighway () INHERITS (road);
|
|
|
|
|
|
|
|
CREATE TABLE shighway (
|
|
|
|
surface text
|
|
|
|
) INHERITS (road);
|
|
|
|
|
|
|
|
CREATE TABLE real_city (
|
2000-01-05 18:32:29 +01:00
|
|
|
pop int4,
|
1997-04-05 23:26:00 +02:00
|
|
|
cname text,
|
|
|
|
outline path
|
|
|
|
);
|
|
|
|
|
|
|
|
--
|
|
|
|
-- test the "star" operators a bit more thoroughly -- this time,
|
|
|
|
-- throw in lots of NULL fields...
|
|
|
|
--
|
|
|
|
-- a is the type root
|
|
|
|
-- b and c inherit from a (one-level single inheritance)
|
|
|
|
-- d inherits from b and c (two-level multiple inheritance)
|
|
|
|
-- e inherits from c (two-level single inheritance)
|
|
|
|
-- f inherits from e (three-level single inheritance)
|
|
|
|
--
|
|
|
|
CREATE TABLE a_star (
|
2010-11-23 21:27:50 +01:00
|
|
|
class char,
|
2000-01-05 18:32:29 +01:00
|
|
|
a int4
|
1997-04-05 23:26:00 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE b_star (
|
2000-01-05 18:32:29 +01:00
|
|
|
b text
|
1997-04-05 23:26:00 +02:00
|
|
|
) INHERITS (a_star);
|
|
|
|
|
|
|
|
CREATE TABLE c_star (
|
2000-01-05 18:32:29 +01:00
|
|
|
c name
|
1997-04-05 23:26:00 +02:00
|
|
|
) INHERITS (a_star);
|
|
|
|
|
|
|
|
CREATE TABLE d_star (
|
2000-01-05 18:32:29 +01:00
|
|
|
d float8
|
1997-04-05 23:26:00 +02:00
|
|
|
) INHERITS (b_star, c_star);
|
|
|
|
|
|
|
|
CREATE TABLE e_star (
|
2000-01-05 18:32:29 +01:00
|
|
|
e int2
|
1997-04-05 23:26:00 +02:00
|
|
|
) INHERITS (c_star);
|
|
|
|
|
|
|
|
CREATE TABLE f_star (
|
2000-01-05 18:32:29 +01:00
|
|
|
f polygon
|
1997-04-05 23:26:00 +02:00
|
|
|
) INHERITS (e_star);
|
|
|
|
|
|
|
|
CREATE TABLE aggtest (
|
2000-01-05 18:32:29 +01:00
|
|
|
a int2,
|
|
|
|
b float4
|
1997-04-05 23:26:00 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE hash_i4_heap (
|
|
|
|
seqno int4,
|
|
|
|
random int4
|
|
|
|
);
|
|
|
|
|
1998-04-26 06:12:15 +02:00
|
|
|
CREATE TABLE hash_name_heap (
|
1997-04-05 23:26:00 +02:00
|
|
|
seqno int4,
|
1998-04-26 06:12:15 +02:00
|
|
|
random name
|
1997-04-05 23:26:00 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE hash_txt_heap (
|
|
|
|
seqno int4,
|
|
|
|
random text
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE hash_f8_heap (
|
|
|
|
seqno int4,
|
|
|
|
random float8
|
|
|
|
);
|
|
|
|
|
|
|
|
-- don't include the hash_ovfl_heap stuff in the distribution
|
|
|
|
-- the data set is too large for what it's worth
|
2010-11-23 21:27:50 +01:00
|
|
|
--
|
1997-04-05 23:26:00 +02:00
|
|
|
-- CREATE TABLE hash_ovfl_heap (
|
2000-01-05 18:32:29 +01:00
|
|
|
-- x int4,
|
|
|
|
-- y int4
|
1997-04-05 23:26:00 +02:00
|
|
|
-- );
|
|
|
|
|
|
|
|
CREATE TABLE bt_i4_heap (
|
|
|
|
seqno int4,
|
|
|
|
random int4
|
|
|
|
);
|
|
|
|
|
1998-04-26 06:12:15 +02:00
|
|
|
CREATE TABLE bt_name_heap (
|
|
|
|
seqno name,
|
1997-04-05 23:26:00 +02:00
|
|
|
random int4
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE bt_txt_heap (
|
|
|
|
seqno text,
|
|
|
|
random int4
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE bt_f8_heap (
|
2010-11-23 21:27:50 +01:00
|
|
|
seqno float8,
|
1997-04-05 23:26:00 +02:00
|
|
|
random int4
|
|
|
|
);
|
|
|
|
|
2006-05-02 13:28:56 +02:00
|
|
|
CREATE TABLE array_op_test (
|
|
|
|
seqno int4,
|
|
|
|
i int4[],
|
|
|
|
t text[]
|
|
|
|
);
|
|
|
|
|
|
|
|
CREATE TABLE array_index_op_test (
|
|
|
|
seqno int4,
|
|
|
|
i int4[],
|
|
|
|
t text[]
|
|
|
|
);
|
2007-08-21 03:11:32 +02:00
|
|
|
|
2014-03-24 01:18:06 +01:00
|
|
|
CREATE TABLE testjsonb (
|
|
|
|
j jsonb
|
|
|
|
);
|
|
|
|
|
2010-11-23 21:27:50 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS test_tsvector(
|
|
|
|
t text,
|
|
|
|
a tsvector
|
2007-08-21 03:11:32 +02:00
|
|
|
);
|
|
|
|
|
2010-11-23 21:27:50 +01:00
|
|
|
CREATE TABLE IF NOT EXISTS test_tsvector(
|
2010-07-26 01:21:22 +02:00
|
|
|
t text
|
|
|
|
);
|
2011-07-22 22:15:43 +02:00
|
|
|
|
2011-09-21 16:32:30 +02:00
|
|
|
CREATE UNLOGGED TABLE unlogged1 (a int primary key); -- OK
|
2015-03-30 21:01:44 +02:00
|
|
|
CREATE TEMPORARY TABLE unlogged2 (a int primary key); -- OK
|
|
|
|
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname;
|
|
|
|
REINDEX INDEX unlogged1_pkey;
|
|
|
|
REINDEX INDEX unlogged2_pkey;
|
|
|
|
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname;
|
|
|
|
DROP TABLE unlogged2;
|
2011-07-22 22:15:43 +02:00
|
|
|
INSERT INTO unlogged1 VALUES (42);
|
2011-09-21 16:32:30 +02:00
|
|
|
CREATE UNLOGGED TABLE public.unlogged2 (a int primary key); -- also OK
|
|
|
|
CREATE UNLOGGED TABLE pg_temp.unlogged3 (a int primary key); -- not OK
|
|
|
|
CREATE TABLE pg_temp.implicitly_temp (a int primary key); -- OK
|
|
|
|
CREATE TEMP TABLE explicitly_temp (a int primary key); -- also OK
|
|
|
|
CREATE TEMP TABLE pg_temp.doubly_temp (a int primary key); -- also OK
|
|
|
|
CREATE TEMP TABLE public.temp_to_perm (a int primary key); -- not OK
|
2011-07-22 22:15:43 +02:00
|
|
|
DROP TABLE unlogged1, public.unlogged2;
|
2014-12-13 19:56:09 +01:00
|
|
|
|
|
|
|
CREATE TABLE as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
|
|
|
|
CREATE TABLE as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
|
|
|
|
CREATE TABLE IF NOT EXISTS as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
|
|
|
|
DROP TABLE as_select1;
|
2015-10-06 03:19:16 +02:00
|
|
|
|
|
|
|
-- check that the oid column is added before the primary key is checked
|
|
|
|
CREATE TABLE oid_pk (f1 INT, PRIMARY KEY(oid)) WITH OIDS;
|
|
|
|
DROP TABLE oid_pk;
|