avoid pgsql error on editing source (Fix #561)