Checksetup fails to complete on PostgreSQL

RESOLVED FIXED in Bugzilla 2.20

Status

()

Bugzilla
Installation & Upgrading
P1
normal
RESOLVED FIXED
13 years ago
13 years ago

People

(Reporter: Max Kanat-Alexander, Assigned: Max Kanat-Alexander)

Tracking

2.19.2
Bugzilla 2.20
Bug Flags:
approval +

Details

Attachments

(1 attachment)

(Assignee)

Description

13 years ago
There is some bad SQL that runs after the upgrade code in checksetup, that
prevents a normal checksetup run from finishing on PostgreSQL.

Once this bug is RESOLVED, checksetup will be able to run correctly on
PostgreSQL for the creation of a brand-new database.
(Assignee)

Comment 1

13 years ago
Created attachment 176842 [details] [diff] [review]
Make checksetup complete properly on PostgreSQL

We were relying on a lot of bad MySQL-specific behavior here. Notably, that
MySQL allows you to exclude NOT NULL fields from the INSERT statements (which
sort of defeats the entire purpose of NOT NULL...).
Attachment #176842 - Flags: review?(bugzilla)
(Assignee)

Updated

13 years ago
Status: NEW → ASSIGNED
Priority: -- → P1
Target Milestone: --- → Bugzilla 2.20
Comment on attachment 176842 [details] [diff] [review]
Make checksetup complete properly on PostgreSQL

>-                          (name, description, userregexp, isbuggroup)
>-                          VALUES (?, ?, ?, ?)');
>+                          (name, description, userregexp, isbuggroup,
>+                           last_changed)
>+                          VALUES (?, ?, ?, ?, NOW())');

this is fine, however the rest of the patch (converting to sql placeholders)
really belongs on another bug.
Attachment #176842 - Flags: review?(bugzilla) → review-
Comment on attachment 176842 [details] [diff] [review]
Make checksetup complete properly on PostgreSQL


behold the speed of my flip-flop.

i missed these changes :(

>-          "INSERT " .
>-           " INTO profiles (login_name, realname, cryptpassword, emailflags) " .
>-          "VALUES ($login, $realname, $cryptedpassword, $defaultflagstring)");
>+          q{INSERT INTO profiles (login_name, realname, cryptpassword, 
>+                                  emailflags, disabledtext, refreshed_when)
>+            VALUES (?, ?, ?, ?, ?, ?)},
>+            undef, $login, $realname, $cryptedpassword, 
>+            Bugzilla::Constants::DEFAULT_EMAIL_SETTINGS, '', '1900-01-01 00:00:00');

anyhow,

>+    my $group_exists = $dbh->selectrow_array(
>+        q{SELECT 1 FROM group_group_map 
>+           WHERE member_id = ? AND grantor_id = ? AND grant_type = ?},
>+        undef, $whineatothers_group, $whine_group, GROUP_MEMBERSHIP);
>+    $dbh->do("INSERT INTO group_group_map " .

nits:
not a fan of q{} where quotes will do.
can you use SELECT COUNT instead?
Attachment #176842 - Flags: review- → review+
(Assignee)

Updated

13 years ago
Flags: approval?
Flags: approval? → approval+
(Assignee)

Comment 4

13 years ago
Checked-in as-is. :-) (It's late. :-))

Checking in checksetup.pl;
/cvsroot/mozilla/webtools/bugzilla/checksetup.pl,v  <--  checksetup.pl
new revision: 1.364; previous revision: 1.363
done
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
No longer depends on: 285121
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.