[odb-users] Cannot create schema

Michał Snoch kontakt at msnoch.pl
Sat Oct 29 07:20:49 EDT 2011


Hi Boris,

I checked if my method is called more than once, but
unfortunately it is called once only. I'm now using 1.6
version of ODB. In earlier versions everything was ok.

Michal

W dniu 27.10.2011 12:22, Boris Kolpackov pisze:
> Hi Michał,
>
> Michał Snoch<kontakt at msnoch.pl>  writes:
>
>> and when I'm trying to create schema via
>>
>>     transaction t1(db->begin());
>>     odb::schema_catalog::create_schema (*db);
>>       t1.commit();
>>
>> I'm getting error that Node already exists
>>
>>     42P07: ERROR: relation "Node" already exists
>>
>>
>> When I'm generating sql files and executing them
>> by myself everything is ok. Of course there is no
>> Node table in db when I'm doing that.
> It seems that for some reason the code that creates the table is
> called more than once. With embedded (into C++) schema, ODB uses
> static initialization to register functions that must be called
> during the schema creation. So the first step in understanding
> what's going on is to set a breakpoint in such a function for the
> Node class and see how many times it is called and by whom. Search
> for CREATE TABLE \"Node in node-odb.cxx to find the place.
>
> Note that this function is supposed to be called multiple times.
> First to drop tables, and then to create them. It is also possible
> that it will be called multiple times for each of these two steps
> as part of a multi-pass process. However, it should never be called
> more than once with the same pass number (second argument) and the
> drop flag (third argument).
>
> Let us know what you find.
>
> Boris


-- 
Michał Snoch



More information about the odb-users mailing list