Skip to content

Instantly share code, notes, and snippets.

@syntaqx
Last active November 8, 2023 21:36
Show Gist options
  • Save syntaqx/a80c435e64a2a844bb21922798864001 to your computer and use it in GitHub Desktop.
Save syntaqx/a80c435e64a2a844bb21922798864001 to your computer and use it in GitHub Desktop.

Revisions

  1. syntaqx revised this gist Nov 8, 2023. 2 changed files with 0 additions and 0 deletions.
    File renamed without changes.
    File renamed without changes.
  2. syntaqx revised this gist Nov 8, 2023. 1 changed file with 2 additions and 0 deletions.
    2 changes: 2 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,2 @@
    INSERT INTO customers (name, email, created_by)
    VALUES ('John Doe', '[email protected]', ROW('namespace1', '12345'));
  3. syntaqx created this gist Nov 8, 2023.
    12 changes: 12 additions & 0 deletions urn.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    CREATE TYPE urn AS (
    namespace TEXT,
    identifier TEXT
    );

    CREATE TABLE customers (
    customer_id SERIAL PRIMARY KEY,
    name TEXT NOT NULL,
    email TEXT UNIQUE NOT NULL,
    created_by urn, -- Using the custom "urn" type
    created_at TIMESTAMP DEFAULT NOW()
    );