Index: doc/src/sgml/ref/clusterdb.sgml =================================================================== RCS file: /projects/cvsroot/pgsql-server/doc/src/sgml/ref/clusterdb.sgml,v retrieving revision 1.7 diff -c -r1.7 clusterdb.sgml *** doc/src/sgml/ref/clusterdb.sgml 2003/02/19 04:06:28 1.7 --- doc/src/sgml/ref/clusterdb.sgml 2003/03/09 14:50:41 *************** *** 43,49 **** clusterdb is a shell script wrapper around the backend command ! via the PostgreSQL interactive terminal . There is no effective difference between clustering databases via this or other methods. --- 43,49 ---- clusterdb is a shell script wrapper around the backend command ! via the PostgreSQL interactive terminal . There is no effective difference between clustering databases via this or other methods. *************** *** 53,65 **** and the libpq front-end library do apply. - - clusterdb might need to connect several - times to the PostgreSQL server, asking for - a password each time. It is convenient to have a - $HOME/.pgpass file in such cases. - - --- 53,58 ---- *************** *** 202,211 **** Something went wrong. clusterdb is only a wrapper ! script. See and for a detailed ! discussion of error messages and potential problems. Note that this message ! may appear once per table to be clustered. --- 195,203 ---- Something went wrong. clusterdb is only a wrapper ! script. See and for a detailed ! discussion of error messages and potential problems. Index: src/bin/scripts/clusterdb =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/bin/scripts/clusterdb,v retrieving revision 1.9 diff -c -r1.9 clusterdb *** src/bin/scripts/clusterdb 2003/02/13 05:37:44 1.9 --- src/bin/scripts/clusterdb 2003/03/09 14:50:41 *************** *** 156,189 **** for db in $dbname do [ "$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)" if [ -z "$table" ]; then ! tables=`${PATHNAME}psql $db $PSQLOPT -F: -P format=unaligned -t -c "$query"` [ "$?" -ne 0 ] && exit 1 else ! # if tablename has a dot, use it as namespace separator ! if echo $table | grep -s '\.' 2>&1 >/dev/null ! then ! tbl=`echo $table | cut -d. -f2` ! 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'"` ! echo $tables ! else ! tables=`${PATHNAME}psql $db $PSQLOPT -F: -P format=unaligned -t -c "$query AND pg_class.relname='$table'"` ! fi ! fi ! query= ! for tabs in $tables ! do ! nspc=`echo $tabs | cut -d: -f1` ! tab=`echo $tabs | cut -d: -f2` ! idx=`echo $tabs | cut -d: -f3` ! query="$query CLUSTER $idx ON $nspc.$tab;" ! done ! ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';$query" -d $db ! if [ "$?" -ne 0 ] ! then ! echo "$CMDNAME: While clustering $db, the following failed: $query" 1>&2 fi done --- 156,167 ---- for db in $dbname do [ "$alldb" ] && echo "Clustering $db" if [ -z "$table" ]; then ! ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';CLUSTER" -d $db [ "$?" -ne 0 ] && exit 1 else ! ${PATHNAME}psql $PSQLOPT $ECHOOPT -c "SET autocommit TO 'on';CLUSTER $table" -d $db ! [ "$?" -ne 0 ] && exit 1 fi done