Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
b83047ee
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b83047ee
编写于
11月 02, 2000
作者:
B
Bruce Momjian
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove pg_dumpaccounts from 7.1 tree.
上级
854307a1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
0 addition
and
220 deletion
+0
-220
contrib/pg_dumpaccounts/Makefile
contrib/pg_dumpaccounts/Makefile
+0
-37
contrib/pg_dumpaccounts/README
contrib/pg_dumpaccounts/README
+0
-9
contrib/pg_dumpaccounts/pg_dumpaccounts.sh
contrib/pg_dumpaccounts/pg_dumpaccounts.sh
+0
-174
未找到文件。
contrib/pg_dumpaccounts/Makefile
已删除
100644 → 0
浏览文件 @
854307a1
#-------------------------------------------------------------------------
#
# Makefile for contrib/pg_dumpaccounts
#
# Copyright (c) 1994, Regents of the University of California
#
# $Header: /cvsroot/pgsql/contrib/pg_dumpaccounts/Attic/Makefile,v 1.2 2000/11/02 18:20:12 wieck Exp $
#
#-------------------------------------------------------------------------
subdir
=
contrib/pg_dumpaccounts
top_builddir
=
../..
include
$(top_builddir)/src/Makefile.global
all
:
pg_dumpaccounts
pg_dumpaccounts
:
pg_dumpaccounts.sh
sed
-e
's,@VERSION@,
$(VERSION)
,g'
\
-e
's,@MULTIBYTE@,
$(MULTIBYTE)
,g'
\
-e
's,@bindir@,
$(bindir)
,g'
\
$<
>
$@
chmod
a+x
$@
install
:
all installdirs
$(INSTALL_SCRIPT)
pg_dumpaccounts
$(DESTDIR)$(bindir)
/pg_dumpaccounts
installdirs
:
$(mkinstalldirs)
$(DESTDIR)$(bindir)
uninstall
:
rm
-f
$(
addprefix
$(DESTDIR)$(bindir)
/, pg_dumpaccounts
)
depend dep
:
clean distclean maintainer-clean
:
rm
-f
pg_dumpaccounts
contrib/pg_dumpaccounts/README
已删除
100644 → 0
浏览文件 @
854307a1
pg_dumpaccounts
This is a little utility script derived from pg_dumpall. It just
dumps the global pg_shadow and pg_group as pg_dumpall does without
dumping any of the databases. This is useful for installations
that have many databases with different backup schedules, where
pg_dumpall will never be run and thus, the users and groups will
never be backed up.
contrib/pg_dumpaccounts/pg_dumpaccounts.sh
已删除
100644 → 0
浏览文件 @
854307a1
#! /bin/sh
# pg_dumpaccounts
#
# Dumps the "pg_shadow" and "pg_group" tables, which belong to the
# whole installation rather than any one individual database.
#
# $Header: /cvsroot/pgsql/contrib/pg_dumpaccounts/Attic/pg_dumpaccounts.sh,v 1.1 2000/11/02 18:20:12 wieck Exp $
CMDNAME
=
`
basename
$0
`
# substituted at build
VERSION
=
'@VERSION@'
MULTIBYTE
=
'@MULTIBYTE@'
bindir
=
'@bindir@'
#
# Find out where we're located
#
PGPATH
=
if
echo
"
$0
"
|
grep
'/'
>
/dev/null 2>&1
;
then
# explicit dir name given
PGPATH
=
`
echo
$0
|
sed
's,/[^/]*$,,'
`
# (dirname command is not portable)
else
# look for it in PATH ('which' command is not portable)
for
dir
in
`
echo
"
$PATH
"
|
sed
's/:/ /g'
`
;
do
# empty entry in path means current dir
[
x
"
$dir
"
=
x
]
&&
dir
=
'.'
if
[
-f
"
$dir
/
$CMDNAME
"
]
;
then
PGPATH
=
"
$dir
"
break
fi
done
fi
# As last resort use the installation directory. We don't want to use
# this as first resort because depending on how users do release upgrades
# they might temporarily move the installation tree elsewhere, so we'd
# accidentally invoke the newly installed versions of pg_dump and psql.
if
[
x
"
$PGPATH
"
=
x
""
]
;
then
PGPATH
=
$bindir
fi
#
# Look for needed programs
#
for
prog
in
psql
;
do
if
[
!
-x
"
$PGPATH
/
$prog
"
]
;
then
echo
"The program
$prog
needed by
$CMDNAME
could not be found. It was"
echo
"expected at:"
echo
"
$PGPATH
/
$prog
"
echo
"If this is not the correct directory, please start
$CMDNAME
"
echo
"with a full search path. Otherwise make sure that the program"
echo
"was installed successfully."
exit
1
fi
done
#
# to adapt to System V vs. BSD 'echo'
#
if
echo
'\\'
|
grep
'\\\\'
>
/dev/null 2>&1
then
BS
=
'\'
dummy
=
'\'
# BSD
else
BS
=
'\\'
# System V
fi
# The dummy assignment is necessary to prevent Emacs' font-lock
# mode from going ballistic when editing this file.
usage
=
#
# Scan options. We're interested in the -h (host) and -p (port) options.
#
while
[
$#
-gt
0
]
;
do
case
$1
in
--help
)
usage
=
t
break
;;
--version
)
echo
"pg_dumpaccounts (PostgreSQL)
$VERSION
"
exit
0
;;
--host
|
-h
)
connectopts
=
"
$connectopts
-h
$2
"
shift
;;
-h
*
)
connectopts
=
"
$connectopts
$1
"
;;
--host
=
*
)
connectopts
=
"
$connectopts
-h "
`
echo
$1
|
sed
's/^--host=//'
`
;;
--port
|
-p
)
connectopts
=
"
$connectopts
-p
$2
"
shift
;;
-p
*
)
connectopts
=
"
$connectopts
$1
"
;;
--port
=
*
)
connectopts
=
"
$connectopts
-p "
`
echo
$1
|
sed
's/^--port=//'
`
;;
*
)
echo
"unknown option '
$1
'"
usage
=
t
;;
esac
shift
done
if
[
"
$usage
"
]
;
then
echo
"
$CMDNAME
dumps users and groups of a PostgreSQL database cluster."
echo
echo
"Usage:"
echo
"
$CMDNAME
[ -c ] [ -h host ] [ -p port ]"
echo
echo
"Options:"
echo
" -h, --host <hostname> server host name"
echo
" -p, --port <port> server port number"
echo
echo
"Report bugs to <pgsql-bugs@postgresql.org>."
exit
0
fi
PSQL
=
"
${
PGPATH
}
/psql
$connectopts
"
echo
"--"
echo
"-- pg_dumpaccounts (
$VERSION
)
$connectopts
"
echo
"--"
echo
"
${
BS
}
connect template1"
#
# Dump users (but not the user created by initdb)
#
echo
"DELETE FROM pg_shadow WHERE usesysid NOT IN (SELECT datdba FROM pg_database WHERE datname = 'template1');"
echo
$PSQL
-d
template1
-At
<<
__END__
SELECT
'CREATE USER "' || usename || '" WITH SYSID ' || usesysid
|| CASE WHEN passwd IS NOT NULL THEN ' PASSWORD ''' || passwd || '''' else '' end
|| CASE WHEN usecreatedb THEN ' CREATEDB'::text ELSE ' NOCREATEDB' END
|| CASE WHEN usesuper THEN ' CREATEUSER'::text ELSE ' NOCREATEUSER' END
|| CASE WHEN valuntil IS NOT NULL THEN ' VALID UNTIL '''::text
|| CAST(valuntil AS TIMESTAMP) || '''' ELSE '' END || ';'
FROM pg_shadow
WHERE usesysid <> (SELECT datdba FROM pg_database WHERE datname = 'template1');
__END__
echo
#
# Dump groups
#
echo
"DELETE FROM pg_group;"
echo
$PSQL
-d
template1
-At
-F
' '
-c
'SELECT * FROM pg_group;'
|
\
while
read
GRONAME GROSYSID GROLIST
;
do
echo
"CREATE GROUP
\"
$GRONAME
\"
WITH SYSID
${
GROSYSID
}
;"
raw_grolist
=
`
echo
"
$GROLIST
"
|
sed
's/^{\(.*\)}$/\1/'
|
tr
','
' '
`
for
userid
in
$raw_grolist
;
do
username
=
`
$PSQL
-d
template1
-At
-c
"SELECT usename FROM pg_shadow WHERE usesysid =
${
userid
}
;"
`
echo
" ALTER GROUP
\"
$GRONAME
\"
ADD USER
\"
$username
\"
;"
done
done
exit
0
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录