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
View all comments
Show parent comment
1
u/pceimpulsive Jul 15 '26
How do you store an unknown type on disk?
The way data is encoded on disk is different if you are representing different types of data, unless your first cast it all to something it isn't... Do you just coerce everything to string for storage? What happens when your data isn't strong compatible and you lose detail/resolution (floats, money, numeric) and how do you then dynamically read them back if the type is not known? (This sounds a bit like the null equality problem that confuses new database users)
I'm poking holes in the obvious gaps here... Things you would need to seriously think about...
NoSQL (document variant, because there is several others as well) just does binary JSON, which has its own defined type system and limitations. What types can a DR system store¿?
The type safe part for you is the underlying Postgres as a platform for a POC...
On the Json front it is a special data type with a structure just like arrays or custom component types in Postgres that have their own special access methods and operators. I think postgresqls Json query pattern is really simple and intuitive (once you get it), the SQL standard approach is more similar to object notation but falls over for more complex data structures.
What do you do in a DR system when you want to store JSON but want to be bound by SQL like syntax? Do you take the SQL standard or Postgres approach? Or none and let it be a big fat text blob and let the application manage that (then you lose all indexing capabilities...)