kind of RULE on SELECT depending on existence of a WHERE condition

From: rawi <only4com(at)web(dot)de>
To: pgsql-sql(at)postgresql(dot)org
Subject: kind of RULE on SELECT depending on existence of a WHERE condition
Date: 2010-03-01 10:07:08
Message-ID: 27741669.post@talk.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


Hi
please help me with the following scenario:

I'd gladly have all persons (contacts, customers, staff etc) in one table
"people" with some distinctive flags.

My reason for this, is that simple contacts could become customers or even
staff, staff members could be in the same time also customers etc and I
would be glad to manage all the data in one table to avoid the same
Person-Record in three tables.

Now, the SELECTs would be generated from an application (hibernate)
automatically inserting some WHERE condition on the flags of the recorded
people depending on the rights of the user.
Some isn't allowed to see staff, an other shouldn't see customers etc.

But - for the case, that an application-programmer or even I (tired, middle
in the night) forget to program the insertion of the needed limiting WHERE
condition - it would be great to have some sort of rule ON SELECT, so a
SELECT without WHERE on the flags would return NOTHING.

Is there a way to achieve this?

Thank you for reading and hoping my problem can be solved.

Rawi

--
View this message in context: http://old.nabble.com/kind-of-RULE-on-SELECT-depending-on-existence-of-a-WHERE-condition-tp27741669p27741669.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Huxton 2010-03-01 10:34:35 Re: kind of RULE on SELECT depending on existence of a WHERE condition
Previous Message Michael Gould 2010-02-27 21:02:06 Re: Issue with insert