Originally I was going to post a bug about this, but after digging further, I think it needs some comment / discussion to find what to do.
While looking to implement NH-1512 (schema metadata for PostgreSQL), I noticed what looks like a problem with IForeignKeyMetadata and the way AbstractForeignKeyMetadata builds those. The first problem I noticed is that AbstractForeignKeyMetadata.AddForeignKey calls GetIndexColumns to get the columns for the foreign key. The way GetIndexColumns works, I'm pretty sure it will fail to find the foreign key columns on many databases[1], so it seems there ought to be a separate GetForeignKeyColumns method for that. Then it occurred to me that if you want to examine if a FK is correct, you need to know what table the FK points to, and you need the columns in pairs (column in this table, column in the referenced table). I started to wonder about all this, did some looking, and found that the foreign key info doesn't seem to be used at all, so I'm not sure what to do about it, if anything. [1] SQLite doesn't seem to support enumerating FK columns. PostgreSQL would need two separate queries to combine index columns with FK columns. I don't have access to MSSQL, but the documentation[2] implies that the IndexColumns schema table won't include FK column info. I don't have access to Oracle either, but the documentation for it is quite clear, in that there is a ForeignKeyColumns schema table to enumerate them. [2] http://msdn.microsoft.com/en-us/library/kcax58fh.aspx -- You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
