Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1figMj-0000tL-2T for pgsql-general@arkaria.postgresql.org; Thu, 26 Jul 2018 13:31:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1figMg-0002V9-Jt for pgsql-general@arkaria.postgresql.org; Thu, 26 Jul 2018 13:31:34 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1figMe-0002V1-NV for pgsql-general@lists.postgresql.org; Thu, 26 Jul 2018 13:31:34 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1figMW-0008W7-Ue for pgsql-general@lists.postgresql.org; Thu, 26 Jul 2018 13:31:31 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 90E3B21D16; Thu, 26 Jul 2018 09:31:23 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 26 Jul 2018 09:31:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; bh=dvkX556bTtAvveUATd7DzNeR+fLHP OS4/N2C0x4V3oE=; b=hrHgD1qyr6ZOxSqLoQJvjN3AcYTADVW3LcpsjvNn/EE+u aHZQny3IuU7OYyDA8z01iErv5O6V8NmAEJbwQN1TntB7cuE5lhmb30FTGdpyKBb7 Go1NObiOwV4CUvzDlJBb8MF40Swc9pvzAAZRu9iNe3AseDlSItmP98t3i0sCAQqO AUcalUySDF2D7u5dZbtBvL7a59aselU73CT8Gb/h+3K/3eZOGbBoFdi/MhwRpcdn R4HeuOOYwdXRkU7qyD2RvmhLbAqBF09d/k4Lypex/tfFlEw30bqDoNTw7NHWbNFP PSxFLmCqUxUU/2WIsnZPUvRltdSahSINjG5t7IK7g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=dvkX55 6bTtAvveUATd7DzNeR+fLHPOS4/N2C0x4V3oE=; b=PBj0DhkqAuNy10uYGOFgYf pgOKWZaeZy0WI+g2pQ7b4huY3lLTruWGf1RbB+RCQpM20QuKVRbI3H0G/PSq3aSO 3uW16B/fHfp7PE5IFAyPyYBVmkkTvJA1fB4vix5uQrQ2GjlvqY7W7Df5ZdE4a+DM t6qtgOhmxspyEVz+qPSjnoWzJxYpID28nyMgUgXAFDrS74kMPcPjC2ZzXJLjOJKu Fthq6QKOcA5KvaEpNCowwBYLfreJKmT4mruia51G4r1KuCEIQT3mSwoFpydJyeDN 0T5QDNcgruy+DxwHLR+DHuK/+Fp5nwmV+Ro3qVMse/7jtWs1tTxgcjpVOk4x+Xqw == X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.134.181]) by mail.messagingengine.com (Postfix) with ESMTPA id A4EB6E4ABC; Thu, 26 Jul 2018 09:31:22 -0400 (EDT) Subject: Re: Permission denied on schema for all users on insert to table with fk To: Leland Weathers Cc: pgsql-general@lists.postgresql.org References: <0357d12a-2b1e-14ac-b9b5-7b0062c529fc@aklaver.com> From: Adrian Klaver Message-ID: Date: Thu, 26 Jul 2018 06:31:21 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07/26/2018 03:52 AM, Leland Weathers wrote: > > > > And a more complete example of what we are seeing with multiple > accounts. This particular set is from an account that has their role > set to that of the database & schema owner which is different than > the table owner role. > > __ > > __ __ > > system=# insert into results.batch (hostname, assemblyversion) > VALUES ('mycomp','0.0.0000.00000');____ > > INSERT 0 1____ > > system=# select lastval();____ > > lastval____ > > ---------____ > >        6____ > > (1 row)____ > > __ __ > > __ __ > > system=# INSERT INTO results.historyitem > (batchid,datasourceid,sequence_order)____ > > system-# VALUES____ > > system-# (6,20,1);____ > > ERROR:  permission denied for schema results____ > > LINE 1: SELECT 1 FROM ONLY "results"."batch"...____ > >                            ^____ > > QUERY:  SELECT 1 FROM ONLY "results"."batch" x WHERE "id" > OPERATOR(pg_catalog.=) $1 FOR KEY SHARE OF x____ > > system=# SELECT FROM results.batch WHERE id=6; > > -- > > (1 row) What does \dn+ results show? Before you mentioned a trigger. I am not seeing that in the schema you sent. Is there one and if so what is it's definition and that of its associated function? What does show?: select session_user, current_user; INSERT INTO results.historyitem (batchid,datasourceid,sequence_order) VALUES (6,20,1); -- Adrian Klaver adrian.klaver@aklaver.com