Skip to main content
100%

Gist 66b1a9a31dce76682837c3fd4d9a468b

✓ Published0🌍 Public
JJonasHeylen
Last edited Feb 9, 2017
Created on Feb 9, 2017

This example demonstrates how to query JSONB data directly in PostgreSQL and flatten it into a relational result set. The code creates a table with a JSONB column, inserts two sample rows, and then uses two different query approaches: the `->>` operator to extract scalar fields as text, and the `jsonb_to_record` function with a column definition list to cast JSON values into typed columns (text and integer). The example highlights both methods for accessing nested JSON data, showing the explicit extraction syntax versus the more structured record-expansion technique, all within a single SQL file.

AI-generated description

Similar vizzes