4 ms·
why not this? SELECT jsonb_column.key FROM table; UPDATE table SET jsonb_column.key = '"value"';
by spaetzleesser 6y ago
why not this?
SELECT jsonb_column.key FROM table;
UPDATE table SET jsonb_column.key = '"value"';
- loloquwowndueo 6y agoBecause the dot is used in table.column notation when the column name is ambiguous (in a join). Overloading it to also denote JSON field values would be confusing, the very thing the change mentioned in the article seeks to avoid.
- mattmanser 6y agoIt's got nothing to do with ambiguity, you're fundamentally thinking about dot notation wrong. The dot notation is the actual naming convention, not using it is a convenient shortcut. Many professional programmers would chew you out for not using it, being lazy and leaving it off can easily introduce unintended bugs. For example, you add a new column to a table, and boom, half your SQL statements now fail because it's got the same name as an existing column on another table.