Skip to content
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

Merged
merged 5 commits into from
Oct 14, 2020

Conversation

hornetmj
Copy link
Contributor

@hornetmj hornetmj commented Oct 8, 2020

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.

  • medium/_02_xtests/cases/coerce1.sql

@hornetmj hornetmj added the bug label Oct 8, 2020
@hornetmj hornetmj added this to the damson milestone Oct 8, 2020
@hornetmj hornetmj self-assigned this Oct 8, 2020
while (pos = strstr (column_list, class_name))
{
strcpy (pos, pos + r1->length + 1);
r2->length -= (r1->length + 1);
Copy link
Contributor

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?

Copy link
Contributor Author

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 ...".


#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);
Copy link
Contributor

@beyondykk9 beyondykk9 Oct 13, 2020

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.

Copy link
Contributor Author

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.

#if !defined(NDEBUG)
column_list = (char *) r2->bytes;

assert (strlen (column_list) != r2->length && r2->length <= 0);
Copy link
Contributor

@beyondykk9 beyondykk9 Oct 13, 2020

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)

Copy link
Contributor Author

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.

{
strcpy (class_name, class_name + r1->length + 1);
r2->length = r2->length - r1->length - 1;
char *class_name = NULL;
Copy link
Contributor

@beyondykk9 beyondykk9 Oct 13, 2020

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

Copy link
Contributor Author

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.

@hornetmj hornetmj merged commit 72ed9a7 into CUBRID:develop Oct 14, 2020
@hornetmj hornetmj deleted the CBRD-23678 branch November 9, 2020 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants