RE: [HACKERS] Enum type emulation: problem with opaque type in PL/pgSQL functions

From: "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au>
To: <pgsql-general(at)postgresql(dot)org>
Subject: RE: [HACKERS] Enum type emulation: problem with opaque type in PL/pgSQL functions
Date: 2000-11-24 01:13:19
Message-ID: NEBBIOAJBMEENKACLNPCEEIPCCAA.chriskl@familyhealth.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

> I don't care how but I need to emulate ENUM type, just to convert
> MySQL dumps to PostgreSQL. E.g. ENUM values
> stored in MySQL dump should be restorable in Postgres without any
> conversion.

In MySQL, ENUM is like this:

create table blah (
sex ENUM ('M', 'F')
);

This can be emulated in Postgres like this:

create table blah (
sex CHAR(1) CHECK (sex IN ('M', 'F'))
);

The _real_ trick is implementing MySQL sets in Postgres...

Chris

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2000-11-24 01:34:46 Re: Backward Compatibility
Previous Message Giovanni Tummarello 2000-11-24 00:32:38 selecting data from multiple DBs

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-11-24 01:32:55 Re: Re: RE: [COMMITTERS] pgsql/src/backend/access/transam ( xact.c xlog.c)
Previous Message Larry Rosenman 2000-11-24 01:02:17 Re: syslog output from explain looks weird...