How do you plan to prevent such references in the future? Will you
validate CHECK constraints at creation time somehow or are you saying
you're going to disallow CHECK to reference external tables at all? I
hope it's not the latter because I've used it to enforce some
interesting use-cases. For example:
CREATE TABLE department_to_operator (department_id BIGINT NOT NULL,
operator_id BIGINT NOT NULL,
PRIMARY KEY (department_id, operator_id),
FOREIGN KEY(department_id) REFERENCES department(id) ON DELETE CASCADE,
FOREIGN KEY(operator_id) REFERENCES operator(id) ON DELETE CASCADE,
CHECK EXISTS (SELECT * FROM department, operator WHERE
department.id = department_id AND
operator.id = operator_id AND department.company_id =
operator.company_id));
The CHECK makes sure that the inserted department and operator are
associated with the same company.
Gili
On 04/07/2014 3:28 AM, Thomas Mueller wrote:
Hi,
To find the changed source code, you can go to
https://code.google.com/p/h2database/source/list . This case is
https://code.google.com/p/h2database/source/detail?r=5707 - test case
is here:
https://code.google.com/p/h2database/source/diff?spec=svn5707&r=5707&format=side&path=/trunk/h2/src/test/org/h2/test/db/TestCases.java
Regards,
Thomas
On Fri, Jul 4, 2014 at 9:12 AM, Noel Grandin <[email protected]
<mailto:[email protected]>> wrote:
On 2014-07-04 08:51 AM, cowwoc wrote:
How is this even possible? When I try creating foreign keys to
tables that are only created later,the CREATE TABLE
statement fails ("table X does not exist"). Can you provide an
example of problematic code?
We allow general SQL statements in our CHECK constraints, and we
don't validate them immediately.
--
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]
<mailto:h2-database%[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to a topic in the
Google Groups "H2 Database" group.
To unsubscribe from this topic, visit
https://groups.google.com/d/topic/h2-database/W_gVs24v6eA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
[email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.
--
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.