Re: database design and refactoring

From: Michael Glaesemann <grzm(at)seespotcode(dot)net>
To: Luca Ferrari <fluca1978(at)infinito(dot)it>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: database design and refactoring
Date: 2007-01-04 19:34:13
Message-ID: 71494552-6AB1-4013-8672-C9DA5051D668@seespotcode.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On Jan 3, 2007, at 5:24 , Luca Ferrari wrote:

> Running the database, the users
> decided to place numbers as strings, so values like 00110002 and so
> on.

Note that '00110002' is not a number (i.e., it's not equal to
110002): it's a string of digits.

> is there a tool or a
> way to easily do such refactoring or should I write a program on my
> own to do
> this?

Not that I know of, though ALTER TABLE <table> ALTER <column>
TYPE ... is pretty easy to use.

> And moreover a database design question: is a better idea to choose
> always
> (when possible) numeric keys?

Depends on your requirements. This is an oft-discussed topic about
which you can find many more opinions by googling on natural and
surrogate keys.

Michael Glaesemann
grzm seespotcode net

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Erik Jones 2007-01-04 19:44:00 Re: Using duplicate foreign keys
Previous Message John McCawley 2007-01-04 19:33:15 Re: Any form of connection-level "session variable" ?