mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
[ Patch applied only to 7.3.X.]
Hi There's a bug in the clusterdb script where it looks like the arguments to the psql command are being passed in the wrong order, so it fails when you run it on a database that is not on localhost. Here's the output from the command: 133 anands-Computer:bin/scripts> clusterdb -h wooster -U rr granada psql: warning: extra option wooster ignored psql: warning: extra option -U ignored psql: warning: extra option rr ignored psql: warning: extra option -F: ignored psql: warning: extra option -P ignored psql: warning: extra option format=unaligned ignored psql: warning: extra option -t ignored psql: warning: extra option -c ignored psql: warning: extra option SELECT nspname, pg_class.relname, pg_class_2.relname FROM pg_class, pg_class AS pg_class_2 JOIN pg_namespace ON (pg_namespace.oid=relnamespace), pg_index WHERE pg_class.oid=pg_index.indrelid AND pg_class_2.oid=pg_index.indexrelid AND pg_index.indisclustered AND pg_class.relowner=(SELECT usesysid FROM pg_user WHERE usename=current_user) ignored psql: FATAL: user "-h" does not exist I'm attaching a patch that fixes the problem. The diff was run on postgresql 7.3.4 Thanks a lot. Anand Ranganathan
This commit is contained in:
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# IDENTIFICATION
|
# IDENTIFICATION
|
||||||
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/clusterdb,v 1.8 2002/10/21 20:32:33 momjian Exp $
|
# $Header: /cvsroot/pgsql/src/bin/scripts/Attic/clusterdb,v 1.8.2.1 2003/09/29 18:53:08 momjian Exp $
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -156,10 +156,12 @@ fi
|
|||||||
|
|
||||||
for db in $dbname
|
for db in $dbname
|
||||||
do
|
do
|
||||||
|
|
||||||
[ "$alldb" ] && echo "Clustering $db"
|
[ "$alldb" ] && echo "Clustering $db"
|
||||||
query="SELECT nspname, pg_class.relname, pg_class_2.relname FROM pg_class, pg_class AS pg_class_2 JOIN pg_namespace ON (pg_namespace.oid=relnamespace), pg_index WHERE pg_class.oid=pg_index.indrelid AND pg_class_2.oid=pg_index.indexrelid AND pg_index.indisclustered AND pg_class.relowner=(SELECT usesysid FROM pg_user WHERE usename=current_user)"
|
query="SELECT nspname, pg_class.relname, pg_class_2.relname FROM pg_class, pg_class AS pg_class_2 JOIN pg_namespace ON (pg_namespace.oid=relnamespace), pg_index WHERE pg_class.oid=pg_index.indrelid AND pg_class_2.oid=pg_index.indexrelid AND pg_index.indisclustered AND pg_class.relowner=(SELECT usesysid FROM pg_user WHERE usename=current_user)"
|
||||||
|
|
||||||
if [ -z "$table" ]; then
|
if [ -z "$table" ]; then
|
||||||
tables=`${PATHNAME}psql $db $PSQLOPT -F: -P format=unaligned -t -c "$query"`
|
tables=`${PATHNAME}psql $PSQLOPT -F: -P format=unaligned -t -c "$query" $db`
|
||||||
[ "$?" -ne 0 ] && exit 1
|
[ "$?" -ne 0 ] && exit 1
|
||||||
else
|
else
|
||||||
# if tablename has a dot, use it as namespace separator
|
# if tablename has a dot, use it as namespace separator
|
||||||
@@ -167,10 +169,10 @@ do
|
|||||||
then
|
then
|
||||||
tbl=`echo $table | cut -d. -f2`
|
tbl=`echo $table | cut -d. -f2`
|
||||||
nspc=`echo $table | cut -d. -f1`
|
nspc=`echo $table | cut -d. -f1`
|
||||||
tables=`${PATHNAME}psql $db $PSQLOPT -F: -P format=unaligned -t -c "$query AND pg_class.relname='$tbl' AND nspname='$nspc'"`
|
tables=`${PATHNAME}psql $PSQLOPT -F: -P format=unaligned -t -c "$query AND pg_class.relname='$tbl' AND nspname='$nspc'" $db`
|
||||||
echo $tables
|
echo $tables
|
||||||
else
|
else
|
||||||
tables=`${PATHNAME}psql $db $PSQLOPT -F: -P format=unaligned -t -c "$query AND pg_class.relname='$table'"`
|
tables=`${PATHNAME}psql $PSQLOPT -F: -P format=unaligned -t -c "$query AND pg_class.relname='$table'" $db`
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
query=
|
query=
|
||||||
|
Reference in New Issue
Block a user