Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkfTx-0005lG-Do for pgsql-jdbc@arkaria.postgresql.org; Mon, 17 Dec 2012 18:32:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TkfTw-0007HT-V3 for pgsql-jdbc@arkaria.postgresql.org; Mon, 17 Dec 2012 18:32:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkfTw-0007HO-FQ for pgsql-jdbc@postgresql.org; Mon, 17 Dec 2012 18:32:04 +0000 Received: from smtp144.ord.emailsrvr.com ([173.203.6.144]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TkfTt-0003f8-Ll for pgsql-jdbc@postgresql.org; Mon, 17 Dec 2012 18:32:03 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp19.relay.ord1a.emailsrvr.com (SMTP Server) with ESMTP id 299363B00ED for ; Mon, 17 Dec 2012 13:31:59 -0500 (EST) X-Virus-Scanned: OK Received: by smtp19.relay.ord1a.emailsrvr.com (Authenticated sender: david.wall-AT-yozons.com) with ESMTPSA id 20B323B0141 for ; Mon, 17 Dec 2012 13:31:57 -0500 (EST) Message-ID: <50CF651C.9040004@computer.org> Date: Mon, 17 Dec 2012 10:31:56 -0800 From: David Wall User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: JDBC with PG 9.2 and large object permissions as they relate to blobs (after upgrade from 8.4) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org We upgraded our PG from 8.4 to 9.2 and found that our pg_dump and pg_restore caused all of the large objects to be given permission to our db admin user, but not our application user. This resulted in some null pointers in our java code when trying to access an OID column, with the PG error saying: permission denied for large object NNNN. I checked with the excellent PG team and they pointed out that prior to 9.0 large objects didn't have any access permissions/roles assigned to them. So I guess on restore, all of the large objects became owned by our DB admin account, and despite all of our application role table GRANTS, these permission changes did not go down to the related large objects. I'm just checking if the latest JDBC library is doing anything special with respect to large objects and permissions. We just use the PreparedStatement getBlob()/setBlob(). Will the large objects be owned by the role that executes the INSERT? By the way, we used the following psql script (found in posting http://doginpool.blogspot.com/2011/10/today-upgraded-to-new-ubuntu-11.html) to give all large objects ownership back to our application role and this seems to have resolved our issue: do $$ declare r record; begin for r in select loid from pg_catalog.pg_largeobject loop execute 'ALTER LARGE OBJECT ' || r.loid || ' OWNER TO DBUSER'; end loop; end$$; CLOSE ALL; Thanks, David -- Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc