If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

LOCATE is not ANSI SQL (prevents user account creation)

RESOLVED FIXED in Bugzilla 2.20

Status

()

Bugzilla
Administration
P1
major
RESOLVED FIXED
13 years ago
13 years ago

People

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

Tracking

2.19.2
Bugzilla 2.20
Dependency tree / graph
Bug Flags:
approval +

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.7.6) Gecko/20050406 Firefox/1.0.2 (Debian package 1.0.2-3)
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.7.6) Gecko/20050406 Firefox/1.0.2 (Debian package 1.0.2-3)

A query crash the process while creating a new user if the edituser.cgi script.

Reproducible: Always

Steps to Reproduce:
1. Select "add a user" in the administration of bugzilla
2. Fill-in the form and leave "Disable text" field blank
3. Submit the form

Actual Results:  
Bugzilla crashes with following message:

DBD::Pg::st execute failed: ERROR:  function locate("unknown", character
varying) does not exist
HINT:  No function matches the given name and argument types. You may need to
add explicit type casts.
 [for Statement "SELECT eventdata FROM tokens WHERE tokentype = 'emailold'
        AND SUBSTRING(eventdata, 1, (LOCATE(':', eventdata) - 1)) = ?
        OR SUBSTRING(eventdata, (LOCATE(':', eventdata) + 1)) = ?" with
ParamValues: 2='herve@everyfeed.com', 1='herve@everyfeed.com'] at
Bugzilla/User.pm line 1142
	Bugzilla::User::is_available_username('herve@everyfeed.com') called at
/home/httpd/htdocs/bugzilla/editusers.cgi line 175
(Reporter)

Updated

13 years ago
Blocks: 98304
(Assignee)

Comment 1

13 years ago
Hrm, I wonder if that's specific to 8.0, or if LOCATE is not ANSI.
OS: Linux → All
Hardware: PC → All
Version: unspecified → 2.19.2
(Assignee)

Comment 2

13 years ago
OK, yeah, we should be using POSITION (or really, sql_position, I think) instead
of LOCATE. That's a pretty easy fix.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Summary: cannot create a user (postgresql query failed) → LOCATE is not ANSI SQL
Target Milestone: --- → Bugzilla 2.20
(Assignee)

Updated

13 years ago
Assignee: administration → mkanat
(Assignee)

Updated

13 years ago
Summary: LOCATE is not ANSI SQL → LOCATE is not ANSI SQL (prevents user account creation)
(Assignee)

Updated

13 years ago
Status: NEW → ASSIGNED
Priority: -- → P1
(Assignee)

Comment 3

13 years ago
Created attachment 182830 [details] [diff] [review]
Fix User Account Creation

OK, there was one other problem, which was that refreshed_when is NOT NULL and
was missing from the INSERT.
Attachment #182830 - Flags: review?(bugreport)
(Reporter)

Comment 4

13 years ago
(In reply to comment #3)
> Created an attachment (id=182830) [edit]
> Fix User Account Creation
> 
> OK, there was one other problem, which was that refreshed_when is NOT NULL and
> was missing from the INSERT.

I have tried your patch and it works just fine for me.

Comment 5

13 years ago
Comment on attachment 182830 [details] [diff] [review]
Fix User Account Creation

refreshed_when should not be now() unless you derived groups.
Users should start out in need of refresh.
Attachment #182830 - Flags: review?(bugreport) → review-
(Assignee)

Comment 6

13 years ago
Created attachment 183786 [details] [diff] [review]
v2

OK, I changed it to be January, 1901 by default.

In another patch, we should probably give refreshed_when a default value. I
think that would be a cleaner long-term solution. (Something for 2.22.)
Attachment #182830 - Attachment is obsolete: true
Attachment #183786 - Flags: review?(bugreport)
(Assignee)

Updated

13 years ago
Blocks: 294426

Comment 7

13 years ago
Comment on attachment 183786 [details] [diff] [review]
v2

r=joel if you've tested it
It does seem like there should have been a simpler way to do this in the first
place.
Attachment #183786 - Flags: review?(bugreport) → review+
(Assignee)

Comment 8

13 years ago
Yep, I just tested it, and it works. :-)
Flags: approval?
Flags: approval? → approval+
(Assignee)

Comment 9

13 years ago
Checking in Bugzilla/User.pm;
/cvsroot/mozilla/webtools/bugzilla/Bugzilla/User.pm,v  <--  User.pm
new revision: 1.55; previous revision: 1.54
done
Status: ASSIGNED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → FIXED
(Assignee)

Comment 10

13 years ago
*** Bug 296075 has been marked as a duplicate of this bug. ***
(Assignee)

Comment 11

13 years ago
*** Bug 299880 has been marked as a duplicate of this bug. ***
You need to log in before you can comment on or make changes to this bug.