Skip to content

Parameter application_name isn't set on dbConnect() #75

Closed

Description

@vnniyB

Current github version of dbConnect(drv=RPostgres()) does accept application_name as a parameter.

dbConnect(drv=RPostgres::Postgres(), application_name = 'applicationX')

However when executing
SELECT * FROM pg_stat_activity

The application_name has not been set.

I am currently doing the following as a work around

con <- dbConnect(drv=RPostgres::Postgres())
           dbSendQuery(con, "SET application_name = 'applicationX'")
           dbDisconnect(con)

Check
SELECT * FROM pg_stat_activity
again and you can see the application_name has been set

Activity

  1. chochkov commented on Mar 13, 2017

    @chochkov

    I'd like to see this progressed too; it'd definitely be an advantage over the RPostgreSQL driver. While the PR is being processed I'm using the following workaround (using RPostgreSQL for now).

    .dbConnect <- function(drv, application_name, ...) {
      old <- Sys.getenv("PGAPPNAME")
      Sys.setenv(PGAPPNAME=application_name)
      conn <- dbConnect(...)
      Sys.setenv(PGAPPNAME=old)
      conn
    }
  2. github-actions commented on Dec 9, 2020

    @github-actions
    Contributor

    This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.

  3. locked and limited conversation to collaborators on Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions