id	summary	reporter	owner	description	type	status	priority	component	severity	resolution	keywords	cc	release
10772	ProgrammingError: operator does not exist: text = integer	mbunkus	hasienda	I've checked the other tickets here with similar subjects; none of them applies.\r\n\r\nAccountManagerPlugin 0.5dev from trunk, revision 12516; Trac 1.0.1; PostgreSQL 9.1\r\n\r\nHappens when you log in. In my special case I've registered a new user account, logged in for the first time. Error occurred.\r\n\r\nError message from log file:\r\n\r\n{{{\r\n2013-01-08 18:49:21,821 Trac[main] ERROR: Exception caught while post-processing request:\r\nTraceback (most recent call last):\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 243, in dispatch\r\n    self._post_process_request(req)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 340, in _post_process_request\r\n    f.post_process_request(req, *(None,)*extra_arg_count)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 123, in post_process_request\r\n    if req.authname and req.authname != 'anonymous':\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/api.py", line 304, in __getattr__\r\n    value = self.callbacks[name](self)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 135, in authenticate\r\n    authname = authenticator.authenticate(req)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/util.py", line 83, in wrap\r\n    return func(self, *args, **kwds)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 334, in authenticate\r\n    user = self._remote_user(req)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 680, in _remote_user\r\n    if acctmgr.check_password(user, password) == True:\r\n  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 273, in check_password\r\n    valid = store.check_password(user, password)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/db.py", line 106, in check_password\r\n    """, (self.key, user))\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/db/util.py", line 65, in execute\r\n    return self.cursor.execute(sql_escape_percent(sql), args)\r\nInternalError: current transaction is aborted, commands ignored until end of transaction block\r\nInternalError: current transaction is aborted, commands ignored until end of transaction block\r\n\r\n2013-01-08 18:49:21,876 Trac[main] ERROR: Internal Server Error:\r\nTraceback (most recent call last):\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 497, in _dispatch_request\r\n    dispatcher.dispatch(req)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 179, in dispatch\r\n    chosen_handler)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 325, in _pre_process_request\r\n    chosen_handler = filter_.pre_process_request(req, chosen_handler)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 420, in pre_process_request\r\n    if not req.session.authenticated or \\\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/api.py", line 304, in __getattr__\r\n    value = self.callbacks[name](self)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 268, in _get_session\r\n    return Session(self.env, req)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/session.py", line 200, in __init__\r\n    if req.authname == 'anonymous':\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/api.py", line 304, in __getattr__\r\n    value = self.callbacks[name](self)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/web/main.py", line 135, in authenticate\r\n    authname = authenticator.authenticate(req)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/util.py", line 83, in wrap\r\n    return func(self, *args, **kwds)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 334, in authenticate\r\n    user = self._remote_user(req)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/web_ui.py", line 680, in _remote_user\r\n    if acctmgr.check_password(user, password) == True:\r\n  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 277, in check_password\r\n    self._maybe_update_hash(user, password)\r\n  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 381, in _maybe_update_hash\r\n    if not get_user_attribute(self.env, 1, user, 'password_refreshed', 1):\r\n  File "build/bdist.linux-i686/egg/acct_mgr/model.py", line 125, in get_user_attribute\r\n    cursor.execute(sql, sql_args)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/db/util.py", line 65, in execute\r\n    return self.cursor.execute(sql_escape_percent(sql), args)\r\nProgrammingError: operator does not exist: text = integer\r\nLINE 4:         WHERE sid=1 AND authenticated='testfufu' AND name='p...\r\n}}}\r\n\r\nRelevant configuration:\r\n\r\n{{{\r\n[account-manager]\r\ndb_htpasswd_hash_type = sha\r\nforce_passwd_change = true\r\nhash_method = HtPasswdHashMethod\r\nhtpasswd_file = /opt/trac/kivitendo/htpasswd\r\nhtpasswd_hash_type = sha\r\nlogin_attempt_max_count = 0\r\nnotify_actions =\r\npassword_store = SessionStore\r\npersistent_sessions = False\r\nrefresh_passwd = true\r\nregister_check = BasicCheck, EmailCheck, UsernamePermCheck, RegExpCheck\r\nverify_email = true\r\n\r\n[components]\r\nacct_mgr.admin.accountguardadminpage = enabled\r\nacct_mgr.admin.accountmanageradminpage = enabled\r\nacct_mgr.api.accountmanager = enabled\r\nacct_mgr.db.sessionstore = enabled\r\nacct_mgr.guard.accountguard = enabled\r\nacct_mgr.htfile.abstractpasswordfilestore = disabled\r\nacct_mgr.htfile.htdigeststore = disabled\r\nacct_mgr.htfile.htpasswdstore = disabled\r\nacct_mgr.http.httpauthstore = disabled\r\nacct_mgr.notification.accountchangelistener = enabled\r\nacct_mgr.notification.accountchangenotificationadminpanel = enabled\r\nacct_mgr.pwhash.htdigesthashmethod = enabled\r\nacct_mgr.pwhash.htpasswdhashmethod = enabled\r\nacct_mgr.register.basiccheck = enabled\r\nacct_mgr.register.bottrapcheck = enabled\r\nacct_mgr.register.emailcheck = enabled\r\nacct_mgr.register.emailverificationmodule = enabled\r\nacct_mgr.register.regexpcheck = enabled\r\nacct_mgr.register.registrationmodule = enabled\r\nacct_mgr.register.usernamepermcheck = enabled\r\nacct_mgr.web_ui.loginmodule = enabled\r\n}}}\r\n\r\nI have a fix for this. When I apply it I get the next error message (only showing the last lines) in a related place:\r\n\r\n{{{\r\n  File "build/bdist.linux-i686/egg/acct_mgr/api.py", line 381, in _maybe_update_hash\r\n    if not get_user_attribute(self.env, 1, user, 'password_refreshed', 1):\r\n  File "build/bdist.linux-i686/egg/acct_mgr/model.py", line 125, in get_user_attribute\r\n    cursor.execute(sql, sql_args)\r\n  File "/usr/local/lib/python2.7/dist-packages/Trac-1.0.1dev_r11468-py2.7.egg/trac/db/util.py", line 65, in execute\r\n    return self.cursor.execute(sql_escape_percent(sql), args)\r\nProgrammingError: operator does not exist: text = integer\r\nLINE 4:         WHERE sid=1 AND authenticated='testfufu' AND name='p...\r\n}}}\r\n\r\nThis error message shows two problems: 1. the data type mismatch and 2. the field order is wrong (have to swap the `name` and `authenticated` columns).\r\n\r\nI'll attach a diff that fixes both places for me. PostgreSQL is simply way more picky about data types than other databases.	defect	new	normal	AccountManagerPlugin	normal		db PostreSQL	rjollos	1.0
