Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yrolw-00048d-23 for pgsql-bugs@arkaria.postgresql.org; Mon, 11 May 2015 14:33:32 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yrolv-00021E-HN for pgsql-bugs@arkaria.postgresql.org; Mon, 11 May 2015 14:33:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YroBh-0002wx-V9 for pgsql-bugs@postgresql.org; Mon, 11 May 2015 13:56:06 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1YroBf-0002CJ-52 for pgsql-bugs@postgresql.org; Mon, 11 May 2015 13:56:05 +0000 MIME-Version: 1.0 Subject: BUG #13269: "alter constraint child_parent deferrable initially deferred" sometimes does not make FK deferred To: pgsql-bugs@postgresql.org From: piotr.findeisen@gmail.com Date: Mon, 11 May 2015 13:55:09 +0000 Message-ID: <20150511135509.1095.7355@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.3 (/) Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org The following bug has been logged on the website: Bug reference: 13269 Logged by: Piotr Findeisen Email address: piotr.findeisen@gmail.com PostgreSQL version: 9.4.1 Operating system: Ubuntu 14.04.1 Description: I experienced the problem in different configurations, originally using JDBC. I managed to repro using just psql, but it may be a bit different problem that originally experienced in my Java program. Below follows SQL that in my opinion should fail at 'commit', i.e. after 6 s sleep. However, when run with psql, it fails immediately, as if FK was not made deferred. ---------------------------- create table parent (parent_id bigint primary key); create table child ( child_id bigint primary key, parent_id bigint constraint child_parent references parent (parent_id) --deferrable initially deferred ); insert into parent (parent_id) values (1); insert into child (child_id, parent_id) values (2, 1); alter table child alter constraint child_parent deferrable initially deferred; -- commit; -- helps in pgadmin begin transaction; delete from parent; select pg_sleep(6); commit; ---------------------------- Additional note: when I run the script with pgadmin, if tails immediately too. However, if I ad 'commit' after 'alter table', it fails after 6 s (as expected). Strange, as "there is no transaction in progress" warning is issued suggesting that commit did not change anything. -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs