PostgreSQL: Insert into JSONB key failing with syntax error at or near "->>" Running the following query auto-generated by Eloquent's upsert function is throwing a syntax error and I'm not sure why? I couldn't find a supporting statement that says PostgreSQL supports the following syntax, looking for some expert advice on whether this would work.
insert into &quot;plugin_positions&quot; 
(&quot;created_at&quot;, &quot;positions&quot;-&gt;&gt;&quot;test&quot;, &quot;slug&quot;, &quot;tag&quot;, &quot;updated_at&quot;) 
values 
('2021-04-10 17:30:40', 0, 'contact-for-telegram', 'rrss', '2021-04-10 17:30:40');

Here's the query that works (which uses the simple column name, and a valid json value):
insert into &quot;plugin_positions&quot; 
(&quot;created_at&quot;, &quot;positions&quot;, &quot;slug&quot;, &quot;tag&quot;, &quot;updated_at&quot;) 
values 
('2021-04-10 17:30:40', '{&quot;test&quot;:0}', 'contact-for-telegram', 'rrss', '2021-04-10 17:30:40');

Does postgresql allow inserting into a table if we specify the column as &quot;positions&quot;-&gt;&gt;&quot;test&quot;?
The reason is that the attributes of a JSON column are not database columns, so you cannot use them in the SET clause of an UPDATE statement.
You can only replace the complete JSON with an UPDATE statement.
It might be a good idea to use regular &quot;scalar&quot; database columns instead of lumping several attributes together into a JSON if you want to modify them individually.