diff --git a/src/test/regress/expected/alter_table.out b/src/test/regress/expected/alter_table.out
index 6b9291b..bd5069d 100644
--- a/src/test/regress/expected/alter_table.out
+++ b/src/test/regress/expected/alter_table.out
@@ -2409,23 +2409,31 @@ CREATE TABLE comment_test (
 CREATE INDEX comment_test_index ON comment_test(indexed_col);
 COMMENT ON COLUMN comment_test.id IS 'Column ''id'' on comment_test';
 COMMENT ON INDEX comment_test_index IS 'Simple index on comment_test';
-COMMENT ON CONSTRAINT comment_test_positive_col_check ON comment_test IS 'CHECK constraint on comment_test.positive_col';
-COMMENT ON CONSTRAINT comment_test_pk ON comment_test IS 'PRIMARY KEY constraint of comment_test';
-COMMENT ON INDEX comment_test_pk IS 'Index backing the PRIMARY KEY of comment_test';
+COMMENT ON CONSTRAINT comment_test_positive_col_check ON comment_test
+    IS 'CHECK constraint on comment_test.positive_col';
+COMMENT ON CONSTRAINT comment_test_pk ON comment_test
+    IS 'PRIMARY KEY constraint of comment_test';
+COMMENT ON INDEX comment_test_pk
+    IS 'Index backing the PRIMARY KEY of comment_test';
 SELECT col_description('comment_test'::regclass, 1) as comment;
            comment           
 -----------------------------
  Column 'id' on comment_test
 (1 row)
 
-SELECT indexrelid::regclass as index, obj_description(indexrelid, 'pg_class') as comment FROM pg_index where indrelid = 'comment_test'::regclass;
+SELECT indexrelid::regclass AS index,
+    obj_description(indexrelid, 'pg_class') AS comment
+FROM pg_index where indrelid = 'comment_test'::regclass ORDER BY index;
        index        |                    comment                    
 --------------------+-----------------------------------------------
- comment_test_index | Simple index on comment_test
  comment_test_pk    | Index backing the PRIMARY KEY of comment_test
+ comment_test_index | Simple index on comment_test
 (2 rows)
 
-SELECT conname as constraint, obj_description(oid, 'pg_constraint') as comment FROM pg_constraint where conrelid = 'comment_test'::regclass;
+SELECT conname as constraint,
+    obj_description(oid, 'pg_constraint') AS comment
+FROM pg_constraint where conrelid = 'comment_test'::regclass
+ORDER BY conname;
            constraint            |                    comment                    
 ---------------------------------+-----------------------------------------------
  comment_test_pk                 | PRIMARY KEY constraint of comment_test
@@ -2449,18 +2457,23 @@ SELECT col_description('comment_test'::regclass, 1) as comment;
  Column 'id' on comment_test
 (1 row)
 
-SELECT indexrelid::regclass as index, obj_description(indexrelid, 'pg_class') as comment FROM pg_index where indrelid = 'comment_test'::regclass;
+SELECT indexrelid::regclass AS index,
+    obj_description(indexrelid, 'pg_class') AS comment
+FROM pg_index where indrelid = 'comment_test'::regclass ORDER BY index;
        index        |                    comment                    
 --------------------+-----------------------------------------------
- comment_test_pk    | Index backing the PRIMARY KEY of comment_test
  comment_test_index | Simple index on comment_test
+ comment_test_pk    | Index backing the PRIMARY KEY of comment_test
 (2 rows)
 
-SELECT conname as constraint, obj_description(oid, 'pg_constraint') as comment FROM pg_constraint where conrelid = 'comment_test'::regclass;
+SELECT conname AS constraint,
+    obj_description(oid, 'pg_constraint') AS comment
+FROM pg_constraint where conrelid = 'comment_test'::regclass
+ORDER BY conname;
            constraint            |                    comment                    
 ---------------------------------+-----------------------------------------------
- comment_test_positive_col_check | CHECK constraint on comment_test.positive_col
  comment_test_pk                 | PRIMARY KEY constraint of comment_test
+ comment_test_positive_col_check | CHECK constraint on comment_test.positive_col
 (2 rows)
 
 -- Check that we map relation oids to filenodes and back correctly.  Only
diff --git a/src/test/regress/sql/alter_table.sql b/src/test/regress/sql/alter_table.sql
index 9f755fa..666ac9c 100644
--- a/src/test/regress/sql/alter_table.sql
+++ b/src/test/regress/sql/alter_table.sql
@@ -1605,13 +1605,21 @@ CREATE INDEX comment_test_index ON comment_test(indexed_col);
 
 COMMENT ON COLUMN comment_test.id IS 'Column ''id'' on comment_test';
 COMMENT ON INDEX comment_test_index IS 'Simple index on comment_test';
-COMMENT ON CONSTRAINT comment_test_positive_col_check ON comment_test IS 'CHECK constraint on comment_test.positive_col';
-COMMENT ON CONSTRAINT comment_test_pk ON comment_test IS 'PRIMARY KEY constraint of comment_test';
-COMMENT ON INDEX comment_test_pk IS 'Index backing the PRIMARY KEY of comment_test';
+COMMENT ON CONSTRAINT comment_test_positive_col_check ON comment_test
+    IS 'CHECK constraint on comment_test.positive_col';
+COMMENT ON CONSTRAINT comment_test_pk ON comment_test
+    IS 'PRIMARY KEY constraint of comment_test';
+COMMENT ON INDEX comment_test_pk
+    IS 'Index backing the PRIMARY KEY of comment_test';
 
 SELECT col_description('comment_test'::regclass, 1) as comment;
-SELECT indexrelid::regclass as index, obj_description(indexrelid, 'pg_class') as comment FROM pg_index where indrelid = 'comment_test'::regclass;
-SELECT conname as constraint, obj_description(oid, 'pg_constraint') as comment FROM pg_constraint where conrelid = 'comment_test'::regclass;
+SELECT indexrelid::regclass AS index,
+    obj_description(indexrelid, 'pg_class') AS comment
+FROM pg_index where indrelid = 'comment_test'::regclass ORDER BY index;
+SELECT conname as constraint,
+    obj_description(oid, 'pg_constraint') AS comment
+FROM pg_constraint where conrelid = 'comment_test'::regclass
+ORDER BY conname;
 
 -- Change the datatype of all the columns. ALTER TABLE is optimized to not
 -- rebuild an index if the new data type is binary compatible with the old
@@ -1626,8 +1634,13 @@ ALTER TABLE comment_test ALTER COLUMN positive_col SET DATA TYPE bigint;
 
 -- Check that the comments are intact.
 SELECT col_description('comment_test'::regclass, 1) as comment;
-SELECT indexrelid::regclass as index, obj_description(indexrelid, 'pg_class') as comment FROM pg_index where indrelid = 'comment_test'::regclass;
-SELECT conname as constraint, obj_description(oid, 'pg_constraint') as comment FROM pg_constraint where conrelid = 'comment_test'::regclass;
+SELECT indexrelid::regclass AS index,
+    obj_description(indexrelid, 'pg_class') AS comment
+FROM pg_index where indrelid = 'comment_test'::regclass ORDER BY index;
+SELECT conname AS constraint,
+    obj_description(oid, 'pg_constraint') AS comment
+FROM pg_constraint where conrelid = 'comment_test'::regclass
+ORDER BY conname;
 
 
 -- Check that we map relation oids to filenodes and back correctly.  Only
