rules on select - different output - Mailing list pgsql-sql

From Marcin Mazurek
Subject rules on select - different output
Date
Msg-id Pine.LNX.4.10.10012021614470.13008-100000@mazek.darkstar.pl
Whole thread Raw
List pgsql-sql
Hi,

I'd like my rule to change the row which is resulting form select.
I'd like to get a row conforming to t1 from t2.
CREATE TABLE t1 (id int, f1 int, f2 int, f3 text, f4 text);
CREATE TABLE t2 (id int, p1 int, p2 text);
CREATE RULE r1 AS ON SELECT TO t2 DO INSTEAD  SELECT id, p1 AS f1, NULL::INT AS f2, p2 as f3, NULL::TEXT as f4 FROM
t2;

psql:test.sql:11: ERROR:  select rules target list must match event
relations st
ructure
test=#

Is there another way to do it?
tia
mazek



pgsql-sql by date:

Previous
From: Jason
Date:
Subject: Re: [PHP-DB] Re: a script that queries database periodically
Next
From: "S.F. Lee"
Date:
Subject: how to execute a C program via trigger ?