schema/spacewalk/postgres/triggers/rhnKickstartSession.sql
| 1
schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.oracle
| 1
schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.postgresql
| 32 ++++++++++
3 files changed, 34 insertions(+)
New commits:
commit a14b2f07e579a3d47aac1f76006f8f7f9f767ca9
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Fri Feb 25 15:33:29 2011 +0100
Need to return new at the end of a trigger function.
Addressing
Caused by: org.postgresql.util.PSQLException: ERROR: control reached end of trigger
procedure without RETURN
Where: PL/pgSQL function "rhn_ks_session_history_trigger_fun"
Pointed out by Pascal PELTRIAUX.
diff --git a/schema/spacewalk/postgres/triggers/rhnKickstartSession.sql
b/schema/spacewalk/postgres/triggers/rhnKickstartSession.sql
index 61799df..b34fcc4 100644
--- a/schema/spacewalk/postgres/triggers/rhnKickstartSession.sql
+++ b/schema/spacewalk/postgres/triggers/rhnKickstartSession.sql
@@ -62,6 +62,7 @@ begin
);
end if;
end if;
+ return new;
end;
$$ language plpgsql;
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.oracle
new file mode 100644
index 0000000..b7b00b1
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.oracle
@@ -0,0 +1 @@
+-- This file is intentionally left empty.
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.postgresql
new file mode 100644
index 0000000..cce4dab
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.3-to-spacewalk-schema-1.4/007-rhn_ks_session_history_trigger_fun.sql.postgresql
@@ -0,0 +1,32 @@
+-- oracle equivalent source sha1 b14267384bc104605623a41b755e68e0103b5aa8
+
+create or replace function rhn_ks_session_history_trigger_fun() returns trigger
+as
+$$
+begin
+ if tg_op ='INSERT' then
+ insert into rhnKickstartSessionHistory (
+ id, kickstart_session_id, action_id, state_id
+ ) values (
+ nextval('rhn_ks_sessionhist_id_seq'),
+ new.id,
+ new.action_id,
+ new.state_id
+ );
+ end if;
+ if tg_op ='UPDATE' then
+ if new.state_id is distinct from old.state_id then
+ insert into rhnKickstartSessionHistory (
+ id, kickstart_session_id, action_id, state_id
+ ) values (
+ nextval('rhn_ks_sessionhist_id_seq'),
+ new.id,
+ new.action_id,
+ new.state_id
+ );
+ end if;
+ end if;
+ return new;
+end;
+$$ language plpgsql;
+