summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/join.out31
-rw-r--r--src/test/regress/expected/join_1.out31
-rw-r--r--src/test/regress/sql/join.sql23
3 files changed, 85 insertions, 0 deletions
diff --git a/src/test/regress/expected/join.out b/src/test/regress/expected/join.out
index 3dd4f5ed7d0..bd33cb5c126 100644
--- a/src/test/regress/expected/join.out
+++ b/src/test/regress/expected/join.out
@@ -2290,3 +2290,34 @@ from yy
301 | | | | 1
(3 rows)
+--
+-- regression test for improper pushing of constants across outer-join clauses
+-- (as seen in early 8.2.x releases)
+--
+create temp table zt1 (f1 int primary key);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "zt1_pkey" for table "zt1"
+create temp table zt2 (f2 int primary key);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "zt2_pkey" for table "zt2"
+create temp table zt3 (f3 int primary key);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "zt3_pkey" for table "zt3"
+insert into zt1 values(53);
+insert into zt2 values(53);
+select * from
+ zt2 left join zt3 on (f2 = f3)
+ left join zt1 on (f3 = f1)
+where f2 = 53;
+ f2 | f3 | f1
+----+----+----
+ 53 | |
+(1 row)
+
+create temp view zv1 as select *,'dummy'::text AS junk from zt1;
+select * from
+ zt2 left join zt3 on (f2 = f3)
+ left join zv1 on (f3 = f1)
+where f2 = 53;
+ f2 | f3 | f1 | junk
+----+----+----+------
+ 53 | | |
+(1 row)
+
diff --git a/src/test/regress/expected/join_1.out b/src/test/regress/expected/join_1.out
index 9e10c73acb7..4690b711402 100644
--- a/src/test/regress/expected/join_1.out
+++ b/src/test/regress/expected/join_1.out
@@ -2290,3 +2290,34 @@ from yy
301 | | | | 1
(3 rows)
+--
+-- regression test for improper pushing of constants across outer-join clauses
+-- (as seen in early 8.2.x releases)
+--
+create temp table zt1 (f1 int primary key);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "zt1_pkey" for table "zt1"
+create temp table zt2 (f2 int primary key);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "zt2_pkey" for table "zt2"
+create temp table zt3 (f3 int primary key);
+NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "zt3_pkey" for table "zt3"
+insert into zt1 values(53);
+insert into zt2 values(53);
+select * from
+ zt2 left join zt3 on (f2 = f3)
+ left join zt1 on (f3 = f1)
+where f2 = 53;
+ f2 | f3 | f1
+----+----+----
+ 53 | |
+(1 row)
+
+create temp view zv1 as select *,'dummy'::text AS junk from zt1;
+select * from
+ zt2 left join zt3 on (f2 = f3)
+ left join zv1 on (f3 = f1)
+where f2 = 53;
+ f2 | f3 | f1 | junk
+----+----+----+------
+ 53 | | |
+(1 row)
+
diff --git a/src/test/regress/sql/join.sql b/src/test/regress/sql/join.sql
index 4efb3c72836..96e15b526c2 100644
--- a/src/test/regress/sql/join.sql
+++ b/src/test/regress/sql/join.sql
@@ -462,3 +462,26 @@ from yy
left join (SELECT * FROM yy where pkyy = 101) as yya ON yy.pkyy = yya.pkyy
left join xx xxa on yya.pkxx = xxa.pkxx
left join xx xxb on coalesce (xxa.pkxx, 1) = xxb.pkxx;
+
+--
+-- regression test for improper pushing of constants across outer-join clauses
+-- (as seen in early 8.2.x releases)
+--
+
+create temp table zt1 (f1 int primary key);
+create temp table zt2 (f2 int primary key);
+create temp table zt3 (f3 int primary key);
+insert into zt1 values(53);
+insert into zt2 values(53);
+
+select * from
+ zt2 left join zt3 on (f2 = f3)
+ left join zt1 on (f3 = f1)
+where f2 = 53;
+
+create temp view zv1 as select *,'dummy'::text AS junk from zt1;
+
+select * from
+ zt2 left join zt3 on (f2 = f3)
+ left join zv1 on (f3 = f1)
+where f2 = 53;