[ckan-changes] [ckan/ckan] 1fe8df: [#1776] Fix bug when upserting [] on JSON column i...

GitHub noreply at github.com
Fri Jun 20 18:58:43 UTC 2014


  Branch: refs/heads/1776-empty-array-json-datastore
  Home:   https://github.com/ckan/ckan
  Commit: 1fe8df11abe122dc001cee4c4d9e614426836466
      https://github.com/ckan/ckan/commit/1fe8df11abe122dc001cee4c4d9e614426836466
  Author: Vitor Baptista <vitor at vitorbaptista.com>
  Date:   2014-06-20 (Fri, 20 Jun 2014)

  Changed paths:
    M ckanext/datastore/db.py
    M ckanext/datastore/tests/test_upsert.py

  Log Message:
  -----------
  [#1776] Fix bug when upserting [] on JSON column in the datastore

We were testing that the new value wasn't `None` using `if value`. As `[]` is a
falsy value, we never went through that `if` and ended up trying to run an
invalid SQL query.

This commit fixes that by explictly testing `if value is not None`.

This was first discovered in
http://stackoverflow.com/questions/24207065/inserting-empty-arrays-in-json-type-fields-in-datastore




More information about the ckan-changes mailing list