Subject Re: [firebird-support] Constraint Problem
Author Robert
Thank you for your reply, Alan.

>> ALTER TABLE "Readers" ADD "AlwaysMonitor" SMALLINT NOT NULL;
>
> I suppose you are aware that the "Readers" table is completely different to
> a READERS table. Do you have both in the DB by any chance?

Yes, I'm aware of that, and there is only a "Readers" table, no
"READERS" table, or any other combination of capitals and lower case.

> And you have completely disconnected all client software and admin tools and
> re-connected after making this NOT NULL change? It's possible that your
> client still thinks it's working with old DD.
> You need to look closely at the DAO components as well. It would seem to me
> that even though you think you are not updating "AlwaysMonitor", that yo may
> be assigning NULL.
> Either use an SQL monitor, or test these theories by just updating the field
> only in ISQL.
> e.g. UPDATE TABLE SET otherfield=VALUE WHERE ID=VALUE;

The way I did the test was to let the one client (the front-end
software) make the required modifications (ie changing the table and
setting AlwaysMonitor to zero for all fields), and then I then fired up
FlameRobin and ran the query:

SELECT * FROM "Readers";

This showed the modified table with AlwaysMonitor set to 0 for all
records, so the front-end software had made the changes correctly (it
still shows this after disconnecting all clients and then reconnecting
with FlameRobin). Then I tried to modify one of the other fields in
the table using the FlameRobin table display interface, and that's when
the error "validation error for column AlwaysMonitor, value "***null***"
gets displayed. This happens even if all clients are completely
disconnected and then reconnected.

>> The insert failed because a column definition includes validation
>> constraints.
>> Engine Code: 335544347
>> Engine Message:
>> validation error for column AlwaysMonitor, value "***null***".
>
> as it should if you are not assigning the value. If you wish to leave the
> field out of an INSERT statement, then you need to assign a default value
> for the NOT NULL field.

It's not an INSERT statement, it's an UPDATE statement; the error report
is buggy IMHO. Even if I explicitly run an UPDATE query, eg:

UPDATE "Readers" SET "Direction"=1 WHERE "ReaderID"=5;

I get the following result:

Message: isc_dsql_execute2 failed

SQL Message : -625
The insert failed because a column definition includes validation
constraints.

Engine Code : 335544347
Engine Message :
validation error for column AlwaysMonitor, value "*** null ***"


Execute time: 00:00:00.

This is despite AlwaysMonitor being set to 0 according to the query
SELECT * FROM "Readers";.

Regards,

Robert.

----------


----------


No virus found in this outgoing message.
Checked by AVG - www.avg.com
Version: 8.5.339 / Virus Database: 270.12.34/2122 - Release Date: 05/19/09 06:21:00


[Non-text portions of this message have been removed]