Hi,

we are having issues with H2 SQL parser. It appears that it is having 
problems understanding queries that contain 
inline views, together with normal tables and JOIN/LEFT JOIN combined in 
the same query. 

The error appears only when there are all these things combined (first a 
table, then an inline view with both, another inline view and a JOIN or 
LEFT JOIN).

It would also seems its only a parsing error. 

We include the minimal cases to reproduce it. We tested with Postgres, 
MySQL and DB2 and the query is valid in all of them. 

Is there any chance to get this one fixed? Is it a hard one?

Thank you in advance



CREATE TABLE "TABLE1" (
  "ID" integer NOT NULL
);

-- THIS DOESNT WORK

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (      
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                
                        
                        ) QVIEW4
                               JOIN
"TABLE1"  QVIEW5
ON ( 1= 1)
                ) v1

-- THIS DOESNT WORK

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                )
                        UNION ALL
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW3
                                )
                        ) QVIEW4
                               LEFT OUTER JOIN
"TABLE1" QVIEW5
ON ( 1= 1)
                )
 -- THIS DOESNT WORK

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                )
                        UNION ALL
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW3
                                )
                        ) QVIEW4
                               JOIN
"TABLE1" QVIEW5
ON ( 1= 1)
                ) 
 -- THIS WORKS

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                )
                        UNION ALL
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW3
                                )
                        )
                              
                ) V1 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.


CREATE TABLE "TABLE1" (
  "ID" integer NOT NULL
);

-- THIS DOESNT WORK

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (      
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                
                        
                        ) QVIEW4
                               JOIN
                                        "TABLE1"  QVIEW5
                                        ON ( 1= 1)
                )       v1

-- THIS DOESNT WORK

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                )
                        UNION ALL
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW3
                                )
                        ) QVIEW4
                               LEFT OUTER JOIN
                                        "TABLE1" QVIEW5
                                        ON ( 1= 1)
                )
                                
                                
-- THIS DOESNT WORK

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                )
                        UNION ALL
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW3
                                )
                        ) QVIEW4
                               JOIN
                                        "TABLE1" QVIEW5
                                        ON ( 1= 1)
                )                               
                                
                                
-- THIS WORKS

SELECT *
        FROM
                "TABLE1" QVIEW1,
                (
                        (
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW2
                                )
                        UNION ALL
                                (
                                        SELECT *
                                                FROM
                                                "TABLE1" QVIEW3
                                )
                        )
                              
                ) V1                            

Reply via email to