Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save NikolayS/61be5662e76277385234e3857436d5a8 to your computer and use it in GitHub Desktop.
Save NikolayS/61be5662e76277385234e3857436d5a8 to your computer and use it in GitHub Desktop.
create table multi(id bigserial primary key, data text);
create table multi1(instance int2 not null default 1) inherits(multi);
create rule domultiply as on insert to multi do instead insert into multi1(data) values('auto1'), ('auto2') returning id, data;
insert into multi(data) values('manual') returning *; -- returns 2 rows!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment