sql: move space existence check to VDBE
Before this patch, the existence of space was checked for the CREATE TABLE or CREATE VIEW statements during the parsing. If the space already exists, an error has been set and cleanup is performed. But, if the statement contained 'IF NOT EXIST', the cleanup was performed, but the error was not set. Meanwhile, create_foreign_key() assumes that if create_table_def->new_space is NULL, then we are dealing with ALTER TABLE statement. This in turn false, since ctd->new_space is nullified also in case of already existing table. This causes an assertion or a segmentation fault when creating a foreign key during space creation. This patch moves this check to VDBE. Parsing now is always processed till the end as in case space doesn’t exist. Closes #4196
Loading
Please register or sign in to comment