I am attempting to upgrade a PostgreSQL database from 11.2 to 12.2, and it has the cstore_fdw extension on it. From what I can tell, this is not supported, so I migrated all cstore foreign tables to native tables, dropped the extension:
create schema cstore_backup;
-- executed the results of all of these:
select
format ('create table cstore_backup.%s_%s as select * from %s.%s;',
foreign_table_schema, foreign_table_name,
foreign_table_schema, foreign_table_name)
from information_schema.foreign_tables ft
where foreign_server_name = 'cstore_server';
select
format ('drop foreign table %s.%s;',
foreign_table_schema, foreign_table_name)
from information_schema.foreign_tables ft
where foreign_server_name = 'cstore_server';
DROP SERVER cstore_server;
drop extension cstore_fdw;
I deleted the folders (I'll put them back to cstore after migration):
rm -fr /apps/pgdata11.2.0/cstore_fdw
rm -f /usr/local/psql11.2/share/postgresql/extension/cst*
I removed references from the postgresql.conf file.
When I run pg_upgrade:
$BIN/pg_upgrade \
--old-bindir=/usr/local/psql11.2/bin \
--new-bindir=/usr/local/psql12.2/bin \
--old-datadir=/apps/pgdata11.2.0 \
--new-datadir=/apps/pgdata12.2.0 \
--old-port=5432 \
--new-port=5432 \
--jobs=4 --link --username=postgres --check
I still get this message in the loadable_libraries.txt output file:
could not load library "/usr/local/psql11.2/lib/postgresql/cstore_fdw.so": ERROR: could not load library "/usr/local/psql11.2/lib/postgresql/cstore_fdw.so": /usr/local/psql11.2/lib/postgresql/cstore_fdw.so: undefined symbol: ExecClearTuple
I'm stumped. Where does cstore_fdw still reside in my installation?
Thanks for the suggestions... it turns out there were some leftover functions in the public schema that referenced the extension, even though it was completely gone. I found all of them with this:
select * from pg_proc where prosrc ilike '%cstore%'
Dropping each of them resolved the issues.
drop function public.cstore_clean_table_resources(oid);
drop function public.cstore_ddl_event_end_trigger();
drop function public.cstore_drop_trigger();
drop function public.cstore_fdw_handler();
drop function public.cstore_fdw_validator(text[], oid);
drop function public.cstore_table_size(relation regclass);