add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE TABLE tbl (
record int,
"time" time,
id text
);

INSERT INTO tbl VALUES
(1, '12:00', '[1,2,3]'),
(2, '12:01', '[4,5,6,7]'),
(3, '12:07', '[8,9]');

SELECT DISTINCT record, time, unnest(translate(id, '[]', '{}'):: int[]) AS ids
FROM tbl
ORDER BY record, time, ids;
3 rows affected
record time ids
1 12:00:00 1
1 12:00:00 2
1 12:00:00 3
2 12:01:00 4
2 12:01:00 5
2 12:01:00 6
2 12:01:00 7
3 12:07:00 8
3 12:07:00 9