[EXTERNAL] Re: [odb-users] Error trying to create schema with polymorphic pragma

Stroud, Sean T ststrou at sandia.gov
Wed Sep 26 14:01:22 EDT 2012


Hi Boris,

No need to build a special binary - I can just use the workaround you provided for now.

Thanks for the quick response!

Sean

-----Original Message-----
From: Boris Kolpackov [mailto:boris at codesynthesis.com] 
Sent: Wednesday, September 26, 2012 12:16 PM
To: Stroud, Sean T
Cc: odb-users at codesynthesis.com
Subject: [EXTERNAL] Re: [odb-users] Error trying to create schema with polymorphic pragma

Hi Sean,

Stroud, Sean T <ststrou at sandia.gov> writes:

> I get the following runtime error trying to create schema via the
> schema_catalog:
> 
>    Error: 1005 (HY000): Can't create table 'TEST_DB.Sensor_Product' 
> (errno: 150)

I tried your test and I get the same error. It appears we don't account for the order of table creation when adding a foreign key constraint. So this is a bug in ODB.

If you would like, I can build you a binary with the fix. 

Alternatively, there is a fairly easy workaround. The idea is to assign different names to product and sensor_product schemas and then create them in the correct order:

odb ... --schema-name base product.h
odb ... --schema-name derived sensor_product.h

And then in main():

schema_catalog::create_schema (*db, "base"); schema_catalog::create_schema (*db, "derived");

Thanks for reporting this and providing the test case!

Boris





More information about the odb-users mailing list