diff --git a/basis/db/postgresql/postgresql-tests.factor b/basis/db/postgresql/postgresql-tests.factor index 04348f44cb..ce13ab2b9c 100644 --- a/basis/db/postgresql/postgresql-tests.factor +++ b/basis/db/postgresql/postgresql-tests.factor @@ -1,6 +1,6 @@ -USING: accessors alien continuations db db.queries db.postgresql db.private -db.tester db.tuples db.types io classes kernel math namespaces prettyprint -sequences system tools.test unicode.case ; +USING: accessors alien continuations db db.errors db.queries db.postgresql +db.private db.tester db.tuples db.types io classes kernel math namespaces +prettyprint sequences system tools.test unicode.case ; IN: db.postgresql.tests : nonexistant-db ( -- db ) @@ -16,7 +16,19 @@ IN: db.postgresql.tests ] unit-test ! Ensure the test database exists -[ ] [ postgresql-test-db [ ] with-db ] unit-test +postgresql-template1-db [ + postgresql-test-db-name ensure-database +] with-db + +! Triggers a two line error message (ERROR + DETAIL) because two +! connections can't simultaneously use the template1 database. +[ + postgresql-template1-db [ + postgresql-template1-db [ + "will_never_exist" ensure-database + ] with-db + ] with-db +] [ sql-unknown-error? ] must-fail-with [ ] [ postgresql-test-db [ diff --git a/basis/db/postgresql/postgresql.factor b/basis/db/postgresql/postgresql.factor index a002175ea8..12acded9c0 100644 --- a/basis/db/postgresql/postgresql.factor +++ b/basis/db/postgresql/postgresql.factor @@ -284,10 +284,10 @@ M: postgresql-db-connection compound ( string object -- string' ) M: postgresql-db-connection parse-db-error "\n" split dup length { { 1 [ first parse-postgresql-sql-error ] } + { 2 [ concat parse-postgresql-sql-error ] } { 3 [ first3 [ parse-postgresql-sql-error ] 2dip postgresql-location >>location ] } } case ; -