Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex formatting problem #285

Open
ptman opened this issue May 19, 2022 · 0 comments
Open

Complex formatting problem #285

ptman opened this issue May 19, 2022 · 0 comments

Comments

@ptman
Copy link

ptman commented May 19, 2022

Let's call this an INSELECT (instead of UPSERT):

WITH i AS (
INSERT INTO users (email)
        VALUES ($1)
    ON CONFLICT
        DO NOTHING
    RETURNING
        *)
    SELECT
        *
    FROM
        i
    UNION
    SELECT
        *
    FROM
        users
    WHERE
        email = $1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant