sql: fixed issue on expand() reported in ML