github.com/cloudberrydb/gpbackup@v1.0.3-0.20240118031043-5410fd45eed6/integration/inheritance_test.go (about) 1 package integration 2 3 import ( 4 "fmt" 5 6 "github.com/cloudberrydb/gp-common-go-libs/dbconn" 7 "github.com/cloudberrydb/gp-common-go-libs/testhelper" 8 9 . "github.com/onsi/ginkgo/v2" 10 . "github.com/onsi/gomega" 11 ) 12 13 var _ = Describe("inheritance", func() { 14 15 It("repeating inherited columns in table declaration of child does not mask columns in parent", func() { 16 /* 17 gpbackup chooses to redundantly define inherited columns in the child. 18 This has no effect, as shown below. 19 However, it does cause "diffs" in the output of `pg_dump` when compared with gpbackup. 20 */ 21 testhelper.AssertQueryRuns(connectionPool, ` 22 CREATE TABLE public.parent_inh_test ( 23 a integer NOT NULL, 24 b integer NOT NULL 25 ) DISTRIBUTED BY (a, b); 26 27 CREATE TABLE public.child_inh_test ( 28 a integer NOT NULL, 29 b integer NOT NULL 30 ) 31 INHERITS (public.parent_inh_test) DISTRIBUTED BY (a, b); 32 33 INSERT into public.child_inh_test values(1,1); 34 INSERT into public.child_inh_test values(2,2); 35 `) 36 defer testhelper.AssertQueryRuns(connectionPool, "DROP table public.parent_inh_test") 37 defer testhelper.AssertQueryRuns(connectionPool, "DROP table public.child_inh_test") 38 39 sum := dbconn.MustSelectString(connectionPool, fmt.Sprintf("SELECT sum(a) FROM public.parent_inh_test")) 40 Expect(sum).To(Equal("3")) 41 }) 42 })