$ perl -MDBI -e 'print DBI->connect->selectrow_arrayref("select version()")->[0], "\n"'
PostgreSQL 9.5devel_HEAD_20141013_0733_494affbd900d on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.9.1, 64-bit
Seeing the above I reckon the following should have worked too but does not:
$ perl -MMojo::Pg -E'say Mojo::Pg->new("dbi:Pg:service=HEAD;");'
Invalid PostgreSQL connection string "dbi:Pg:service=HEAD;" at -e line 1.
Likewise, env var DBI_DSN is not used.
Ideally, DBI_DSN='dbi:Pg:' + the above PG-envvars should make connection easy and switchable between pg-versions.
Hi,
It seems Mojo::Pg doesn't take PG* environment variables properly into account:
example:
$ env | grep ^PG PGSERVICEFILE=/home/aardvark/.pg_service PGSERVICE=HEAD PGPASSFILE=/home/aardvark/.pg_aardvark
$ grep -A 5 $PGSERVICE $PGSERVICEFILE [HEAD] host=/tmp port=6545 user=aardvark dbname=testdb
they suffice for DBI connect:
$ perl -MDBI -e 'print DBI->connect->selectrow_arrayref("select version()")->[0], "\n"' PostgreSQL 9.5devel_HEAD_20141013_0733_494affbd900d on x86_64-unknown-linux-gnu, compiled by gcc (GCC) 4.9.1, 64-bit
Seeing the above I reckon the following should have worked too but does not: $ perl -MMojo::Pg -E'say Mojo::Pg->new("dbi:Pg:service=HEAD;");' Invalid PostgreSQL connection string "dbi:Pg:service=HEAD;" at -e line 1.
Likewise, env var DBI_DSN is not used.
Ideally, DBI_DSN='dbi:Pg:' + the above PG-envvars should make connection easy and switchable between pg-versions.