mirror of
https://github.com/postgres/postgres.git
synced 2025-08-05 07:41:25 +03:00
Rename pg_user to pg_shadow.
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# pg_dumpall [pg_dump parameters]
|
# pg_dumpall [pg_dump parameters]
|
||||||
# dumps all databases to standard output
|
# dumps all databases to standard output
|
||||||
# It also dumps the pg_user table
|
# It also dumps the pg_shadow table
|
||||||
#
|
#
|
||||||
# to adapt to System V vs. BSD 'echo'
|
# to adapt to System V vs. BSD 'echo'
|
||||||
#set -x
|
#set -x
|
||||||
@@ -30,21 +30,21 @@ echo "${BS}connect template1"
|
|||||||
# we don't use POSTGRES_SUPER_USER_ID because the postgres super user id
|
# we don't use POSTGRES_SUPER_USER_ID because the postgres super user id
|
||||||
# could be different on the two installations
|
# could be different on the two installations
|
||||||
#
|
#
|
||||||
echo "select datdba into table tmp_pguser \
|
echo "select datdba into table tmp_pg_shadow \
|
||||||
from pg_database where datname = 'template1';"
|
from pg_database where datname = 'template1';"
|
||||||
echo "delete from pg_user where usesysid <> tmp_pguser.datdba;"
|
echo "delete from pg_shadow where usesysid <> tmp_pg_shadow.datdba;"
|
||||||
echo "drop table tmp_pguser;"
|
echo "drop table tmp_pg_shadow;"
|
||||||
#
|
#
|
||||||
# load all the non-postgres users
|
# load all the non-postgres users
|
||||||
#
|
#
|
||||||
echo "copy pg_user from stdin;"
|
echo "copy pg_shadow from stdin;"
|
||||||
psql -q template1 <<END
|
psql -q template1 <<END
|
||||||
select pg_user.*
|
select pg_shadow.*
|
||||||
into table tmp_pg_user
|
into table tmp_pg_shadow
|
||||||
from pg_user
|
from pg_shadow
|
||||||
where usesysid <> $POSTGRES_SUPER_USER_ID;
|
where usesysid <> $POSTGRES_SUPER_USER_ID;
|
||||||
copy tmp_pg_user to stdout;
|
copy tmp_pg_shadow to stdout;
|
||||||
drop table tmp_pg_user;
|
drop table tmp_pg_shadow;
|
||||||
END
|
END
|
||||||
echo "${BS}."
|
echo "${BS}."
|
||||||
psql -l -A -q -t| tr '|' ' ' | grep -v '^template1 ' | \
|
psql -l -A -q -t| tr '|' ' ' | grep -v '^template1 ' | \
|
||||||
@@ -52,7 +52,7 @@ while read DATABASE DBUSERID DATAPATH
|
|||||||
do
|
do
|
||||||
POSTGRES_USER="`echo \" \
|
POSTGRES_USER="`echo \" \
|
||||||
select usename \
|
select usename \
|
||||||
from pg_user \
|
from pg_shadow \
|
||||||
where usesysid = $DBUSERID; \" | \
|
where usesysid = $DBUSERID; \" | \
|
||||||
psql -A -q -t template1`"
|
psql -A -q -t template1`"
|
||||||
echo "${BS}connect template1 $POSTGRES_USER"
|
echo "${BS}connect template1 $POSTGRES_USER"
|
||||||
|
Reference in New Issue
Block a user