Created
May 26, 2022 19:43
-
-
Save patmaddox/3ccea16b14e3690980f02dbb324003fb to your computer and use it in GitHub Desktop.
This file contains 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
CREATE TABLE users (id serial PRIMARY KEY NOT NULL, username text NOT NULL); | |
INSERT INTO users (username) VALUES ('admin'); | |
INSERT INTO users (username) VALUES ('pat'); | |
CREATE RULE no_delete_admin AS ON DELETE TO users WHERE username='admin' DO INSTEAD NOTHING; | |
SELECT * FROM users; | |
DELETE FROM users; | |
SELECT * FROM users; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment