-
Notifications
You must be signed in to change notification settings - Fork 662
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds null check for node in HasRangeTableRef (#7609)
DESCRIPTION: Adds null check for node in HasRangeTableRef to prevent errors
- Loading branch information
1 parent
fcc72d8
commit 0ab42e7
Showing
4 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
-- The following query retrieves the foreign key constraints of the table "pg_dist_background_job" | ||
-- along with their details. This modification includes a fix for a null pointer exception that occurred | ||
-- in the "HasRangeTableRef" method of "worker_shard_visibility". The issue was resolved with PR #7604. | ||
select | ||
ct.conname as constraint_name, | ||
a.attname as column_name, | ||
fc.relname as foreign_table_name, | ||
fns.nspname as foreign_table_schema | ||
from | ||
(SELECT ct.conname, ct.conrelid, ct.confrelid, ct.conkey, ct.contype, | ||
ct.confkey, generate_subscripts(ct.conkey, 1) AS s | ||
FROM pg_constraint ct | ||
) AS ct | ||
inner join pg_class c on c.oid=ct.conrelid | ||
inner join pg_namespace ns on c.relnamespace=ns.oid | ||
inner join pg_attribute a on a.attrelid=ct.conrelid and a.attnum = | ||
ct.conkey[ct.s] | ||
left join pg_class fc on fc.oid=ct.confrelid | ||
left join pg_namespace fns on fc.relnamespace=fns.oid | ||
left join pg_attribute fa on fa.attrelid=ct.confrelid and fa.attnum = | ||
ct.confkey[ct.s] | ||
where | ||
ct.contype='f' | ||
and fc.relname='pg_dist_background_job' | ||
and ns.nspname='pg_catalog' | ||
order by | ||
fns.nspname, fc.relname, a.attnum; | ||
constraint_name | column_name | foreign_table_name | foreign_table_schema | ||
--------------------------------------------------------------------- | ||
pg_dist_background_task_job_id_fkey | job_id | pg_dist_background_job | pg_catalog | ||
pg_dist_background_task_depend_job_id_fkey | job_id | pg_dist_background_job | pg_catalog | ||
(2 rows) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
-- The following query retrieves the foreign key constraints of the table "pg_dist_background_job" | ||
-- along with their details. This modification includes a fix for a null pointer exception that occurred | ||
-- in the "HasRangeTableRef" method of "worker_shard_visibility". The issue was resolved with PR #7604. | ||
select | ||
ct.conname as constraint_name, | ||
a.attname as column_name, | ||
fc.relname as foreign_table_name, | ||
fns.nspname as foreign_table_schema | ||
from | ||
(SELECT ct.conname, ct.conrelid, ct.confrelid, ct.conkey, ct.contype, | ||
ct.confkey, generate_subscripts(ct.conkey, 1) AS s | ||
FROM pg_constraint ct | ||
) AS ct | ||
inner join pg_class c on c.oid=ct.conrelid | ||
inner join pg_namespace ns on c.relnamespace=ns.oid | ||
inner join pg_attribute a on a.attrelid=ct.conrelid and a.attnum = | ||
ct.conkey[ct.s] | ||
left join pg_class fc on fc.oid=ct.confrelid | ||
left join pg_namespace fns on fc.relnamespace=fns.oid | ||
left join pg_attribute fa on fa.attrelid=ct.confrelid and fa.attnum = | ||
ct.confkey[ct.s] | ||
where | ||
ct.contype='f' | ||
and fc.relname='pg_dist_background_job' | ||
and ns.nspname='pg_catalog' | ||
order by | ||
fns.nspname, fc.relname, a.attnum; |