I agree with paul here. I think in the optimal solution would be a table prefix for every column, so we have *zero* name clashes for joins. I doubt we will get there any time soon, but it is something to thing about. It simplifies queries, whereas having id as the pk for each table convolutes and complicates queries. Kyle http://www.kylehall.info ByWater Solutions ( http://bywatersolutions.com ) Meadville Public Library ( http://www.meadvillelibrary.org ) Crawford County Federated Library System ( http://www.ccfls.org ) Mill Run Technology Solutions ( http://millruntech.com ) On Wed, Jun 6, 2012 at 12:24 PM, Paul Poulain <paul.poulain@biblibre.com> wrote:
Le 25/05/2012 18:23, Marc Balmer a écrit :
I contradict. This results neither in complexity nor in mistakes. Imagine two tables, A and B, which both have an id column, then a select would probably look like the following:
select A.id as aid, B.id as bid from A, B, where ...
So it's not a problem.
I contradict your contradiction. If you have branches.id as identifier, then, the FK in borrowers table (the branch of the patron) can't be id, as, in your proposition, the identifier of the borrower will be borrower.id
It means instead of : borrowers(borrower_id,surname,firstname,branch_id) / branches(branch_id,name) / SELECT * FROM borrowers LEFT JOIN branches USING(branch_id) and use all field in a hash, your option would result in:
borrowers(id,surname,firstname,branch_fk_id) / branches(id,name) / SELECT borrowers.*,branches.id as bid,branches.name LEFT JOIN branches ON (borrowers.branch_fk_id,branches.id), and deal with bid as a hash entry.
So, depending on the part of Koha you'll refer to $borrowers->{bid} or $branch->{id}
I can't imagine a second that would be easier to read. No gain, big loss, this option must be forgotten according to me.
-- Paul POULAIN http://www.biblibre.com Expert en Logiciels Libres pour l'info-doc Tel : (33) 4 91 81 35 08 _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/