Postgresql – How to relate to information_schema

foreign keyinformation-schemapostgresqlrelational-theory

Is it possible to create a foreign key that relates to information_schema?

For an application implementation, I would like to store extra column information in another table, but I want to ensure that it is not describing columns that do not exist.

Is it possible to have a foreign key that relates to information_schema? If so, how?

Best Answer

Is it possible to have a foreign key that relates to information_schema

No.

information_schema contains views. You can't have a foreign key to a view.

You can't set a foreign key to point at the underlying pg_catalog.pg_attribute table that defines columns, either, because foreign keys to system catalogs are not supported.