BUG #1816: Insert null values on a null field

From: "Rafael Barrios" <rbarrios(at)emdis(dot)net(dot)co>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #1816: Insert null values on a null field
Date: 2005-08-11 12:51:51
Message-ID: 20050811125101.M53510@emdis.net.co
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Thanks for your valuable response.
---------- Original Message -----------
From: Richard Huxton <dev(at)archonet(dot)com>
To: Rafael Barrios <rbarrios(at)emdis(dot)net(dot)co>, pgsql-bugs(at)postgresql(dot)org
Sent: Thu, 11 Aug 2005 08:14:13 +0100
Subject: Re: [BUGS] BUG #1816: Insert null values on a null field

> Rafael Barrios wrote:
> > Richard, thanks for your response.
> > here is te information you request:
>
> Don't forget to cc: the mailing list.
>
> > CREATE TABLE tbarrio (
> > bar_coddep character varying(2) NOT NULL,
> > bar_codmun character varying(3) NOT NULL,
> > bar_codbarrio character varying(3) NOT NULL,
> > bar_barrio character varying(40) NOT NULL,
> > bar_zongeografica character varying(1) NOT NULL
> > );
> >
> > ALTER TABLE ONLY tbarrio
> > ADD CONSTRAINT pk_tbarrio PRIMARY KEY (bar_coddep, bar_codmun,
bar_codbarrio);
> >
> > ALTER TABLE ONLY tbarrio
> > ADD CONSTRAINT fk_tbarrio_tmunicipio FOREIGN KEY (bar_coddep, bar_codmun)
> > REFERENCES tmunicipio(mun_coddep, mun_codmun) ON UPDATE CASCADE;
>
> > failling Insert: (adds records to table 'barrio' observe empty values..)
> >
> > INSERT INTO tbarrio VALUES ('05', '001', '', '', '');
>
> These aren't null - they are empty strings. You haven't forbidden
> empty strings.
>
> You'll want constraint(s) to do something like:
>
> ALTER TABLE tbarrio
> ADD CONSTRAINT no_empty_codbarrio
> CHECK (bar_codbarrio > '');
>
> http://www.postgresql.org/docs/8.0/static/sql-altertable.html
>
> HTH
> --
> Richard Huxton
> Archonet Ltd
------- End of Original Message -------

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Marc G. Fournier 2005-08-11 13:48:39 [8.0.0] out of memory on large UPDATE
Previous Message Richard Huxton 2005-08-11 08:24:52 Re: Data Selection Slow From VB 6.0