I'm a total PostgreSQL newbie. But I think it sounds interesting to use json/jsonb in a relational database.
//just for info: I try to realize it by C# .NET Core WebAPI with Dapper
I'd like to have a table with a (multidimensional) json column like, for example:
id | data _____________________________________|_________________________________________________________________________________ | 4BF30FE6-D7DD-480B-8592-DC9676576FEF | { timestamps:{ "created":1578614541, "modified":1578615707 }, "type":"single"} 1AC2CD8F-09D0-456C-9FD4-B63E354BD324 | { timestamps:{ "created":1578614676, "modified":1578615921 }, "type":"multiple"} 50AD2D82-5919-4555-BCC2-B24E0DE24263 | { timestamps:{ "created":1578614552, "modified":1578615784 }, "type":"single"} 8C3BE671-17D1-49FD-A891-D5E69FDF7FC2 | { timestamps:{ "created":1578614685, "modified":1578615173 }, "type":"single"}
And I want to get all ids which have data::timestamps.created greater than 1578614670.
Pseudo code:
SELECT id, data FROM table WHERE data::timestamps.created > 1578614670;
id | data _____________________________________|_________________________________________________________________________________ | 1AC2CD8F-09D0-456C-9FD4-B63E354BD324 | { timestamps:{ "created":1578614676, "modified":1578615921 }, "type":"multiple"} 8C3BE671-17D1-49FD-A891-D5E69FDF7FC2 | { timestamps:{ "created":1578614685, "modified":1578615173 }, "type":"single"}
Is there a simple way to achieve this?