Redshift Serverless - Creating masking policies
I am trying to execute this code:
CREATE MASKING POLICY mask_ssn
WITH (ssn VARCHAR(11))
USING (LEFT(ssn, 7) || '00');
And I'm not sure if Datagrip does something to it but it's rejected every time and throws an error. When I run the SQL in sqlworkbench inside AWS, the query is executed correctly.
请先登录再写评论。
Hi,
I am able to execute your DDL statement just fine on DataGrip 2025.2.3. Please check your permissions and provide the error message if this doesn't bring you any further
Version: 2025.2.3
It's not about permissions as I am connected as admin user. Executing this code via AWS Toolkit for VSCode or SQLWorkbench in AWS works fine with the same credentials and the same syntax.
This is code directly from AWS website not changed by me. As you can see a lot of things are highlighted as incorrect syntax.
It doesn't parse the statement correctly, and as a result. executes only a portion of it, which is incorrect. I'll file an issue for this
As a workaround, please focus the cursor outside the statement and use the following settings
Whole script is dangerous but thank you. For now I will just select the whole statement I want to execute. Thanks for checking, I'm glad we found the root cause quickly, will look forward to the fix
https://youtrack.jetbrains.com/issue/DBE-24305/CREATE-MASKING-POLICY-isnt-highlighted-properly
If it works fine in AWS but not in DataGrip, it’s probably just how DataGrip handles the query. Check the SQL dialect or try running it as a raw script.