default value -- best practice question

From: "Aurangzeb M(dot) Agha" <aagha(at)bigfoot(dot)com>
To: PostgreSQL General List <pgsql-general(at)postgresql(dot)org>
Subject: default value -- best practice question
Date: 2002-11-27 11:37:41
Message-ID: Pine.LNX.4.50.0211270322480.32401-100000@cinemaspace.berkeley.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm adding a new column to one of my tables and wanted to know if there's
any need for me to set a default value since the type of the column is
'int'.

sql1: alter table todo add column clubmusictypeid int;

sql2: alter table todo alter column clubmusictypeid set default 0;

In general (given a column of type int), is it alright to just do sql1 and
forget about setting a default, or are there advantages to defaulting to
0. I'm presuming that if no default is set, the default is null?

Thx in Advance,
Aurangzeb

--
Aurangzeb M. Agha | Email : aagha(at)bigfoot(dot)com
PGP ID: 0x68B3A763 |

"Those who would give up essential liberty to purchase a little
temporary safety deserve neither liberty nor safety."

- Benjamin Franklin

Browse pgsql-general by date

  From Date Subject
Next Message Achilleus Mantzios 2002-11-27 12:23:12 FreeBSD, Linux: select, select count(*) performance
Previous Message Jean-Christian Imbeault 2002-11-27 10:16:02 Re: 7.3RC2 createlang error