Re: equivalent of mysql's SET type? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: equivalent of mysql's SET type?
Date
Msg-id AANLkTimW6UKACfRytE+CGXYnjnJkkNYkF7C35WuY3HqJ@mail.gmail.com
Whole thread Raw
In response to Re: equivalent of mysql's SET type?  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
On Thu, Mar 10, 2011 at 3:54 PM, Merlin Moncure <mmoncure@gmail.com> wrote:
> On Thu, Mar 10, 2011 at 3:21 PM, Reece Hart <reece@harts.net> wrote:
>> On Wed, Mar 9, 2011 at 9:16 AM, Merlin Moncure <mmoncure@gmail.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

pgsql-general by date:

Previous
From: Manos Karpathiotakis
Date:
Subject: Re: Maximum number of tables
Next
From: Vlad Romascanu
Date:
Subject: converting E'C:\\something' to bytea