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

GitHub noreply at github.com
Wed Jul 30 17:53:45 UTC 2014


  Branch: refs/heads/master
  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


  Commit: 3f0056c8fa8dfdbf796d1d5413e4d25c42910ff9
      https://github.com/ckan/ckan/commit/3f0056c8fa8dfdbf796d1d5413e4d25c42910ff9
  Author: joetsoi <joe.yeung.tsoi at gmail.com>
  Date:   2014-07-30 (Wed, 30 Jul 2014)

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

  Log Message:
  -----------
  Merge branch '1776-empty-array-json-datastore'


Compare: https://github.com/ckan/ckan/compare/21732d2c729b...3f0056c8fa8d


More information about the ckan-changes mailing list