I've fixed this in my local copy, but sadly I am completely useless at
CVS etc....so here's what I did. Please let me know if anyone suspects
this is dodgy or plain wrong.
FILE: select.c, LINE: 1136
Changed:
if( longNames )
To:
if( longNames || pTabList->nSrc>1 ){
Many thanks,
Steve
-----Original Message-----
From: Dennis Cote [mailto:[EMAIL PROTECTED]
Sent: 14 September 2005 16:04
To: [email protected]
Subject: Re: [sqlite] Column Naming Convention (yet again)
Drew, Stephen wrote:
>Hello,
>
>It's that time of the month again - column naming convention
discussion.
>
>The documentation states quite clearly:
>
>Case 4: short_column_names=OFF and full_column_names=OFF
>
>For this case (which was the default prior to version 3.1.0) the result
>is the same as for case 2 for simple queries and is the same as case 5
>for joins. In other words, for a query with only a single table in the
>FROM clause, the name of the result set column matches the text of the
>expression that defined the column as in case 2. For a join, the column
>name is of the form "TABLE.COLUMN" where TABLE and COLUMN are the names
>of the table and column from which the data comes, as defined in the
>original CREATE TABLE statement.
>
>Now this is great, but (and this isn't the first time I've mentioned
>it)....
>
>CREATE TABLE TEST1 (a INTEGER, b TEXT, PRIMARY KEY (a))
>
>CREATE TABLE TEST2 (a INTEGER, b TEXT, PRIMARY KEY (a))
>
>SELECT T1.a, T1.b, T2.a, T2.b FROM TEST1 T1, TEST2 T2 WHERE T1.a = T2.a
>
>---------------> this is fine and returns the column names as written
>
>SELECT T1.*, T2.* FROM TEST1 T1, TEST2 T2 WHERE T1.a = T2.a
>
>---------------> this STILL returns without the table-alias prefix.
>
>In my mind these statements both fall into the category mentioned
above.
>
>
>
>Can I ask what the logic is here? (this page doesn't seem to cover it:
>http://www.sqlite.org/cvstrac/wiki?p=ColumnNames)
>
>Following the upgrade to 3.2.5 (on the basis this had been fixed), I do
>not want to tell my users to expand their T1.* to include all the
>column names, as this is a pain when the tables have hundreds of
>columns.....
>
>Any thoughts appreciated.
>
>Regards,
>
>Steve
>
>
>
>
Steve,
You are correct. Something is still broken, either the code or the docs.
I think it's the code. These two statements should produce the same
column headings, and since they are joining two tables, they should both
have full (table.column) column names.
Dennis Cote