Re: problems with SELECT query results

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: Joshua <joshua(at)joshuaneil(dot)com>, Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: problems with SELECT query results
Date: 2007-05-29 20:35:06
Message-ID: 267552.53183.qm@web31812.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql


--- Joshua <joshua(at)joshuaneil(dot)com> wrote:

> Hello,
>
> Thank you all for your assistance. I did end up finding NULL in the
> 'onorder' column which should have been zero's.... this was in a test
> table that happened to have some NULL in it for one reason or another
> but I should not find this in the production version of the table.

If this should be allowed to have nulls, you should add a not null constraint to your table to
prevent this sort of thing from happening. If a field should have zero's instead of nulls, you
should also add a default value of zero for this column.

ALTER TABLE Slparts
ALTER COLUMN onorder SET NOT NULL,
ALTER COLUMN onorder SET DEFAULT 0;

Regards,
Richard Broersma Jr.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Vang 2007-05-29 21:04:02 current transaction is aborted, commands ignored until end of transaction block
Previous Message John D. Burger 2007-05-29 20:28:37 Re: Geographic data sources, queries and questions

Browse pgsql-sql by date

  From Date Subject
Next Message Bart Degryse 2007-05-30 07:33:40 spi and error messages
Previous Message Lew 2007-05-29 19:33:53 Re: problems with SELECT query results