Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id B7A2A634F63 for ; Thu, 3 Sep 2009 21:49:58 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 96283-06 for ; Fri, 4 Sep 2009 00:49:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id E19D863267C for ; Thu, 3 Sep 2009 21:49:50 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id 2F186A2EF; Thu, 3 Sep 2009 20:49:49 -0400 (EDT) Date: Thu, 3 Sep 2009 20:49:49 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: "JUNG, Christian" cc: pgsql-jdbc@postgresql.org Subject: Re: PATCH: SET ROLE as connection parameter In-Reply-To: <24BB5F92CE3E62419C5A6D5B1A1E0F46028E1B1C@nts58.saarstahl.de> Message-ID: References: <24BB5F92CE3E62419C5A6D5B1A1E0F46028E1AF1@nts58.saarstahl.de> <24BB5F92CE3E62419C5A6D5B1A1E0F46028E1B1C@nts58.saarstahl.de> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/10 X-Sequence-Number: 19957 On Thu, 3 Sep 2009, JUNG, Christian wrote: > sendStartupPacket by >> adding it to the params array? If so that would save a network >> -----Original Message----- >> 1) Can this be done in the V3 ConnectionFactoryImpl's > roundtrip >> per connection that used this option. > > I'm afraid that setting the role in the startup packet won't work. It's > only possible to change the role if the connection is in transaction > state (as far as I understand the GUC stuff in the backend code > correctly). Hmm, it looks like this works on CVS HEAD, but not before that. It must be related to the removal of flatfiles.c. We can't make any version specific decisions prior to establishing a connection, so we can't do it in the startup packet, but I think it should still be in the ConnectionFactory code. For the V2 Protocol it can be done in the existing network trip done by runInitialQueries. > Should the options be stored in a HashMap and the user be allowed to set > any key-/value-pair (no check if keys are allowed/mistyped, easy to use > new features) or should there be dedicated getter/setter (new features > have to be coded)? The previous discussion was that this wouldn't work for Datasources which have to be accessed in a Java-Bean(y) way, so they can only take simply parameters, not a Map. So I'd just do role and search_path for the moment because we don't have any good ideas on how a general solution would work. Kris Jurka