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-24867] rev: regression bug-fix related to DBLINK - CCI_U_TYPE, no serve name #4507

Merged

Conversation

beyondykk9
Copy link
Contributor

@beyondykk9 beyondykk9 commented Jul 24, 2023

http://jira.cubrid.org/browse/CBRD-24867

buf-fix list

  1. DATETIMELTZ was not processed for ext-type
    ext-type should be converted to CCI_U_TYPE
  2. SELECT DBLINK ('url', 'SELECT ... FROM ...') was not processed.
    we should consider the query with URL instead server-name
  3. alias match check
    not need to check for table@server (i.e. SELECT * FROM ...)
    added m_attr_star to S_REMOTE_TBL_COLS to identified (SELECT * FROM...)
  4. remake select list
    only when the column-def list not exists
  5. quoted name is processed properly
    the quoted name like "From" is transmitted to "From" as a quoted name
    because the remote query should be executed on other DBMS like Oracle.
    The ["From"] and `"From"` and """From""" is will be "From" at remote server even though the DBMS is CUBRID or not.
  6. the functions including generic-function should passed to remote server
    the parser set the flag cannot_prepare not to prepare for genric-function
    we should clear the flag for remote DML.

@beyondykk9 beyondykk9 added this to the fig milestone Jul 24, 2023
@beyondykk9 beyondykk9 requested a review from ctshim July 24, 2023 08:56
@beyondykk9 beyondykk9 self-assigned this Jul 24, 2023
@beyondykk9 beyondykk9 requested review from hgryoo and hyunikn August 1, 2023 07:26
@hgryoo
Copy link
Member

hgryoo commented Aug 1, 2023

Can you give test cases for each regression? They would help me to understand the changes in this PR.

@beyondykk9
Copy link
Contributor Author

Can you give test cases for each regression? They would help me to understand the changes in this PR.

see the last comment on JIRA issue CBRD-24867.

return;
if (pt_remake_dblink_select_list (parser, &spec->info.spec, rmt_tbl_cols) != NO_ERROR)
{
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line must be 'goto error_exit;' , instead of 'return' to free rmt_tbl_cols.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good point.

}

id_node->info.name.original = "c";
if ((dblink_table->cols = pt_mk_attr_def_node (parser, id_node, NULL)) == NULL)
{
return ER_FAILED;
error = ER_DBLINK;
goto error_exit;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems necessary to restore parser->custom_print before returning at line 5127.
An easy way to do this is to 'goto error_exit' instead of 'return NO_ERROR'.
In this case, 'clean_up' or something similar can be a better name instead of the label 'error_exit' .

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, good point.

return NO_ERROR;

error_exit:
parser->custom_print &= ~PT_PRINT_SUPPRESS_FOR_DBLINK;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the original value of parser->custom_print always have the bit PT_PRINT_SUPPRESS_FOR_DBLINK ?
Can we always delete the bit as this line does?
Storing the original value and restoring it at this line, which is a frequent pattern through out the code, seems more general way of handling parser->custom_print.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

printing the tree is called at various places through whole parser, compile, and optimize logic.
the custom_print should be kept the options to fit for purpose.

pt_append_string (parser, derived_spec->info.dblink_table.remote_table_name,
class_spec_info->entity_name->info.name.original);

parser->custom_print &= ~PT_PRINT_SUPPRESS_FOR_DBLINK;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the original value of parser->custom_print have PT_PRINT_SUPPRESS_FOR_DBLINK bit?
If it can, deleting the bit does not always restore the original value.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set and clear is always pair, so the flag is not set erroneously.

@@ -13687,20 +13692,21 @@ do_execute_insert (PARSER_CONTEXT * parser, PT_NODE * statement)

CHECK_MODIFICATION_ERROR ();

if (statement->xasl_id == NULL)
/* for dblink: no need to check xal_is is NULL */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

xal_is means xasl_id?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah ha, mis-spelled

@mhoh3963 mhoh3963 merged commit 54cf199 into CUBRID:develop Aug 4, 2023
@beyondykk9 beyondykk9 deleted the CBRD-24867-buf-fix-cci-utype-no-server-name branch August 4, 2023 08:32
@@ -4836,7 +4868,8 @@ pt_dblink_table_fill_attr_def (PARSER_CONTEXT * parser, PT_NODE * attr_def_node,
int is_default = 0;

attr_def_node->data_type = NULL;
attr_def_node->type_enum = pt_type[attr->type_idx];
/* it needs to convert ext type to CCI_U_TYPE */
attr_def_node->type_enum = pt_type[(T_CCI_U_TYPE) CCI_GET_COLLECTION_DOMAIN (attr->type_idx)];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dblink_get_basic_utype() function for a similar purpose. How about using this?
attr_def_node->type_enum = dblink_get_basic_utype(attr->type_idx)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants