-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CBRD-23678] Remove the HANG bug that occurred when the table name and column name are the same. #2467
Conversation
…d column name are the same.
src/parser/parse_tree_cl.c
Outdated
while (pos = strstr (column_list, class_name)) | ||
{ | ||
strcpy (pos, pos + r1->length + 1); | ||
r2->length -= (r1->length + 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand what you intended.
Is this the purpose of removing class_name from column_list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shparkcubrid Yes, it is. this is to eliminate syntax errors in insert statements. for example, the phrase "insert into foo (foo.c1, foo.c2) values ..." is changed to the phrase "insert into foo (c1, c2) values ...".
src/parser/parse_tree_cl.c
Outdated
|
||
#if !defined(NDEBUG) | ||
assert (class_name != NULL && strlen (class_name) != 0 && strlen (class_name) != r1->length); | ||
assert (column_list != NULL && strlen (column_list) != 0 && strlen (column_list) != r2->length); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rewrite assert
the strlen(class_name) != r->length is correct?
isn't it to check strlen(class_name) == r1->length ?
and the next assertion clause looks similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byungwook-kim It is removed.
src/parser/parse_tree_cl.c
Outdated
#if !defined(NDEBUG) | ||
column_list = (char *) r2->bytes; | ||
|
||
assert (strlen (column_list) != r2->length && r2->length <= 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's assertion fail.
rewrite assert clause to (strlen(column_list) == r2->length) && r2->length > 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byungwook-kim It is removed.
src/parser/parse_tree_cl.c
Outdated
{ | ||
strcpy (class_name, class_name + r1->length + 1); | ||
r2->length = r2->length - r1->length - 1; | ||
char *class_name = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
recommend: column_list can be rebuilt as below
column_name can refer to p->info.insert.attr_list.info.name.original
next column_name can refer to p->info.insert.attr_list.next
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@byungwook-kim Your recommendation is accepted. I appreciate your advice.
… in the insert statement.
http://jira.cubrid.org/browse/CBRD-23678
Fixed a bug that occurred in the following medium test case. an infinite loop occurs If the table name and column name are the same.