postgresql/src/test/regress/expected/create_table.out

253 lines
5.7 KiB
Plaintext
Raw Normal View History

2000-01-05 18:31:08 +01:00
--
-- CREATE_TABLE
--
--
-- CLASS DEFINITIONS
--
CREATE TABLE hobbies_r (
name text,
person text
);
2000-01-05 18:31:08 +01:00
CREATE TABLE equipment_r (
name text,
hobby text
);
2000-01-05 18:31:08 +01:00
CREATE TABLE onek (
unique1 int4,
unique2 int4,
2000-01-05 18:31:08 +01:00
two int4,
four int4,
2000-01-05 18:31:08 +01:00
ten int4,
twenty int4,
hundred int4,
thousand int4,
twothousand int4,
fivethous int4,
tenthous int4,
2000-01-05 18:31:08 +01:00
odd int4,
even int4,
stringu1 name,
stringu2 name,
string4 name
);
2000-01-05 18:31:08 +01:00
CREATE TABLE tenk1 (
unique1 int4,
unique2 int4,
2000-01-05 18:31:08 +01:00
two int4,
four int4,
2000-01-05 18:31:08 +01:00
ten int4,
twenty int4,
hundred int4,
thousand int4,
twothousand int4,
fivethous int4,
tenthous int4,
2000-01-05 18:31:08 +01:00
odd int4,
even int4,
stringu1 name,
stringu2 name,
string4 name
) WITH OIDS;
2000-01-05 18:31:08 +01:00
CREATE TABLE tenk2 (
unique1 int4,
unique2 int4,
two int4,
four int4,
2000-01-05 18:31:08 +01:00
ten int4,
twenty int4,
hundred int4,
thousand int4,
2000-01-05 18:31:08 +01:00
twothousand int4,
fivethous int4,
tenthous int4,
2000-01-05 18:31:08 +01:00
odd int4,
even int4,
stringu1 name,
stringu2 name,
string4 name
);
2000-01-05 18:31:08 +01:00
CREATE TABLE person (
name text,
2000-01-05 18:31:08 +01:00
age int4,
location point
);
2000-01-05 18:31:08 +01:00
CREATE TABLE emp (
salary int4,
manager name
) INHERITS (person) WITH OIDS;
2000-01-05 18:31:08 +01:00
CREATE TABLE student (
gpa float8
) INHERITS (person);
2000-01-05 18:31:08 +01:00
CREATE TABLE stud_emp (
percent int4
) INHERITS (emp, student);
NOTICE: merging multiple inherited definitions of column "name"
NOTICE: merging multiple inherited definitions of column "age"
NOTICE: merging multiple inherited definitions of column "location"
2000-01-05 18:31:08 +01:00
CREATE TABLE city (
name name,
location box,
budget city_budget
);
2000-01-05 18:31:08 +01:00
CREATE TABLE dept (
dname name,
mgrname text
);
2000-01-05 18:31:08 +01:00
CREATE TABLE slow_emp4000 (
home_base box
);
2000-01-05 18:31:08 +01:00
CREATE TABLE fast_emp4000 (
home_base box
);
2000-01-05 18:31:08 +01:00
CREATE TABLE road (
name text,
thepath path
);
2000-01-05 18:31:08 +01:00
CREATE TABLE ihighway () INHERITS (road);
CREATE TABLE shighway (
surface text
) INHERITS (road);
2000-01-05 18:31:08 +01:00
CREATE TABLE real_city (
pop int4,
cname text,
outline path
);
2000-01-05 18:31:08 +01:00
--
-- 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 (
class char,
2000-01-05 18:31:08 +01:00
a int4
);
CREATE TABLE b_star (
b text
) INHERITS (a_star);
2000-01-05 18:31:08 +01:00
CREATE TABLE c_star (
c name
) INHERITS (a_star);
2000-01-05 18:31:08 +01:00
CREATE TABLE d_star (
d float8
) INHERITS (b_star, c_star);
NOTICE: merging multiple inherited definitions of column "class"
NOTICE: merging multiple inherited definitions of column "a"
2000-01-05 18:31:08 +01:00
CREATE TABLE e_star (
e int2
) INHERITS (c_star);
2000-01-05 18:31:08 +01:00
CREATE TABLE f_star (
f polygon
) INHERITS (e_star);
2000-01-05 18:31:08 +01:00
CREATE TABLE aggtest (
a int2,
b float4
);
CREATE TABLE hash_i4_heap (
seqno int4,
random int4
);
2000-01-05 18:31:08 +01:00
CREATE TABLE hash_name_heap (
seqno int4,
random name
);
2000-01-05 18:31:08 +01:00
CREATE TABLE hash_txt_heap (
seqno int4,
random text
);
2000-01-05 18:31:08 +01:00
CREATE TABLE hash_f8_heap (
seqno int4,
random float8
);
2000-01-05 18:31:08 +01:00
-- don't include the hash_ovfl_heap stuff in the distribution
-- the data set is too large for what it's worth
--
2000-01-05 18:31:08 +01:00
-- CREATE TABLE hash_ovfl_heap (
-- x int4,
-- y int4
-- );
CREATE TABLE bt_i4_heap (
seqno int4,
random int4
);
2000-01-05 18:31:08 +01:00
CREATE TABLE bt_name_heap (
seqno name,
random int4
);
2000-01-05 18:31:08 +01:00
CREATE TABLE bt_txt_heap (
seqno text,
random int4
);
2000-01-05 18:31:08 +01:00
CREATE TABLE bt_f8_heap (
seqno float8,
random int4
);
CREATE TABLE array_op_test (
seqno int4,
i int4[],
t text[]
);
CREATE TABLE array_index_op_test (
seqno int4,
i int4[],
t text[]
);
CREATE TABLE testjsonb (
j jsonb
);
CREATE TABLE IF NOT EXISTS test_tsvector(
t text,
a tsvector
);
CREATE TABLE IF NOT EXISTS test_tsvector(
t text
);
NOTICE: relation "test_tsvector" already exists, skipping
CREATE UNLOGGED TABLE unlogged1 (a int primary key); -- OK
CREATE TEMPORARY TABLE unlogged2 (a int primary key); -- OK
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname;
relname | relkind | relpersistence
----------------+---------+----------------
unlogged1 | r | u
unlogged1_pkey | i | u
unlogged2 | r | t
unlogged2_pkey | i | t
(4 rows)
REINDEX INDEX unlogged1_pkey;
REINDEX INDEX unlogged2_pkey;
SELECT relname, relkind, relpersistence FROM pg_class WHERE relname ~ '^unlogged\d' ORDER BY relname;
relname | relkind | relpersistence
----------------+---------+----------------
unlogged1 | r | u
unlogged1_pkey | i | u
unlogged2 | r | t
unlogged2_pkey | i | t
(4 rows)
DROP TABLE unlogged2;
INSERT INTO unlogged1 VALUES (42);
CREATE UNLOGGED TABLE public.unlogged2 (a int primary key); -- also OK
CREATE UNLOGGED TABLE pg_temp.unlogged3 (a int primary key); -- not OK
ERROR: only temporary relations may be created in temporary schemas
LINE 1: CREATE UNLOGGED TABLE pg_temp.unlogged3 (a int primary key);
^
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
ERROR: cannot create temporary relation in non-temporary schema
LINE 1: CREATE TEMP TABLE public.temp_to_perm (a int primary key);
^
DROP TABLE unlogged1, public.unlogged2;
CREATE TABLE as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
CREATE TABLE as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
ERROR: relation "as_select1" already exists
CREATE TABLE IF NOT EXISTS as_select1 AS SELECT * FROM pg_class WHERE relkind = 'r';
NOTICE: relation "as_select1" already exists, skipping
DROP TABLE as_select1;