Improve generated_stored test
authorPeter Eisentraut <[email protected]>
Mon, 20 Jan 2025 14:27:33 +0000 (15:27 +0100)
committerPeter Eisentraut <[email protected]>
Mon, 20 Jan 2025 14:27:33 +0000 (15:27 +0100)
It makes more sense to put the catalog sanity check at the end of the
test rather than at the beginning, so that it can also check whatever
the tests did rather than just whatever happened before the tests.

Suggested-by: jian he <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/a368248e-69e4-40be-9c07-6c3b5880b0a6@eisentraut.org

src/test/regress/expected/generated_stored.out
src/test/regress/sql/generated_stored.sql

index 0d037d48ca01f43397c5e7d2dd84f36af0e0bf8b..09dd36c37c3f043df4b3a959eac24eaa0d477d2f 100644 (file)
@@ -1,9 +1,3 @@
--- sanity check of system catalog
-SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE attgenerated NOT IN ('', 's');
- attrelid | attname | attgenerated 
-----------+---------+--------------
-(0 rows)
-
 CREATE SCHEMA generated_stored_tests;
 GRANT USAGE ON SCHEMA generated_stored_tests TO PUBLIC;
 SET search_path = generated_stored_tests;
@@ -1356,3 +1350,9 @@ CREATE TABLE gtest28b (LIKE gtest28a INCLUDING GENERATED);
  c      | integer |           |          | 
  x      | integer |           |          | generated always as (b * 2) stored
 
+-- sanity check of system catalog
+SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE attgenerated NOT IN ('', 's');
+ attrelid | attname | attgenerated 
+----------+---------+--------------
+(0 rows)
+
index c18e0e1f65516b51d6beaba28702acb0820e9722..9623287e5177b325adfe8c3411e60ecb36d4c588 100644 (file)
@@ -1,7 +1,3 @@
--- sanity check of system catalog
-SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE attgenerated NOT IN ('', 's');
-
-
 CREATE SCHEMA generated_stored_tests;
 GRANT USAGE ON SCHEMA generated_stored_tests TO PUBLIC;
 SET search_path = generated_stored_tests;
@@ -675,3 +671,7 @@ ALTER TABLE gtest28a DROP COLUMN a;
 CREATE TABLE gtest28b (LIKE gtest28a INCLUDING GENERATED);
 
 \d gtest28*
+
+
+-- sanity check of system catalog
+SELECT attrelid, attname, attgenerated FROM pg_attribute WHERE attgenerated NOT IN ('', 's');