From: Richard Huxton <dev@archonet.com>
To: Kenneth Gonsalves <lawgon@thenilgiris.com>
Cc: weberp@paradise.net.nz
Cc: pgsql-sql@postgresql.org
Subject: Re: Query performance problem
Date: Thu, 17 Mar 2005 14:05:45 +0000
Message-ID: <42398EB9.2050707@archonet.com> (raw)
In-Reply-To: <200503171801.19412.lawgon@thenilgiris.com>
References: <200503172120.20676.weberp@paradise.net.nz>
<200503171801.19412.lawgon@thenilgiris.com>
Kenneth Gonsalves wrote:
> On Thursday 17 Mar 2005 1:50 pm, Phil Daintree wrote:
>
>
>>CREATE TABLE chartdetails (
>> accountcode integer DEFAULT 0 NOT NULL,
>> period integer DEFAULT 0 NOT NULL,
>> budget double precision DEFAULT (0)::double precision NOT NULL,
>> actual double precision DEFAULT (0)::double precision NOT NULL,
>> bfwd double precision DEFAULT (0)::double precision NOT NULL,
>> bfwdbudget double precision DEFAULT (0)::double precision NOT
>>NULL );
>
>
> although may be not relevant to your question, as i have noticed this
> before with mysql 'sql', what is the point of having a NOT NULL field
> that defaults to 0? the whole idea of a NOT NULL field is to have the
> value filled in compulsorily and having a default of 0 or '' defeats
> the purpose
Not necessarily. NOT NULL here helps to ensure you can add values
together without the risk of a null result. There are plenty of "amount"
columns that should be not-null (total spent, total ordered etc).
--
Richard Huxton
Archonet Ltd
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: dev@archonet.com, lawgon@thenilgiris.com, weberp@paradise.net.nz
Subject: Re: Query performance problem
In-Reply-To: <42398EB9.2050707@archonet.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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