pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
View with Union and update rule - fails
2+ messages / 2 participants
[nested] [flat]

* View with Union and update rule - fails
@ 2005-01-07 11:10 Filip Jirsák <Filip.Jirsak@gymnacel.cz>
  2005-01-07 18:29 ` Re: View with Union and update rule - fails Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: Filip Jirsák @ 2005-01-07 11:10 UTC (permalink / raw)
  To: pgsql-sql

Hi,
I have trouble with following VIEW and RULE:

----------------

CREATE SCHEMA test
    AUTHORIZATION postgres;

CREATE TABLE test.table1 (
     uid int4,
     col1 int4,
     col2 int4,
     col3 int4
);

CREATE TABLE test.table2 (
     col4 int4
) INHERITS (test.table1);

CREATE TABLE test.table3 (
     col5 int4
) INHERITS (test.table1);

CREATE VIEW test.view1 AS
     SELECT uid, col1,col2,col3 FROM test.table2
UNION
     SELECT uid, col1,col2,col3 FROM test.table3;

INSERT INTO test.table1 VALUES (1,1,1,1);
INSERT INTO test.table1 VALUES (2,2,2,2);
INSERT INTO test.table1 VALUES (3,3,3,3);
INSERT INTO test.table1 VALUES (4,4,4,4);
INSERT INTO test.table2 VALUES (5,5,5,5,5);
INSERT INTO test.table2 VALUES (6,6,6,6,6);
INSERT INTO test.table2 VALUES (7,7,7,7,7);
INSERT INTO test.table2 VALUES (8,8,8,8,8);
INSERT INTO test.table3 VALUES (9,9,9,9,9);
INSERT INTO test.table3 VALUES (10,10,10,10,10);
INSERT INTO test.table3 VALUES (11,11,11,11,11);
INSERT INTO test.table3 VALUES (12,12,12,12,12);

CREATE OR REPLACE RULE r1 AS
      ON UPDATE TO test.view1 DO INSTEAD
     UPDATE test.table1 SET col1 = 100;

UPDATE test.view1 SET col2 = 101 WHERE uid=1;
----------------

I get:

ERROR:  unrecognized node type: 651

But

UPDATE test.view1 SET col2 = 101;

(without WHERE) works fine. View without UNION works also fine.
Is there something wrong in my code, or is it some feature/bug?
PostgreSQL is 7.4.5 running on Gentoo Linux.
Thanks,
Filip Jirsák




^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: View with Union and update rule - fails
  2005-01-07 11:10 View with Union and update rule - fails Filip Jirsák <Filip.Jirsak@gymnacel.cz>
@ 2005-01-07 18:29 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2005-01-07 18:29 UTC (permalink / raw)
  To: Filip Jirsák <Filip.Jirsak@gymnacel.cz>; +Cc: pgsql-sql

=?ISO-8859-2?Q?Filip_Jirs=E1k?= <Filip.Jirsak@gymnacel.cz> writes:
> I have trouble with following VIEW and RULE:
> ...
> I get:
> ERROR:  unrecognized node type: 651

I can replicate this failure in 7.4.6 but not in 8.0.  I believe it's
fixed by the change discussed here:
http://archives.postgresql.org/pgsql-general/2004-10/msg00069.php

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2005-01-07 18:29 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-01-07 11:10 View with Union and update rule - fails Filip Jirsák <Filip.Jirsak@gymnacel.cz>
2005-01-07 18:29 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox