uwdb / Cosette

Cosette is an automated SQL solver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Help, throw an exception when parsing

wjinshui opened this issue · comments

Try to execute the following statement, but an exeception throws, please help!

schema s1(id:int, year_born:int);
schema s2(id:int);
table person(s1);
table writer(s2);
query q1 `select count(*) from person where exists (select * from writer where writer.id = person.id and person.year_born = 1935)`;
query q2 `select count(*) from (select distinct person.id from person,writer where person.id=writer.id and person.year_born=1935)`;
verify q1 q2;

Hi Jinshui,

I rewrite your query as below:

schema s1(id:int, year_born:int);
schema s2(id:int);
table person(s1);
table writer(s2);
query q1 
`select count(*) from person p where exists (select * from writer w where w.id = p.id and p.year_born = 1935)`;
query q2 `select count(*) from (select distinct p.id from person p, writer w where p.id=w.id and p.year_born=1935) a`;
verify q1 q2;

It returns a counterexample. Currently, we are forcing that user put an alias for each table.