Open tcm-marcel opened 7 years ago
@hzxa21 @chenboy @luochenUmich -- Can you help @tcm-marcel with this problem?
How does peloton in general react to invalid inputs at the moment? I just saw that adding an existing table also leads to a crash. Is this a general issue that invalid inputs aren't handled correctly?
This is likely. @haojin2 is working on a related fix in #808
I think if the query is having invalid syntax then it's the parser's responsibility to handle it. If it has correct syntax but the underlying operation is illegal, then other parts should be responsible for handling that. I'm now working on throwing exceptions for bad syntax, not all invalid queries.
I may was inaccurate, it's not a syntax problem. So your PR hopefully will solve these ones.
UPDATE: sorry, did not read correctly. If you are working on syntax problems, then this one here is another issue.
Actually, I think that @tcm-marcel's example should be caught in the planner. The parser/binder doesn't "know" the number of columns that the table has.
Please confirm with @hzxa21 @chenboy @luochenUmich
The binder can know the number of columns in the table by requesting the catalog. I think there are no major differences on doing the validity checks in binder or optimizer. I feel like we should do it in the binder because it is where the query first contacts the catalog.
The function
planner::InsertPlan::InsertPlan
checks the validity of INSERT statements only with assertions instead of throwing an exception that can be handled.Example 1
Example 2
Ubuntu 16.04 x86_64 gcc