- Newest
- Most votes
- Most comments
In Amazon Redshift, the default value for enable_case_sensitive_identifier and enable_case_sensitive_super_attribute is false.
When JSON attribute names are in uppercase or mixedcase, you must navigate SUPER type structures in a case sensitive way. To do that, you can configure enable_case_sensitive_identifier to TRUE and wrap the uppercase and mixedcase attribute names with double quotation marks. You can also configure enable_case_sensitive_super_attribute to TRUE. This is by design as per the documentation here [1].
Since the SQL client does not allow setting parameters, you can use LOWER_ATTRIBUTE_NAMES function which converts all applicable attribute names in a SUPER value to lowercase as shown below:
with q as (select LOWER_ATTRIBUTE_NAMES(json_parse('{"loHi":1}')) o) select o."loHi", o.loHi, o.lohi, o."lohi", o."LOHI", o.LOHI from q ;
----------------------------------OUTPUT----------------------------
lohi lohi lohi lohi lohi lohi
1 1 1 1 1 1
Resources:
If you cannot use the enable_case_sensitive_super_attribute parameter due to limitations in your SQL client, there are alternative approaches to handle mixed case JSON in Amazon Redshift:
- Use the LOWER_ATTRIBUTE_NAMES function: This function converts all attribute names in a SUPER value to lowercase, allowing you to query the data consistently. Here's how you can modify your query:
with q as (select LOWER_ATTRIBUTE_NAMES(json_parse('{"loHi":1}')) as o) select o.lohi from q
This approach will return the value 1 for the 'lohi' attribute.
- Use double quotes and enable_case_sensitive_identifier: If you can set the
enable_case_sensitive_identifierparameter to TRUE (which is different fromenable_case_sensitive_super_attribute), you can use double quotes to specify the exact case of the attribute name:
SET enable_case_sensitive_identifier to TRUE; with q as (select json_parse('{"loHi":1}') o) select o."loHi" from q
This should return the value 1 for the 'loHi' attribute.
- Parse the JSON as needed: If the above options are not available, you can parse the JSON string directly in your query:
with q as (select '{"loHi":1}' as json_string) select json_extract_path_text(json_string, 'loHi') as lohi from q
This approach allows you to specify the exact case of the JSON key without relying on SUPER type or configuration parameters.
By using one of these methods, you should be able to work with mixed case JSON in Redshift without needing to set the enable_case_sensitive_super_attribute parameter.
Sources
LOWER_ATTRIBUTE_NAMES function - Amazon Redshift
SUPER configurations - Amazon Redshift
JSON functions - Amazon Redshift
Looks like LOWER_ATTRIBUTE_NAMES suggested by AWS AI works although still would like to know if this is a bug
Relevant content
asked 5 years ago
asked 4 years ago
- AWS OFFICIALUpdated 5 months ago

Thanks, the documentation of
enable_case_sensitive_super_attributecould be a bit more explicit and say that when it is set to false then mixed case keys are simply ignored.