Search Postgresql Archives

Convert a row to a nested JSON document containing all relations in PostgreSQL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello.


In PostgreSQL 10.10, I have created a trigger function that converts the `NEW` row to a JSON object using `to_jsonb(NEW)`. But now I need to include the records on the other side of the foreign keys in `NEW` record in the JSON object in a nested fashion.


What is the best and most generic way to accomplish this without prior knowledge about the schema of the `NEW` record? I need to keep this trigger function as generic as possible, because I plan to use it on all tables. One level of depth in following foreign keys is currently enough for me.


Thank you.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux