perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Terrence Brannon <>
Subject DBIx::Recordset - detecting table linkages
Date Sat, 11 Oct 2003 11:45:32 GMT

We have::

DBIx::Recordset and DBIx::Database will try to automatically detect 
links between tables based on the field and table names. For this 
feature to work, the field which points to another table must consist of 
the table name and the field name of the destination joined together 
with an underscore (as in the above example name.street_id). Then it 
will automatically recognized as a pointer to

My comments:

Table linkage detection is a useful feature. However, whenever we must 
use SQL, the easiest way to join two tables is via a NATURAL join, in 
which case, both tables would have the field named
street_id. In one case it is the primary key and in another it is the 
foreign key, allowing:

FROM street

instead of

FROM street
    INNER JOIN f ON = f.street_id

So, why is it preferable to have different names for foreign and primary 
keys if the most succinct SQL can be generated from them having the same 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message