Added select for connection extension and fixed primary key column name bug