SET client_min_messages=NOTICE;
CREATE EXTENSION multicorn;
CREATE EXTENSION hstore;
CREATE server multicorn_srv foreign data wrapper multicorn options (
    wrapper 'multicorn.testfdw.TestForeignDataWrapper'
);
CREATE user mapping for postgres server multicorn_srv options (usermapping 'test');
CREATE foreign table testmulticorn (
    test1 hstore,
    test2 hstore
) server multicorn_srv options (
    option1 'option1',
    test_type 'dict'
);
-- Test "normal" usage
select * from testmulticorn;
NOTICE:  [('option1', 'option1'), ('test_type', 'dict'), ('usermapping', 'test')]
NOTICE:  [('test1', 'hstore'), ('test2', 'hstore')]
NOTICE:  []
NOTICE:  ['test1', 'test2']
                                      test1                                       |                                      test2                                       
----------------------------------------------------------------------------------+----------------------------------------------------------------------------------
 "index"=>"0", "repeater"=>"1", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"0", "repeater"=>"2", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"1", "repeater"=>"3", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"1", "repeater"=>"1", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"2", "repeater"=>"2", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"2", "repeater"=>"3", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"3", "repeater"=>"1", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"3", "repeater"=>"2", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"4", "repeater"=>"3", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"4", "repeater"=>"1", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"5", "repeater"=>"2", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"5", "repeater"=>"3", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"6", "repeater"=>"1", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"6", "repeater"=>"2", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"7", "repeater"=>"3", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"7", "repeater"=>"1", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"8", "repeater"=>"2", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"8", "repeater"=>"3", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"9", "repeater"=>"1", "column_name"=>"test1", "maybe_hstore"=>"a => b"  | "index"=>"9", "repeater"=>"2", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"10", "repeater"=>"3", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"10", "repeater"=>"1", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"11", "repeater"=>"2", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"11", "repeater"=>"3", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"12", "repeater"=>"1", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"12", "repeater"=>"2", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"13", "repeater"=>"3", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"13", "repeater"=>"1", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"14", "repeater"=>"2", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"14", "repeater"=>"3", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"15", "repeater"=>"1", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"15", "repeater"=>"2", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"16", "repeater"=>"3", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"16", "repeater"=>"1", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"17", "repeater"=>"2", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"17", "repeater"=>"3", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"18", "repeater"=>"1", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"18", "repeater"=>"2", "column_name"=>"test2", "maybe_hstore"=>"a => b"
 "index"=>"19", "repeater"=>"3", "column_name"=>"test1", "maybe_hstore"=>"a => b" | "index"=>"19", "repeater"=>"1", "column_name"=>"test2", "maybe_hstore"=>"a => b"
(20 rows)

select test1 -> 'repeater' as r from testmulticorn order by r;
NOTICE:  []
NOTICE:  ['test1']
 r 
---
 1
 1
 1
 1
 1
 1
 1
 2
 2
 2
 2
 2
 2
 3
 3
 3
 3
 3
 3
 3
(20 rows)

DROP USER MAPPING FOR postgres SERVER multicorn_srv;
DROP EXTENSION multicorn cascade;
NOTICE:  drop cascades to 2 other objects
DETAIL:  drop cascades to server multicorn_srv
drop cascades to foreign table testmulticorn
