According to this SO Answer, there is no unique constraint matching given keys for referenced table "..." is an error you get when you make a foreign key reference call to a column which is not unique. But why am I getting this error here?
postgres=# create database example;
CREATE DATABASE
postgres=# \c example
You are now connected to database "masterdb" as user "postgres".
masterdb=# create table foo(
id bigserial
);
CREATE TABLE
masterdb=# create table bar (
id bigserial,
foo_fid bigint not null references foo (id)
);
ERROR: there is no unique constraint matching given keys for referenced table "foo"