User.find_by(id: 123) fails: no login, no adminstration

This makes me think that your postgres indices are corrupt.

I would recommend first following the steps listed on Corruption - PostgreSQL wiki to preserve your data.

After you’ve made a copy if you run the postgres CLI and try that same underlying query you should results like:

discourse_development=# SELECT  "users"."id", "users"."username" FROM "users" WHERE "users"."id" = 2 LIMIT 1;
 id | username 
----+-------------
  2 | juanettedoe
(1 row)

discourse_development=# SELECT  "users"."id", "users"."username" FROM "users" WHERE "users"."username_lower" = 'juanettedoe' LIMIT 1;
 id | username 
----+-------------
  2 | juanettedoe
(1 row)