On 5/7/05, Dan Bolser wrote:
> On Sat, 7 May 2005, Jochem van Dieten wrote:
>>On 5/7/05, Dan Bolser wrote:
>>
>>> select pk from a inner join b using (pk);
>>>
>>> ERROR 1052 (23000): Column 'pk' in field list is ambiguous!!!
>>>
>>> Is this a bug, or is it like this for a reason? It drives me nuts, because
>>> it is not ambigious (as far as I can tell). Am I a fool?
>>
>> It is not ambiguous according to the SQL standard. If this behaviour
>> of MySQL is documented it is an omission in the MySQL implementation
>> that you get the error. If this behaviour is not documented, it is a
>> bug.
>
> Perhaps the omission is documented? Should I try to log this as a bug?
Always get it into the system. Even if it is considered not a bug but
a feature I think it warrants a documentation update.
But the problem with fixing this is that it is not backward compatible
and will break for everybody who qualifies his field names.
> Out of interest, what would happen in the following case...
>
> select pk from a inner join b on a.pk = b.pk+1;
>
> Would that be 'correctly' ambigious according to the sql specification?
That would indeed be ambiguous according to the SQL standard.
Jochem