#1750 koji 1.19.0 does not function with Postgres < 9.4
Closed: Fixed 2 years ago by tkopecek. Opened 2 years ago by jforaker.

After upgrading our RHEL7-based hub to Koji 1.19.0, we began getting these error messages:

[Fri Nov 01 14:41:19.233365 2019] [:error] [pid 9589] 2019-11-01 14:41:19,233 [ERROR] m=listUsers u=None p=9589 r=192.168.1.1:49088 koji.db: Query failed. Query was: 
[Fri Nov 01 14:41:19.233398 2019] [:error] [pid 9589] SELECT id, array_remove(array_agg(krb_principal), NULL), name, status, usertype
[Fri Nov 01 14:41:19.233403 2019] [:error] [pid 9589]   FROM users
[Fri Nov 01 14:41:19.233407 2019] [:error] [pid 9589]   LEFT JOIN user_krb_principals ON users.id = user_krb_principals.user_id
[Fri Nov 01 14:41:19.233411 2019] [:error] [pid 9589]  WHERE (usertype = 0)
[Fri Nov 01 14:41:19.233415 2019] [:error] [pid 9589]  GROUP BY users.id
[Fri Nov 01 14:41:19.233419 2019] [:error] [pid 9589]  ORDER BY name
[Fri Nov 01 14:41:19.233423 2019] [:error] [pid 9589] 
[Fri Nov 01 14:41:19.233427 2019] [:error] [pid 9589]  
[Fri Nov 01 14:41:19.233431 2019] [:error] [pid 9589] 
[Fri Nov 01 14:41:19.238652 2019] [:error] [pid 9589] 2019-11-01 14:41:19,238 [WARNING] m=listUsers u=None p=9589 r=192.168.1.1:49088 koji.xmlrpc: Traceback (most recent call last):
[Fri Nov 01 14:41:19.238665 2019] [:error] [pid 9589]   File "/usr/share/koji-hub/kojixmlrpc.py", line 237, in _wrap_handler
[Fri Nov 01 14:41:19.238669 2019] [:error] [pid 9589]     response = handler(environ)
[Fri Nov 01 14:41:19.238673 2019] [:error] [pid 9589]   File "/usr/share/koji-hub/kojixmlrpc.py", line 280, in handle_rpc
[Fri Nov 01 14:41:19.238677 2019] [:error] [pid 9589]     return self._dispatch(method, params)
[Fri Nov 01 14:41:19.238681 2019] [:error] [pid 9589]   File "/usr/share/koji-hub/kojixmlrpc.py", line 317, in _dispatch
[Fri Nov 01 14:41:19.238685 2019] [:error] [pid 9589]     ret = koji.util.call_with_argcheck(func, params, opts)
[Fri Nov 01 14:41:19.238690 2019] [:error] [pid 9589]   File "/usr/lib/python2.7/site-packages/koji/util.py", line 261, in call_with_argcheck
[Fri Nov 01 14:41:19.238694 2019] [:error] [pid 9589]     return func(*args, **kwargs)
[Fri Nov 01 14:41:19.238698 2019] [:error] [pid 9589]   File "/usr/share/koji-hub/kojihub.py", line 11251, in listUsers
[Fri Nov 01 14:41:19.238702 2019] [:error] [pid 9589]     return query.execute()
[Fri Nov 01 14:41:19.238706 2019] [:error] [pid 9589]   File "/usr/share/koji-hub/kojihub.py", line 8670, in execute
[Fri Nov 01 14:41:19.238710 2019] [:error] [pid 9589]     data = _multiRow(query, self.values, (self.aliases or self.columns))
[Fri Nov 01 14:41:19.238714 2019] [:error] [pid 9589]   File "/usr/share/koji-hub/kojihub.py", line 4903, in _multiRow
[Fri Nov 01 14:41:19.238718 2019] [:error] [pid 9589]     return [dict(zip(fields, row)) for row in _fetchMulti(query, values)]
[Fri Nov 01 14:41:19.238722 2019] [:error] [pid 9589]   File "/usr/share/koji-hub/kojihub.py", line 4875, in _fetchMulti
[Fri Nov 01 14:41:19.238726 2019] [:error] [pid 9589]     c.execute(query, values)
[Fri Nov 01 14:41:19.238730 2019] [:error] [pid 9589]   File "/usr/lib/python2.7/site-packages/koji/db.py", line 136, in execute
[Fri Nov 01 14:41:19.238734 2019] [:error] [pid 9589]     ret = self.cursor.execute(operation, parameters)
[Fri Nov 01 14:41:19.238738 2019] [:error] [pid 9589] ProgrammingError: function array_remove(character varying[], unknown) does not exist
[Fri Nov 01 14:41:19.238752 2019] [:error] [pid 9589] LINE 2: SELECT id, array_remove(array_agg(krb_principal), NULL), nam...
[Fri Nov 01 14:41:19.238757 2019] [:error] [pid 9589]                    ^
[Fri Nov 01 14:41:19.238760 2019] [:error] [pid 9589] HINT:  No function matches the given name and argument types. You might need to add explicit type casts.
[Fri Nov 01 14:41:19.238764 2019] [:error] [pid 9589] 
[Fri Nov 01 14:41:19.238768 2019] [:error] [pid 9589] 

The issue appears to be due to RHEL shipping with Postgres 9.2, which does not have support for the array_remove() function used in the SQL blocks in listUsers(), which was introduced in version 9.4. It looks like get_group_members() should be similarly affected.


I just submitted PR #1751 with a potential fix for this issue.

Metadata Update from @tkopecek:
- Custom field Size adjusted to small
- Issue set to the milestone: 1.20
- Issue tagged with: bug

2 years ago

Metadata Update from @tkopecek:
- Issue set to the milestone: 1.19.1 (was: 1.20)

2 years ago

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #1751 Merged 2 years ago