anchor.diff:     ;; comparing it with key "quantity".  Postgres operator -> gives
      ;; the raw jsonb of the key while Postgres operator ->>
      ;; converts it to text.  This library only uses Postgres type
  -   ;; jsonb. See also the Postgres docs at
  +   ;; jsonb. See the Postgres docs at
      ;; http://www.postgresql.org/docs/9.4/static/functions-json.html
      ))
   
  
positive.code: 
  ;; Make connection and set search path immediatley after
  ;; Foreign keys?  Promote to foreign key?  Yep, can't do in JSON...
  ;; Domain consolidation? (distinct 'human "eyeColor")
  ;; Is the nsubst as we walk tree buggy?  Can we not save
  ;; up all desired subs and do them all together?
  
  ;; We could promote to foreign key:
  ;; What key and Postgres type in your child model?  What master table?
  
negative.code:     (show (pj:distinct 'human "favoriteFruit")))
    (values))
  
  ;;;; User defined SQL queries for when FILTER and the other interface
  ;;;; functions are not sufficient.
  
  ;;; These must return JSON objects only.
  ;;; Macroexpand away to see the generated SQL.
  
  ;;; Try slime-edit-definition (M-.) on DEFINE-JSON-QUERY to read
  ;;; details on the syntactic sugar of j->, j->>, jbuild, to-jsonb and
  ;;; also the named parameter interpolation.
  
  (define-json-query rich-humans$ (min-balance gender)
    (:order-by
  
     ;; jbuild makes a new JSON object which consists of just the
     ;; key/values pairs in the JSON document with the specified keys.
     (:select (jbuild ("key" "guid" "gender" "name" "balance"))
  
      :from 'human ;; this is why we need to set the search path above
                   ;; otherwise it would need to be 'pgj_model.history
  
      ;; j->> is a little syntactic sugar to get at the top level keys
      ;; in 'jdoc using the Postgres operator :->> which returns text.
      ;; So we must cast to a Postgres number type for comparisons.
      :where (:and (:>= (:type (j->> "balance") real) min-balance)
  
                   (:= (j->> "gender") gender))) ;; can also do this using 'containment', see below
  
     (:type (j->> "balance") real)))
  