Hacker News new | past | comments | ask | show | jobs | submit login

I was excited to see this:

"Automatically updatable VIEWs"

But then read this:

https://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_...

"Simple views can now be updated in the same way as regular tables. The view can only reference one table (or another updatable view) and must not contain more complex operators, join types etc."

As primarity a database developer, to me this is useless. Not sure why I'd want a view for only one table.

For permissions there has been column level perms for some time, which is more efficient than multiple views.




The reason I'm excited by this is that it makes it much easier to have small adapter tables that allow a table whose definition has changed slightly over time to support older code (that might be using column names, for example, that no longer make any sense); even if you only then use these adapters for a few minutes, it lets you, in a safe manner, make these kinds of modifications (by, in a transaction, renaming the old table and replacing it with a view; you can then modify the real table under a transaction, update your code to point to the new table, and then drop the view). Another interesting use case for this is to add computed columns to a table.


This is pretty standard (it is how updatable views work in MSSQL). The advantage they provide is if you wanted to provide a limited view into a table (say 4 of 20 columns) but still allow updates. Granted, that's a pretty small use case, but updating a view that spanned multiple tables could easily become a monster of a problem to solve generally.


>it is how updatable views work in MSSQL

Not exactly. The updated columns may only unambiguously reference one table, but you can execute an update on a view which references multiple tables.


Postgres tends to introduce features iteratively. Today it's the simple case that does very little; in a few versions you wonder why everyone else is so far behind.

This kind of updateable view is pretty much the standard. Oracle doesn't destructure VIEWs to route data to tables. If you think about it, this is not a simple problem to solve.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: