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

From Reece Hart
Subject Re: equivalent of mysql's SET type?
Date
Msg-id AANLkTikdpos1uHSB9HvftuqeZQZ32ENbEUxV4HdB-CEX@mail.gmail.com
Whole thread Raw
In response to Re: equivalent of mysql's SET type?  (John R Pierce <pierce@hogranch.com>)
Responses Re: equivalent of mysql's SET type?  (Merlin Moncure <mmoncure@gmail.com>)
List pgsql-general
On Tue, Mar 8, 2011 at 9:41 PM, John R Pierce <pierce@hogranch.com> wrote:
why not just have a set of booleans in the table for these individual on/off attributes?   wouldn't that be simplest?

I like that approach, but I think it's unlikely to fly in this specific case for a couple reasons.

First, there are actually 8 factors (I edited for clarity... sorry about that).

The original database is actively developed (released apx quarterly). I will need an approach that minimizes my burden when they edit the set factors.

And, I'd like to be compatible with mysql syntax and semantics for sets. If you hold your nose for a moment, you'll be able to read the following without becoming ill: mysql uses comma delimited strings to assign and query set types (but stored internally as bit vectors). So, one does validation_status = 'cluster,freq' to set those bits or validation_status like '%freq%' to query. Much to my chagrin, emulating this interface will make migration easier. However, implementing this string interface to set/get boolean columns is just too offensive to whatever modest design sensibilities I have. (For more pleasure reading, see http://dev.mysql.com/doc/refman/5.0/en/set.html. I particularly like the *warning* issued when one tries to add a value that's not part of the set.)

-Reece

pgsql-general by date:

Previous
From: "Edmundo Robles L."
Date:
Subject: about memory size reported by system.
Next
From: Merlin Moncure
Date:
Subject: Re: equivalent of mysql's SET type?