web/modules/rhn/RHN/DB/ChannelEditor.pm | 16 ++++++----------
web/modules/rhn/RHN/DB/Errata.pm | 8 ++++----
2 files changed, 10 insertions(+), 14 deletions(-)
New commits:
commit 72380a5633f05de256b001b89fecdf20a34372b5
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 14:48:16 2011 +0100
Replacing date arithmetics with current_timestamp + numtodsinterval().
Addressing
DBD::Pg::st execute failed: ERROR: operator is not unique: date + unknown at
character 174
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm
b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index 7258175..f581e9f 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -466,20 +466,16 @@ EOQ
$sth->execute($cid);
- my $now = RHN::Date->now->long_date;
-
- $delay = $delay / (24*60*60);
-
if ($sth->fetchrow) {
$sth->finish;
$sth = $dbh->prepare(<<EOQ);
UPDATE rhnTaskQueue
- SET earliest = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS') + ?
+ SET earliest = current_timestamp + numtodsinterval(?, 'second')
WHERE task_data = ?
EOQ
- $sth->execute($now, $delay, $cid);
+ $sth->execute($delay, $cid);
}
else {
$sth->finish;
@@ -487,10 +483,10 @@ EOQ
$sth = $dbh->prepare(<<EOQ);
INSERT INTO rhnTaskQueue
(org_id, task_name, task_data, priority, earliest)
-VALUES (?, 'update_errata_cache_by_channel', ?, 0, TO_DATE(?, 'YYYY-MM-DD
HH24:MI:SS') + ?)
+VALUES (?, 'update_errata_cache_by_channel', ?, 0, current_timestamp +
numtodsinterval(?, 'second'))
EOQ
- $sth->execute($org_id, $cid, $now, $delay);
+ $sth->execute($org_id, $cid, $delay);
}
$dbh->commit;
commit 575b2a1eb45342f305c600f0fac4977e21801200
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 14:35:41 2011 +0100
We need to use current_timestamp instead of sysdate.
Addressing
DBD::Pg::st execute failed: ERROR: column "sysdate" does not exist at
character 260
diff --git a/web/modules/rhn/RHN/DB/ChannelEditor.pm
b/web/modules/rhn/RHN/DB/ChannelEditor.pm
index 7699f77..7258175 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -729,7 +729,7 @@ INSERT
INTO rhnRepoRegenQueue
(id, channel_label, client, reason, force, bypass_filters, next_action, created,
modified)
VALUES (sequence_nextval('rhn_repo_regen_queue_id_seq'),
- :label, 'perl-web::add_cloned_errata_to_channel', NULL, 'N',
'N', sysdate, sysdate, sysdate)
+ :label, 'perl-web::add_cloned_errata_to_channel', NULL, 'N',
'N', current_timestamp, current_timestamp, current_timestamp)
EOQ
my $channel = RHN::Channel->lookup(-id => $attr{to_cid});
commit 8f27dd3090f2b7fbb4653cccd73d5a514e268c5d
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 14:34:43 2011 +0100
Use sequence_nextval function.
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 02420fb..7699f77 100644
--- a/web/modules/rhn/RHN/DB/ChannelEditor.pm
+++ b/web/modules/rhn/RHN/DB/ChannelEditor.pm
@@ -728,7 +728,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 (sequence_nextval('rhn_repo_regen_queue_id_seq'),
:label, 'perl-web::add_cloned_errata_to_channel', NULL, 'N',
'N', sysdate, sysdate, sysdate)
EOQ
commit 431881bb33217f21b360b09201348f4f0a36ca74
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 14:32:42 2011 +0100
PostgreSQL does not like table alias on insert.
Addressing
DBD::Pg::st execute failed: ERROR: syntax error at or near "EFP" at
character 36
diff --git a/web/modules/rhn/RHN/DB/Errata.pm b/web/modules/rhn/RHN/DB/Errata.pm
index 082f1d1..7267378 100644
--- a/web/modules/rhn/RHN/DB/Errata.pm
+++ b/web/modules/rhn/RHN/DB/Errata.pm
@@ -707,7 +707,7 @@ EOQ
my $efp_table = $self->table_map('rhnErrataFilePackage');
my $efp_insert_query = <<EOQ;
INSERT
- INTO $efp_table EFP
+ INTO $efp_table
(errata_file_id, package_id)
VALUES (:ef_id, :pid)
EOQ
commit b69538049699bf784a8807b32abf60f7b1351a18
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 14:30:13 2011 +0100
We need to use global evr_t_as_vre_simple instead of PE.evr.as_vre_simple().
Addressing
RHN::Exception: DBD::Pg::st execute failed: ERROR: cross-database references are not
implemented: pe.evr.as_vre_simple
diff --git a/web/modules/rhn/RHN/DB/Errata.pm b/web/modules/rhn/RHN/DB/Errata.pm
index e45cf9d..082f1d1 100644
--- a/web/modules/rhn/RHN/DB/Errata.pm
+++ b/web/modules/rhn/RHN/DB/Errata.pm
@@ -681,7 +681,7 @@ EOQ
my $ep_table = $self->table_map('rhnErrataPackage');
$query = <<EOQ;
SELECT sequence_nextval('rhn_erratafile_id_seq') AS ID, EFT.id AS TYPE_ID,
Csum.checksum md5sum, P.path, P.id AS PACKAGE_ID,
- PN.name || '-' || PE.evr.as_vre_simple() || '.' || PA.label AS
NVREA
+ PN.name || '-' || evr_t_as_vre_simple(PE.evr) || '.' || PA.label
AS NVREA
FROM rhnErrataFileType EFT, rhnPackage P, $ep_table EP, rhnPackageName PN,
rhnPackageEVR PE, rhnPackageArch PA, rhnChecksum Csum
WHERE EFT.label = 'RPM'
AND P.id = EP.package_id
commit cd29155debbd447b59ade9aedf8ca487a8758b6b
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 14:27:01 2011 +0100
Use sequence_nextval function.
Addressing
RHN::Exception: DBD::Pg::st execute failed: ERROR: missing FROM-clause entry for
table "rhn_erratafile_id_seq" at character 8
diff --git a/web/modules/rhn/RHN/DB/Errata.pm b/web/modules/rhn/RHN/DB/Errata.pm
index 4360ddc..e45cf9d 100644
--- a/web/modules/rhn/RHN/DB/Errata.pm
+++ b/web/modules/rhn/RHN/DB/Errata.pm
@@ -680,7 +680,7 @@ EOQ
my $ep_table = $self->table_map('rhnErrataPackage');
$query = <<EOQ;
-SELECT rhn_erratafile_id_seq.nextval AS ID, EFT.id AS TYPE_ID, Csum.checksum md5sum,
P.path, P.id AS PACKAGE_ID,
+SELECT sequence_nextval('rhn_erratafile_id_seq') AS ID, EFT.id AS TYPE_ID,
Csum.checksum md5sum, P.path, P.id AS PACKAGE_ID,
PN.name || '-' || PE.evr.as_vre_simple() || '.' || PA.label AS
NVREA
FROM rhnErrataFileType EFT, rhnPackage P, $ep_table EP, rhnPackageName PN,
rhnPackageEVR PE, rhnPackageArch PA, rhnChecksum Csum
WHERE EFT.label = 'RPM'
commit 7a4b03ab4a8a83789975a6e54a6b1b61d8abbc27
Author: Jan Pazdziora <jpazdziora(a)redhat.com>
Date: Mon Feb 28 13:56:43 2011 +0100
Use sequence_nextval function.
Addressing
RHN::Exception: DBD::Pg::st execute failed: ERROR: missing FROM-clause entry for
table "rhn_erratafile_id_seq" at character 99
diff --git a/web/modules/rhn/RHN/DB/Errata.pm b/web/modules/rhn/RHN/DB/Errata.pm
index d81826b..4360ddc 100644
--- a/web/modules/rhn/RHN/DB/Errata.pm
+++ b/web/modules/rhn/RHN/DB/Errata.pm
@@ -443,7 +443,7 @@ sub commit {
if ($self->id == -1) {
unless ($id) {
- my $sth = $dbh->prepare("SELECT rhn_errata_id_seq.nextval FROM
DUAL");
+ my $sth = $dbh->prepare("SELECT
sequence_nextval('rhn_errata_id_seq') FROM DUAL");
$sth->execute;
($id) = $sth->fetchrow;
die "No new errata id from seq rhn_errata_id_seq (possible error: " .
$sth->errstr . ")" unless $id;