You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[#26576] YSQL: Enable table inheritance for all ported tests
Summary:
Setting the defaults for `BasePgRegressTestPorted` to match more closely with Postgres behaviour will help simplify efforts to port more Postgres tests.
5aea237 / D42034 enabled inheritance on Yugabyte, but did not update all of the regression tests. This diff sets `ysql_enable_inheritance=true` for all tests that derive from `BasePgRegressTestPorted`. This cascades into some changes:
* any Java test deriving from this class doesn't need to explicitly set the flag anymore.
* regress tests that use table inheritance no longer have an error in their output. Many of these tests have a comment similar to "TODO: port more once inheritance is enabled". Generally, uncommenting the following lines results in the expected output. This change touches only lines related to `INHERITS`, and does not attempt to re-port other sections of the affected files.
* `yb_enable_read_committed_isolation` is also now enabled by default in `BasePgRegressTestPorted` to enable some new test cases. This does not set the isolation level to read committed, but just **allows** it to be set.
To help review, it's helpful to diff the `yb.port.*.sql` and `yb.port.*.out` files with their sources.
```
function portdiffsql() {
diff src/postgres/src/test/regress/sql/$1.sql src/postgres/src/test/regress/sql/yb.port.$1.sql
}
function portdiffout() {
diff src/postgres/src/test/regress/expected/$1.out src/postgres/src/test/regress/expected/yb.port.$1.out
}
portdiffsql foreign_data
portdiffsql foreign_key
portdiffsql generated
portdiffsql insert_conflict
portdiffsql privileges
portdiffsql rowsecurity
portdiffsql truncate
portdiffout foreign_data
portdiffout foreign_key
portdiffout generated
portdiffout insert_conflict
portdiffout privileges
portdiffout rowsecurity
portdiffout truncate
```
Differences worth calling out:
* There are a few cases where we need to delete + reinsert rows to get match the ctid update behaviour of Postgres
* `yb.port.foreign_key` has extra changes because indexes on `INET` are not supported.
* `yb.port.truncate` has some tests for `TRUNCATE ONLY` that depend on `TRUNCATE` being transactional. It's not transactional in YB, so to keep the coverage of `TRUNCATE ONLY`, manually reset the table after each `ROLLBACK`. (lines ~1640 in yb.port.truncate.sql`). The results of the `SELECT`s are identical to PG.
Jira: DB-15944
Test Plan:
```
./yb_build.sh --java-test TestPgRegressPgAuth
./yb_build.sh --java-test TestPgRegressPgDml
./yb_build.sh --java-test TestPgRegressPgForeignData
./yb_build.sh --java-test TestPgRegressPgGenerated
./yb_build.sh --java-test TestPgRegressPgMiscIndependent
./yb_build.sh --java-test TestPgRegressForeignKey
```
Jenkins
Reviewers: fizaa, sanketh
Reviewed By: sanketh
Subscribers: smishra, yql
Differential Revision: https://phorge.dev.yugabyte.com/D42816
create table pktable(ptest1 text, primary key(base1, ptest1)) inherits (pktable_base); -- YB: #17017: replace INET with TEXT because indexes on INET are not supported
952
958
-- just generally bad types (with and without column references on the referenced table)
create table pktable(ptest1 text, ptest2 text[], primary key(base1, ptest1), foreign key(base2, ptest2) references -- YB: #17017: replace INET with TEXT because indexes on INET are not supported
ERROR: foreign key constraint "pktable_base2_ptest2_fkey" cannot be implemented
982
+
DETAIL: Key columns "ptest2" and "ptest1" are of incompatible types: text[] and text.
983
+
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(base2, ptest2) references -- YB: #17017: replace INET with TEXT because indexes on INET are not supported
ERROR: foreign key constraint "pktable_base2_ptest2_fkey" cannot be implemented
986
+
DETAIL: Key columns "base2" and "ptest1" are of incompatible types: integer and text.
987
+
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(ptest2, base2) references -- YB: #17017: replace INET with TEXT because indexes on INET are not supported
ERROR: foreign key constraint "pktable_ptest2_base2_fkey" cannot be implemented
990
+
DETAIL: Key columns "ptest2" and "base1" are of incompatible types: text and integer.
991
+
create table pktable(ptest1 text, ptest2 text, primary key(base1, ptest1), foreign key(ptest2, base2) references -- YB: #17017: replace INET with TEXT because indexes on INET are not supported
971
992
pktable(base1, ptest1)) inherits (pktable_base);
993
+
ERROR: foreign key constraint "pktable_ptest2_base2_fkey" cannot be implemented
994
+
DETAIL: Key columns "ptest2" and "base1" are of incompatible types: text and integer.
0 commit comments