How to implement a value alias or synonym

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: How to implement a value alias or synonym
Date: 2013-07-10 19:48:30
Message-ID: 0AD01C53605506449BA127FB8B99E5E16831E351@FMSMSX114.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi:

v9.0.1 on linux

Is there a way to query on synonyms of a value transparent to the user?
For example, a column called "animal" can have any text value, including 'horse' and 'cow' and 'pig'. But I want the user to find all the animal='pig' records if they specify 'hog' instead.
So..
select * from thetable where animal = 'pig'
..would generate the same results as...
select * from thetable where animal = 'hog'

There are no 'hog' records in the table, just 'pig' records. And I want to have control over the synonyms, perhaps in some sort of ref table ?

Thanks in Advance for any ideas.

Browse pgsql-general by date

  From Date Subject
Next Message Carlos Oliva 2013-07-10 19:58:49 Re: How to implement a value alias or synonym
Previous Message Adrian.Vondendriesch 2013-07-10 19:19:26 Re: Single Line Query Logging