db: split return states by null vs non-null parameter