Closed Bug 358228 Opened 19 years ago Closed 19 years ago

tr_install.pl: tr_AddGroup() is broken on PostgreSQL

Categories

(Testopia :: General, defect)

x86
Linux
defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: tlast, Assigned: vrb)

References

Details

Attachments

(1 file, 1 obsolete file)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060413 Red Hat/1.0.8-1.4.1 Firefox/1.0.8 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060413 Red Hat/1.0.8-1.4.1 Firefox/1.0.8 in sub tr_AddGroup, my $sth = $dbh->prepare('INSERT INTO groups - (name, description, userregexp, isbuggroup) - VALUES (?, ?, ?, ?)'); - $sth->execute($name, $desc, '', 0); + $sth = $dbh->prepare('INSERT INTO groups + (name, description, userregexp, isbuggroup, last_changed) + VALUES (?, ?, ?, ?, NOW())'); + $sth->execute($name, $desc, "''", 0); Reproducible: Always
Install will fail at "Adding group name" due to: last_changed field being null userregexp being '' and postgres has no "last_insert_id()"
Summary: Install will fail at "Adding group name" due to last_changed field being null → tr_AddGroup is broken on PostgreSQL
Assignee: ghendricks → vrb
Summary: tr_AddGroup is broken on PostgreSQL → tr_install.pl: tr_AddGroup() is broken on PostgreSQL
Status: NEW → ASSIGNED
Blocks: 356146
Attached patch patch version 1 (obsolete) — Splinter Review
Picked up fixes from checksetup.pl:AddGroup() Simplified GroupDoesExist() down to one line. BTW, this statement will not work with mysql: $sth->execute($name, $desc, "''", 0); Instead, we use this: $sth->execute($name, $desc, "", 0);
Attachment #243836 - Flags: review?(ghendricks)
Comment on attachment 243836 [details] [diff] [review] patch version 1 >- return $id; >+ return $dbh->selectrow_array("SELECT COUNT(*) FROM groups WHERE name='$name'"); > } Is there a reason why you are not using placeholders here?
I guess I was looking at a bad example. :-) Bugzilla still contains several SELECT COUNT statements that look like this. I'll fix it.
Attached patch patch version 2Splinter Review
Use placeholder in GroupDoesExist()
Attachment #243836 - Attachment is obsolete: true
Attachment #243839 - Flags: review?(ghendricks)
Attachment #243836 - Flags: review?(ghendricks)
Attachment #243839 - Flags: review?(ghendricks) → review+
r2335 | vrb | 2006-10-27 14:57:24 -0600 (Fri, 27 Oct 2006) | 4 lines Changed paths: M /trunk/tr_install.pl Use placeholder in GroupDoesExist()
Checking in tr_install.pl; /cvsroot/mozilla/webtools/testopia/tr_install.pl,v <-- tr_install.pl new revision: 1.9; previous revision: 1.8 done
Status: ASSIGNED → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Many thanks - installation succeeded!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: