MichaelDBA/pg_get_tabledef

Handle cross schema references for partitioning

MichaelDBA opened this issue · 3 comments

1> test case:
CREATE SCHEMA a;
create table a.test_parent_23210642 ( i serial );
CREATE SCHEMA b;
create table b.test_child_23210642 () inherits (a.test_parent_23210642);

2> pg_get_tabledef show result:
select * from public.pg_get_tabledef('b','test_child_23210642', false);
pg_get_tabledef

CREATE TABLE b.test_child_23210642( +
) INHERITS (b.test_parent_23210642) +
TABLESPACE pg_default; +
+

The actual parent table test_parent_23210642 is under a schema

The Limitations section explicitly says:
"Does not currently work for table relationships across multiple schemas, e.g., partitioning across schemas"

I am still gonna look at this and see if it can be fixed. Stay tuned.

I very much hope that this problem is resolved

@liuhangyu Fixed, please retest.