Re: BUG #10836: Rule with RETURNING claims incorrect type
От | Marko Tiikkaja |
---|---|
Тема | Re: BUG #10836: Rule with RETURNING claims incorrect type |
Дата | |
Msg-id | 53B40E5B.1050209@joh.to обсуждение исходный текст |
Ответ на | BUG #10836: Rule with RETURNING claims incorrect type (hoschiraffel@freenet.de) |
Ответы |
Re: BUG #10836: Rule with RETURNING claims incorrect type
|
Список | pgsql-bugs |
On 7/2/14 3:05 PM, hoschiraffel@freenet.de wrote: > 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 You're actually only returning a single column. RETURNING (id, info) is the same as RETURNING ROW(id, info), which is very different from RETURNING id, info. See http://www.postgresql.org/docs/9.3/static/rowtypes.html, for example. Note that this behaviour is the same as in SELECT lists; SELECT (id, info) FROM foobar; will also only give you a single column. .marko
В списке pgsql-bugs по дате отправления: