schema/spacewalk/postgres/procs/create_pxt_session.sql
| 8 ++--
schema/spacewalk/postgres/procs/procs.deps
| 3 +
schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.oracle
| 1
schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.postgresql
| 18 ++++++++++
4 files changed, 26 insertions(+), 4 deletions(-)
New commits:
commit 69ae5de9b7e688fe5df8558e83c685042e5f7d73
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Mar 1 16:43:35 2012 +0100
create_pxt_session: schema upgrade
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.oracle
b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.oracle
new file mode 100644
index 0000000..b7b00b1
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.oracle
@@ -0,0 +1 @@
+-- This file is intentionally left empty.
diff --git
a/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.postgresql
b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.postgresql
new file mode 100644
index 0000000..b20b377
--- /dev/null
+++
b/schema/spacewalk/upgrade/spacewalk-schema-1.6-to-spacewalk-schema-1.7/110-create_pxt_session.sql.postgresql
@@ -0,0 +1,18 @@
+-- oracle equivalent source sha1 b14267384bc104605623a41b755e68e0103b5aa8
+
+create or replace function
+create_pxt_session(p_web_user_id in numeric, p_expires in numeric, p_value in varchar)
+returns numeric as $$
+declare
+ l_id numeric;
+begin
+ l_id := nextval( 'pxt_id_seq' );
+
+ perform pg_dblink_exec(
+ 'insert into PXTSessions (id, value, expires, web_user_id) values (' ||
+ l_id || ', ' || ', ' || coalesce(quote_literal(p_value),
'NULL') ||
+ ', ' || ', ' || p_expires || ', ' || p_web_user_id ||
'); commit');
+
+ return l_id;
+end;
+$$ language plpgsql;
commit c6ee6f26b2214fa0f342553c8d989898d4c892d5
Author: Milan Zazrivec <mzazrivec(a)redhat.com>
Date: Thu Mar 1 16:40:38 2012 +0100
use pg_dblink_exec to execute insert inside create_pxt_session
diff --git a/schema/spacewalk/postgres/procs/create_pxt_session.sql
b/schema/spacewalk/postgres/procs/create_pxt_session.sql
index 1e24e4c..4239494 100644
--- a/schema/spacewalk/postgres/procs/create_pxt_session.sql
+++ b/schema/spacewalk/postgres/procs/create_pxt_session.sql
@@ -24,10 +24,12 @@ returns numeric as $$
declare
l_id numeric;
begin
- select nextval( 'pxt_id_seq' ) into l_id;
+ l_id := nextval( 'pxt_id_seq' );
- insert into PXTSessions (id, value, expires, web_user_id)
- values (l_id, p_value, p_expires, p_web_user_id);
+ perform pg_dblink_exec(
+ 'insert into PXTSessions (id, value, expires, web_user_id) values (' ||
+ l_id || ', ' || ', ' || coalesce(quote_literal(p_value),
'NULL') ||
+ ', ' || ', ' || p_expires || ', ' || p_web_user_id ||
'); commit');
return l_id;
end;
diff --git a/schema/spacewalk/postgres/procs/procs.deps
b/schema/spacewalk/postgres/procs/procs.deps
index 06f303d..d9ca05d 100644
--- a/schema/spacewalk/postgres/procs/procs.deps
+++ b/schema/spacewalk/postgres/procs/procs.deps
@@ -22,7 +22,8 @@ create_new_org :: web_customer rhnUserGroupType
rhnUserGroup
create_new_user :: web_contact web_user_contact_permission \
web_user_personal_info web_user_site_info \
rhnUserInfo
-create_pxt_session :: PXTSessions
+create_pxt_session :: pg_dblink_exec \
+ PXTSessions
delete_server :: rhn_channel.pks rhn_config.pks \
rhn_config.pks rhn_server.pks rhn_entitlements.pks \
rhn_server.pks \
Show replies by date