Skip to content

Instantly share code, notes, and snippets.

@teepark
Last active October 3, 2016 22:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save teepark/9279c57ad4aa15dc68597afeaaab0ec2 to your computer and use it in GitHub Desktop.
Save teepark/9279c57ad4aa15dc68597afeaaab0ec2 to your computer and use it in GitHub Desktop.
multi-insert with composite type fails?
create domain required_int as integer check (not null);
create type xypoint as (
name text,
x required_int,
y int
);
create table foo (
description text,
location xypoint
);
-- single insert works fine
insert into foo (description, location.name, location.x)
values ('desc1', 'home', 1);
-- but a bulk insert fails
insert into foo (description, location.name, location.x)
values
('desc2', 'work', 2),
('desc3', 'the bar', 3);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment