Skip to content

Instantly share code, notes, and snippets.

@abevieiramota
Last active September 11, 2020 18:38
Show Gist options
  • Save abevieiramota/0988e38baee94b76e060e1dfefad939c to your computer and use it in GitHub Desktop.
Save abevieiramota/0988e38baee94b76e060e1dfefad939c to your computer and use it in GitHub Desktop.
estranho.sql
create temporary table a (id serial primary key);
create temporary table b (nome text not null) inherits (a);
create temporary table c (id_a int not null references a(id));
insert into b values (default, 'teste');
select * from a;
-- 1
insert into c values (1);
--SQL Error [23503]: ERROR: insert or update on table "c" violates foreign key constraint "c_id_a_fkey"
-- Detalhe: Key (id_a)=(1) is not present in table "a".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment