JSON foreign keys in PostgreSQL

It is not possible, and may not ever be possible, to assign a foreign key to a json property. It’d be a major and quite complicated change to PostgreSQL’s foreign key enforcement. I don’t think it’s impossible to do, but would face similar issues to those experienced by the foreign-keys-to-arrays patch.

With 9.4 it’ll be possible to make a whole json object a foreign key as jsonb supports equality tests. In 9.3 you can’t even do that.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)