pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ENUM Type
3+ messages / 3 participants
[nested] [flat]

* ENUM Type
@ 1999-02-15 09:01  J. Kinsley <jkinsley@horus.bticc.net>
  0 siblings, 0 replies; 3+ messages in thread

From: J. Kinsley @ 1999-02-15 09:01 UTC (permalink / raw)
  To: pgsql-sql

Has anyone implemented an ENUM type in PostgreSQL like the ENUM type 
in MySQL?  I have a series of MySQL tables that I want to switch over 
to PostgreSQL, but the tables contain a number of ENUM types.  I am 
not a very good C programmer, so I am not really sure how to go about 
creating my own.  Any assistance would be appreciated.

Please Cc any replies to me directly.

Thanks,
Jarrod Kinsley




^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* ENUM Type
@ 2000-03-03 21:37  Kyle Bateman <kyle@actarg.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Kyle Bateman @ 2000-03-03 21:37 UTC (permalink / raw)
  To: pgsql-sql

Does PostgreSQL have support for an ENUM type?

I didn't see it in the docs, but maybe someone has figured out how to
create one easily with the add new type stuff...

Kyle

Attachments:

kyle.vcf (text/x-vcard, 290B) download begin:vcard n:Bateman;Kyle tel;fax:801-377-8096 tel;work:801-377-8033x101 x-mozilla-html:FALSE url:www.actiontarget.com org:Action Target Inc adr:;;PO Box 636;Provo;UT;84603;US version:2.1 email;internet:kyle@actiontarget.com title:President x-mozilla-cpt:;-15520 fn:Kyle Bateman end:vcard
^ permalink raw reply [nested|flat] 3+ messages in thread

* Re: [SQL] ENUM Type
@ 2000-03-04 17:05  Peter Eisentraut <peter_e@gmx.net>
  parent: Kyle Bateman <kyle@actarg.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Peter Eisentraut @ 2000-03-04 17:05 UTC (permalink / raw)
  To: Kyle Bateman <kyle@actarg.com>; +Cc: pgsql-sql

Kyle Bateman writes:

> Does PostgreSQL have support for an ENUM type?

No. You can create a separate table that maps some, say integer, key to a,
say, string. That's usually how ENUM stuff is ported away from MySQL (also
known as TheirSQL). Alternatively you can also pull something like this:

CREATE TABLE test (
    ...
    a text check (a in ('value1', 'value2', ...)),
    ...
)

You get the idea.

> I didn't see it in the docs, but maybe someone has figured out how to
> create one easily with the add new type stuff...

That "add new type stuff" isn't all one might think it is either.

-- 
Peter Eisentraut                  Sernanders väg 10:115
peter_e@gmx.net                   75262 Uppsala
http://yi.org/peter-e/            Sweden




^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2000-03-04 17:05 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-02-15 09:01 ENUM Type J. Kinsley <jkinsley@horus.bticc.net>
2000-03-03 21:37 ENUM Type Kyle Bateman <kyle@actarg.com>
2000-03-04 17:05 ` Peter Eisentraut <peter_e@gmx.net>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox