On 18 Mar 2018, at 9:31am, Moritz Bruder <mues...@googlemail.com> wrote:

> I'm not exactly sure what the SQL standard says 

As best I can find, SQL92 does not specify what happens when you choose an AS 
clause giving a value name the same as a column.  It doesn't go into much 
detail at all about applying "AS" to a value.

It does go into more detail about applying "AS" to a table name.  Section 5.4 
paragraph 12 it says

            An <identifier> that is a <correlation name> is associated with
            a table within a particular scope. The scope of a <correlation
            name> is either a <select statement: single row>, <subquery>, or
            <query specification> (see Subclause 6.3, "<table reference>").
            Scopes may be nested. In different scopes, the same <correlation
            name> may be associated with different tables or with the same
            table.

We can apply this to a 'correlation name' for a value rather than a table.  If 
I read this right, it suggests you're right: the use of 'name' should equate to 
your definition '(test.name || '!')', not to 'test.name'.

However if I see code where the programmer picked an alias the same as a real 
column name I'd question the quality of that programmer's thinking.  I get a 
"Do not do this." feeling.

Cue comment from the development team about backward compatibility.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to