schema/spacewalk/postgres/packages/rhn_channel.pkb | 2 +-
web/modules/rhn/RHN/DB.pm | 10 ++++------
web/modules/rhn/RHN/DB/Channel.pm | 2 +-
web/modules/rhn/RHN/DB/ChannelEditor.pm | 4 ++--
web/modules/rhn/RHN/DB/TableClass.pm | 7 +++++--
5 files changed, 13 insertions(+), 12 deletions(-)
New commits:
commit 4684cefca6af77089c5ad6d6d63e63144a570917
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Oct 6 13:34:13 2010 +0200
Use current_timestamp instead of the Oracle-specific sysdate in set_cloned_from.
diff --git a/web/modules/rhn/RHN/DB/Channel.pm b/web/modules/rhn/RHN/DB/Channel.pm
index d1c0c01..b0f160d 100644
--- a/web/modules/rhn/RHN/DB/Channel.pm
+++ b/web/modules/rhn/RHN/DB/Channel.pm
@@ -919,7 +919,7 @@ EOQ
INSERT
INTO rhnChannelCloned
(original_id, id, created, modified)
-VALUES (:from_cid, :to_cid, sysdate, sysdate)
+VALUES (:from_cid, :to_cid, current_timestamp, current_timestamp)
EOQ
$sth = $dbh->prepare($query);
commit 367578ac437fb700013eb841bd23e8494ff5f158
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Oct 6 13:30:45 2010 +0200
Avoid the integer arithmetics with timestamps in PostgreSQL.
diff --git a/schema/spacewalk/postgres/packages/rhn_channel.pkb
b/schema/spacewalk/postgres/packages/rhn_channel.pkb
index 63630aa..40902eb 100644
--- a/schema/spacewalk/postgres/packages/rhn_channel.pkb
+++ b/schema/spacewalk/postgres/packages/rhn_channel.pkb
@@ -999,7 +999,7 @@ update pg_settings set setting = 'rhn_channel,' || setting
where name = 'search_
last_modified_value := date_to_use;
if last_modified_value <= channel_last_modified then
- last_modified_value := last_modified_value + 1/86400;
+ last_modified_value := last_modified_value + interval '1 second';
end if;
update rhnChannel set last_modified = last_modified_value
commit 396629dbc9ff2b28ada4e30b30835bc67b1beffb
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Oct 6 13:21:46 2010 +0200
To PostgreSQL, procedures are just functions, call them as such.
diff --git a/web/modules/rhn/RHN/DB.pm b/web/modules/rhn/RHN/DB.pm
index 00025d6..5f6a266 100644
--- a/web/modules/rhn/RHN/DB.pm
+++ b/web/modules/rhn/RHN/DB.pm
@@ -420,6 +420,9 @@ sub ping {
# some extension functions
sub call_procedure {
my $self = shift;
+ if ($self->{Driver}->{Name} eq 'Pg') {
+ return $self->call_function(@_);
+ }
my $procname = shift;
my @params = @_;
my @placeholders = map { ":p$_" } 1 .. scalar @params;
commit a09360c65770933faecd310b92aeb77a5cfd3b67
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Oct 6 13:17:54 2010 +0200
We do not seem to be using the inout parameter anywhere in our code, remove the code
to make porting to PostgreSQL easier.
diff --git a/web/modules/rhn/RHN/DB.pm b/web/modules/rhn/RHN/DB.pm
index d0b076c..00025d6 100644
--- a/web/modules/rhn/RHN/DB.pm
+++ b/web/modules/rhn/RHN/DB.pm
@@ -433,12 +433,7 @@ sub call_procedure {
my $i = 0;
foreach my $param (@params) {
- if (ref $param eq 'SCALAR') {
- $sth->bind_param_inout($placeholders[$i], $param, 4096);
- }
- else {
- $sth->bind_param($placeholders[$i], $param);
- }
+ $sth->bind_param($placeholders[$i], $param);
$i++;
}
commit 6e533cf16b59b5a72abe8762d1faff244743e8b5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Oct 6 13:11:24 2010 +0200
Use current_timestamp instead of the Oracle-specific sysdate in
clone_channel_packages.
Addressing
DBD::Pg::st execute failed: ERROR: column "sysdate" does not exist at
character 211
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm
b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index 8549757..f89e71c 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -294,7 +294,7 @@ INSERT
INTO rhnRepoRegenQueue
(id, channel_label, client, reason, force, bypass_filters, next_action, created,
modified)
VALUES (null,
- :label, 'perl-web::clone_channel_packages', NULL, 'N',
'N', sysdate, sysdate, sysdate)
+ :label, 'perl-web::clone_channel_packages', NULL, 'N',
'N', current_timestamp, current_timestamp, current_timestamp)
EOQ
my $channel = RHN::Channel->lookup(-id => $to_cid);
commit 51b500794f93a2a584a200487feb1d13b0abf211
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Oct 6 13:09:53 2010 +0200
Since we have trigger which sets rhnRepoRegenQueue.id since
f2153167da508852183501f320c2e71c08a0441c, we can avoid .nextval.
Addressing
DBD::Pg::st execute failed: ERROR: missing FROM-clause entry for table
"rhn_repo_regen_queue_id_seq" at character 141
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm
b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index 4977009..8549757 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -293,7 +293,7 @@ EOQ
INSERT
INTO rhnRepoRegenQueue
(id, channel_label, client, reason, force, bypass_filters, next_action, created,
modified)
-VALUES (rhn_repo_regen_queue_id_seq.nextval,
+VALUES (null,
:label, 'perl-web::clone_channel_packages', NULL, 'N',
'N', sysdate, sysdate, sysdate)
EOQ
commit b950aa91472dfde360b26b5495c3f207b0bf56ba
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Wed Oct 6 12:09:18 2010 +0200
As PostgreSQL does not support table aliases in inserts, remove them.
diff --git a/web/modules/rhn/RHN/DB/TableClass.pm b/web/modules/rhn/RHN/DB/TableClass.pm
index 525485e..bb627f7 100644
--- a/web/modules/rhn/RHN/DB/TableClass.pm
+++ b/web/modules/rhn/RHN/DB/TableClass.pm
@@ -145,9 +145,12 @@ sub insert_query {
return '' unless grep { exists $changed_fields{$_} } $self->column_names;
+ my $remove_alias = "$self->{alias}.";
my $ret;
- $ret .= "INSERT INTO $self->{name} $self->{alias}\n (";
- $ret .= join(", ", grep { exists $changed_fields{$_} }
$self->column_names);
+ $ret .= "INSERT INTO $self->{name}\n (";
+ $ret .= join(", ",
+ map { ($remove_alias eq substr($_, 0, length($remove_alias))) ? substr($_,
length($remove_alias)) : $_ }
+ grep { exists $changed_fields{$_} } $self->column_names);
$ret .= ") VALUES (";
$ret .= join(", ", map { $self->type_to_placeholder($_) }
grep { exists $changed_fields{$_} } map { "$_" }
$self->column_names);