CREATE RULE with WHERE clause

From: Ranieri Mazili <ranieri(dot)oliveira(at)terra(dot)com(dot)br>
To: pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: CREATE RULE with WHERE clause
Date: 2007-06-05 13:11:59
Message-ID: 4665611F.9020500@terra.com.br
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hello,

I need to create a rule, but I need that it have a WHERE clause, how bellow:

CREATE RULE rule_role_sul AS
ON SELECT TO t1 WHERE roles = 'role_sul'
DO INSTEAD
SELECT field1, field2 FROM t2;

CREATE RULE rule_role_sul AS
ON SELECT TO t1 WHERE roles = 'role_norte'
DO INSTEAD
SELECT field3, field4 FROM t2;

Someone knows how can I do it?

I appreciate any help

Thanks

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma Jr 2007-06-05 13:16:33 Re: Foreign keys and indexes
Previous Message Filip Rembiałkowski 2007-06-05 13:08:34 Re: Foreign keys and indexes

Browse pgsql-sql by date

  From Date Subject
Next Message Chander Ganesan 2007-06-05 13:12:21 Re: the right time to vacuum database?
Previous Message Loredana Curugiu 2007-06-05 12:59:04 Re: [SQL] JOIN