Consider the following schema
CREATE TYPE episode_id AS
(
season_nr int,
episode_nr int,
show_id bigint
);
CREATE TABLE episodes
(
id episode_id primary key,
title varchar(255) not null,
release_date timestamptz null
);
I want to insert to multiple rows in one query;
insert into episodes (id.season_nr, id.episode_nr, id.show_id, title, release_date)
values
(1, 1, 58811, 'Pilot', null),
(1, 2, 58811, 'Vector', null),
(1, 3, 58811, '274', null),
(1, 4, 58811, 'Single Strand', null),
(1, 5, 58811, 'The White Room', null);
It throws:
> ERROR: multiple assignments to same column "id" SQL state: 42601
My client library does not support ROW
syntax. How could I make this work?