Closed shadowcat-mst closed 6 years ago
Wouldn't Travis testing be borked too then? https://travis-ci.org/kraih/mojo-pg
Perhaps it's a new feature in recent versions of Postgres, on IRC we've had reports that it works from at least 9.4 onwards.
PostgreSQL versions before 9.2 throw an error when setting search_path to a non-existent schema:
$ pg_lsclusters -h|while read v n rest; do echo -n "$v: "; psql -X --cluster $v/$n -c 'set search_path to no_such_schema'; done
8.4: ERROR: schema "no_such_schema" does not exist
9.0: ERROR: schema "no_such_schema" does not exist
9.1: ERROR: invalid value for parameter "search_path": "no_such_schema"
DETAIL: schema "no_such_schema" does not exist
9.2: SET
9.3: SET
9.4: SET
9.5: SET
9.6: SET
That means it works for at least all versions of PostgreSQL that have not reached their EOL date. https://www.postgresql.org/support/versioning/
Yes. @shadowcat-mst appears to be running Debian 7 (wheezy), which is also EOLed (except for limited LTS).
I tend to test against the oldest version of things I still have to live with in production.
If Mojo::Pg explicitly doesn't support earlier versions, could it at least die() on connect with a useful error or something?
I wouldn't want a 'die', but it would be useful if the test script had a helpful 'diag'.
@shadowcat-mst: if you have a min, could you adjust the title of this issue now it's clear it's not about new contributors, but about using old databases.
Looks like this issue went stale.
The trivial fix for this would be to move the ->search_path
call to after the DROP/CREATE
schema. Or, if that only affects new connections, use ->query('SET search_path TO …')
instead.
Steps to reproduce the behavior
Try and run the tests with TEST_ONLINE=postgresql:///some_db_name
Expected behavior
Tests run
Actual behavior
Everything dies because the tests tries to set search_path to nonexistant schemas
e.g. from t/migrations.t
Isolate tests
but that isn't valid with no such schema already existing, which it doesn't when I just created a fresh database for testing Mojo::Pg against and thus:
Basically so far as I can tell you can't run the tests against any database you didn't ... already run the tests against.
That probably wouldn't be too terrible to fix, but also I'm not even sure where the foo and bar schemas are supposed to come from for t/database.t so I didn't think patching blindly seemed like a good idea.
Am I missing something here or is this horked?