dhavalshah9131 commented on code in PR #569:
URL: https://github.com/apache/ranger/pull/569#discussion_r2097397367


##########
liquibase-database-upgrade/changelogs/kms/db/postgres/create_trigger_kmsencoded_postgres.sql:
##########
@@ -0,0 +1,40 @@
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+
+--liquibase formatted sql
+
+-- Create a trigger function
+CREATE OR REPLACE FUNCTION copy_data_trigger_function()
+RETURNS TRIGGER AS
+'
+BEGIN
+     -- If column_a is updated and is not null, update column_b
+     IF NEW.kms_encoded IS NOT NULL THEN

Review Comment:
   To avoid unintended overwrites and to make trigger logic more robust I think 
it will be better to check 
   
    -- If kms_encoded is set and kms_encoded_value is null, copy to 
kms_encoded_value
       IF NEW.kms_encoded IS NOT NULL AND NEW.kms_encoded_value IS NULL THEN
       
       
       



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@ranger.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to