[BUGS] odd lock on CREATE TABLE AS SELECT

2009-11-08 Thread digital.de...@gmx.it
Hello, I hope it's not a bug, but I get an exclusive lock in a CREATE TABLE AS SELECT statement, contained in the following function/transaction: -- this is an alternative to CLUSTER TABLE, you know, create a -- sorted clone of the table,then create all indexes, FKs and -- then "switch" to new ta

[BUGS] odd deadlock on CREATE TABLE AS SELECT

2009-11-08 Thread digital.de...@gmx.it
Hello, I hope it's not a bug, but I get a deadlock error in a function/transaction with these statements: CREATE OR REPLACE FUNCTION cluster_adc_table () RETURNS INTEGER AS $$ BEGIN DROP TABLE IF EXISTS adc_clustered; RAISE NOTICE 'start creating clustered table at %s', clock_ti