On Mon, Apr 21, 2014 at 1:16 AM, Andre <andreest...@gmail.com> wrote:

> Hi,
>
> Apparently when a CTE is used, the column name includes the table alias.
> However, when no CTE is used, the alias is not present in the returned
> column name.
>
> SQLite version 3.8.4.3 2014-04-03 16:53:12
> Enter ".help" for usage hints.
> Connected to a transient in-memory database.
> Use ".open FILENAME" to reopen on a persistent database.
> sqlite> create table X (columnA int);
> sqlite> insert into X values (1);
> sqlite> .header on
> sqlite> select alias.columnA from X alias;
> *columnA*
> 1
> sqlite> with CTE as (select columnA from X) select alias.columnA from CTE
> alias;
> *alias.columnA*
> 1
> sqlite>
>
> I experienced this when rewriting a query to use CTE in an application that
> based some logic on the column name. I'd expect not to see the alias either
> way. Is this a bug or is it expected for CTEs?
>

See http://www.sqlite.org/c3ref/mark/column_name.html?If+there+is+n*fiedfor
further information.

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to