Hi,
Rami is on the right track. H2 assumes the referenced table is in the same
schema. Try:
drop table test.t2;
drop table t1;
create schema test;
CREATE TABLE T1 (
col1a INT, col1b INT,
primary key(col1a, col1b)
);
CREATE TABLE test.T2 (
col2a INT, col2b INT,
FOREIGN KEY (col2a , col2b)
REFERENCES public.T1(col1a, col1b)
);
Regards,
Thomas
On Tuesday, October 18, 2011, Rami Ojares wrote:
>
> CREATE TABLE test.T2 (
>> col2a INT, col2b INT,
>> FOREIGN KEY (col2a , col2b) REFERENCES T1(col1a, col1b)
>> )
>>
>> The error message is:
>> Table "T1" not found
>>
>
> The reason for the error is that you are not in test schema (you are
> probably in the default PUBLIC schema).
> And thus when you point to table T1 H2 interprets that you mean PUBLIC.T1
> because you do not qualify
> the reference with schema.
> Try
> CREATE TABLE test.T2 (
> col2a INT, col2b INT,
> FOREIGN KEY (col2a , col2b) REFERENCES test.T1(col1a, col1b)
> )
>
> - rami
>
> --
> You received this message because you are subscribed to the Google Groups
> "H2 Database" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at http://groups.google.com/**
> group/h2-database?hl=en <http://groups.google.com/group/h2-database?hl=en>
> .
>
>
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.