From 257d8157205a7be5f9799e8941b922521d678a25 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sat, 31 Dec 2016 18:39:08 -0500
Subject: [PATCH] Fix unstable regression test results.

Commit 2ac3ef7a0 added a query with an underdetermined output row order;
it has failed multiple times in the buildfarm since then.  Add an ORDER BY
to fix.  Also, don't rely on a DROP CASCADE to drop in a well-determined
order; that hasn't failed yet but I don't trust it much, and we're not
saving any typing by using CASCADE anyway.
---
 src/test/regress/expected/insert.out | 8 +++-----
 src/test/regress/sql/insert.sql      | 5 +++--
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/test/regress/expected/insert.out b/src/test/regress/expected/insert.out
index 49f667b1194..383d8848471 100644
--- a/src/test/regress/expected/insert.out
+++ b/src/test/regress/expected/insert.out
@@ -314,7 +314,8 @@ from pg_attribute
 where attname = 'a'
  and (attrelid = 'p'::regclass
    or attrelid = 'p1'::regclass
-   or attrelid = 'p11'::regclass);
+   or attrelid = 'p11'::regclass)
+order by attrelid::regclass::text;
  attrelid | attname | attnum 
 ----------+---------+--------
  p        | a       |      1
@@ -333,7 +334,4 @@ select tableoid::regclass, * from p;
 (1 row)
 
 -- cleanup
-drop table p cascade;
-NOTICE:  drop cascades to 2 other objects
-DETAIL:  drop cascades to table p1
-drop cascades to table p11
+drop table p, p1, p11;
diff --git a/src/test/regress/sql/insert.sql b/src/test/regress/sql/insert.sql
index 08dc068de80..687bd4b5041 100644
--- a/src/test/regress/sql/insert.sql
+++ b/src/test/regress/sql/insert.sql
@@ -185,7 +185,8 @@ from pg_attribute
 where attname = 'a'
  and (attrelid = 'p'::regclass
    or attrelid = 'p1'::regclass
-   or attrelid = 'p11'::regclass);
+   or attrelid = 'p11'::regclass)
+order by attrelid::regclass::text;
 
 alter table p1 attach partition p11 for values from (2) to (5);
 alter table p attach partition p1 for values from (1, 2) to (1, 10);
@@ -195,4 +196,4 @@ insert into p values (1, 2);
 select tableoid::regclass, * from p;
 
 -- cleanup
-drop table p cascade;
+drop table p, p1, p11;
-- 
GitLab