mirror of https://github.com/postgres/postgres
The idea behind this patch is to make it possible to run individual test scripts without running the entire core test suite. Making all the scripts completely independent would involve a massive rewrite, and would probably be worse for coverage of things like concurrent DDL. So this patch just does what seems practical with limited changes. The net effect is that any test script can be run after running limited earlier dependencies: * all scripts depend on test_setup * many scripts depend on create_index * other dependencies are few in number, and are documented in the parallel_schedule file. To accomplish this, I chose a small number of commonly-used tables and moved their creation and filling into test_setup. Later scripts are expected not to modify these tables' data contents, for fear of affecting other scripts' results. Also, our former habit of declaring all C functions in one place is now gone in favor of declaring them where they're used, if that's just one script, or in test_setup if necessary. There's more that could be done to remove some of the remaining inter-script dependencies, but significantly more-invasive changes would be needed, and at least for now it doesn't seem worth it. Discussion: https://postgr.es/m/1114748.1640383217@sss.pgh.pa.uspull/77/head
parent
ba15f16107
commit
cc50080a82
@ -1,34 +0,0 @@ |
||||
-- |
||||
-- CREATE_FUNCTION_1 |
||||
-- |
||||
-- directory path and dlsuffix are passed to us in environment variables |
||||
\getenv libdir PG_LIBDIR |
||||
\getenv dlsuffix PG_DLSUFFIX |
||||
\set regresslib :libdir '/regress' :dlsuffix |
||||
-- Create C functions needed by create_type.sql |
||||
CREATE FUNCTION widget_in(cstring) |
||||
RETURNS widget |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
NOTICE: type "widget" is not yet defined |
||||
DETAIL: Creating a shell type definition. |
||||
CREATE FUNCTION widget_out(widget) |
||||
RETURNS cstring |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
NOTICE: argument type widget is only a shell |
||||
CREATE FUNCTION int44in(cstring) |
||||
RETURNS city_budget |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
NOTICE: type "city_budget" is not yet defined |
||||
DETAIL: Creating a shell type definition. |
||||
CREATE FUNCTION int44out(city_budget) |
||||
RETURNS cstring |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
NOTICE: argument type city_budget is only a shell |
||||
CREATE FUNCTION test_canonicalize_path(text) |
||||
RETURNS text |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
@ -1,73 +0,0 @@ |
||||
-- |
||||
-- CREATE_FUNCTION_2 |
||||
-- |
||||
-- directory path and dlsuffix are passed to us in environment variables |
||||
\getenv libdir PG_LIBDIR |
||||
\getenv dlsuffix PG_DLSUFFIX |
||||
\set regresslib :libdir '/regress' :dlsuffix |
||||
CREATE FUNCTION hobbies(person) |
||||
RETURNS setof hobbies_r |
||||
AS 'select * from hobbies_r where person = $1.name' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION hobby_construct(text, text) |
||||
RETURNS hobbies_r |
||||
AS 'select $1 as name, $2 as hobby' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION hobby_construct_named(name text, hobby text) |
||||
RETURNS hobbies_r |
||||
AS 'select name, hobby' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE) |
||||
RETURNS hobbies_r.person%TYPE |
||||
AS 'select person from hobbies_r where name = $1' |
||||
LANGUAGE SQL; |
||||
NOTICE: type reference hobbies_r.name%TYPE converted to text |
||||
NOTICE: type reference hobbies_r.person%TYPE converted to text |
||||
CREATE FUNCTION equipment(hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = $1.name' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION equipment_named(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where equipment_r.hobby = equipment_named.hobby.name' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION equipment_named_ambiguous_1a(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = equipment_named_ambiguous_1a.hobby.name' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION equipment_named_ambiguous_1b(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where equipment_r.hobby = hobby.name' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION equipment_named_ambiguous_1c(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = hobby.name' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION equipment_named_ambiguous_2a(hobby text) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = equipment_named_ambiguous_2a.hobby' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION equipment_named_ambiguous_2b(hobby text) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where equipment_r.hobby = hobby' |
||||
LANGUAGE SQL; |
||||
CREATE FUNCTION pt_in_widget(point, widget) |
||||
RETURNS bool |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
CREATE FUNCTION overpaid(emp) |
||||
RETURNS bool |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
CREATE FUNCTION interpt_pp(path, path) |
||||
RETURNS point |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
CREATE FUNCTION reverse_name(name) |
||||
RETURNS name |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
-- |
||||
-- Function dynamic loading |
||||
-- |
||||
LOAD :'regresslib'; |
@ -1,3 +1,219 @@ |
||||
-- |
||||
-- TEST_SETUP --- prepare environment expected by regression test scripts |
||||
-- |
||||
-- directory paths and dlsuffix are passed to us in environment variables |
||||
\getenv abs_srcdir PG_ABS_SRCDIR |
||||
\getenv libdir PG_LIBDIR |
||||
\getenv dlsuffix PG_DLSUFFIX |
||||
\set regresslib :libdir '/regress' :dlsuffix |
||||
-- |
||||
-- Postgres formerly made the public schema read/write by default, |
||||
-- and most of the core regression tests still expect that. |
||||
-- |
||||
GRANT ALL ON SCHEMA public TO public; |
||||
-- |
||||
-- These tables have traditionally been referenced by many tests, |
||||
-- so create and populate them. Insert only non-error values here. |
||||
-- (Some subsequent tests try to insert erroneous values. That's okay |
||||
-- because the table won't actually change. Do not change the contents |
||||
-- of these tables in later tests, as it may affect other tests.) |
||||
-- |
||||
CREATE TABLE CHAR_TBL(f1 char(4)); |
||||
INSERT INTO CHAR_TBL (f1) VALUES |
||||
('a'), |
||||
('ab'), |
||||
('abcd'), |
||||
('abcd '); |
||||
VACUUM CHAR_TBL; |
||||
CREATE TABLE FLOAT8_TBL(f1 float8); |
||||
INSERT INTO FLOAT8_TBL(f1) VALUES |
||||
('0.0'), |
||||
('-34.84'), |
||||
('-1004.30'), |
||||
('-1.2345678901234e+200'), |
||||
('-1.2345678901234e-200'); |
||||
VACUUM FLOAT8_TBL; |
||||
CREATE TABLE INT2_TBL(f1 int2); |
||||
INSERT INTO INT2_TBL(f1) VALUES |
||||
('0 '), |
||||
(' 1234 '), |
||||
(' -1234'), |
||||
('32767'), -- largest and smallest values |
||||
('-32767'); |
||||
VACUUM INT2_TBL; |
||||
CREATE TABLE INT4_TBL(f1 int4); |
||||
INSERT INTO INT4_TBL(f1) VALUES |
||||
(' 0 '), |
||||
('123456 '), |
||||
(' -123456'), |
||||
('2147483647'), -- largest and smallest values |
||||
('-2147483647'); |
||||
VACUUM INT4_TBL; |
||||
CREATE TABLE INT8_TBL(q1 int8, q2 int8); |
||||
INSERT INTO INT8_TBL VALUES |
||||
(' 123 ',' 456'), |
||||
('123 ','4567890123456789'), |
||||
('4567890123456789','123'), |
||||
(+4567890123456789,'4567890123456789'), |
||||
('+4567890123456789','-4567890123456789'); |
||||
VACUUM INT8_TBL; |
||||
CREATE TABLE POINT_TBL(f1 point); |
||||
INSERT INTO POINT_TBL(f1) VALUES |
||||
('(0.0,0.0)'), |
||||
('(-10.0,0.0)'), |
||||
('(-3.0,4.0)'), |
||||
('(5.1, 34.5)'), |
||||
('(-5.0,-12.0)'), |
||||
('(1e-300,-1e-300)'), -- To underflow |
||||
('(1e+300,Inf)'), -- To overflow |
||||
('(Inf,1e+300)'), -- Transposed |
||||
(' ( Nan , NaN ) '), |
||||
('10.0,10.0'); |
||||
-- We intentionally don't vacuum point_tbl here; geometry depends on that |
||||
CREATE TABLE TEXT_TBL (f1 text); |
||||
INSERT INTO TEXT_TBL VALUES |
||||
('doh!'), |
||||
('hi de ho neighbor'); |
||||
VACUUM TEXT_TBL; |
||||
CREATE TABLE VARCHAR_TBL(f1 varchar(4)); |
||||
INSERT INTO VARCHAR_TBL (f1) VALUES |
||||
('a'), |
||||
('ab'), |
||||
('abcd'), |
||||
('abcd '); |
||||
VACUUM VARCHAR_TBL; |
||||
CREATE TABLE onek ( |
||||
unique1 int4, |
||||
unique2 int4, |
||||
two int4, |
||||
four int4, |
||||
ten int4, |
||||
twenty int4, |
||||
hundred int4, |
||||
thousand int4, |
||||
twothousand int4, |
||||
fivethous int4, |
||||
tenthous int4, |
||||
odd int4, |
||||
even int4, |
||||
stringu1 name, |
||||
stringu2 name, |
||||
string4 name |
||||
); |
||||
\set filename :abs_srcdir '/data/onek.data' |
||||
COPY onek FROM :'filename'; |
||||
VACUUM ANALYZE onek; |
||||
CREATE TABLE onek2 AS SELECT * FROM onek; |
||||
VACUUM ANALYZE onek2; |
||||
CREATE TABLE tenk1 ( |
||||
unique1 int4, |
||||
unique2 int4, |
||||
two int4, |
||||
four int4, |
||||
ten int4, |
||||
twenty int4, |
||||
hundred int4, |
||||
thousand int4, |
||||
twothousand int4, |
||||
fivethous int4, |
||||
tenthous int4, |
||||
odd int4, |
||||
even int4, |
||||
stringu1 name, |
||||
stringu2 name, |
||||
string4 name |
||||
); |
||||
\set filename :abs_srcdir '/data/tenk.data' |
||||
COPY tenk1 FROM :'filename'; |
||||
VACUUM ANALYZE tenk1; |
||||
CREATE TABLE tenk2 AS SELECT * FROM tenk1; |
||||
VACUUM ANALYZE tenk2; |
||||
CREATE TABLE person ( |
||||
name text, |
||||
age int4, |
||||
location point |
||||
); |
||||
\set filename :abs_srcdir '/data/person.data' |
||||
COPY person FROM :'filename'; |
||||
VACUUM ANALYZE person; |
||||
CREATE TABLE emp ( |
||||
salary int4, |
||||
manager name |
||||
) INHERITS (person); |
||||
\set filename :abs_srcdir '/data/emp.data' |
||||
COPY emp FROM :'filename'; |
||||
VACUUM ANALYZE emp; |
||||
CREATE TABLE student ( |
||||
gpa float8 |
||||
) INHERITS (person); |
||||
\set filename :abs_srcdir '/data/student.data' |
||||
COPY student FROM :'filename'; |
||||
VACUUM ANALYZE student; |
||||
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" |
||||
\set filename :abs_srcdir '/data/stud_emp.data' |
||||
COPY stud_emp FROM :'filename'; |
||||
VACUUM ANALYZE stud_emp; |
||||
CREATE TABLE road ( |
||||
name text, |
||||
thepath path |
||||
); |
||||
\set filename :abs_srcdir '/data/streets.data' |
||||
COPY road FROM :'filename'; |
||||
VACUUM ANALYZE road; |
||||
CREATE TABLE ihighway () INHERITS (road); |
||||
INSERT INTO ihighway |
||||
SELECT * |
||||
FROM ONLY road |
||||
WHERE name ~ 'I- .*'; |
||||
VACUUM ANALYZE ihighway; |
||||
CREATE TABLE shighway ( |
||||
surface text |
||||
) INHERITS (road); |
||||
INSERT INTO shighway |
||||
SELECT *, 'asphalt' |
||||
FROM ONLY road |
||||
WHERE name ~ 'State Hwy.*'; |
||||
VACUUM ANALYZE shighway; |
||||
-- |
||||
-- We must have some enum type in the database for opr_sanity and type_sanity. |
||||
-- |
||||
create type stoplight as enum ('red', 'yellow', 'green'); |
||||
-- |
||||
-- Also create some non-built-in range types. |
||||
-- |
||||
create type float8range as range (subtype = float8, subtype_diff = float8mi); |
||||
create type textrange as range (subtype = text, collation = "C"); |
||||
-- |
||||
-- Create some C functions that will be used by various tests. |
||||
-- |
||||
CREATE FUNCTION binary_coercible(oid, oid) |
||||
RETURNS bool |
||||
AS :'regresslib', 'binary_coercible' |
||||
LANGUAGE C STRICT STABLE PARALLEL SAFE; |
||||
CREATE FUNCTION ttdummy () |
||||
RETURNS trigger |
||||
AS :'regresslib' |
||||
LANGUAGE C; |
||||
-- Use hand-rolled hash functions and operator classes to get predictable |
||||
-- result on different machines. The hash function for int4 simply returns |
||||
-- the sum of the values passed to it and the one for text returns the length |
||||
-- of the non-empty string value passed to it or 0. |
||||
create function part_hashint4_noop(value int4, seed int8) |
||||
returns int8 as $$ |
||||
select value + seed; |
||||
$$ language sql strict immutable parallel safe; |
||||
create operator class part_test_int4_ops for type int4 using hash as |
||||
operator 1 =, |
||||
function 2 part_hashint4_noop(int4, int8); |
||||
create function part_hashtext_length(value text, seed int8) |
||||
returns int8 as $$ |
||||
select length(coalesce(value, ''))::int8 |
||||
$$ language sql strict immutable parallel safe; |
||||
create operator class part_test_text_ops for type text using hash as |
||||
operator 1 =, |
||||
function 2 part_hashtext_length(text, int8); |
||||
|
@ -1,36 +0,0 @@ |
||||
-- |
||||
-- CREATE_FUNCTION_1 |
||||
-- |
||||
|
||||
-- directory path and dlsuffix are passed to us in environment variables |
||||
\getenv libdir PG_LIBDIR |
||||
\getenv dlsuffix PG_DLSUFFIX |
||||
|
||||
\set regresslib :libdir '/regress' :dlsuffix |
||||
|
||||
-- Create C functions needed by create_type.sql |
||||
|
||||
CREATE FUNCTION widget_in(cstring) |
||||
RETURNS widget |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
|
||||
CREATE FUNCTION widget_out(widget) |
||||
RETURNS cstring |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
|
||||
CREATE FUNCTION int44in(cstring) |
||||
RETURNS city_budget |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
|
||||
CREATE FUNCTION int44out(city_budget) |
||||
RETURNS cstring |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
||||
|
||||
CREATE FUNCTION test_canonicalize_path(text) |
||||
RETURNS text |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT IMMUTABLE; |
@ -1,96 +0,0 @@ |
||||
-- |
||||
-- CREATE_FUNCTION_2 |
||||
-- |
||||
|
||||
-- directory path and dlsuffix are passed to us in environment variables |
||||
\getenv libdir PG_LIBDIR |
||||
\getenv dlsuffix PG_DLSUFFIX |
||||
|
||||
\set regresslib :libdir '/regress' :dlsuffix |
||||
|
||||
|
||||
CREATE FUNCTION hobbies(person) |
||||
RETURNS setof hobbies_r |
||||
AS 'select * from hobbies_r where person = $1.name' |
||||
LANGUAGE SQL; |
||||
|
||||
|
||||
CREATE FUNCTION hobby_construct(text, text) |
||||
RETURNS hobbies_r |
||||
AS 'select $1 as name, $2 as hobby' |
||||
LANGUAGE SQL; |
||||
|
||||
|
||||
CREATE FUNCTION hobby_construct_named(name text, hobby text) |
||||
RETURNS hobbies_r |
||||
AS 'select name, hobby' |
||||
LANGUAGE SQL; |
||||
|
||||
|
||||
CREATE FUNCTION hobbies_by_name(hobbies_r.name%TYPE) |
||||
RETURNS hobbies_r.person%TYPE |
||||
AS 'select person from hobbies_r where name = $1' |
||||
LANGUAGE SQL; |
||||
|
||||
|
||||
CREATE FUNCTION equipment(hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = $1.name' |
||||
LANGUAGE SQL; |
||||
|
||||
|
||||
CREATE FUNCTION equipment_named(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where equipment_r.hobby = equipment_named.hobby.name' |
||||
LANGUAGE SQL; |
||||
|
||||
CREATE FUNCTION equipment_named_ambiguous_1a(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = equipment_named_ambiguous_1a.hobby.name' |
||||
LANGUAGE SQL; |
||||
|
||||
CREATE FUNCTION equipment_named_ambiguous_1b(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where equipment_r.hobby = hobby.name' |
||||
LANGUAGE SQL; |
||||
|
||||
CREATE FUNCTION equipment_named_ambiguous_1c(hobby hobbies_r) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = hobby.name' |
||||
LANGUAGE SQL; |
||||
|
||||
CREATE FUNCTION equipment_named_ambiguous_2a(hobby text) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where hobby = equipment_named_ambiguous_2a.hobby' |
||||
LANGUAGE SQL; |
||||
|
||||
CREATE FUNCTION equipment_named_ambiguous_2b(hobby text) |
||||
RETURNS setof equipment_r |
||||
AS 'select * from equipment_r where equipment_r.hobby = hobby' |
||||
LANGUAGE SQL; |
||||
|
||||
|
||||
CREATE FUNCTION pt_in_widget(point, widget) |
||||
RETURNS bool |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
|
||||
CREATE FUNCTION overpaid(emp) |
||||
RETURNS bool |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
|
||||
CREATE FUNCTION interpt_pp(path, path) |
||||
RETURNS point |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
|
||||
CREATE FUNCTION reverse_name(name) |
||||
RETURNS name |
||||
AS :'regresslib' |
||||
LANGUAGE C STRICT; |
||||
|
||||
-- |
||||
-- Function dynamic loading |
||||
-- |
||||
LOAD :'regresslib'; |
@ -1,3 +1,269 @@ |
||||
-- |
||||
-- TEST_SETUP --- prepare environment expected by regression test scripts |
||||
-- |
||||
|
||||
-- directory paths and dlsuffix are passed to us in environment variables |
||||
\getenv abs_srcdir PG_ABS_SRCDIR |
||||
\getenv libdir PG_LIBDIR |
||||
\getenv dlsuffix PG_DLSUFFIX |
||||
|
||||
\set regresslib :libdir '/regress' :dlsuffix |
||||
|
||||
-- |
||||
-- Postgres formerly made the public schema read/write by default, |
||||
-- and most of the core regression tests still expect that. |
||||
-- |
||||
GRANT ALL ON SCHEMA public TO public; |
||||
|
||||
-- |
||||
-- These tables have traditionally been referenced by many tests, |
||||
-- so create and populate them. Insert only non-error values here. |
||||
-- (Some subsequent tests try to insert erroneous values. That's okay |
||||
-- because the table won't actually change. Do not change the contents |
||||
-- of these tables in later tests, as it may affect other tests.) |
||||
-- |
||||
|
||||
CREATE TABLE CHAR_TBL(f1 char(4)); |
||||
|
||||
INSERT INTO CHAR_TBL (f1) VALUES |
||||
('a'), |
||||
('ab'), |
||||
('abcd'), |
||||
('abcd '); |
||||
VACUUM CHAR_TBL; |
||||
|
||||
CREATE TABLE FLOAT8_TBL(f1 float8); |
||||
|
||||
INSERT INTO FLOAT8_TBL(f1) VALUES |
||||
('0.0'), |
||||
('-34.84'), |
||||
('-1004.30'), |
||||
('-1.2345678901234e+200'), |
||||
('-1.2345678901234e-200'); |
||||
VACUUM FLOAT8_TBL; |
||||
|
||||
CREATE TABLE INT2_TBL(f1 int2); |
||||
|
||||
INSERT INTO INT2_TBL(f1) VALUES |
||||
('0 '), |
||||
(' 1234 '), |
||||
(' -1234'), |
||||
('32767'), -- largest and smallest values |
||||
('-32767'); |
||||
VACUUM INT2_TBL; |
||||
|
||||
CREATE TABLE INT4_TBL(f1 int4); |
||||
|
||||
INSERT INTO INT4_TBL(f1) VALUES |
||||
(' 0 '), |
||||
('123456 '), |
||||
(' -123456'), |
||||
('2147483647'), -- largest and smallest values |
||||
('-2147483647'); |
||||
VACUUM INT4_TBL; |
||||
|
||||
CREATE TABLE INT8_TBL(q1 int8, q2 int8); |
||||
|
||||
INSERT INTO INT8_TBL VALUES |
||||
(' 123 ',' 456'), |
||||
('123 ','4567890123456789'), |
||||
('4567890123456789','123'), |
||||
(+4567890123456789,'4567890123456789'), |
||||
('+4567890123456789','-4567890123456789'); |
||||
VACUUM INT8_TBL; |
||||
|
||||
CREATE TABLE POINT_TBL(f1 point); |
||||
|
||||
INSERT INTO POINT_TBL(f1) VALUES |
||||
('(0.0,0.0)'), |
||||
('(-10.0,0.0)'), |
||||
('(-3.0,4.0)'), |
||||
('(5.1, 34.5)'), |
||||
('(-5.0,-12.0)'), |
||||
('(1e-300,-1e-300)'), -- To underflow |
||||
('(1e+300,Inf)'), -- To overflow |
||||
('(Inf,1e+300)'), -- Transposed |
||||
(' ( Nan , NaN ) '), |
||||
('10.0,10.0'); |
||||
-- We intentionally don't vacuum point_tbl here; geometry depends on that |
||||
|
||||
CREATE TABLE TEXT_TBL (f1 text); |
||||
|
||||
INSERT INTO TEXT_TBL VALUES |
||||
('doh!'), |
||||
('hi de ho neighbor'); |
||||
VACUUM TEXT_TBL; |
||||
|
||||
CREATE TABLE VARCHAR_TBL(f1 varchar(4)); |
||||
|
||||
INSERT INTO VARCHAR_TBL (f1) VALUES |
||||
('a'), |
||||
('ab'), |
||||
('abcd'), |
||||
('abcd '); |
||||
VACUUM VARCHAR_TBL; |
||||
|
||||
CREATE TABLE onek ( |
||||
unique1 int4, |
||||
unique2 int4, |
||||
two int4, |
||||
four int4, |
||||
ten int4, |
||||
twenty int4, |
||||
hundred int4, |
||||
thousand int4, |
||||
twothousand int4, |
||||
fivethous int4, |
||||
tenthous int4, |
||||
odd int4, |
||||
even int4, |
||||
stringu1 name, |
||||
stringu2 name, |
||||
string4 name |
||||
); |
||||
|
||||
\set filename :abs_srcdir '/data/onek.data' |
||||
COPY onek FROM :'filename'; |
||||
VACUUM ANALYZE onek; |
||||
|
||||
CREATE TABLE onek2 AS SELECT * FROM onek; |
||||
VACUUM ANALYZE onek2; |
||||
|
||||
CREATE TABLE tenk1 ( |
||||
unique1 int4, |
||||
unique2 int4, |
||||
two int4, |
||||
four int4, |
||||
ten int4, |
||||
twenty int4, |
||||
hundred int4, |
||||
thousand int4, |
||||
twothousand int4, |
||||
fivethous int4, |
||||
tenthous int4, |
||||
odd int4, |
||||
even int4, |
||||
stringu1 name, |
||||
stringu2 name, |
||||
string4 name |
||||
); |
||||
|
||||
\set filename :abs_srcdir '/data/tenk.data' |
||||
COPY tenk1 FROM :'filename'; |
||||
VACUUM ANALYZE tenk1; |
||||
|
||||
CREATE TABLE tenk2 AS SELECT * FROM tenk1; |
||||
VACUUM ANALYZE tenk2; |
||||
|
||||
CREATE TABLE person ( |
||||
name text, |
||||
age int4, |
||||
location point |
||||
); |
||||
|
||||
\set filename :abs_srcdir '/data/person.data' |
||||
COPY person FROM :'filename'; |
||||
VACUUM ANALYZE person; |
||||
|
||||
CREATE TABLE emp ( |
||||
salary int4, |
||||
manager name |
||||
) INHERITS (person); |
||||
|
||||
\set filename :abs_srcdir '/data/emp.data' |
||||
COPY emp FROM :'filename'; |
||||
VACUUM ANALYZE emp; |
||||
|
||||
CREATE TABLE student ( |
||||
gpa float8 |
||||
) INHERITS (person); |
||||
|
||||
\set filename :abs_srcdir '/data/student.data' |
||||
COPY student FROM :'filename'; |
||||
VACUUM ANALYZE student; |
||||
|
||||
CREATE TABLE stud_emp ( |
||||
percent int4 |
||||
) INHERITS (emp, student); |
||||
|
||||
\set filename :abs_srcdir '/data/stud_emp.data' |
||||
COPY stud_emp FROM :'filename'; |
||||
VACUUM ANALYZE stud_emp; |
||||
|
||||
CREATE TABLE road ( |
||||
name text, |
||||
thepath path |
||||
); |
||||
|
||||
\set filename :abs_srcdir '/data/streets.data' |
||||
COPY road FROM :'filename'; |
||||
VACUUM ANALYZE road; |
||||
|
||||
CREATE TABLE ihighway () INHERITS (road); |
||||
|
||||
INSERT INTO ihighway |
||||
SELECT * |
||||
FROM ONLY road |
||||
WHERE name ~ 'I- .*'; |
||||
VACUUM ANALYZE ihighway; |
||||
|
||||
CREATE TABLE shighway ( |
||||
surface text |
||||
) INHERITS (road); |
||||
|
||||
INSERT INTO shighway |
||||
SELECT *, 'asphalt' |
||||
FROM ONLY road |
||||
WHERE name ~ 'State Hwy.*'; |
||||
VACUUM ANALYZE shighway; |
||||
|
||||
-- |
||||
-- We must have some enum type in the database for opr_sanity and type_sanity. |
||||
-- |
||||
|
||||
create type stoplight as enum ('red', 'yellow', 'green'); |
||||
|
||||
-- |
||||
-- Also create some non-built-in range types. |
||||
-- |
||||
|
||||
create type float8range as range (subtype = float8, subtype_diff = float8mi); |
||||
|
||||
create type textrange as range (subtype = text, collation = "C"); |
||||
|
||||
-- |
||||
-- Create some C functions that will be used by various tests. |
||||
-- |
||||
|
||||
CREATE FUNCTION binary_coercible(oid, oid) |
||||
RETURNS bool |
||||
AS :'regresslib', 'binary_coercible' |
||||
LANGUAGE C STRICT STABLE PARALLEL SAFE; |
||||
|
||||
CREATE FUNCTION ttdummy () |
||||
RETURNS trigger |
||||
AS :'regresslib' |
||||
LANGUAGE C; |
||||
|
||||
-- Use hand-rolled hash functions and operator classes to get predictable |
||||
-- result on different machines. The hash function for int4 simply returns |
||||
-- the sum of the values passed to it and the one for text returns the length |
||||
-- of the non-empty string value passed to it or 0. |
||||
|
||||
create function part_hashint4_noop(value int4, seed int8) |
||||
returns int8 as $$ |
||||
select value + seed; |
||||
$$ language sql strict immutable parallel safe; |
||||
|
||||
create operator class part_test_int4_ops for type int4 using hash as |
||||
operator 1 =, |
||||
function 2 part_hashint4_noop(int4, int8); |
||||
|
||||
create function part_hashtext_length(value text, seed int8) |
||||
returns int8 as $$ |
||||
select length(coalesce(value, ''))::int8 |
||||
$$ language sql strict immutable parallel safe; |
||||
|
||||
create operator class part_test_text_ops for type text using hash as |
||||
operator 1 =, |
||||
function 2 part_hashtext_length(text, int8); |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue