BUG #10836: Rule with RETURNING claims incorrect type

Поиск
Список
Период
Сортировка
От hoschiraffel@freenet.de
Тема BUG #10836: Rule with RETURNING claims incorrect type
Дата
Msg-id 20140702130537.5170.32873@wrigleys.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #10836: Rule with RETURNING claims incorrect type  (Marko Tiikkaja <marko@joh.to>)
Re: BUG #10836: Rule with RETURNING claims incorrect type  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-bugs
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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Pavan Deolasee
Дата:
Сообщение: Re: BUG #10675: alter database set tablespace and unlogged table
Следующее
От: Maria Guadalupe Lopez Campos
Дата:
Сообщение: