Ok, I can see that the constraint is specified incorrectly (in the wrong
order).

It really had to be something like that. Still, should it be possible to
create a constraint with mismatched columns like that?

Sorry!

Mike




On Thu, Mar 5, 2015 at 3:35 PM, Mike Goodwin <[email protected]> wrote:

> Hi,
>
> I am having an issue with a particular insert not working. I have made a
> simplified test case below. I've tried on 1.4.186 and 1.3.171 where I
> originally had the issue. Remove the constraint and there is no error
> thrown.
>
>
> DROP ALL OBJECTS;
> SET DB_CLOSE_DELAY -1;
> CREATE USER IF NOT EXISTS SA SALT '694c052f6b533d5a' HASH
> '532086380c0f4606b7361da93e8cba54e938ab51988e2ced7c88c8d582e972cc' ADMIN;
> CREATE SCHEMA IF NOT EXISTS "foo" AUTHORIZATION SA;
> CREATE CACHED TABLE "foo"."site"(
>     "Id" BIGINT NOT NULL,
>     "name" VARCHAR NOT NULL,
> );
> ALTER TABLE "foo"."site" ADD CONSTRAINT "foo".CONSTRAINT_35 PRIMARY
> KEY("Id");
> INSERT INTO "foo"."site"("Id", "name") VALUES(1, 'North Side');
> CREATE CACHED TABLE "foo"."costing_revision"(
>     "week" DATE NOT NULL,
>     "site" BIGINT,
>     "rev" INTEGER NOT NULL
> );
> CREATE CACHED TABLE "foo"."costing"(
>     "week" DATE NOT NULL,
>     "site" BIGINT,
> );
>
>
> ALTER TABLE "foo"."costing_revision" ADD CONSTRAINT
> "foo".FK_COSTING_REVISION_COSTING FOREIGN KEY("week", "site") REFERENCES
> "foo"."costing"("site", "week") NOCHECK;
>
> SELECT * FROM "foo"."site";
>
> INSERT INTO "foo"."costing_revision"
>       ("week",       "site",                "rev")
> VALUES('2013-10-06', 1,  0 );;
>
> I get the following error,
>
> Data conversion error converting "DATE '2013-10-06' (costing: ""site""
> BIGINT)"; SQL statement:
> INSERT INTO "foo"."costing_revision"
>       ("week",       "site",                "rev")
> VALUES('2013-10-06', 1,  0 ) [22018-186]
> <http://192.168.0.11:49444/query.do?jsessionid=893d641fcb88f183ab4f31046155a055#>
> 22018/22018 (Help)
> <http://h2database.com/javadoc/org/h2/constant/ErrorCode.html#c22018>
>
>
>
> regards,
>
> Mike
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to