Bug in SQL schema