> > > The collation column is empty here, which means that collation for > str* columns is default collation i.e. C. This isn't true, since the > default ncollation on the foreign server is different from the default > collation of local database. AFAIU, import foreign schema should have > set appropriate collation of the foreign table. >
That's what we saw. The query inside IMPORT FOREIGN SCHEMA assumes a NULL collation means default, without asking the server what that default is. I was thinking that we could change the select inside postgresImportForeignSchema and replace collname, with something borrowed from information_schema.sql like coalesce(collname, (SELECT encoding FROM pg_catalog.pg_database WHERE datname = pg_catalog.current_database())) which itself isn't right because encoding names don't match up perfectly with collation names.