Re: equivalent of mysql's SET type?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Reece Hart <reece(at)harts(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: equivalent of mysql's SET type?
Date: 2011-03-16 14:54:34
Message-ID: AANLkTimW6UKACfRytE+CGXYnjnJkkNYkF7C35WuY3HqJ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Mar 10, 2011 at 3:54 PM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
> On Thu, Mar 10, 2011 at 3:21 PM, Reece Hart <reece(at)harts(dot)net> wrote:
>> On Wed, Mar 9, 2011 at 9:16 AM, Merlin Moncure <mmoncure(at)gmail(dot)com> wrote:
>>>
>>> create type validation_flags as
>>> (
>>>  cluster bool,
>>>  freq bool
>>> );
>>
>> Wow. That solution is nearly sexy, and far and away better than any solution
>> that I would have come up with. Thanks, Merlin!
>
> thanks -- I do what I do. fyi another thing is this only works if no
> flags substrings of other flag -- no big deal to add a little guard
> against that in the 'in' function though if you need to.
> also one pain point with composite types is that you can't flip
> specific fields like this:
>
> update foo set (flags).freq = true;

Actually you *can* do this -- I just didn't know it.

update foo set flags.freq = true;

will work, so all that extra stuff to do that isn't needed.

merlin

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vlad Romascanu 2011-03-16 15:04:28 converting E'C:\\something' to bytea
Previous Message Manos Karpathiotakis 2011-03-16 14:35:57 Re: Maximum number of tables