Hacker News new | ask | show | jobs
by colanderman 3839 days ago
This is incorrect. None of these functions modify the value of a column. All of them are purely functional and return a jsonb value with the specified field(s) replaced.

The significance is one of performance and convenience: before, you would have had to construct a new jsonb object with only the field(s) you wanted modified changed. (In fact it is possible to define these new operators in terms of such; I have done so.) Now you can just use these handy built-in functions, which presumably perform better than the manual method as well.

1 comments

I think you are using different interpretations of "you".

If you do:

  update aTable
  set loginInfo = loginInfo - 'lastLogin'
where 'loginInfo' is a jsonb column, you, the programmer, need not write out the parts of the data to keep. PostgreSQL still sees this as 'read column, evaluate expression, write result', so it will read and write the entire jsonb value.