Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for passing application_name into connect #77

Closed
mrmuskrat opened this issue Feb 5, 2021 · 3 comments
Closed

Add support for passing application_name into connect #77

mrmuskrat opened this issue Feb 5, 2021 · 3 comments

Comments

@mrmuskrat
Copy link

mrmuskrat commented Feb 5, 2021

When I try to pass application_name as a connection parameter as documented in the libpq-connect docs I get an error:
invalid connection option "application_name"

I know... It's not documented to work in DBD::Pg but it should. Java and Python can set it and Perl should be able to as well!

If I can set $ENV{PGAPPNAME} soon enough in the process that usually works but it's not always feasible to do so.

In the meantime, I'm issuing a SET application_name = 'foo' after connection (via DBIx::Class::Storage::DBI's on_connect_do/connect_info, scroll up to see the real-life examples).

@mrmuskrat
Copy link
Author

mrmuskrat commented Feb 5, 2021

It should also work with a service connection file too.

@ilmari
Copy link
Collaborator

ilmari commented Feb 6, 2021

Which version of DBD::Pg and libpq are you using? That error message is from libpq, but it has supported application_name since version 9.0.

1> my $dbh = DBI->connect("dbi:Pg:application_name=reply")
$res[1] = bless( {}, 'DBI::db' )

2> $dbh->selectrow_array('show application_name')
$res[2] = 'reply'

3> DBD::Pg->VERSION 
$res[3] = '3.13.0'

6> $dbh->{pg_lib_version}
$res[4] = 120003

@mrmuskrat
Copy link
Author

mrmuskrat commented Feb 6, 2021 via email

@ilmari ilmari closed this as completed Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants