Re: [HACKERS] Varying results when using merge joins overpostgres_fdw vs hash joins - Mailing list pgsql-hackers

From Corey Huinker
Subject Re: [HACKERS] Varying results when using merge joins overpostgres_fdw vs hash joins
Date
Msg-id CADkLM=cZC5hdANm5OTgUvDAX3y7GASTt61qxsYxKA7FGAXx4Fw@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Varying results when using merge joins overpostgres_fdw vs hash joins  (Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>)
Responses Re: [HACKERS] Varying results when using merge joins over postgres_fdw vs hash joins
List pgsql-hackers

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. 

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] src/test/subscription/t/005_encoding.pl is broken
Next
From: Peter Geoghegan
Date:
Subject: Re: [HACKERS] Varying results when using merge joins overpostgres_fdw vs hash joins