On 1 Aug 2002, Manuel Cano [ISO-8859-1] Mu�oz wrote:
> liman@linux:~/proyectos/cange> psql prueba
> Welcome to psql, the PostgreSQL interactive terminal.
>
> Type: \copyright for distribution terms
> \h for help with SQL commands
> \? for help on internal slash commands
> \g or terminate with semicolon to execute query
> \q to quit
>
> prueba=# select * from conceptos;
> id | id_tabla1 | descripcion | borrado
> ----+-----------+-----------------------------+---------
> 0 | | Este es el primer registro | f
> 1 | | Este es el segundo registro | f
> 2 | | Este es el tercer registro | f
> (3 rows)
It looks to me that it's either treating id_tabla1 as
NULL (which passes the constraint) or 0 (which passes the
constraint). What version are you using?