Re: CASE eval issue

From: Aaron Burt <aaron(at)bavariati(dot)org>
To: pdxpug(at)postgresql(dot)org
Subject: Re: CASE eval issue
Date: 2011-10-18 23:30:52
Message-ID: 20111018233052.GE21112@kailarose.respond2.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pdxpug

On Tue, Oct 18, 2011 at 03:42:10PM -0700, David E. Wheeler wrote:
> On Oct 18, 2011, at 3:31 PM, Aaron Burt wrote:
>
> > Query:
> > select id,
> > case has_column_privilege('mytable', 'secure_column', 'SELECT')
> > when FALSE then 'NA'
> > else secure_column
> > end as secure_column
> > from mytable where id=12345;
> >
> Try this:
>
> select id,
> case when has_column_privilege('mytable', 'secure_column', 'SELECT')
> then 'NA'
> else secure_column
> end as secure_column
> from mytable where id=12345;

Not sure I follow you. Your version appears to reverse the condition.
I did also use the 'case when (condition) then ...' form but as one would
expect, it acted the same. I also used explicit cases for TRUE and FALSE.

Thanks,
Aaron

In response to

Responses

Browse pdxpug by date

  From Date Subject
Next Message David E. Wheeler 2011-10-19 02:24:08 Re: CASE eval issue
Previous Message David E. Wheeler 2011-10-18 22:42:10 Re: CASE eval issue