GEOT-4472 - doing a search for primary key column name, rather than assuming 'fid' will work, backport of #197