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 1g75kr-0007OI-5F for pgsql-general@arkaria.postgresql.org; Mon, 01 Oct 2018 21:29:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g75kp-0005vV-Hz for pgsql-general@arkaria.postgresql.org; Mon, 01 Oct 2018 21:29:23 +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 1g75kp-0005vO-6t for pgsql-general@lists.postgresql.org; Mon, 01 Oct 2018 21:29:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g75km-0006OG-Pp for pgsql-general@lists.postgresql.org; Mon, 01 Oct 2018 21:29:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w91LTJg8030055; Mon, 1 Oct 2018 17:29:19 -0400 From: Tom Lane To: derek cc: pgsql-general@lists.postgresql.org Subject: Re: CREATE TABLE AS SELECT hangs In-reply-to: References: Comments: In-reply-to derek message dated "Mon, 01 Oct 2018 13:35:43 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <30053.1538429359.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Mon, 01 Oct 2018 17:29:19 -0400 Message-ID: <30054.1538429359@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk derek writes: > I am trying to populate/create a database with CREATE TABLE AS SELECT > like so: > CREATE TABLE test_table AS > SELECT row_number() over() as gid, cells.geom > FROM test_geom_function(1,2,3) AS cells; > This works on one database instance, but not on another. On the database > it doesn't work on it seems to hang on executing and when I cancel it I get > ERROR:  canceling statement due to user request > CONTEXT:  while inserting index tuple (6,13) in relation > "pg_type_typname_nsp_index" > SQL state: 57014 Hmm (pokes around) ... That error context message seems to only be possible if we were blocked waiting for some other transaction. I theorize that you have an uncommitted transaction someplace that has created the same table name. Cancelling it would fix things. regards, tom lane