EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB483657: Table Prefix with Multiple Segments is Incorrectly Quoted


Community Admin

• Strategy


In MicroStrategy 2019 and previous versions, the table prefix is not correctly quoted for values with multiple segments, leading to errors when executing the generated SQL.

Symptoms

  • User uses a database that uses a multi-segmented table prefix, e.g, Snowflake, and specified the prefix in Database Instances
ka04W000001Ix3ZQAS_0EM2R000000mLDS.jpeg
  • Incorrect quoting around leads to a SQL error.
    • Ex. tablespace.namespace. is not separated and is incorrectly quoted as "tablespace.namespace".

Glossary

  • Unified Quoting
  • Changing the Data Engine Version

Steps to Reproduce

  • Set the table prefix to a multi-segmented value. There are multiple ways to do this; we changed the table prefix for the YR_CATEGORY_SLS table to "tablespace.namespace.": 
ka04W000001Ix3ZQAS_0EM2R000000m9iE.jpeg
  • Restart the Intelligence Server. This is necessary to see the changes.
  • Run a report that uses the warehouse or table that you set the table prefix for. For example, create a report of "Year", "Cost".
  • Execute the report and View SQL:

select    a11.YEAR_ID  YEAR_ID,
    sum(a11.TOT_COST)  WJXBFS1
from    "tablespace.namespace"."YR_CATEGORY_SLS"   a11
group by    a11.YEAR_ID
Note that because the entire prefix is quoted by double quotes, instead of each segment is quoted separately, the syntax of this query is wrong and the execution will fail.​​

Cause


This is a known issue in Strategy 2019 and earlier versions:

  • When table names contains special characters, Data Engine will quote them based on Database specific pattern, in order for the query to execute correctly in the warehouse. For some database types, the quotation setting is by default turned on.
  • Data Engine is always able to quote the table names and its prefix separately but did not support quoting of multi-segment table prefixes, so the entire string is quoted as a single entity. In other words, strings with segments separated by dots are not quoted by segment, but altogether.

Solution

  • Upgrade to Strategy 2020 or above. We recommend the latest version.


In the new fix, multi-segment table prefixes are correctly separated and quoted.For example, tablespace.namespace. will become "tablespace"."namespace".
We provide an example of how incorrect SQL can change after the fix:


Sample ProcedureUser ProcedureProvided out of the box.Created by users.Not editable.Can be edited.Can be used as a starting point when developing User Procedures.Can be based on Sample Procedures.BEFORE fixAFTER fix


select    YEAR_ID    YEAR_ID,
...
from     "tablespace.namespace"."YR_CATEGORY_SLS"



select   YEAR_ID  YEAR_ID,
...
from    "tablespace"."namespace"."YR_CATEGORY_SLS"


Sample ProcedureUser ProcedureProvided out of the box.Created by users.Not editable.Can be edited.Can be used as a starting point when developing User Procedures.Can be based on Sample Procedures.BEFORE fixAFTER fix


select    YEAR_ID    YEAR_ID,
...
from     "tablespace.namespace"."YR_CATEGORY_SLS"



select   YEAR_ID  YEAR_ID,
...
from    "tablespace"."namespace"."YR_CATEGORY_SLS"


Sample ProcedureUser ProcedureProvided out of the box.Created by users.Not editable.Can be edited.Can be used as a starting point when developing User Procedures.Can be based on Sample Procedures.BEFORE fixAFTER fix


select    YEAR_ID    YEAR_ID,
...
from     "tablespace.namespace"."YR_CATEGORY_SLS"



select   YEAR_ID  YEAR_ID,
...
from    "tablespace"."namespace"."YR_CATEGORY_SLS"


Sample ProcedureUser ProcedureProvided out of the box.Created by users.Not editable.Can be edited.Can be used as a starting point when developing User Procedures.Can be based on Sample Procedures.BEFORE fixAFTER fix


select    YEAR_ID    YEAR_ID,
...
from     "tablespace.namespace"."YR_CATEGORY_SLS"



select   YEAR_ID  YEAR_ID,
...
from    "tablespace"."namespace"."YR_CATEGORY_SLS"

Strategy Internal Reference Number for this technical note is KB483657 and DE131186.


Comment

0 comments

Details

Knowledge Article

Published:

September 25, 2019

Last Updated:

September 25, 2019