Skip to content

Commit

Permalink
HCK-9036: remove mandatory quoting for default value (#43)
Browse files Browse the repository at this point in the history
<!--do not remove this marker, its needed to replace info when ticket
title is updated -->
<!--jira-description-action-hidden-marker-start-->

<table>
<td>
<a href="https://hackolade.atlassian.net/browse/HCK-9036"
title="HCK-9036" target="_blank"><img alt="Sub-bug"
src="https://hackolade.atlassian.net/rest/api/2/universal_avatar/view/type/issuetype/avatar/10303?size=medium"
/>HCK-9036</a> [DB2] Unexpected quotation of table columns default
values
  </td></table>
  <br />
 

<!--jira-description-action-hidden-marker-end-->
  • Loading branch information
serhii-filonenko authored Dec 6, 2024
1 parent 059e952 commit 8adf147
Showing 1 changed file with 1 addition and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,6 @@ const getIdentityOptions = ({ start, increment, minValue, maxValue, cycle }) =>
return [startWith, incrementBy, cycle, minimumValue, maximumValue].filter(Boolean).join(', ');
};

/**
* @param {{ defaultValue: DefaultValue, type: string }}
* @returns {DefaultValue}
*/
const wrapInQuotesDefaultValue = ({ defaultValue, type }) => {
const isStringDataType = STRING_DATA_TYPES.includes(toUpper(type));

return isStringDataType ? wrapInSingleQuotes({ name: defaultValue }) : defaultValue;
};

/**
* @param {{ default?: DefaultValue, identity?: object }}
* @returns {string}
Expand All @@ -59,9 +49,7 @@ const getColumnDefault = ({ default: defaultValue, identity, type }) => {
}

if (defaultValue || defaultValue === 0) {
const value = wrapInQuotesDefaultValue({ defaultValue, type });

return ` WITH DEFAULT ${value}`;
return ` WITH DEFAULT ${defaultValue}`;
}
return '';
};
Expand Down

0 comments on commit 8adf147

Please sign in to comment.