Hi,

A few weeks ago I created ticket 4037 with the description:


The following query

select databasename.tablename.* from databasename.tablename

returns:

near "*": syntax error

However, the following query returns no error:

select databasename.tablename.fieldname from databasename.tablename


I just noticed the ticket was closed without being fixed, with the following
remark:

"Please discuss this on the sqlite-users mailing list, especially including
what the SQL standard says and what other databases say."

Now, I have to admit that English is not my first language, nor the second,
but the way I see it this remark means something like: "This is not a bug,
and if you want to find out why please ask this question in the mailing
list. "

So here I am asking the question here: is this a bug or not?

More info:

I found this issue while using a query builder component available for
Delphi (the Active Query Builder) which may generate the above query based
on the user selection. I suppose I will have a hard time trying to convince
the developers of Active Query Builder to "fix" their tool because it
generates a query that SQLite does not support.

Regarding "what other databases say": the only other database that I
currently have access to is SQL Server, and it supports the syntax without
complaining.

I also downloaded the SQL92 standard, and I didn't find anything relevant
but maybe I didn't know where to look so I would appreciate any pointers.

I am perfectly willing to accept an explanation like: "yes, it is a bug but
it's a corner case and we have better things to do, so stop bugging us and
get a life". In which case I will probably have to find a workaround like
parsing the query and stripping the "databasename" to get something like:

select tablename.* from databasename.tablename

which works fine. However, the following scenario still does not work:

1. The "main" database and the attached database "databasename" both contain
a table called "tablename"
2. The tables with duplicate names from both databases participate in the
generated query, which looks like

select databasename.tablename.*, main.tablename.fieldname
from databasename.tablename, main.tablename

In this case we cannot strip the "databasename" because the syntax would be
ambiguous.

Could anybody help me with this? Basically what I'm looking for is the
answers to these questions:

1. Is this a bug or not? If not, any reason why not?
2. Are other databases supporting this syntax?
3. Is this an invalid syntax according to the SQL standard?
4. Is there a workaround?

I would appreciate any help.

Bogdan Ureche
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to