Subject RE: [firebird-support] rare problem
Author Leyne, Sean
Sergio,

> I have this table, with 5 records:
>
> CREATE TABLE FAC_VEN_SUC (
> ID ID /* ID = NUMERIC(9,0) NOT NULL */,
> SUCURSAL ID /* ID = NUMERIC(9,0) NOT NULL */,
> LETRA CARACTER NOT NULL /* CARACTER = CHAR(1) */,
> NUMERO NUMERO_DOC /* NUMERO_DOC = NUMERIC(18,0) DEFAULT
> 0 */,
> EMITIENDO BOOLEAN /* BOOLEAN = SMALLINT default 0 CHECK (value
> is null or value in (0, 1)) */,
> ID_EMPRESAS ID /* ID = NUMERIC(9,0) NOT NULL */,
> ALERTA NUMERO_DOC /* NUMERO_DOC = NUMERIC(18,0) DEFAULT 0
> */,
> SIGNO NUMERO_CHICO /* NUMERO_CHICO = SMALLINT DEFAULT 0
> */
> );
>
> ID has the values from 1 to 5, but when I try to create a PK on ID I get
> this:
>
> The insert failed because a column definition includes validation constraints.
> validation error for column ID, value "*** null ***".
>
> How is it possible? Just in case, I'm using FB 2.5

Are you *sure* that no record exist with ID = NULL?

What does this query report?
SELECT COUNT(*) FROM FAC_VEN_SUC WHERE ID IS NULL


Separately, it may be a personal thing but I would use INTEGER and BIGINT types for NUMERIC( 9,0) and NUMERIC( 18,0) domains.


Sean