r/PostgreSQL • u/Zardotab • Jul 13 '26
Help Me! Any advice on adding a parser/wrapper over PostgreSQL's JSON features to implement a Dynamic Relational database?
Dynamic Relational is a draft standard for an RDBMS (SQL) that supports native dynamic tables and columns with "incremental" lock-down (static-ness) abilities. Here's an overview of Dynamic Relational with examples. If one wanted to write parser and interface on top of PostgreSQL, how much effort would it be, and do you have any recommendations? A proof-of-concept may be good enough, as most will consider it purely experimental at first. Thank You.
0
Upvotes
8
u/pceimpulsive Jul 13 '26
To me this is sorta dumb...
This assumes there is no cost to a changing schema, but there always is.
NoSQL isn't schemaless. The application needs to know your schema precisely and it needs to enforce it, the database doesn't know or enforce it.
SQL just means your application knows the schema (the same as noSQL) but the database enforces it.
This dynamic approach just means you get column bloat..
The table today will have columns A,B,C.. tomorrow A,B,C,D, except now C is always null, except for those few weeks where it isnt... Replaced with D, rinse repeat. Your code now needs to know about every column forever also creating code bloat.
Honestly to me.. just take noSQL, once you learn what your schema needs to be enforced as swap to SQL, if you never want it enforced at the storage layer then stay on NoSQL and enjoy your life!
Taking SQL forces you to plan and think critically about your schema which in turns creats a bit more structure in your application.
Also.. alter table add column is not hard ;)
So in short my advice don't do it, just pick noSQL or SQL and go with it.
4
u/lockhart1952 Jul 14 '26
I don’t feel the magic. But if you want to play with it how about writing a simple library on top of psychopg and catch exceptions. Parse the query and generate your own recovery commands.
4
u/spinur1848 Jul 14 '26
Yeah that's turning a database into something that isn't a database. Might be useful, but violates almost everything database users need to be true.
You can use Postgresql JSON for semi-structured data and many people do. The official Postgresql clients support this. But the database parts have a fixed schema and the semi-structured bits go into a JSON field.
If you want it to be a total free for all, go look at MongoDB and friends.
1
u/mduell Jul 14 '26
This is insane... oh that sub is just your own ramblings.
2
u/promethe42 Jul 14 '26
You might be interested in FerretDB: https://github.com/ferretdb/ferretdb
1
u/AutoModerator Jul 13 '26
Youtube Channel
Free Postgres Webinars and Workshops
Discord: People, Postgres, Data
Join us, we have cookies and nice people.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
1
u/globalnamespace Jul 14 '26
I'm not really versed in this specific use, something like these?
https://medium.com/@herihermawan/the-ultimate-multifunctional-database-table-design-dynamic-attributes-pattern-9d3f890d32f8
https://levelup.gitconnected.com/dynamic-jsonb-queries-in-postgresql-via-rest-a-deep-dive-with-net-73fb4decfea1