@@ -651,6 +651,27 @@ DROP INDEX hyper_constr_mid_idx;
651651
652652\i include/ chunk_utils_internal_orderedappend .sql
653653
654+ -- TEST hypertable with foreign key into it
655+ \c :TEST_DBNAME :ROLE_4
656+ CREATE TABLE hyper_fk (ts timestamptz primary key , device text , value float);
657+ SELECT table_name FROM create_hypertable(' hyper_fk' , ' ts' );
658+
659+ INSERT INTO hyper_fk(ts, device, value) VALUES (' 2020-01-01 00:00:00' , ' d1' , 1 .0 );
660+ \c postgres_fdw_db :ROLE_4
661+ CREATE TABLE fdw_hyper_fk (ts timestamptz NOT NULL , device text , value float);
662+ INSERT INTO fdw_hyper_fk VALUES ( ' 2021-05-05 00:00' , ' d2' , 2 .0 );
663+
664+ \c :TEST_DBNAME :ROLE_4
665+ -- this is a stand-in for the OSM table
666+ CREATE FOREIGN TABLE child_hyper_fk
667+ (ts timestamptz NOT NULL , device text , value float)
668+ SERVER s3_server OPTIONS ( schema_name ' public' , table_name ' fdw_hyper_fk' );
669+ SELECT _timescaledb_functions .attach_osm_table_chunk (' hyper_fk' , ' child_hyper_fk' );
670+
671+ -- create table with fk into hypertable
672+ CREATE TABLE event (ts timestamptz REFERENCES hyper_fk(ts) , info text );
673+ INSERT INTO event VALUES ( ' 2021-05-05 00:00' , ' osm_chunk_ts' );
674+
654675-- clean up databases created
655676\c :TEST_DBNAME :ROLE_SUPERUSER
656677DROP DATABASE postgres_fdw_db WITH (FORCE);
0 commit comments