OAuth Email missing in data explorer

(Bas van Leeuwen) #1

Using this query:

SELECT id, username, email
FROM users

The following is returned

All those NULL results are people who have signed up using Google OAuth2

The emails are in the system correctly, I can see them in their profiles.

What am I doing wrong? :slight_smile:

(Régis Hanol) #2

We no longer use the email column on the users table.

You need to join the users table with the user_emails table with the primary = true condition :wink:

(Bas van Leeuwen) #3
SELECT u.id, u.username, u.email, ue.email
FROM users u
INNER JOIN user_emails ue ON u.id = ue.id
WHERE ue.primary = true

That worked :slight_smile:

I was thrown off by the one email that was there; but I guess that’s a remnant of running

cd /var/discourse
./launcher enter app
rake admin:create

when I was troubleshooting my email troubles.

(Régis Hanol) #4

The column is in readonly mode. We’ll completely remove it when we’re 100% it’s safe to do so.