[Mojolicious] Inserting JSON with Mojo::Pg
Stefan Adams
2018-08-29 02:19:14 UTC
Can you *insert* a new record as JSON? Updating seems to work, but I can't
seem to get the syntax for inserting.

$pg->db->update('cache', {record => {-json => {a => 2}}});

No success:
$pg->db->insert('cache', {record => {-json => {a => 2}}});

<https://mojolicious.org/perldoc/SQL/Abstract/Pg#JSON> demonstrates that an
*update* can take a JSON structure, but does not demonstrate such for
*insert*. If one can update a record to include JSON, why not allow to
insert it? If you have a table with a json column, how is one to populate
the column on the initial insert?
You received this message because you are subscribed to the Google Groups "Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mojolicious+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.