Christopher Browne cbbrowne
Wed Apr 20 19:26:42 PDT 2005
Fernando Schapachnik wrote:

>Consider the scripting way:
>
>cmd="SELECT schemaname || '.' || tablename from pg_tables';"
>list=`$psql -c "$cmd" `
>
>i=1
>for k in $list
>do
>        echo "set add table (set id=1, origin=1, id=$i, fully qualified name = 
>'$k');" >> $arch
>        i=`expr $i + 1`
>done
>
>Or something alike.
>
>  
>
That will, by all means, be helpful, although it's more likely to be
useful to do something like...

for db in `psql -t -l | cut -d "|" -f 1`; do
  l=0
  for tbl in `psql -q -d $db -t -c "select schemaname || '.' ||
tablename from pg_tables;"`; do
    l=`expr $l + 1`
    echo "set add table (id=$l, set=1, origin=1, fully qualified
name='$tbl');" >> $db.add.slonik
   done
done

Note that if there are 60 databases, this creates 60 files.  And note
that the above includes a bunch of schemas that probably should be left
out...

It's not bad as a "proof of concept" that it's plausible.

But you then have to configure 60 clusters, subscribe them, and manage
them, which will be not too much fun...


More information about the Slony1-general mailing list