D. Richard Hipp wrote:
Simon Berthiaume wrote:

For those of you that tends to write complex queries, I noted that
SQLite doesn't like when a table name follows a opening parenthesis in
the FROM clause.


The simplest fix for this would be to insert "SELECT * FROM" right after
the "(" in the FROM list.  So, if the original query was like this:

SELECT * FROM tab1 LEFT JOIN (tab2 LEFT JOIN tab3);

The query could be rewritten as follows:

SELECT * FROM tab1 LEFT JOIN (SELECT * FROM tab2 LEFT JOIN tab3);

The 2nd form would be correctly understood by SQLite.  It wouldn't be
very difficult to get the SQLite parser to do this automatically, I
expect.  Then the first form would work just like the second without
any need for human intervention.


Note a recent similar change to SQLite in check-in [1180]


http://www.sqlite.org/cvstrac/chngview?cn=1180

The IN operator for SQLite used to require a fully-formed SELECT statement
on the right.  Like this:

column IN (SELECT * FROM table)

But after check-in [1180], you can now use the following shorthand:

column IN table

The change was to automatically insert the "SELECT * FROM" in the
parser.  I'm guessing that a changes to allow parentheses in the
FROM clause would be along the same lines.  So if anybody is interested
in working on a patch, I suggest you have a look at [1180] first
to see if you can get any ideas from it.

--
D. Richard Hipp -- [EMAIL PROTECTED] -- 704.948.4565


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to