Subject Re: [firebird-support] NOT NULL constraint not being enforced by Firebird
Author Antonio Galicia
On 6/9/06, dr_bentonquest <bentonquest@...> wrote:

> Please note that the DEDXTRA and PERXTRA fields are not in the INSERT
> field list. I tought they would receive the default value (a zero).
> Instead, I get null values on them, which I can easily confirm
> with a SELECT.

Hi!

I can't reproduce this error.

> So, under which conditions would a 'not null' field accept null
> values? Using FB 1.5.3 for Linux.

I do this
-----------------------------
CREATE TABLE PRUEBA(
ID INTEGER,
TEXTO VARCHAR(5),
DEDXTRA NUMERIC(9,2) DEFAULT 0 NOT NULL,
PERXTRA NUMERIC(9,2) DEFAULT 0 NOT NULL
);

INSERT INTO PRUEBA (ID, TEXTO) VALUES (1, 'A');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (2, 'BB');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (3, 'CCC');
INSERT INTO PRUEBA (ID, TEXTO) VALUES (4, 'DDDD');

-----------------------------

Then:

SQL> select * from PRUEBA;

ID TEXTO DEDXTRA PERXTRA
============ ===== ============ ============

1 A 0.00 0.00
2 BB 0.00 0.00
3 CCC 0.00 0.00
4 DDDD 0.00 0.00

SQL> SHOW VERSION;
ISQL Version: LI-V1.5.3.4870 Firebird 1.5
Firebird/linux AMD64 (access method), version "LI-V1.5.3.4870 Firebird 1.5"
on disk structure version 10.1
SQL>
-----------------------------

--
Saludos,
Toño
----
http://agc.com.mx/antoniogc/blog