2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-29 13:07:50 +00:00

[#2166] Added session value setter functions

src/bin/admin/tests/pgsql_tests.sh.in
    pgsql_upgrade_6_2_to_7_0()  - added session variable tests

src/share/database/scripts/pgsql/dhcpdb_create.pgsql
src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in
    Added set_session_value functions
    Cleaned up get_session_* functions
    Whitespace cleanup

src/share/database/scripts/pgsql/dhcpdb_drop.pgsql
    Added session variable functions
This commit is contained in:
Thomas Markwalder 2021-11-03 15:20:42 -04:00 committed by Tomek Mrugalski
parent 658a424d03
commit ab3fcdd674
4 changed files with 273 additions and 141 deletions

View File

@ -310,6 +310,28 @@ pgsql_upgrade_6_2_to_7_0() {
pgsql_execute "$select_sql"
assert_eq 0 "${EXIT_CODE}" "the dhcp6_server table is broken or missing. (expected status code %d, returned %d)"
# Verify that session variable setting is present and functional.
# First we try fetching big and small int values that do not exist, we should get 0.
# Then we set an integer value and fetch it as big and small.
session_sql="\
select get_session_small_int('kea.test_val'); \
select get_session_small_int('kea.test_val'); \
select set_session_value('kea.test_val', '987'); \
select get_session_value('kea.test_val'); \
select get_session_big_int('kea.test_val'); \
select get_session_small_int('kea.test_val'); \
select set_session_value('kea.test_val', cast('984' as SMALLINT)); \
select get_session_small_int('kea.test_val'); \
select set_session_value('kea.test_val', cast('1984' as BIGINT)); \
select get_session_big_int('kea.test_val'); \
"
run_command \
pgsql_execute "$session_sql"
assert_eq 0 "${EXIT_CODE}" "session variable handling broken. (expected status code %d, returned %d)"
clean_out=`echo ${OUTPUT} | tr '\n' ' '`
assert_str_eq "0 0 987 987 987 984 1984 " "${clean_out}" "session variable output incorrect"
}
pgsql_upgrade_test() {

View File

@ -580,7 +580,7 @@ CREATE TABLE lease4_stat (
--
-- Create v4 insert trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease4_insert () RETURNS trigger AS $stat_lease4_insert$
CREATE OR REPLACE FUNCTION proc_stat_lease4_insert() RETURNS trigger AS $stat_lease4_insert$
BEGIN
IF NEW.state < 2 THEN
UPDATE lease4_stat
@ -604,7 +604,7 @@ AFTER INSERT ON lease4
--
-- Create v4 update trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease4_update () RETURNS trigger AS $stat_lease4_update$
CREATE OR REPLACE FUNCTION proc_stat_lease4_update() RETURNS trigger AS $stat_lease4_update$
BEGIN
IF OLD.state != NEW.state THEN
IF OLD.state < 2 THEN
@ -638,7 +638,7 @@ AFTER UPDATE ON lease4
--
-- Create the v4 delete trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease4_delete () RETURNS trigger AS $stat_lease4_delete$
CREATE OR REPLACE FUNCTION proc_stat_lease4_delete() RETURNS trigger AS $stat_lease4_delete$
BEGIN
IF OLD.state < 2 THEN
-- Decrement the state count if record exists
@ -667,7 +667,7 @@ CREATE TABLE lease6_stat (
--
-- Create v6 insert trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease6_insert () RETURNS trigger AS $stat_lease6_insert$
CREATE OR REPLACE FUNCTION proc_stat_lease6_insert() RETURNS trigger AS $stat_lease6_insert$
BEGIN
IF NEW.state < 2 THEN
UPDATE lease6_stat
@ -694,7 +694,7 @@ AFTER INSERT ON lease6
--
-- Create v6 update trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease6_update () RETURNS trigger AS $stat_lease6_update$
CREATE OR REPLACE FUNCTION proc_stat_lease6_update() RETURNS trigger AS $stat_lease6_update$
BEGIN
IF OLD.state != NEW.state THEN
IF OLD.state < 2 THEN
@ -910,7 +910,7 @@ UPDATE schema_version
-- Upgrade to schema 6.1 begins here:
-- Fix v4 update trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease4_update () RETURNS trigger AS $stat_lease4_update$
CREATE OR REPLACE FUNCTION proc_stat_lease4_update() RETURNS trigger AS $stat_lease4_update$
BEGIN
IF OLD.subnet_id != NEW.subnet_id OR OLD.state != NEW.state THEN
IF OLD.state < 2 THEN
@ -938,7 +938,7 @@ $stat_lease4_update$ LANGUAGE plpgsql;
--
-- Fix the v4 delete trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease4_delete () RETURNS trigger AS $stat_lease4_delete$
CREATE OR REPLACE FUNCTION proc_stat_lease4_delete() RETURNS trigger AS $stat_lease4_delete$
BEGIN
IF OLD.state < 2 THEN
-- Decrement the state count if record exists
@ -953,7 +953,7 @@ $stat_lease4_delete$ LANGUAGE plpgsql;
--
-- Fix v6 update trigger procedure
CREATE OR REPLACE FUNCTION proc_stat_lease6_update () RETURNS trigger AS $stat_lease6_update$
CREATE OR REPLACE FUNCTION proc_stat_lease6_update() RETURNS trigger AS $stat_lease6_update$
BEGIN
IF OLD.subnet_id != NEW.subnet_id OR
OLD.lease_type != NEW.lease_type OR
@ -1715,13 +1715,67 @@ CREATE TRIGGER dhcp4_audit_modification_ts_update
CREATE INDEX dhcp4_audit_idx1 ON dhcp4_audit (modification_type);
CREATE INDEX dhcp4_audit_idx2 ON dhcp4_audit (revision_id);
-- Stores a TEXT value to a session variable
-- name name of session variable to set
-- value TEXT value to store
CREATE OR REPLACE FUNCTION set_session_value(name text, value TEXT)
RETURNS VOID
AS $$
DECLARE
BEGIN
PERFORM set_config(name, value, false);
RETURN;
EXCEPTION
WHEN OTHERS THEN
RAISE EXCEPTION 'set_session_value(%) : value:[%] failed, sqlstate: %', name, value, sqlstate;
END;$$
LANGUAGE plpgsql;
-- Stores a BIGINT value to a session variable
-- Note the value converted to TEXT and then stored as Postgresql does
-- not support any other data type in session variables.
-- name name of session variable to set
-- value BIGINT value to store
CREATE OR REPLACE FUNCTION set_session_value(name text, value BIGINT)
RETURNS VOID
AS $$
BEGIN
PERFORM set_config(name, cast(value as text), false);
RETURN;
EXCEPTION
WHEN OTHERS THEN
RAISE EXCEPTION 'set_session_value(%) : value:[%] failed, sqlstate: %', name, value, sqlstate;
END;$$
LANGUAGE plpgsql;
-- Stores a SMALLINT value to a session variable
-- Note the value converted to TEXT and then stored as Postgresql does
-- not support any other data type in session variables.
-- name name of session variable to set
-- value SMALLINT value to store
CREATE OR REPLACE FUNCTION set_session_value(name text, value SMALLINT)
RETURNS VOID
AS $$
BEGIN
PERFORM set_config(name, cast(value as text), false);
RETURN;
EXCEPTION
WHEN OTHERS THEN
RAISE EXCEPTION 'set_session_value(%) : value:[%] failed, sqlstate: %', name, value, sqlstate;
END;$$
LANGUAGE plpgsql;
-- Fetches a text value from the session configuration.
-- param name name of the session variable to fetch
-- If the name is not found it returns NULL.
-- Postgresql allows you to store custom session values
-- but throws an exception if they have not first been
-- set. This allows us to be a bit more graceful.
CREATE OR REPLACE FUNCTION get_session_value(name text)
CREATE OR REPLACE FUNCTION get_session_value(name TEXT)
RETURNS TEXT
AS $$
DECLARE
@ -1731,9 +1785,11 @@ BEGIN
RETURN(text_value);
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE 'get_session_value(%) failed, sqlstate: %', name, sqlstate;
WHEN undefined_object THEN
-- Variable has not been initialized so return NULL
RETURN NULL;
WHEN OTHERS THEN
RAISE EXCEPTION 'get_session_value(%, TEXT) failed, sqlstate: %', name, sqlstate;
END;$$
LANGUAGE plpgsql;
@ -1772,8 +1828,7 @@ AS $$
DECLARE
int_value SMALLINT := 0;
text_value TEXT := '';
BEGIN
text_value = get_session_value(name);
BEGIN text_value = get_session_value(name);
IF text_value is NULL or text_value = '' THEN
RETURN(0);
END IF;
@ -1840,8 +1895,8 @@ BEGIN
VALUES (audit_ts, srv_id, audit_log_message) returning id INTO audit_revision_id;
-- Update pertienent session variables.
PERFORM set_config('kea.audit_revision_id', cast(audit_revision_id as text), false);
PERFORM set_config('kea.cascade_transaction', cast(cascade_transaction as text), false);
PERFORM set_session_value('kea.audit_revision_id', audit_revision_id);
PERFORM set_session_value('kea.cascade_transaction', cascade_transaction);
END IF;
RETURN;
END;$$;
@ -1988,7 +2043,7 @@ BEGIN
-- Note this does not work prior to Postgres 9.2 unless the variables are
-- defined in postgresql.conf. I think for now we put up with CB not supported
-- prior to 9.2 or we tell people how to edit the conf file.
PERFORM set_config('kea.depend_on_known_indirectly', cast(depend_on_known_indirectly as text), false);
PERFORM set_session_value('kea.depend_on_known_indirectly', depend_on_known_indirectly);
-- Bail if the class is updated without re-positioning.
IF(
@ -2077,7 +2132,7 @@ END;$$;
-- Trigger procedure to position an inserted class within the class hierarchy
-- and create audit.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AINS () RETURNS trigger AS $dhcp4_client_class_AINS$
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AINS() RETURNS trigger AS $dhcp4_client_class_AINS$
BEGIN
PERFORM setClientClass4Order(NEW.id, NEW.follow_class_name, NULL);
PERFORM createAuditEntryDHCP4('dhcp4_client_class', NEW.id, 'create');
@ -2104,10 +2159,10 @@ CREATE TRIGGER dhcp4_client_class_AINS
-- values will be compared with the new dependencies after an update.
-- If they change, an error will be signaled.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AUPD () RETURNS trigger AS $dhcp4_client_class_AUPD$
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AUPD() RETURNS trigger AS $dhcp4_client_class_AUPD$
BEGIN
PERFORM set_config('kea.depend_on_known_directly', cast(OLD.depend_on_known_directly as text), false);
PERFORM set_config('kea.client_class_id', cast(NEW.id as text), false);
PERFORM set_session_value('kea.depend_on_known_directly', OLD.depend_on_known_directly);
PERFORM set_session_value('kea.client_class_id', NEW.id);
PERFORM setClientClass4Order(NEW.id, NEW.follow_class_name, OLD.follow_class_name);
PERFORM createAuditEntryDHCP4('dhcp4_client_class', NEW.id, 'update');
RETURN NULL;
@ -2123,7 +2178,7 @@ CREATE TRIGGER dhcp4_client_class_AUPD
-- -----------------------------------------------------------------------
-- Trigger procedure to create the audit entry for client class delete.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_ADEL () RETURNS trigger AS $dhcp4_client_class_ADEL$
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_ADEL() RETURNS trigger AS $dhcp4_client_class_ADEL$
BEGIN
PERFORM createAuditEntryDHCP4('dhcp4_client_class', OLD.id, 'delete');
RETURN NULL;
@ -2449,8 +2504,8 @@ BEGIN
VALUES (audit_ts, srv_id, audit_log_message) returning id INTO audit_revision_id;
-- Update pertienent session variables.
PERFORM set_config('kea.audit_revision_id', cast(audit_revision_id as text), false);
PERFORM set_config('kea.cascade_transaction', cast(cascade_transaction as text), false);
PERFORM set_session_value('kea.audit_revision_id', audit_revision_id);
PERFORM set_session_value('kea.cascade_transaction', cascade_transaction);
END IF;
RETURN;
END;$$;
@ -2592,7 +2647,7 @@ BEGIN
-- Note this does not work prior to Postgres 9.2 unless the variables are
-- defined in postgresql.conf. I think for now we put up with CB not supported
-- prior to 9.2 or we tell people how to edit the conf file.
PERFORM set_config('kea.depend_on_known_indirectly', cast(depend_on_known_indirectly as text), false);
PERFORM set_session_value('kea.depend_on_known_indirectly', depend_on_known_indirectly);
-- Bail if the class is updated without re-positioning.
IF(
@ -2681,7 +2736,7 @@ END;$$;
-- Trigger procedure to position an inserted class within the class hierarchy
-- and create audit.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AINS () RETURNS trigger AS $dhcp6_client_class_AINS$
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AINS() RETURNS trigger AS $dhcp6_client_class_AINS$
BEGIN
PERFORM setClientClass6Order(NEW.id, NEW.follow_class_name, NULL);
PERFORM createAuditEntryDHCP6('dhcp6_client_class', NEW.id, 'create');
@ -2707,10 +2762,10 @@ CREATE TRIGGER dhcp6_client_class_AINS
-- values will be compared with the new dependencies after an update.
-- If they change, an error will be signaled.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AUPD () RETURNS trigger AS $dhcp6_client_class_AUPD$
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AUPD() RETURNS trigger AS $dhcp6_client_class_AUPD$
BEGIN
PERFORM set_config('kea.depend_on_known_directly', cast(OLD.depend_on_known_directly as text), false);
PERFORM set_config('kea.client_class_id', cast(NEW.id as text), false);
PERFORM set_session_value('kea.depend_on_known_directly', OLD.depend_on_known_directly);
PERFORM set_session_value('kea.client_class_id', NEW.id);
PERFORM setClientClass6Order(NEW.id, NEW.follow_class_name, OLD.follow_class_name);
PERFORM createAuditEntryDHCP6('dhcp6_client_class', NEW.id, 'update');
RETURN NULL;
@ -2726,7 +2781,7 @@ CREATE TRIGGER dhcp6_client_class_AUPD
-- -----------------------------------------------------------------------
-- Trigger procedure to create the audit entry for client class delete.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_ADEL () RETURNS trigger AS $dhcp6_client_class_ADEL$
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_ADEL() RETURNS trigger AS $dhcp6_client_class_ADEL$
BEGIN
PERFORM createAuditEntryDHCP6('dhcp6_client_class', OLD.id, 'delete');
RETURN NULL;

View File

@ -165,5 +165,6 @@ DROP FUNCTION IF EXISTS modification_ts_update();
DROP FUNCTION IF EXISTS get_session_small_int(name text);
DROP FUNCTION IF EXISTS get_session_big_int(name text);
DROP FUNCTION IF EXISTS get_session_value(name text);
DROP FUNCTION IF EXISTS set_session_value(name text, value TEXT);
DROP FUNCTION IF EXISTS set_session_value(name text, value BIGINT);
DROP FUNCTION IF EXISTS set_session_value(name text, value SMALLINT);

View File

@ -721,13 +721,66 @@ CREATE TRIGGER dhcp4_audit_modification_ts_update
CREATE INDEX dhcp4_audit_idx1 ON dhcp4_audit (modification_type);
CREATE INDEX dhcp4_audit_idx2 ON dhcp4_audit (revision_id);
-- Stores a TEXT value to a session variable
-- name name of session variable to set
-- value TEXT value to store
CREATE OR REPLACE FUNCTION set_session_value(name text, value TEXT)
RETURNS VOID
AS \$\$
DECLARE
BEGIN
PERFORM set_config(name, value, false);
RETURN;
EXCEPTION
WHEN OTHERS THEN
RAISE EXCEPTION 'set_session_value(%) : value:[%] failed, sqlstate: %', name, value, sqlstate;
END;\$\$
LANGUAGE plpgsql;
-- Stores a BIGINT value to a session variable
-- Note the value converted to TEXT and then stored as Postgresql does
-- not support any other data type in session variables.
-- name name of session variable to set
-- value BIGINT value to store
CREATE OR REPLACE FUNCTION set_session_value(name text, value BIGINT)
RETURNS VOID
AS \$\$
BEGIN
PERFORM set_config(name, cast(value as text), false);
RETURN;
EXCEPTION
WHEN OTHERS THEN
RAISE EXCEPTION 'set_session_value(%) : value:[%] failed, sqlstate: %', name, value, sqlstate;
END;\$\$
LANGUAGE plpgsql;
-- Stores a SMALLINT value to a session variable
-- Note the value converted to TEXT and then stored as Postgresql does
-- not support any other data type in session variables.
-- name name of session variable to set
-- value SMALLINT value to store
CREATE OR REPLACE FUNCTION set_session_value(name text, value SMALLINT)
RETURNS VOID
AS \$\$
BEGIN
PERFORM set_config(name, cast(value as text), false);
RETURN;
EXCEPTION
WHEN OTHERS THEN
RAISE EXCEPTION 'set_session_value(%) : value:[%] failed, sqlstate: %', name, value, sqlstate;
END;\$\$
LANGUAGE plpgsql;
-- Fetches a text value from the session configuration.
-- param name name of the session variable to fetch
-- If the name is not found it returns NULL.
-- Postgresql allows you to store custom session values
-- but throws an exception if they have not first been
-- set. This allows us to be a bit more graceful.
CREATE OR REPLACE FUNCTION get_session_value(name text)
CREATE OR REPLACE FUNCTION get_session_value(name TEXT)
RETURNS TEXT
AS \$\$
DECLARE
@ -735,11 +788,12 @@ DECLARE
BEGIN
text_value = current_setting(name);
RETURN(text_value);
EXCEPTION
WHEN OTHERS THEN
RAISE NOTICE 'get_session_value(%) failed, sqlstate: %', name, sqlstate;
WHEN undefined_object THEN
-- Variable has not been initialized so return NULL
RETURN NULL;
WHEN OTHERS THEN
RAISE EXCEPTION 'get_session_value(%, TEXT) failed, sqlstate: %', name, sqlstate;
END;\$\$
LANGUAGE plpgsql;
@ -846,8 +900,8 @@ BEGIN
VALUES (audit_ts, srv_id, audit_log_message) returning id INTO audit_revision_id;
-- Update pertienent session variables.
PERFORM set_config('kea.audit_revision_id', cast(audit_revision_id as text), false);
PERFORM set_config('kea.cascade_transaction', cast(cascade_transaction as text), false);
PERFORM set_session_value('kea.audit_revision_id', audit_revision_id);
PERFORM set_session_value('kea.cascade_transaction', cascade_transaction);
END IF;
RETURN;
END;\$\$;
@ -994,7 +1048,7 @@ BEGIN
-- Note this does not work prior to Postgres 9.2 unless the variables are
-- defined in postgresql.conf. I think for now we put up with CB not supported
-- prior to 9.2 or we tell people how to edit the conf file.
PERFORM set_config('kea.depend_on_known_indirectly', cast(depend_on_known_indirectly as text), false);
PERFORM set_session_value('kea.depend_on_known_indirectly', depend_on_known_indirectly);
-- Bail if the class is updated without re-positioning.
IF(
@ -1083,7 +1137,7 @@ END;\$\$;
-- Trigger procedure to position an inserted class within the class hierarchy
-- and create audit.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AINS () RETURNS trigger AS \$dhcp4_client_class_AINS\$
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AINS() RETURNS trigger AS \$dhcp4_client_class_AINS\$
BEGIN
PERFORM setClientClass4Order(NEW.id, NEW.follow_class_name, NULL);
PERFORM createAuditEntryDHCP4('dhcp4_client_class', NEW.id, 'create');
@ -1110,10 +1164,10 @@ CREATE TRIGGER dhcp4_client_class_AINS
-- values will be compared with the new dependencies after an update.
-- If they change, an error will be signaled.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AUPD () RETURNS trigger AS \$dhcp4_client_class_AUPD\$
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_AUPD() RETURNS trigger AS \$dhcp4_client_class_AUPD\$
BEGIN
PERFORM set_config('kea.depend_on_known_directly', cast(OLD.depend_on_known_directly as text), false);
PERFORM set_config('kea.client_class_id', cast(NEW.id as text), false);
PERFORM set_session_value('kea.depend_on_known_directly', OLD.depend_on_known_directly);
PERFORM set_session_value('kea.client_class_id', NEW.id);
PERFORM setClientClass4Order(NEW.id, NEW.follow_class_name, OLD.follow_class_name);
PERFORM createAuditEntryDHCP4('dhcp4_client_class', NEW.id, 'update');
RETURN NULL;
@ -1129,7 +1183,7 @@ CREATE TRIGGER dhcp4_client_class_AUPD
-- -----------------------------------------------------------------------
-- Trigger procedure to create the audit entry for client class delete.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_ADEL () RETURNS trigger AS \$dhcp4_client_class_ADEL\$
CREATE OR REPLACE FUNCTION func_dhcp4_client_class_ADEL() RETURNS trigger AS \$dhcp4_client_class_ADEL\$
BEGIN
PERFORM createAuditEntryDHCP4('dhcp4_client_class', OLD.id, 'delete');
RETURN NULL;
@ -1455,8 +1509,8 @@ BEGIN
VALUES (audit_ts, srv_id, audit_log_message) returning id INTO audit_revision_id;
-- Update pertienent session variables.
PERFORM set_config('kea.audit_revision_id', cast(audit_revision_id as text), false);
PERFORM set_config('kea.cascade_transaction', cast(cascade_transaction as text), false);
PERFORM set_session_value('kea.audit_revision_id', audit_revision_id);
PERFORM set_session_value('kea.cascade_transaction', cascade_transaction);
END IF;
RETURN;
END;\$\$;
@ -1598,7 +1652,7 @@ BEGIN
-- Note this does not work prior to Postgres 9.2 unless the variables are
-- defined in postgresql.conf. I think for now we put up with CB not supported
-- prior to 9.2 or we tell people how to edit the conf file.
PERFORM set_config('kea.depend_on_known_indirectly', cast(depend_on_known_indirectly as text), false);
PERFORM set_session_value('kea.depend_on_known_indirectly', depend_on_known_indirectly);
-- Bail if the class is updated without re-positioning.
IF(
@ -1687,7 +1741,7 @@ END;\$\$;
-- Trigger procedure to position an inserted class within the class hierarchy
-- and create audit.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AINS () RETURNS trigger AS \$dhcp6_client_class_AINS\$
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AINS() RETURNS trigger AS \$dhcp6_client_class_AINS\$
BEGIN
PERFORM setClientClass6Order(NEW.id, NEW.follow_class_name, NULL);
PERFORM createAuditEntryDHCP6('dhcp6_client_class', NEW.id, 'create');
@ -1713,10 +1767,10 @@ CREATE TRIGGER dhcp6_client_class_AINS
-- values will be compared with the new dependencies after an update.
-- If they change, an error will be signaled.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AUPD () RETURNS trigger AS \$dhcp6_client_class_AUPD\$
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_AUPD() RETURNS trigger AS \$dhcp6_client_class_AUPD\$
BEGIN
PERFORM set_config('kea.depend_on_known_directly', cast(OLD.depend_on_known_directly as text), false);
PERFORM set_config('kea.client_class_id', cast(NEW.id as text), false);
PERFORM set_session_value('kea.depend_on_known_directly', OLD.depend_on_known_directly);
PERFORM set_session_value('kea.client_class_id', NEW.id);
PERFORM setClientClass6Order(NEW.id, NEW.follow_class_name, OLD.follow_class_name);
PERFORM createAuditEntryDHCP6('dhcp6_client_class', NEW.id, 'update');
RETURN NULL;
@ -1732,7 +1786,7 @@ CREATE TRIGGER dhcp6_client_class_AUPD
-- -----------------------------------------------------------------------
-- Trigger procedure to create the audit entry for client class delete.
-- -----------------------------------------------------------------------
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_ADEL () RETURNS trigger AS \$dhcp6_client_class_ADEL\$
CREATE OR REPLACE FUNCTION func_dhcp6_client_class_ADEL() RETURNS trigger AS \$dhcp6_client_class_ADEL\$
BEGIN
PERFORM createAuditEntryDHCP6('dhcp6_client_class', OLD.id, 'delete');
RETURN NULL;