Skip site navigation (1) Skip section navigation (2)

Re: Notes on implementing URI syntax for libpq

From: Alexey Klyukin <alexk(at)commandprompt(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>
Cc: Alexander Shulgin <ash(at)commandprompt(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Notes on implementing URI syntax for libpq
Date: 2011-11-24 08:22:21
Message-ID: (view raw or whole thread)
Lists: pgsql-hackers

On Nov 24, 2011, at 9:40 AM, Martijn van Oosterhout wrote:

> On Thu, Nov 24, 2011 at 08:59:56AM +0200, Alexander Shulgin wrote:
>>> How would you specifiy a local port/UNIX domain socket?
>> Missed that in my previous reply.
>> If host part of the URI points to localhost, the UNIX domain socket would be considered by libpq just as if you would pass "-h localhost -p 5433".
> Uh, no it doesn't. "-h localhost" uses TCP/IP (try it). This is one
> piece of mysql magic we don't copy.  If you want to use the socket you
> need to specify "-h /tmp" or wherever you keep it.  Leaving out the -h
> parameter also uses UNIX domain sockets.
> Which does raise the valid question of how to represent that in URI
> syntax. SQLAlchemy (for example) doesn't try with it's URL syntax, to
> connect to a non-default UNIX socket, you need to create the URL object
> directly.
> How about the "service" option, that's a nice way of handling
> non-default socket options.

Another idea is to use local:/dir/name for UNIX domain socket instead of hostname:port, like it's displayed in the psql prompt.

Alexey Klyukin
The PostgreSQL Company – Command Prompt, Inc.

In response to


pgsql-hackers by date

Next:From: Lars KanisDate: 2011-11-24 08:24:22
Subject: [PATCH] PostgreSQL fails to build with 32bit MinGW-w64
Previous:From: Jan UrbańskiDate: 2011-11-24 08:07:02
Subject: Re: PL/Python SQL error code pass-through

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group