[This is a repost, direct mail wasn't working]

Hi all,

I spent a moment at fixing here and there to make some test work under
firebird.

I'm out of luck figuring out the proper solution for
engine.ReflectionTest.testbasic: FB2 fails here because the test tries
to create a table with a primary key and a foreign key to itself, but
the issued SQL define the foreign key sooner than that the primary key.
In other words, the statement is something like

 CREATE TABLE engine_users (
   user_id INTEGER,
   ...
   FOREIGN KEY (parent_user_id) REFERENCES engine_users (user_id)
   PRIMARY KEY (user_id)
 )

This works for example in sqlite, but AFAICS FB2 is not smart enough:
it accepts the stmt only if I swap the constraints, otherwise it
complains about a missing unique index on the target field...

Digging the issue, I was looking at AnsiSchemaGenerator.visit_table()
which, at some point, calls .get_column_specification() passing a
"first_pk" flag, which at first seemed what I was looking for: as the
comment suggests, if "at all possible" the "primary key" should go
earlier on the column itself, but:

a) none of the current backends make any use of it

b) even if they did, how could they omit the "primary key" constraint
from the final loop on the table's ones?

Ideally the PK constraint (if any) should be visited before the
remaining FK constraints, but I don't see any sensible way of doing
that, since the container is a set.

Any advice?

Thanks in advance,
and happy gnu year everybody ;)

ciao, lele.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to