Re: BUG #1659: primary key accepts null value

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Ä°brahim <ibrahimbayer(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #1659: primary key accepts null value
Date: 2005-05-12 13:52:08
Message-ID: 20050512135208.GA45068@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, May 11, 2005 at 01:36:00PM +0100, Ä°brahim wrote:
>
> i m using pg 8.0.2 in a project with Visual Studio.NET at Windows Platform
> but when i send a null value to my Prmary Key column it accepts that value.

PRIMARY KEY implies NOT NULL. Are you sure the value being inserted
is NULL and not, for example, an empty string? What's the output of
the following query (use your own table and column names)?

SELECT pkcolumn, length(pkcolumn), pkcolumn IS NULL FROM tablename;

Are you sure the column has a PRIMARY KEY constraint? If you connect
with psql, what's the output of the following command?

\d tablename

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Sankaran Anupama 2005-05-12 14:24:31 Re: Do dropdb and createdb read password from .pgpass
Previous Message Michael Beckstette 2005-05-12 13:27:58 Re: Missing tables in postgresql 7.2.4