joncrlsn / pgdiff

Compares the PostgreSQL schema between two databases and generates SQL statements that can be run manually against the second database to make their schemas match.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't connect with Kerberos/GSSAPI auth

daqscott opened this issue · comments

./pgdiff -h1 host1 -p 5432 -d1 db1 -h2 host2 -p2 5432 -d2 db2 INDEX
-- db1: {db1 host1 5432 }
-- db2: {db2 host2 5432 }
-- Run the following SQL againt db2:
2015/03/31 10:48:31 Error running querypq: unexpected error: "setting PGKRBSRVNAME not supported"

In my environment all databases are GSSAPI auth, and the environment variable PGKRBSRVNAME is the key to making that work. There are no passwords for any databases as there are strict policies against them at my firm. Would it be hard to add support for this? I might be able to help, but I don't know any go, though I'm not opposed to learning. If it's as simple as tweaking your code to use gssapi I can manage, but I don't think adding gssapi to the go postgresql driver is a good first project for me ;)

One minor side issue: there's also a misspelling of "against" in the message above. I tested against the binary downloaded on March 31, 2015 against postgresql 9.2.4, and I can guarantee that all the standard client utilities work just fine with this environment var & w/o passwords.
Cheers!

Thank you for the feedback, daqscott. I apologize for letting this go so long (I didn't see the email, but have fixed that for the future). I appreciate the mis-spelling warning. I'm big on correct spelling everywhere.

I'm not sure about postgres and GSSAPI. It's probably something that would be supported in the Go Postgres driver. If there is one that supports it then let me know.

One idea short of a new Postgres driver would be to make two "--schema-only" dumps and load them into a local Postgres install and do the compare.

I did find some ideas here: http://www.postgresql.org/docs/9.2/static/libpq-connect.html (search page for gss and kerb). krbsrvname, host, or hostaddr might be options you can specify using the -o1 and -o2 parameters (-O and -o in the upcoming version 0.9.1)