pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Jones <erik@myemma.com>
To: pgsql-sql <pgsql-sql@postgresql.org>
Subject: Rule rewrite to possible union?
Date: Thu, 6 Dec 2007 16:03:22 -0600
Message-ID: <CD8629AA-978A-4DC0-946F-5AF3451CADC1@myemma.com> (raw)

Here's what I'd like to happen, but I'm not seeing how it can be done.

Say we have this simple table:

CREATE TABLE foo (
id integer,
foo varchar
);

and then many tables along these lines:

CREATE TABLE ud1_foo (LIKE foo);
CREATE TABLE ud2_foo (LIKE foo);

What I'd like is to do is select against foo and if there is an id in  
the where clause equal to 1 or 2 add a union with the appropriate  
table.  I could easily do this at the application level, but this is  
for a migration (the ud tables are going away) and I'd like to  
minimize the number of transient application code changes wherever  
possible.  Is there any way I can make this happen?

Erik Jones

Software Developer | Emma®
erik@myemma.com
800.595.4401 or 615.292.5888
615.292.0777 (fax)

Emma helps organizations everywhere communicate & market in style.
Visit us online at http://www.myemma.com





Message-ID: <CD8629AA-978A-4DC0-946F-5AF3451CADC1@myemma.com>
Permalink:  ../CD8629AA-978A-4DC0-946F-5AF3451CADC1@myemma.com/
Also on:    postgresql.org/message-id/CD8629AA-978A-4DC0-946F-5AF3451CADC1@myemma.com

 · 

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: erik@myemma.com
  Subject: Re: Rule rewrite to possible union?
  In-Reply-To: <CD8629AA-978A-4DC0-946F-5AF3451CADC1@myemma.com>

* 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