So far, all the examples we saw of collection manipulation have used the UPDATE
and DELETE
statements. It is possible to write the full value of a collection in an INSERT
statement as well, by simply providing a literal representation of the collection's contents:
INSERT INTO "users" ( "username", "email", "encrypted_password", "social_identities", "version" ) VALUES ( 'ivan', '[email protected]', 0x48acb738ece5780f37b626a0cb64928b, {'twitter': 875958, 'instagram': 109550}, NOW() );
The INSERT
statement does not, however, support discrete updates. As we explored in the previous chapter, INSERT
and UPDATE
are, at their core, different ways of expressing the same operation. However, in the context of collection manipulation, as with partial writes, the two statements have different capabilities.