Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 84e6042

Browse files
committed
Make pg_regress a tad simpler and more general-purpose by removing its
code to forcibly drop regressuser[1-4] and regressgroup[1-2]. Instead, let the privileges.sql test do that for itself (this is made easy by the recent addition of DROP ROLE IF EXISTS). Per a recent patch proposed by Joachim Wieland --- the rest of his patch is superseded by the rewrite into C, but this is a good idea we should adopt.
1 parent 2256d29 commit 84e6042

File tree

3 files changed

+29
-13
lines changed

3 files changed

+29
-13
lines changed

src/test/regress/expected/privileges.out

+11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
--
22
-- Test access privileges
33
--
4+
-- Clean up in case a prior regression run failed
5+
-- Suppress NOTICE messages when users/groups don't exist
6+
SET client_min_messages TO 'error';
7+
DROP ROLE IF EXISTS regressgroup1;
8+
DROP ROLE IF EXISTS regressgroup2;
9+
DROP ROLE IF EXISTS regressuser1;
10+
DROP ROLE IF EXISTS regressuser2;
11+
DROP ROLE IF EXISTS regressuser3;
12+
DROP ROLE IF EXISTS regressuser4;
13+
RESET client_min_messages;
14+
-- test proper begins here
415
CREATE USER regressuser1;
516
CREATE USER regressuser2;
617
CREATE USER regressuser3;

src/test/regress/pg_regress.sh

+1-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.64 2006/01/05 03:01:38 momjian Exp $
2+
# $PostgreSQL: pgsql/src/test/regress/pg_regress.sh,v 1.65 2006/07/18 00:32:41 tgl Exp $
33

44
me=`basename $0`
55
: ${TMPDIR=/tmp}
@@ -555,18 +555,6 @@ if [ $? -ne 0 ]; then
555555
fi
556556

557557

558-
# ----------
559-
# Remove regressuser* and regressgroup* user accounts.
560-
# ----------
561-
562-
message "dropping regression test user accounts"
563-
"$bindir/psql" -q -X $psql_options -c 'DROP GROUP regressgroup1; DROP GROUP regressgroup2; DROP USER regressuser1, regressuser2, regressuser3, regressuser4;' $dbname 2>/dev/null
564-
if [ $? -eq 2 ]; then
565-
echo "$me: could not drop user accounts"
566-
(exit 2); exit
567-
fi
568-
569-
570558
# ----------
571559
# Install any requested PL languages
572560
# ----------

src/test/regress/sql/privileges.sql

+17
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,23 @@
22
-- Test access privileges
33
--
44

5+
-- Clean up in case a prior regression run failed
6+
7+
-- Suppress NOTICE messages when users/groups don't exist
8+
SET client_min_messages TO 'error';
9+
10+
DROP ROLE IF EXISTS regressgroup1;
11+
DROP ROLE IF EXISTS regressgroup2;
12+
13+
DROP ROLE IF EXISTS regressuser1;
14+
DROP ROLE IF EXISTS regressuser2;
15+
DROP ROLE IF EXISTS regressuser3;
16+
DROP ROLE IF EXISTS regressuser4;
17+
18+
RESET client_min_messages;
19+
20+
-- test proper begins here
21+
522
CREATE USER regressuser1;
623
CREATE USER regressuser2;
724
CREATE USER regressuser3;

0 commit comments

Comments
 (0)