if [catch {pg_connect testauth} conn] { set conn [pg_connect template1] set r [pg_exec $conn "create database testauth"] if {$r != "PGRES_COMMAND_OK"} { html "Unable to create test authentication database" } pg_result $r -clear pg_disconnect $conn set conn [pg_connect testauth] } if ![catch {set r [pg_exec $conn "drop table auth"]}] { pg_result $r -clear } set r [pg_exec $conn "create table auth(user text, password text)"] pg_result $r -clear set password [neo_crypt foo salt] set r [pg_exec $conn "insert into auth values ('test', '$password')"] pg_result $r -clear If everything has gone as planned, a database has been created with the user "test" and password "foo". Go to the actual test page.