Case sensitivity problem in view of JSON in a SUPER column

1

I have JSON data containing mixed-case keys in a column of type SUPER. Example JSON:

{
"MyKey1": "value 1",
"MyKey2": "value 2"
}

Long story short, to query fields I have to set enable_case_sensitive_identifier to true and quote the identifiers.

set enable_case_sensitive_identifier to true;
select column."MyKey1", column."MyKey2" from table;

Without setting enable_case_sensitive_identifier to true, redshift downcases the identifiers and returns null for "mykey1" and "mykey2".

But now I need to make a view where I split the JSON into individual columns, with a query such as the above. And it's back to downcasing and returning null when I query the view.

Is there any way to set a parameter in a view? Or some other way to force case-sensitive identifiers?

  • "ALTER USER admin SET enable_case_sensitive_identifier = TRUE;" you can use this code. This will switch on case sensitive for SUPER type for admin user. Or you can add it on cluster level for all users. But this "SET enable_case_sensitive_identifier = TRUE; " don't work for session. Be awere if you will create table with <"ColumnName"> it will be apply on table as <ColumnName> butn if you will create table with <ColumnName> it will apply as <columnname>

  • "SET enable_case_sensitive_identifier = TRUE" works if you reboot your cluster.

wesm
질문됨 3년 전1913회 조회
1개 답변
2

Update.

It works if you create a parameter group where you set enable_case_sensitive_identifier to true, and configure your database to use it (and reboot cluster.) I had to delete and recreate my view before it worked.

wesm
답변함 3년 전
profile picture
전문가
검토됨 2달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠