Revert "change select to be db safe"

This reverts commit 0e60278de715869d47ef15f5f3eee7307feff590.
Revert "Revert "change select to be db safe""

This reverts commit 2aabd64507743c00a86cb04bd626e07b78339502.