Skip to content

Commit

Permalink
Fix flakiness in db_ddladmin tests (babelfish-for-postgresql#3258)
Browse files Browse the repository at this point in the history
Fix flakiness in db_ddladmin tests

Post MVU it is possible that a relation has a same oid as
that of a schema which was a source of flakiness. As a
fix skip schema entries in pg_shdepend catalog.


Signed-off-by: Tanzeel Khan <[email protected]>
  • Loading branch information
tanscorpio7 authored and timchang514 committed Dec 17, 2024
1 parent d860c3a commit bb23a3a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
18 changes: 9 additions & 9 deletions test/JDBC/expected/db_ddladmin-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,10 @@ babel_5116_v1 #!#master_dbo
SELECT CAST(r.rolname AS CHAR(30)), CAST(object_name(objid) AS char(22)), deptype FROM pg_depend d
JOIN pg_roles r ON (d.refobjid = r.oid)
WHERE
object_name(objid) LIKE 'babel_5116%' AND
refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid') AND
r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%' AND
NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
object_name(objid) LIKE 'babel_5116%'
AND refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid')
AND classid != (SELECT oid FROM pg_class WHERE relname = 'pg_namespace')
AND r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%'
AND (r.rolname LIKE '%dbo%' OR r.rolname LIKE '%db_ddladmin%')
ORDER BY deptype, r.rolname, object_name(objid);
GO
Expand All @@ -881,12 +881,12 @@ char#!#char#!#varchar
SELECT CAST(r.rolname AS CHAR(30)), CAST(object_name(objid) AS char(22)), deptype FROM pg_shdepend d
JOIN pg_roles r ON (d.refobjid = r.oid)
WHERE
object_name(objid) LIKE 'babel_5116%' AND
refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid') AND
r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%' AND
NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
object_name(objid) LIKE 'babel_5116%'
AND refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid')
AND classid != (SELECT oid FROM pg_class WHERE relname = 'pg_namespace')
AND r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%'
AND NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
AND (r.rolname LIKE '%dbo%' OR r.rolname LIKE '%db_ddladmin%') AND deptype!= 'i'
AND (r.rolname NOT IN ('ad_db_db_ddladmin', 'alter_db_db_ddladmin'))
ORDER BY deptype, r.rolname, object_name(objid);
GO
~~START~~
Expand Down
18 changes: 9 additions & 9 deletions test/JDBC/expected/single_db/db_ddladmin-vu-verify.out
Original file line number Diff line number Diff line change
Expand Up @@ -866,10 +866,10 @@ babel_5116_v1 #!#master_dbo
SELECT CAST(r.rolname AS CHAR(30)), CAST(object_name(objid) AS char(22)), deptype FROM pg_depend d
JOIN pg_roles r ON (d.refobjid = r.oid)
WHERE
object_name(objid) LIKE 'babel_5116%' AND
refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid') AND
r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%' AND
NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
object_name(objid) LIKE 'babel_5116%'
AND refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid')
AND classid != (SELECT oid FROM pg_class WHERE relname = 'pg_namespace')
AND r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%'
AND (r.rolname LIKE '%dbo%' OR r.rolname LIKE '%db_ddladmin%')
ORDER BY deptype, r.rolname, object_name(objid);
GO
Expand All @@ -881,12 +881,12 @@ char#!#char#!#varchar
SELECT CAST(r.rolname AS CHAR(30)), CAST(object_name(objid) AS char(22)), deptype FROM pg_shdepend d
JOIN pg_roles r ON (d.refobjid = r.oid)
WHERE
object_name(objid) LIKE 'babel_5116%' AND
refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid') AND
r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%' AND
NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
object_name(objid) LIKE 'babel_5116%'
AND refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid')
AND classid != (SELECT oid FROM pg_class WHERE relname = 'pg_namespace')
AND r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%'
AND NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
AND (r.rolname LIKE '%dbo%' OR r.rolname LIKE '%db_ddladmin%') AND deptype!= 'i'
AND (r.rolname NOT IN ('ad_db_db_ddladmin', 'alter_db_db_ddladmin'))
ORDER BY deptype, r.rolname, object_name(objid);
GO
~~START~~
Expand Down
18 changes: 9 additions & 9 deletions test/JDBC/input/fixed_roles/db_ddladmin-vu-verify.mix
Original file line number Diff line number Diff line change
Expand Up @@ -430,23 +430,23 @@ GO
SELECT CAST(r.rolname AS CHAR(30)), CAST(object_name(objid) AS char(22)), deptype FROM pg_depend d
JOIN pg_roles r ON (d.refobjid = r.oid)
WHERE
object_name(objid) LIKE 'babel_5116%' AND
refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid') AND
r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%' AND
NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
object_name(objid) LIKE 'babel_5116%'
AND refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid')
AND classid != (SELECT oid FROM pg_class WHERE relname = 'pg_namespace')
AND r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%'
AND (r.rolname LIKE '%dbo%' OR r.rolname LIKE '%db_ddladmin%')
ORDER BY deptype, r.rolname, object_name(objid);
GO

SELECT CAST(r.rolname AS CHAR(30)), CAST(object_name(objid) AS char(22)), deptype FROM pg_shdepend d
JOIN pg_roles r ON (d.refobjid = r.oid)
WHERE
object_name(objid) LIKE 'babel_5116%' AND
refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid') AND
r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%' AND
NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
object_name(objid) LIKE 'babel_5116%'
AND refclassid = (SELECT oid FROM pg_class WHERE relname = 'pg_authid')
AND classid != (SELECT oid FROM pg_class WHERE relname = 'pg_namespace')
AND r.rolname NOT LIKE '%datareader%' AND r.rolname NOT LIKE '%datawriter%'
AND NOT (object_name(objid) = 'babel_5116_tabletype1' AND deptype = 'a')
AND (r.rolname LIKE '%dbo%' OR r.rolname LIKE '%db_ddladmin%') AND deptype!= 'i'
AND (r.rolname NOT IN ('ad_db_db_ddladmin', 'alter_db_db_ddladmin'))
ORDER BY deptype, r.rolname, object_name(objid);
GO

Expand Down

0 comments on commit bb23a3a

Please sign in to comment.