NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
USING is bad anyway (Score:1)
I prefer to name my primary key column `id` and use `foo_id` as the name for foreign key columns. Then I use `ON` explicitly.
Overall the query becomes more verbose, but I prefer it that way. It makes my schemata much more easily readable when columns immediately reveal themselves for what they are by their name.
Reply to This
Re: (Score:2)
That still doesn't fix the bug :)
Re: (Score:2)
I don't actually see the bug, yet, but I'm still a little groggy this AM. I do agree with your principle. But you may have to help me along to see this specific bug. :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:2)
Major Hint: what are we joining on and what data structure is Perl using?
Re: (Score:2)
You know, this might be a MySQL-specific bug. I don't have other databases handy on which to test this. I tried it in SQLite and the problem doesn't appear:
Re: (Score:2)
I think it's definitely MySQL specific ... it sounds like MySQL doesn't actually know how to do that type of join properly?
But I'm confused about something else ... I thought selectrow_hashref should give you a hash where the keys are the fieldnames and the values are the values in the record. You seem to be indicating a problem where one of the values is NULL and that gets used as a key in the hash? But I can't see how that would happen, unless I'm misunderstanding the expected results of selectrow_has
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:2)
You seem to be indicating a problem where one of the values is NULL and that gets used as a key in the hash?
No, I misunderstood. Never mind. :)
J. David works really hard, has a passion for writing good software, and knows many of the world's best Perl programmers
Re: (Score:1)
I’m saying that you got bitten this easily because you combined two bad ideas.
Although now that I think of it, the naming scheme I use means that any join would lead to duplicate
idcolumns.Good thing I avoid
SELECT *like the pest, then. Hmm, looking at some of my own source code, I find I do use the star quite a lot in the older parts. However, it’s always qualified with a table name, which explains why I never ran into your bug.