I think the underlying feeling here is that if you're not doing anything tricky, and just straight up referencing a column name, that it should be fair to assume that the result will have that column name.
I.e. with create table foo (bar); if I run select bar from foo; I should be able to assume the result column is named "bar". So... select a as c from test is certain to have a field named "c", select c as d from (something with a field named "c") is certain to have a field named "d", but select d from (something with a field named "d") doesn't give a field named "d"? I'd say it's fair to be confused at that. I definitely don't want to have to do queries in the form of "select foo as foo, bar as bar, baz as baz..." -----Original Message----- From: sqlite-users [mailto:[email protected]] On Behalf Of Simon Slavin Sent: Friday, December 22, 2017 11:34 AM To: SQLite mailing list Subject: Re: [sqlite] Changed behaviour or bug using field alias in 3.21.0 On 22 Dec 2017, at 3:04pm, Tim Streater <[email protected]> wrote: > 2) I don't see this issue mentioned when I read the PHP documentation about > their SQLite interface, nor do I see it in the Xojo docs about *their* > interface either. I assume their interfaces are not rewriting SELECT > statements to include AS for every column selected, so should they be warning > their users about it? If you want to depend on the name of a column, use AS. If column names without AS were documented in the SQL standard, and SQLite / PHP / Xojo violated that standard, then there would need to be a warning. But there’s no standard for column names without AS in the SQL standard so no warning is needed. If you think that column names are simple, please consider this: CREATE TABLE ta (ca INTEGER); CREATE TABLE tb (cb INTEGER); SELECT ca FROM ta UNION SELECT cb FROM tb; What should the name of the resulting column be ? Simon. _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

