Re: Using varchar primary keys.

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
Cc: Tim Uckun <timuckun(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Using varchar primary keys.
Date: 2013-04-01 13:35:13
Message-ID: CAHyXU0ymCYXay0AJ1mSLZ8+wK5eu29hVq5dDQy+0zP4NMpU3Lg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 1, 2013 at 1:22 AM, Jasen Betts <jasen(at)xnet(dot)co(dot)nz> wrote:
> On Mon, Apr 01, 2013 at 07:08:15PM +1300, Tim Uckun wrote:
>> >
>> > how about using an enum instead of this table?
>> >
>> >
>> That's an interesting idea. Are enums mutable?
>
>
> since 9.1 you can add values.
>
> http://www.postgresql.org/docs/9.1/static/sql-altertype.html

It's an interesting idea, but I don't think enums are designed to act
as a primary key except in cases where the data is basically static
and is relatively small. For starters, any manipulation of the enum
requires a lock.

enums can be a real life saver when you need custom ordering built
into a string, especially if that ordering is floated over a composite
index.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Merlin Moncure 2013-04-01 14:04:48 Re: Current Schema for Functions called within other Functions
Previous Message Adrian Klaver 2013-04-01 13:14:59 Re: Problem with pg_basebackup and streaming replication. (9.2.3 / win64)