|
2 | 2 | #
|
3 | 3 | # pg_dumpall [pg_dump parameters]
|
4 | 4 | # dumps all databases to standard output
|
5 |
| -# It also dumps the pg_user table |
| 5 | +# It also dumps the pg_shadow table |
6 | 6 | #
|
7 | 7 | # to adapt to System V vs. BSD 'echo'
|
8 | 8 | #set -x
|
@@ -30,29 +30,29 @@ echo "${BS}connect template1"
|
30 | 30 | # we don't use POSTGRES_SUPER_USER_ID because the postgres super user id
|
31 | 31 | # could be different on the two installations
|
32 | 32 | #
|
33 |
| -echo "select datdba into table tmp_pguser \ |
| 33 | +echo "select datdba into table tmp_pg_shadow \ |
34 | 34 | from pg_database where datname = 'template1';"
|
35 |
| -echo "delete from pg_user where usesysid <> tmp_pguser.datdba;" |
36 |
| -echo "drop table tmp_pguser;" |
| 35 | +echo "delete from pg_shadow where usesysid <> tmp_pg_shadow.datdba;" |
| 36 | +echo "drop table tmp_pg_shadow;" |
37 | 37 | #
|
38 | 38 | # load all the non-postgres users
|
39 | 39 | #
|
40 |
| -echo "copy pg_user from stdin;" |
| 40 | +echo "copy pg_shadow from stdin;" |
41 | 41 | psql -q template1 <<END
|
42 |
| -select pg_user.* |
43 |
| -into table tmp_pg_user |
44 |
| -from pg_user |
| 42 | +select pg_shadow.* |
| 43 | +into table tmp_pg_shadow |
| 44 | +from pg_shadow |
45 | 45 | where usesysid <> $POSTGRES_SUPER_USER_ID;
|
46 |
| -copy tmp_pg_user to stdout; |
47 |
| -drop table tmp_pg_user; |
| 46 | +copy tmp_pg_shadow to stdout; |
| 47 | +drop table tmp_pg_shadow; |
48 | 48 | END
|
49 | 49 | echo "${BS}."
|
50 | 50 | psql -l -A -q -t| tr '|' ' ' | grep -v '^template1 ' | \
|
51 | 51 | while read DATABASE DBUSERID DATAPATH
|
52 | 52 | do
|
53 | 53 | POSTGRES_USER="`echo \" \
|
54 | 54 | select usename \
|
55 |
| - from pg_user \ |
| 55 | + from pg_shadow \ |
56 | 56 | where usesysid = $DBUSERID; \" | \
|
57 | 57 | psql -A -q -t template1`"
|
58 | 58 | echo "${BS}connect template1 $POSTGRES_USER"
|
|
0 commit comments