Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When adding a view showing users online a PostgreSQL query is generated which uses IF function that is undefined (I guess the one from MySQL).
Steps to reproduce:
- Go to admin/structure/views/add.
- Show: users.
- Click "Continue" button.
- Add filter "User: is online".
- Click "Apply" button. (after this point you can already see the error behind the modal)
- Click "Apply" button.
The error I get is:
SQLSTATE[42883]: Undefined function: 7 ERROR: function if(boolean, integer, integer) does not exist LINE 7: WHERE (( (users.status <> '0') AND (IF((1462262107 - session... ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.
And the SQL query:
SELECT users.name AS users_name, users.uid AS uid, users.created AS users_created
FROM
{users} users
LEFT JOIN {sessions} sessions ON users.uid = sessions.uid
WHERE (( (users.status <> '0') AND (IF((1462260823 - sessions.timestamp) < 900, 1, 0) = '0') ))
ORDER BY users_created DESC
LIMIT 10 OFFSET 0
Comments
Comment #2
mrjigsaw CreditAttribution: mrjigsaw commented