The introduction of the JSONB data type in PostgreSQL, definitely makes the “NoSQL” side of this relational DBMS come out: this introduction meets the requirements of all those who prefer a data structure in a “key-value” array, dictionary style (widely used in the field of development) and, at the same time, ensures all the advantages of a relational database.
Written by Giuseppe Broccolo
First published in Italian
Since PostgreSQL 9.3, it is possible to update and insert into views directly, so long as the view refers to only one underlying table.
PostgreSQL 9.4 allows us to use the CHECK clause for INSERTs into updatable views. For example, consider a table composed of just one integer column; and consider two views, one on numbers divisible by 2 and one on numbers divisible by 3. If we try to insert the number 123 into the first view:
$ CREATE TABLE some_data(id int4 PRIMARY KEY);
$ CREATE VIEW first AS SELECT * FROM some_data WHERE 0 = id%2;
$ CREATE VIEW second AS SELECT * FROM some_data WHERE 0 = id%3;
$ INSERT INTO first(id) VALUES (123 (more…)