pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
CREATE TABLE AS SELECT hangs
3+ messages / 2 participants
[nested] [flat]

* CREATE TABLE AS SELECT hangs
@ 2018-10-01 18:35  derek <jmorgan3@uwf.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: derek @ 2018-10-01 18:35 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Hello,

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

Any help/suggestions would be greatly appreciated.  I am running 
PostgreSQL 9.6 with PostGIS also for some spatial functionality.

Thanks,

Derek

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: CREATE TABLE AS SELECT hangs
@ 2018-10-01 21:29  Tom Lane <tgl@sss.pgh.pa.us>
  parent: derek <jmorgan3@uwf.edu>
  0 siblings, 1 reply; 3+ messages in thread

From: Tom Lane @ 2018-10-01 21:29 UTC (permalink / raw)
  To: derek <jmorgan3@uwf.edu>; +Cc: pgsql-general@lists.postgresql.org

derek <jmorgan3@uwf.edu> 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




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: CREATE TABLE AS SELECT hangs
@ 2018-10-01 22:20  derek <jmorgan3@uwf.edu>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: derek @ 2018-10-01 22:20 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-general@lists.postgresql.org

Tom.

Thanks so much for your response. Your theory appears to have been 
correct, and it is working like a champ now.

Best,

Derek

On 10/1/2018 4:29 PM, Tom Lane wrote:
> derek <jmorgan3@uwf.edu> 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





^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2018-10-01 22:20 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-10-01 18:35 CREATE TABLE AS SELECT hangs derek <jmorgan3@uwf.edu>
2018-10-01 21:29 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-10-01 22:20   ` derek <jmorgan3@uwf.edu>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox