Subject Re: [firebird-support] Unique constraint causes insert to fail with 'conversion error from string " "'
Author Thomas Steinmaurer
> I have a table T (PBM_CLAIM BIGINT, CLAIM_SRC SMALLINT, ...) with the
> unique constraint:
>
> ALTER TABLE RELAY_CLAIM ADD CONSTRAINT U_RELAY_CLAIM_SRC UNIQUE
> (PBM_CLAIM,CLAIM_SRC);
>
> If I try to insert a row with (NULL, NULL, ...) when this constraint
> exists, I get the error
>
> ISC ERROR CODE:335544334
> ISC ERROR MESSAGE:
> conversion error from string " "
> I drop the constraint, and the insert works.
> I'm at a loss to understand what's going on, as adding the constraint to
> an existing table works and there are thousands of rows where the tuple
> is (NULL,NULL).
> A simple test table with only a few test rows, these two columns, and
> the unique constraint works fine.
>
> Does anyone have any ideas or experience anything like this?

Looks a bit like a client exception where a string with a single space
gets (implicitly) converted to a numeric value, as your underlaying
fields are bigint/smallint.

Basically, a compound unique constraint shouldn't throw an exception
when all related fields are NULL.


--
With regards,
Thomas Steinmaurer
http://www.upscene.com/