Skip to content

Implement Connection Service File #538

Closed

Description

@feikesteenbergen

Currently the driver does not support specifying a connection using a service description.
Details: https://www.postgresql.org/docs/current/static/libpq-pgservice.html

I'm currently not a go programmer myself, however looking at the code I might be able to create a proof-of-concept implementation.

Basically, what needs to happen that iff a service is specified, we need to read the libpq parameters from the Connection Service File. For a start, we could use the same logic (and limitations) as the pgpass reading: https://github.com/lib/pq/blob/master/conn.go#L159-L168

Questions:

  • Does anyone - other than me - think this is useful?
  • The Connection Service File is in an ini format, should we use an external ini (or toml) library to implement this?

Activity

  1. cuboci commented on Feb 14, 2017

    @cuboci

    I would love this. I've started using a ~/.pg_service.conf file for cleaner psql command line parameters and would be quite happy if I could use the same service=foo parameter for my PostgreSQL-using go programs.

  2. dskoda1 commented on Apr 4, 2017

    @dskoda1

    @feikesteenbergen @cuboci I also agree this would be useful. It would help bridge the gap between Postgres clients in other languages like psycopg2 which implements this.

  3. jl- commented on Aug 5, 2018

    @jl-

    Any update on this feature?

  4. schoukri commented on Oct 14, 2018

    @schoukri

    I too would love to see this feature implemented. I use a command line tool called migrate, which is written in go and uses lib/pq. I was surprised to learn that it didn't support the service file (especially given that it does support the pgpass file).

  5. added 2 commits that reference this issue on May 21, 2019
    b1b6063
    36e7fd7
  6. added a commit that references this issue on Jun 6, 2019
    51906d9
  7. added a commit that references this issue on Jul 5, 2019
    c63bf70
  8. added a commit that references this issue on Jul 24, 2019
    17d418b
  9. added a commit that references this issue on Jan 6, 2020
    a30c0ae
  10. added a commit that references this issue on Jan 31, 2020
    8750518
  11. added 3 commits that reference this issue on Mar 17, 2026
    17af9a0
    473f917
    e331f57
  12. added a commit that references this issue on Mar 17, 2026
    dc8ff5d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions