R
R
Roman Rakzin2020-04-19 14:54:27
PostgreSQL
Roman Rakzin, 2020-04-19 14:54:27

Is it possible to set value validation in Postgresql json field?

Is it possible to bind keys to json field to other tables?
example field data {parameter1: value1, parameter2: value2} and at the same time, if there is a parameter1 value, then what would it be tied to a specific table and, accordingly, the value could not be "anyhow", but was tied to another table.
Is this done at all in json fields at the level of the DBMS kernel (without manually writing the code of checks bypassing the database)?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2020-04-19
@melkij

No, the foreign key mechanism cannot do that.
Move the value from json to a real table field (at the same time save on space and the cost of processing conditions on this field) and create an FK.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question