rules on select - different output

From: Marcin Mazurek <mazek(at)poznan(dot)mtl(dot)pl>
To: pgsql-sql(at)postgresql(dot)org
Subject: rules on select - different output
Date: 2000-12-02 15:18:55
Message-ID: Pine.LNX.4.10.10012021614470.13008-100000@mazek.darkstar.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-sql by date

  From Date Subject
Next Message Edipo E. F. Melo 2000-12-02 15:20:04 Re: I can be a BUG?
Previous Message hubert depesz lubaczewski 2000-12-02 10:27:23 Re: subselects