|
2 | 2 | # |
3 | 3 | # pg_dumpall [pg_dump parameters] |
4 | 4 | # dumps all databases to standard output |
5 | | -# It also dumps thepg_user table |
| 5 | +# It also dumps thepg_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 tabletmp_pguser \ |
| 33 | +echo"select datdba into tabletmp_pg_shadow \ |
34 | 34 | from pg_database where datname ='template1';" |
35 | | -echo"delete frompg_user where usesysid<>tmp_pguser.datdba;" |
36 | | -echo"drop tabletmp_pguser;" |
| 35 | +echo"delete frompg_shadow where usesysid<>tmp_pg_shadow.datdba;" |
| 36 | +echo"drop tabletmp_pg_shadow;" |
37 | 37 | # |
38 | 38 | # load all the non-postgres users |
39 | 39 | # |
40 | | -echo"copypg_user from stdin;" |
| 40 | +echo"copypg_shadow from stdin;" |
41 | 41 | psql -q template1 <<END |
42 | | -selectpg_user.* |
43 | | -into tabletmp_pg_user |
44 | | -frompg_user |
| 42 | +selectpg_shadow.* |
| 43 | +into tabletmp_pg_shadow |
| 44 | +frompg_shadow |
45 | 45 | where usesysid <>$POSTGRES_SUPER_USER_ID; |
46 | | -copytmp_pg_user to stdout; |
47 | | -drop tabletmp_pg_user; |
| 46 | +copytmp_pg_shadow to stdout; |
| 47 | +drop tabletmp_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 | selectusename \ |
55 | | -frompg_user \ |
| 55 | +frompg_shadow \ |
56 | 56 | where usesysid =$DBUSERID;\"| \ |
57 | 57 | psql -A -q -t template1`" |
58 | 58 | echo"${BS}connect template1$POSTGRES_USER" |
|