Re: Mysql -> PgSQL

From: Tommi Maekitalo <t(dot)maekitalo(at)epgmbh(dot)de>
To: PGSQL <pgsql-general(at)postgresql(dot)org>
Subject: Re: Mysql -> PgSQL
Date: 2002-08-22 06:21:10
Message-ID: 200208220821.10655.t.maekitalo@epgmbh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am Mittwoch, 21. August 2002 20:18 schrieb Bruce Momjian:
> Ray Hunter wrote:
> > I am trying to convert a data type in mysql to postgresql and was
> > wondering which one i would use in pgsql.
> >
> > the type is "set" (example):
> >
> > name set( 'val1', 'val2', 'val3' ) NOT NULL DEFAULT 'val2'
> >
> > How can i do that in pgsql?
>
> Sure:
>
> x CHAR(4) NOT NULL DEFAULT 'val2' CHECK (x = 'val1' OR x = 'val2' ...)

Thats not so trivial. The type set can have "zero or more values, each of
which must be chosen from a list of allowed values" (from Mysql-manual). In
PostgreSQL you have to use a details-table for this. This is a nonstandard
feature of Mysql (these people concentrate in creating nonstandard extensions
before supporting the full standard ;-)

Tommi

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2002-08-22 06:39:20 Re: Primary Keys
Previous Message Tommi Maekitalo 2002-08-22 06:13:08 Re: removing duplicates - sql