Re: Notes on implementing URI syntax for libpq

From: Alexander Shulgin <ash(at)commandprompt(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Notes on implementing URI syntax for libpq
Date: 2011-11-26 20:07:21
Message-ID: 1322336877-sup-2201@moon
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Excerpts from Robert Haas's message of Thu Nov 24 13:57:17 +0200 2011:
>
> I think it would be really weird not to support user:pw(at)host:port. You can presumably also support the JDBC style for backward compatibility, but I don't think we should adopt that syntax as project standard.

By the way, if we're already considering this, what about special syntax for SSL, instead of the JDBC's "&ssl=true" thingy?

Given that the default sslmode is "prefer" I assume libpq tries SSL first, then falls back to plain text if that's not available.

To me, it looks much more natural if the fact that SSL is/should be used is stated early in the URI syntax, like: "https://", "svn+ssh://", etc., rather than in the query parameters (if the parameters were to be passed to remote service to process, like it's done with HTTP[S], this would not make any sense at all.)

But given that sslmode can currently be either of: "disable", "allow", "prefer", "require", "verify-ca" or "verify-full" (and who knows if any new allowed mode could show up later,) allowing "&sslmode=whatever" makes sense. Note, that this is not the same as "&ssl=whatever".

So how about this:

postgresql:ssl://user:pw(at)host:port/dbname?sslmode=...

The "postgresql:ssl://" designator would assume "sslmode=require", if not overriden in extra parameters and "postgresql://" would imply "sslmode=prefer". And to disable SSL you would pick either designator and append "sslmode=disable".

The JDBC's "ssl=true" will translate to "sslmode=require".

If we can decide on this, we should also put reasonable effort into making JDBC support the same syntax.

Thoughts?

--
Alex

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2011-11-26 20:28:57 Re: Patch: Perl xsubpp
Previous Message Dimitri Fontaine 2011-11-26 19:50:46 Re: why do we need two snapshots per query?