pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Dedels <cdedels@mygeotivity.com>
To: pgsql-sql@postgresql.org
Subject: dynamic rules?
Date: Thu, 3 Jun 2004 21:32:47 -0700
Message-ID: <20040604043444.845E4D1B1DF@svr1.postgresql.org> (raw)

Is it possible to create a select rule that returns results depending on a
where clause in the original select statement?

For Example (oversimplified):

CREATE TABLE one (data int);
CREATE TABLE two (data int);

I make the query:
SELECT data FROM number WHERE type=1;

If the type is 1 (type=1) I want to return 'SELECT data FROM one;'
If the type is 2 (type=2) I want to return 'SELECT data FROM two;'

Thanks,

Chris




view thread (3+ messages)  latest in thread

Message-ID: <20040604043444.845E4D1B1DF@svr1.postgresql.org>
Permalink:  ../20040604043444.845E4D1B1DF@svr1.postgresql.org/
Also on:    postgresql.org/message-id/20040604043444.845E4D1B1DF@svr1.postgresql.org

 · 

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: cdedels@mygeotivity.com
  Subject: Re: dynamic rules?
  In-Reply-To: <20040604043444.845E4D1B1DF@svr1.postgresql.org>

* 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