pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ranieri Mazili <ranieri.oliveira@terra.com.br>
To: pgsql-general@postgresql.org
To: pgsql-sql@postgresql.org
Subject: CREATE RULE with WHERE clause
Date: Tue, 05 Jun 2007 10:11:59 -0300
Message-ID: <4665611F.9020500@terra.com.br> (raw)

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 




view thread (3+ messages)  latest in thread

Message-ID: <4665611F.9020500@terra.com.br>
Permalink:  ../4665611F.9020500@terra.com.br/
Also on:    postgresql.org/message-id/4665611F.9020500@terra.com.br

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ranieri.oliveira@terra.com.br, pgsql-general@postgresql.org
  Subject: Re: CREATE RULE with WHERE clause
  In-Reply-To: <4665611F.9020500@terra.com.br>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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