Re: equivalent of mysql's SET type?

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: equivalent of mysql's SET type?
Date: 2011-03-09 01:51:50
Message-ID: 5D6735C9-2E63-4841-A875-D65337D77950@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Mar 8, 2011, at 5:06 PM, Reece Hart wrote:

> I'm considering porting a MySQL database to PostgreSQL. That database uses MySQL's SET type. Does anyone have advice about representing this type in PostgreSQL?
>
> MySQL DDL excerpt:
> CREATE TABLE `transcript_variation` (
> `transcript_variation_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
> `transcript_stable_id` varchar(128) NOT NULL,
> ...
> `consequence_type` set('ESSENTIAL_SPLICE_SITE','STOP_GAINED','STOP_LOST','COMPLEX_INDEL','SPLICE_SITE')
> ) ENGINE=MyISAM AUTO_INCREMENT=174923212 DEFAULT CHARSET=latin1;
>
>
> I'm considering implementing this as a new type based on a bit vector, but I wonder if anyone has a more flexible general solution.

tsvector or intarray might be other options, depending on how you're going to query it and whether those are really strings or more enum-ish.

The more SQLy way of doing it would be to have that stored in a separate table, with a foreign key to this one.

Cheers,
Steve

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Duncan 2011-03-09 01:52:33 Re: equivalent of mysql's SET type?
Previous Message Reece Hart 2011-03-09 01:06:40 equivalent of mysql's SET type?