Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6c863e3

Browse files
committed
testgres test for foreign hash partitions added
1 parent0dead52 commit6c863e3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

‎tests/partitioning_test.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,14 @@ def test_foreign_table(self):
354354
master.start()
355355
master.psql('postgres','create extension pg_pathman')
356356
master.psql('postgres','create extension postgres_fdw')
357+
358+
# RANGE partitioning test with FDW:
359+
# - create range partitioned table in master
360+
# - create foreign server
361+
# - create foreign table and insert some data into it
362+
# - attach foreign table to partitioned one
363+
# - try inserting data into foreign partition via parent
364+
# - drop partitions
357365
master.psql(
358366
'postgres',
359367
'''create table abc(id serial, name text);
@@ -406,6 +414,34 @@ def test_foreign_table(self):
406414
# Testing drop partitions (including foreign partitions)
407415
master.safe_psql('postgres','select drop_partitions(\'abc\')')
408416

417+
# HASH partitioning with FDW:
418+
# - create hash partitioned table in master
419+
# - create foreign table
420+
# - replace local partition with foreign one
421+
# - insert data
422+
# - drop partitions
423+
master.psql(
424+
'postgres',
425+
'''create table hash_test(id serial, name text);
426+
select create_hash_partitions('hash_test', 'id', 2)''')
427+
fserv.safe_psql('postgres','create table f_hash_test(id serial, name text)')
428+
429+
master.safe_psql(
430+
'postgres',
431+
'''import foreign schema public limit to (f_hash_test)
432+
from server fserv into public'''
433+
)
434+
master.safe_psql(
435+
'postgres',
436+
'select replace_hash_partition(\'hash_test_1\',\'f_hash_test\')')
437+
master.safe_psql('postgres','insert into hash_test select generate_series(1,10)')
438+
439+
self.assertEqual(
440+
master.safe_psql('postgres','select * from hash_test'),
441+
'1|\n2|\n5|\n6|\n8|\n9|\n3|\n4|\n7|\n10|\n'
442+
)
443+
master.safe_psql('postgres','select drop_partitions(\'hash_test\')')
444+
409445

410446
if__name__=="__main__":
411447
unittest.main()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp