Skip to content

Instantly share code, notes, and snippets.

@Alxandr
Created July 22, 2024 10:45
Show Gist options
  • Save Alxandr/90084b68aeef6da5b88e609856aed5ba to your computer and use it in GitHub Desktop.
Save Alxandr/90084b68aeef6da5b88e609856aed5ba to your computer and use it in GitHub Desktop.
// prereq: schema foo finnes og bruker 1 har lov til aa lage tabeller der, og bruker 2 har ikke men har lov til aa lese
{
await using var db = CreateConnection("connstr1");
db.Exec("CREATE TABLE foo.bar (id INT PRIMARY KEY)");
}
{
await using var db = CreateConnection("connstr2");
db.Exec("SELECT * FROM foo.bar"); // works
db.Exec("CREATE TABLE foo.baz (id INT PRIMARY KEY)"); // throws - no permission
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment