> If using autoload=True when defining your metadata, be sure your FK  
> constraint names are unique to the schema . PostgreSQL scopes FK  
> constraint names to the table, but SQLAlchemy loads them from the SQL  
> standard information_schema, which is designed for schema-scoped  
> constraint names.

While I don't really understand "PostgreSQL scopes FK constraint names to
the table", I can say that my patch fixing ticket 71 (when can we see it
accepted?) does not load from information_schema and is not schema-scoped:
worst than that! the query looks for the foreign keys (and the tables) using
the function pg_table_is_visible(c.oid):

      SELECT conname, pg_catalog.pg_get_constraintdef(oid, true) as condef
      FROM  pg_catalog.pg_constraint r
      WHERE r.conrelid = (
          SELECT c.oid FROM pg_catalog.pg_class c
                       LEFT JOIN pg_catalog.pg_namespace n
                       ON n.oid = c.relnamespace
          WHERE c.relname = :table_name
            AND pg_catalog.pg_table_is_visible(c.oid))
            AND r.contype = 'f' ORDER BY 1


I can't see any possible drawback of this feature, that makes it possible to
autoload tables in one schema referencing tables in another schema that is
visible anyhow. If there is a possibility of a mistake this means the table
should be specified by the schema (that's a different issue, anyhow), but
the fk are bound to their tables by r.conrelid = c.oid

sandro
*:-)


> which is news to me; the query used to reflect foreign keys takes  
> table name into account, and a unit test which reflects anonymously- 
> created foreign keys from two different tables works fine (and always  
> has...).   can someone illustrate this problem for me ? 

-- 
Sandro Dentella  *:-)
http://www.tksql.org                    TkSQL Home page - My GPL work

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to