make sql utility functions rvalue-aware