Created
December 5, 2017 13:46
-
-
Save serverhorror/b0edc0eb5c6c100ac380fbd96fbf46d2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH | |
sel AS (SELECT id, key, value FROM labels WHERE (key = 'sequencing_strandness' AND value = 'paired-end')), | |
ins AS ( | |
INSERT INTO "labels"(key, value) | |
SELECT key, value | |
WHERE NOT EXISTS (SELECT 1 FROM sel) | |
RETURNING "id", key, value | |
) | |
SELECT * FROM ins UNION ALL SELECT * FROM sel | |
; | |
ERROR: column "key" does not exist | |
LINE 5: SELECT key, value | |
^ | |
HINT: There is a column named "key" in table "labels", but it cannot be referenced from this part of the query. | |
Time: 2.784 ms |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment