I have three columns in my table: id, email, and OAuthEmail. When a user, ([email protected]) signs up with an email I'd like to create a new record if the email is not in the table. If the user previously signed up with OAuthEmail (if OAuthEmail = [email protected]), I'd like to add [email protected] to the email column. I have tried the following -
INSERT INTO users ("email")
VALUES ([email protected])
ON CONFLICT (user."OAuthEmail" = [email protected])
DO UPDATE SET (users.email = [email protected])
WHERE users."OAuthEmail" = [email protected];
I am getting a syntax error at "=" on the line - ON CONFLICT (users.email = user."OAuthEmail").
emailorOAuthEmail? A few records of sample data and desired results would help clarifying your question.