Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X2KEm-0006yt-Vr for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Jul 2014 13:06:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1X2KEm-0002Gp-Dl for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Jul 2014 13:06:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1X2KEk-0002D3-IR for pgsql-bugs@postgresql.org; Wed, 02 Jul 2014 13:06:10 +0000 Received: from wrigleys.postgresql.org ([204.145.124.246]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1X2KEc-00057K-VZ for pgsql-bugs@postgresql.org; Wed, 02 Jul 2014 13:06:09 +0000 MIME-Version: 1.0 Subject: BUG #10836: Rule with RETURNING claims incorrect type To: pgsql-bugs@postgresql.org From: hoschiraffel@freenet.de Date: Wed, 02 Jul 2014 13:05:37 +0000 Message-ID: <20140702130537.5170.32873@wrigleys.postgresql.org> X-Pg-Spam-Score: -1.9 (-) 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: 10836 Logged by: Matthias Raffelsieper Email address: hoschiraffel@freenet.de PostgreSQL version: 9.3.4 Operating system: Mac OSX Description: Hi all. While trying to create rules, I hit a situation that I figure might be a bug. In essence, I observe that when explicitly listing columns in a RETURNING statement of a rule, the type checking is somehow thrown off. When using the '*' all is fine. Please see below for a small example session that exhibits this bug. $ psql test psql (9.3.4) Type "help" for help. test=# \set VERBOSITY verbose test=# create table foobar (id int, info text); CREATE TABLE test=# create view test_me as select id as foo, info as bar from foobar; CREATE VIEW test=# create rule test_me_ins as on insert to test_me do instead insert into foobar values (new.foo,new.bar) returning (id,info); ERROR: 42P17: RETURNING list's entry 1 has different type from column "foo" LOCATION: checkRuleResultList, rewriteDefine.c:682 test=# create rule test_me_ins as on insert to test_me do instead insert into foobar values (new.foo,new.bar) returning *; CREATE RULE test=# insert into test_me VALUES (1,'hello'); INSERT 0 1 test=# insert into test_me VALUES (2,'world') returning bar; bar ------- world (1 row) INSERT 0 1 test=# select * from test_me; foo | bar -----+------- 1 | hello 2 | world (2 rows) test=# Cheers, Matt -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs