avoid sql syntax error for spouts with zero items
avoid pgsql error on editing source (Fix #561)