aboutsummaryrefslogtreecommitdiff
path: root/src/test/regress/sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/sql')
-rw-r--r--src/test/regress/sql/create_aggregate.sql26
-rw-r--r--src/test/regress/sql/create_index.sql90
-rw-r--r--src/test/regress/sql/create_operator.sql32
-rw-r--r--src/test/regress/sql/create_view.sql20
-rw-r--r--src/test/regress/sql/sanity_check.sql9
-rw-r--r--src/test/regress/sql/tests6
6 files changed, 183 insertions, 0 deletions
diff --git a/src/test/regress/sql/create_aggregate.sql b/src/test/regress/sql/create_aggregate.sql
new file mode 100644
index 00000000000..79b3b02b8dc
--- /dev/null
+++ b/src/test/regress/sql/create_aggregate.sql
@@ -0,0 +1,26 @@
+--
+-- AGGREGATE DEFINITIONS
+--
+
+-- all functions CREATEd
+CREATE AGGREGATE newavg (
+ sfunc1 = int4pl, basetype = int4, stype1 = int4,
+ sfunc2 = int4inc, stype2 = int4,
+ finalfunc = int4div,
+ initcond1 = '0', initcond2 = '0'
+);
+
+-- sfunc1 (value-dependent) only
+CREATE AGGREGATE newsum (
+ sfunc1 = int4pl, basetype = int4, stype1 = int4,
+ initcond1 = '0'
+);
+
+-- sfunc2 (value-independent) only
+CREATE AGGREGATE newcnt (
+ sfunc2 = int4inc, basetype = int4, stype2 = int4,
+ initcond2 = '0'
+);
+
+VACUUM;
+
diff --git a/src/test/regress/sql/create_index.sql b/src/test/regress/sql/create_index.sql
new file mode 100644
index 00000000000..da3bb70451c
--- /dev/null
+++ b/src/test/regress/sql/create_index.sql
@@ -0,0 +1,90 @@
+--
+-- CREATE ancillary data structures (i.e. indices)
+--
+
+--
+-- BTREE
+--
+CREATE INDEX onek_unique1 ON onek USING btree(unique1 int4_ops);
+
+CREATE INDEX onek_unique2 ON onek USING btree(unique2 int4_ops);
+
+CREATE INDEX onek_hundred ON onek USING btree(hundred int4_ops);
+
+CREATE INDEX onek_stringu1 ON onek USING btree(stringu1 char16_ops);
+
+CREATE INDEX tenk1_unique1 ON tenk1 USING btree(unique1 int4_ops);
+
+CREATE INDEX tenk1_unique2 ON tenk1 USING btree(unique2 int4_ops);
+
+CREATE INDEX tenk1_hundred ON tenk1 USING btree(hundred int4_ops);
+
+CREATE INDEX tenk2_unique1 ON tenk2 USING btree(unique1 int4_ops);
+
+CREATE INDEX tenk2_unique2 ON tenk2 USING btree(unique2 int4_ops);
+
+CREATE INDEX tenk2_hundred ON tenk2 USING btree(hundred int4_ops);
+
+CREATE INDEX rix ON road USING btree (name text_ops);
+
+CREATE INDEX iix ON ihighway USING btree (name text_ops);
+
+CREATE INDEX six ON shighway USING btree (name text_ops);
+
+--
+-- BTREE ascending/descending cases
+--
+-- we load int4/text from pure descending data (each key is a new
+-- low key) and c16/f8 from pure ascending data (each key is a new
+-- high key). we had a bug where new low keys would sometimes be
+-- "lost".
+--
+CREATE INDEX bt_i4_index ON bt_i4_heap USING btree (seqno int4_ops);
+
+CREATE INDEX bt_c16_index ON bt_c16_heap USING btree (seqno char16_ops);
+
+CREATE INDEX bt_txt_index ON bt_txt_heap USING btree (seqno text_ops);
+
+CREATE INDEX bt_f8_index ON bt_f8_heap USING btree (seqno float8_ops);
+
+--
+-- BTREE partial indices
+-- partial indices are not supported in postgres95
+--
+--CREATE INDEX onek2_u1_prtl ON onek2 USING btree(unique1 int4_ops)
+-- where onek2.unique1 < 20 or onek2.unique1 > 980;
+
+--CREATE INDEX onek2_u2_prtl ON onek2 USING btree(unique2 int4_ops)
+-- where onek2.stringu1 < 'B';
+
+-- EXTEND INDEX onek2_u2_prtl where onek2.stringu1 < 'C';
+
+-- EXTEND INDEX onek2_u2_prtl;
+
+-- CREATE INDEX onek2_stu1_prtl ON onek2 USING btree(stringu1 char16_ops)
+-- where onek2.stringu1 >= 'J' and onek2.stringu1 < 'K';
+
+--
+-- RTREE
+--
+-- rtrees use a quadratic page-splitting algorithm that takes a
+-- really, really long time. we don't test all rtree opclasses
+-- in the regression test (we check them USING the sequoia 2000
+-- benchmark).
+--
+CREATE INDEX rect2ind ON fast_emp4000 USING rtree (home_base bigbox_ops);
+
+
+--
+-- HASH
+--
+CREATE INDEX hash_i4_index ON hash_i4_heap USING hash (random int4_ops);
+
+CREATE INDEX hash_c16_index ON hash_c16_heap USING hash (random char16_ops);
+
+CREATE INDEX hash_txt_index ON hash_txt_heap USING hash (random text_ops);
+
+CREATE INDEX hash_f8_index ON hash_f8_heap USING hash (random float8_ops);
+
+-- CREATE INDEX hash_ovfl_index ON hash_ovfl_heap USING hash (x int4_ops);
+
diff --git a/src/test/regress/sql/create_operator.sql b/src/test/regress/sql/create_operator.sql
new file mode 100644
index 00000000000..60e44207820
--- /dev/null
+++ b/src/test/regress/sql/create_operator.sql
@@ -0,0 +1,32 @@
+--
+-- OPERATOR DEFINITIONS
+--
+CREATE OPERATOR ## (
+ leftarg = path,
+ rightarg = path,
+ procedure = path_inter,
+ commutator = ##
+);
+
+CREATE OPERATOR <% (
+ leftarg = point,
+ rightarg = circle,
+ procedure = pt_in_circle,
+ commutator = >=%
+);
+
+CREATE OPERATOR @#@ (
+ rightarg = int4, -- left unary
+ procedure = int4fac
+);
+
+CREATE OPERATOR #@# (
+ leftarg = int4, -- right unary
+ procedure = int4fac
+);
+
+CREATE OPERATOR #%# (
+ leftarg = int4, -- right unary
+ procedure = int4fac
+);
+
diff --git a/src/test/regress/sql/create_view.sql b/src/test/regress/sql/create_view.sql
new file mode 100644
index 00000000000..a8e248ce837
--- /dev/null
+++ b/src/test/regress/sql/create_view.sql
@@ -0,0 +1,20 @@
+--
+-- VIRTUAL CLASS DEFINITIONS
+-- (this also tests the query rewrite system)
+--
+
+CREATE VIEW street AS
+ SELECT r.name, r.thepath, c.cname AS cname
+ FROM road r, real_city c
+ WHERE c.outline ## r.thepath;
+
+CREATE VIEW iexit AS
+ SELECT ih.name, ih.thepath,
+ interpt_pp(ih.thepath, r.thepath) AS exit
+ FROM ihighway ih, ramp r
+ WHERE ih.thepath ## r.thepath;
+
+CREATE VIEW toyemp AS
+ SELECT name, age, location, 12*salary AS annualsal
+ FROM emp;
+
diff --git a/src/test/regress/sql/sanity_check.sql b/src/test/regress/sql/sanity_check.sql
new file mode 100644
index 00000000000..20b159084ba
--- /dev/null
+++ b/src/test/regress/sql/sanity_check.sql
@@ -0,0 +1,9 @@
+--
+-- sanity check, if we don't have indices the test will take years to
+-- complete.
+--
+SELECT relname, relhasindex
+ FROM pg_class
+ WHERE relhasindex
+ ORDER BY relname;
+
diff --git a/src/test/regress/sql/tests b/src/test/regress/sql/tests
index f78e57f4e73..c0b29c003da 100644
--- a/src/test/regress/sql/tests
+++ b/src/test/regress/sql/tests
@@ -2,6 +2,11 @@ create_function
create_type
create_table
create_misc
+create_aggregate
+create_view
+create_operator
+create_index
+sanity_check
reltime
abstime
boolean
@@ -23,3 +28,4 @@ point
polygon
text
tinterval
+misc