निम्नलिखित करीब आता है:
pg_dump --schema-only --format c dbName | \
pg_restore --schema-only --clean --dbname=dbNameTest
सिवाय इसके कि यह काम नहीं करता है अगर dbNameTest अभी मौजूद नहीं है। निम्नलिखित कार्य करता है (हालांकि यह शिकायत करता है कि dbNameTest पहले से ही मौजूद है। मैं इसके साथ रह सकता हूं)
createdb dbNameTest
pg_dump --schema-only --format c dbName | \
pg_restore --schema-only --clean --dbname=dbNameTest
छोटे विकल्पों वाला एक ऑनलाइनर होगा:
createdb dbNameTest ; pg_dump -s -F c dbName | pg_restore -s -c -d dbNameTest
एक श स्क्रिप्ट pg_copy_schema कुछ ऐसा होगा:
#!/bin/sh
if [ -z "$2" ] ; then echo "Usage: `basename $0` original-db new-db" ; exit 1 ; fi
echo "Copying schema of $1 to $2"
createdb "$2" 2> /dev/null
pg_dump --schema-only --format c "$1" | pg_restore --schema-only --clean --dbname="$2"