The behaviour you're asking about is explicitly undefined in sqlite. Today
it might work like you are reporting and tomorrow it might do something
different. The ONLY way to guarantee specific column names is to do what
Simon suggested: always use "as". If you don't, the exact results are
undefined.

----- stephan
(Sent from a mobile device, possibly from bed. Please excuse brevity,
typos, and top-posting.)
On Aug 25, 2015 19:52, "sqlite-mail" <sqlite-mail at dev.dadbiz.es> wrote:

> First of all thanks for reply !
>
> I can understand your point, what confuses me is that when we query a view
> with "a.*" it doesn't qualify the names so I thought that was a mistake
> when
> we use individual names otherwise I would expected qualified names there
> too.
>
>
> Cheers !
> >  Tue Aug 25 2015 19:45:27 CEST from "Simon Slavin" <slavins at bigfraud.org
> >
> >Subject: Re: [sqlite] Why sqlite show qualified column names when
> selecting
> >from views ?
> >
> >  On 25 Aug 2015, at 6:13pm, sqlite-mail <sqlite-mail at dev.dadbiz.es>
> wrote:
> >
> >
> >>When querying views sqlite shows qualified column names if they are
> >>specified
> >> individually.
> >>
>
> >  Sorry but this has been mentioned a few times here and won't be changed.
> >The SQL standard doesn't mention column names so SQL engines are free to
> do
> >what they want.
> >
> > In SQLite you can depend on column names only if you have specified them
> >using 'AS'. So I would expect, but haven't tested right now ...
> >
> >
> >>SQL: SELECT a.* FROM tbl_view AS a;
> >> Column 0: id
> >> Column 1: name
> >> SQL: SELECT a.id, a.name FROM tbl_view AS a;
> >> Column 0: a.id <<<<<<<<<<<<<<<<<<<<< only with individual fields
> >> Column 1: a.name <<<<<<<<<<<<<<<<<<<
> >>
> >>
>
> >  SQL: SELECT a.id AS id, a.name AS name FROM tbl_view AS a;
> > Column 0: id
> > Column 1: name
> >
> > Simon.
> > _______________________________________________
> > sqlite-users mailing list
> > sqlite-users at mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> >
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>

Reply via email to