-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
c/consoleRelated to consoleRelated to consolep/highcandidate for being included in the upcoming sprintcandidate for being included in the upcoming sprints/wipStatus: This issue is a work in progressStatus: This issue is a work in progress
Description
Imagine we have the following table:
CREATE TABLE users (
id uuid PRIMARY KEY NOT NULL DEFAULT gen_random_uuid(),
email text
);If we want to ensure that each user has a unique email we simply add:
ALTER TABLE users ADD CONSTRAINT email_unique UNIQUE (email);If we try it out by inserting some data:
INSERT INTO users (email) VALUES ('test@example.com');
INSERT INTO users (email) VALUES ('test@example.com');
ERROR: duplicate key value violates unique constraint "email_unique"
DETAIL: Key (email)=(test@example.com) already exists. But if we try insert the same email with upper case:
INSERT INTO users (email) VALUES ('TEST@example.com');
SELECT * from users;
id | email
--------------------------------------+------------------
de624d84-63a3-11e9-a923-1681be663d3e | test@example.com
0c4b25af-5736-4985-9b4c-bdfebd04694d | TEST@example.comI think this can be part of the hasura console.
Metadata
Metadata
Assignees
Labels
c/consoleRelated to consoleRelated to consolep/highcandidate for being included in the upcoming sprintcandidate for being included in the upcoming sprints/wipStatus: This issue is a work in progressStatus: This issue is a work in progress