Closed Bug 286686 Opened 20 years ago Closed 20 years ago

ORDER BY column needs to be selected or grouped

Categories

(Bugzilla :: Bugzilla-General, defect)

2.19.2
defect
Not set
normal

Tracking

()

RESOLVED FIXED
Bugzilla 2.20

People

(Reporter: Tomas.Kopal, Assigned: Tomas.Kopal)

References

Details

Attachments

(1 file, 3 obsolete files)

For normal selects, Postgres requires columns, which are used in the ORDER BY clause to be also in GROUP BY. For SELECT DISTINCT, columns used in ORDER BY needs to be SELECTed. Patch will follow
Status: NEW → ASSIGNED
Flags: blocking2.20?
Target Milestone: --- → Bugzilla 2.20
Attached patch V1 (obsolete) — Splinter Review
In the course of fixing this, I was actually able to get rid of one query in editusers.cgi, yupeee :-).
Attachment #177832 - Flags: review?(mkanat)
Flags: blocking2.20? → blocking2.20+
>- my $query = 'SELECT DISTINCT userid, login_name, realname, disabledtext ' . >- 'FROM profiles'; >+ my $query = 'SELECT DISTINCT userid, login_name, realname, ' . >+ 'disabledtext, login_name FROM profiles'; I'm no Pg guy, but this seems strange to me... Do you really need to read login_name twice?
(In reply to comment #2) > >- my $query = 'SELECT DISTINCT userid, login_name, realname, disabledtext ' . > >- 'FROM profiles'; > >+ my $query = 'SELECT DISTINCT userid, login_name, realname, ' . > >+ 'disabledtext, login_name FROM profiles'; > > I'm no Pg guy, but this seems strange to me... Do you really need to read > login_name twice? Ummmm, no? :-) Sorry, my oversight, I will fix that, thanks.
Attachment #177832 - Flags: review?(mkanat)
Attached patch V1.1 (obsolete) — Splinter Review
Fixed comment #2.
Attachment #177832 - Attachment is obsolete: true
Attachment #179644 - Flags: review?(mkanat)
Attached patch V1.2 (obsolete) — Splinter Review
Sorry for the spam, I was a bit trigger-happy. I removed the functional change, but didn't remove change in formatting. Fixed.
Attachment #179644 - Attachment is obsolete: true
Attachment #179645 - Flags: review?(mkanat)
Attachment #179644 - Flags: review?(mkanat)
Comment on attachment 179645 [details] [diff] [review] V1.2 Hrm... this patch seems to be missing the actual SQL change for editusers.cgi, and so now any actual changes to that file as a part of this bug aren't necessary, right?
(In reply to comment #6) > (From update of attachment 179645 [details] [diff] [review] [edit]) > Hrm... this patch seems to be missing the actual SQL change for editusers.cgi, > and so now any actual changes to that file as a part of this bug aren't > necessary, right? > Well, yes, I suppose. But I am sure the change in that file is still a valid improvement. Should I move it to a different bug then?
(In reply to comment #7) > Well, yes, I suppose. But I am sure the change in that file is still a valid > improvement. Should I move it to a different bug then? Sure. :-) I always like code cleanup. And then you can ask wurblzap for review. :-)
Attached patch V1.3Splinter Review
Removed editusers.cgi part of the patch to bug 289062.
Attachment #179645 - Attachment is obsolete: true
Attachment #179660 - Flags: review?(mkanat)
Attachment #179645 - Flags: review?(mkanat)
Comment on attachment 179660 [details] [diff] [review] V1.3 Great! This is now obviously correct. :-)
Attachment #179660 - Flags: review?(mkanat) → review+
Flags: approval?
Flags: approval? → approval+
Checking in summarize_time.cgi; /cvsroot/mozilla/webtools/bugzilla/summarize_time.cgi,v <-- summarize_time.cginew revision: 1.7; previous revision: 1.6 done Checking in Bugzilla/User.pm; /cvsroot/mozilla/webtools/bugzilla/Bugzilla/User.pm,v <-- User.pm new revision: 1.51; previous revision: 1.50 done
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Version: unspecified → 2.19.2
Blocks: 293678
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: