Union JSON demo

Owned by simonw, visibility: Unlisted

SQL query
WITH blogmarks AS (
    SELECT 
        bb.id,
        bb.slug,
        bb.link_url,
        bb.link_title,
        bb.created,
        COALESCE(
            json_agg(DISTINCT bt.tag) FILTER (WHERE bt.tag IS NOT NULL),
            '[]'::json
        ) AS tags
    FROM 
        blog_blogmark bb
    LEFT JOIN 
        blog_blogmark_tags bbt ON bb.id = bbt.blogmark_id
    LEFT JOIN 
        blog_tag bt ON bbt.tag_id = bt.id
    GROUP BY 
        bb.id, bb.slug, bb.link_url, bb.link_title, bb.created
    ORDER BY 
        bb.created DESC
    LIMIT 20
),
entries AS (
    SELECT 
        be.id,
        be.title,
        be.slug,
        be.created,
        COALESCE(
            json_agg(DISTINCT bt.tag) FILTER (WHERE bt.tag IS NOT NULL),
            '[]'::json
        ) AS tags
    FROM 
        blog_entry be
    LEFT JOIN 
        blog_entry_tags bet ON be.id = bet.entry_id
    LEFT JOIN 
        blog_tag bt ON bet.tag_id = bt.id
    GROUP BY 
        be.id, be.title, be.slug, be.created
    ORDER BY 
        be.created DESC
    LIMIT 10
)
SELECT 
    'blogmarks' AS type,
    json_agg(
        json_build_object(
            'id', id,
            'slug', slug,
            'link_url', link_url,
            'link_title', link_title,
            'created', created,
            'tags', tags
        )
    ) AS rows
FROM 
    blogmarks

UNION ALL

SELECT 
    'entries' AS type,
    json_agg(
        json_build_object(
            'id', id,
            'title', title,
            'slug', slug,
            'created', created,
            'tags', tags
        )
    ) AS rows
FROM 
    entries

2 rows

type rows
blogmarks
[
  {
    "id": 9658,
    "slug": "claude-sonnet-5-5",
    "link_url": "https://www.anthropic.com/claude-sonnet-5-5",
    "link_title": "Claude Sonnet 5.5",
    "created": "2026-09-28T22:07:38+00:00",
    "tags": [
      "ai",
      "anthropic",
      "claude",
      "generative-ai",
      "llm-release",
      "llms",
      "pelican-riding-a-bicycle"
    ]
  },
  {
    "id": 9657,
    "slug": "bof-agentic-engineering",
    "link_url": "https://luma.com/vxuiuyvg",
    "link_title": "SF October 14th: A Birds of a Feather Session on Agentic Engineering",
    "created": "2026-09-23T02:53:19+00:00",
    "tags": [
      "agentic-engineering",
      "ai",
      "coding-agents",
      "events",
      "generative-ai",
      "jesse-vincent",
      "llms"
    ]
  },
  {
    "id": 9656,
    "slug": "cloudflare-python-worker",
    "link_url": "https://blog.cloudflare.com/python-workers-ga/",
    "link_title": "Cloudflare Python Workers are now generally available",
    "created": "2026-09-21T22:25:44+00:00",
    "tags": [
      "cloudflare",
      "pyodide",
      "python",
      "webassembly"
    ]
  },
  {
    "id": 9641,
    "slug": "gemini-hacked-three-companies",
    "link_url": "https://www.wsj.com/tech/ai/gemini-hacked-three-companies-in-first-known-breakout-by-googles-ai-5c0baba2",
    "link_title": "Gemini Hacked Three Companies in First Known Breakout by Google\u2019s AI",
    "created": "2026-09-18T23:57:57+00:00",
    "tags": [
      "accidental-cyberattacks",
      "ai",
      "gemini",
      "generative-ai",
      "llms",
      "security"
    ]
  },
  {
    "id": 9640,
    "slug": "the-creative-spirit-of-who-framed-roger-rabbit",
    "link_url": "https://blog.cypressf.com/post/828067789747208192/the-creative-spirit-of-who-framed-roger-rabbit",
    "link_title": "The Creative Spirit of Who Framed Roger Rabbit",
    "created": "2026-09-18T14:36:41+00:00",
    "tags": [
      "animation",
      "film",
      "pelican-riding-a-bicycle"
    ]
  },
  {
    "id": 9639,
    "slug": "targeted-attacks-on-rustaceans",
    "link_url": "https://blog.rust-lang.org/2026/09/17/targeted-attacks/",
    "link_title": "Be alert: targeted attacks on prominent Rustaceans",
    "created": "2026-09-17T23:59:19+00:00",
    "tags": [
      "dependency-cooldowns",
      "open-source",
      "rust",
      "security",
      "supply-chain"
    ]
  },
  {
    "id": 9638,
    "slug": "how-to-write-with-an-llm",
    "link_url": "https://sockpuppet.org/blog/2026/09/17/how-to-write-with-an-llm/",
    "link_title": "How To Write With An LLM",
    "created": "2026-09-17T23:37:27+00:00",
    "tags": [
      "ai",
      "generative-ai",
      "llms",
      "thomas-ptacek",
      "writing"
    ]
  },
  {
    "id": 9637,
    "slug": "compaction-summaries",
    "link_url": "https://alignment.openai.com/misalignment-reports/self-generated-prompt-injections-in-compaction-summaries/",
    "link_title": "Self-generated prompt injections in compaction summaries",
    "created": "2026-09-17T20:57:55+00:00",
    "tags": [
      "ai",
      "ai-personality",
      "generative-ai",
      "llms",
      "openai",
      "prompt-injection"
    ]
  },
  {
    "id": 9636,
    "slug": "one-claude",
    "link_url": "https://claude.com/blog/cowork-is-now-claude",
    "link_title": "Claude Cowork and chat are now one Claude",
    "created": "2026-09-16T18:09:49+00:00",
    "tags": [
      "ai",
      "anthropic",
      "claude",
      "general-agents",
      "generative-ai",
      "llms"
    ]
  },
  {
    "id": 9635,
    "slug": "the-contagion-of-fear",
    "link_url": "https://bcantrill.dtrace.org/2026/09/13/the-contagion-of-fear/",
    "link_title": "The contagion of fear",
    "created": "2026-09-14T21:18:13+00:00",
    "tags": [
      "ai",
      "ai-ethics",
      "anthropic",
      "bryan-cantrill"
    ]
  },
  {
    "id": 9634,
    "slug": "openai-agents-rubygems-replaced",
    "link_url": "https://www.rubyhack.ai/",
    "link_title": "OpenAI agents carried out an undisclosed attack on RubyGems",
    "created": "2026-09-12T00:42:25+00:00",
    "tags": [
      "accidental-cyberattacks",
      "ai",
      "ai-ethics",
      "generative-ai",
      "llms",
      "openai",
      "ruby",
      "security",
      "supply-chain"
    ]
  },
  {
    "id": 9633,
    "slug": "so-you-want-to-use-openrouter",
    "link_url": "https://mmoustafa.com/blog/so-you-want-to-use-openrouter/",
    "link_title": "So you want to use OpenRouter?",
    "created": "2026-09-11T22:49:18+00:00",
    "tags": [
      "ai",
      "generative-ai",
      "llms",
      "openrouter"
    ]
  },
  {
    "id": 9632,
    "slug": "soft-deprecating-re-match",
    "link_url": "https://hugovk.dev/blog/2026/soft-deprecating-re.match/",
    "link_title": "Soft-deprecating re.match()",
    "created": "2026-09-11T14:47:57+00:00",
    "tags": [
      "python",
      "regular-expressions"
    ]
  },
  {
    "id": 9631,
    "slug": "datasette-security",
    "link_url": "https://datasette.io/blog/2026/september-security-releases/",
    "link_title": "Datasette 1.0a39 and 0.65.4 security releases",
    "created": "2026-09-11T03:27:16+00:00",
    "tags": [
      "agentic-engineering",
      "ai",
      "ai-security-research",
      "datasette",
      "generative-ai",
      "llms",
      "releases",
      "security"
    ]
  },
  {
    "id": 9630,
    "slug": "trynix",
    "link_url": "https://fzakaria.com/2026/09/04/any-nix-package-live-in-your-browser",
    "link_title": "Any Nix package, live in your browser",
    "created": "2026-09-10T23:44:15+00:00",
    "tags": [
      "code-review",
      "github-actions",
      "linux",
      "webassembly"
    ]
  },
  {
    "id": 9629,
    "slug": "shopify-react-native",
    "link_url": "https://shopify.engineering/back-to-native",
    "link_title": "Native is now the future of mobile at Shopify",
    "created": "2026-09-10T21:11:15+00:00",
    "tags": [
      "ai",
      "ai-assisted-search",
      "android",
      "coding-agents",
      "generative-ai",
      "ios",
      "llms",
      "mobile",
      "open-source",
      "react",
      "shopify",
      "swift"
    ]
  },
  {
    "id": 9628,
    "slug": "on-navier-stokes-replaced",
    "link_url": "https://openai.com/index/navier-stokes-solution/",
    "link_title": "On the Navier\u2013Stokes Millennium Prize Problem",
    "created": "2026-09-08T23:55:12+00:00",
    "tags": [
      "ai",
      "ai-ethics",
      "generative-ai",
      "llms",
      "mathematics",
      "openai",
      "training-data"
    ]
  },
  {
    "id": 9627,
    "slug": "introducing-chatgpt-images-25",
    "link_url": "https://openai.com/index/introducing-chatgpt-images-2-5/",
    "link_title": "Introducing ChatGPT Images 2.5",
    "created": "2026-09-08T22:46:33+00:00",
    "tags": [
      "ai",
      "generative-ai",
      "openai",
      "text-to-image",
      "tools",
      "uv"
    ]
  },
  {
    "id": 9626,
    "slug": "creepy-crawlies",
    "link_url": "https://people.kernel.org/monsieuricon/creepy-crawlies",
    "link_title": "Creepy crawlies",
    "created": "2026-09-07T23:08:58+00:00",
    "tags": [
      "ai-ethics",
      "crawling",
      "datasette",
      "git",
      "linux"
    ]
  },
  {
    "id": 9625,
    "slug": "research-acceleration-the-view-inside-openai",
    "link_url": "https://openai.com/index/research-acceleration-view-inside-openai/",
    "link_title": "Research acceleration: The view inside OpenAI",
    "created": "2026-09-06T23:57:40+00:00",
    "tags": [
      "ai",
      "chatgpt",
      "coding-agents",
      "generative-ai",
      "llms",
      "november-2025-inflection",
      "openai",
      "recursive-self-improvement"
    ]
  }
]
entries
[
  {
    "id": 9505,
    "title": "OpenAI DevDay 2026 live blog",
    "slug": "openai-devday-2026-live-blog",
    "created": "2026-09-29T15:55:13+00:00",
    "tags": [
      "ai",
      "coding-agents",
      "generative-ai",
      "live-blog",
      "llms",
      "openai",
      "openai-devday"
    ]
  },
  {
    "id": 9504,
    "title": "2026 in LLMs (so far)",
    "slug": "2026-in-llms-so-far",
    "created": "2026-09-27T23:54:15+00:00",
    "tags": [
      "ai",
      "ai-security-research",
      "annotated-talks",
      "generative-ai",
      "llms",
      "openai-hugging-face-incident"
    ]
  },
  {
    "id": 9503,
    "title": "Claude Opus 5.5, GPT-6 Sol, GPT-6 Luna, and a new price war",
    "slug": "opus-and-sol-and-luna",
    "created": "2026-09-22T23:46:41+00:00",
    "tags": [
      "ai",
      "anthropic",
      "claude",
      "generative-ai",
      "gpt",
      "gpt-6-astra",
      "llm-pricing",
      "llm-release",
      "llms",
      "openai",
      "pelican-riding-a-bicycle"
    ]
  },
  {
    "id": 9502,
    "title": "Jev introduces a new shape of LLM - System One, aka Decision Models",
    "slug": "jev",
    "created": "2026-09-21T23:09:20+00:00",
    "tags": [
      "ai",
      "ai-bias",
      "evals",
      "generative-ai",
      "jev",
      "llms"
    ]
  },
  {
    "id": 9471,
    "title": "Generating running routes with GPT-6 Astra and ChatGPT Work",
    "slug": "astra-running-routes",
    "created": "2026-09-12T23:56:42+00:00",
    "tags": [
      "ai",
      "chatgpt",
      "d3",
      "generative-ai",
      "geospatial",
      "gpt-6-astra",
      "llms",
      "openai",
      "skills"
    ]
  },
  {
    "id": 9470,
    "title": "OpenAI agents attacked RubyGems back in May",
    "slug": "openai-agents-rubygems",
    "created": "2026-09-12T00:42:25+00:00",
    "tags": [
      "accidental-cyberattacks",
      "ai",
      "ai-ethics",
      "generative-ai",
      "llms",
      "openai",
      "ruby",
      "security",
      "supply-chain"
    ]
  },
  {
    "id": 9469,
    "title": "Some thoughts on the Navier\u2013Stokes Millennium Prize Problem",
    "slug": "on-navier-stokes",
    "created": "2026-09-08T23:55:12+00:00",
    "tags": [
      "ai",
      "ai-ethics",
      "generative-ai",
      "llms",
      "mathematics",
      "openai",
      "training-data"
    ]
  },
  {
    "id": 9442,
    "title": "The Pelican comparison grid for Astra is pretty interesting",
    "slug": "astra-pelicans",
    "created": "2026-09-04T23:59:05+00:00",
    "tags": [
      "ai",
      "generative-ai",
      "gpt-6-astra",
      "llms",
      "openai",
      "pelican-riding-a-bicycle"
    ]
  },
  {
    "id": 9441,
    "title": "OpenAI's rogue agents were caught communicating via public wikis",
    "slug": "rogue-agent-wikis",
    "created": "2026-09-04T17:38:48+00:00",
    "tags": [
      "accidental-cyberattacks",
      "ai",
      "ai-ethics",
      "ai-security-research",
      "django",
      "generative-ai",
      "llms",
      "openai",
      "perl",
      "wikis"
    ]
  },
  {
    "id": 9440,
    "title": "Claude's new system prompt really doesn't want to reproduce song lyrics",
    "slug": "claudes-new-system-prompt",
    "created": "2026-09-02T14:16:42+00:00",
    "tags": [
      "ai",
      "ai-ethics",
      "claude",
      "generative-ai",
      "git-scraping",
      "llms",
      "prompt-engineering",
      "system-prompts"
    ]
  }
]
Copy and export data

Duration: 45.42ms