Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 51465176E18C for ; Sat, 17 Mar 2012 19:04:51 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1S91k1-000414-SR for pgsql-hackers@postgresql.org; Sat, 17 Mar 2012 22:04:50 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q2HM4V55024815; Sat, 17 Mar 2012 18:04:31 -0400 (EDT) To: Andres Freund , pgsql-hackers@postgresql.org, Thom Brown , Dimitri Fontaine Subject: Re: Command Triggers, patch v11 In-reply-to: <9503.1332006327@sss.pgh.pa.us> References: <201203162237.38813.andres@anarazel.de> <21818.1331934775@sss.pgh.pa.us> <201203162317.43818.andres@anarazel.de> <7094.1331996567@sss.pgh.pa.us> <9503.1332006327@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Sat, 17 Mar 2012 13:45:27 -0400" Date: Sat, 17 Mar 2012 18:04:30 -0400 Message-ID: <24814.1332021870@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201203/1168 X-Sequence-Number: 205050 I've found a couple more issues in the CTAS patch: 1. Previous versions delivered a "SELECT n" command tag for either spelling of the command: regression=# select * into t1 from int8_tbl; SELECT 6 regression=# create table t2 as select * from int8_tbl; SELECT 6 With the patch I get regression=# select * into t1 from int8_tbl; SELECT 0 0 regression=# create table t2 as select * from int8_tbl; CREATE TABLE AS The first of these is particularly unfortunate since it's outright lying as to the number of rows processed. I'm not sure what we should do instead. We have gotten push-back before anytime we changed the command tag for an existing command (and in fact it seems that we intentionally added the rowcount display in 9.0, which means there are people out there who care about that functionality). On the other hand, the traditional output for CREATE TABLE AS doesn't seem to satisfy the principle of least astonishment. A third consideration is that if we are pushing CREATE TABLE AS as the preferred spelling, people will probably complain if it omits functionality that SELECT INTO provides; so I'm not sure that "SELECT n" in one case and "CREATE TABLE AS" in the other would be a good idea either. Any opinions what to do here? 2. Historically, CREATE RULE has allowed a rule action to be SELECT INTO (though not CREATE TABLE AS). Currently the patch is throwing an error for that. This seems like something that might not be worth fixing, though. It's fairly hard to conceive of a use-case for such a rule, since it would work only once before starting to throw "table already exists" errors. How much do we care about preserving backward compatibility here? regards, tom lane