Adds null check for node in HasRangeTableRef#7604
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## release-12.1 #7604 +/- ##
================================================
+ Coverage 89.55% 89.65% +0.09%
================================================
Files 274 274
Lines 59479 59574 +95
Branches 7415 7435 +20
================================================
+ Hits 53268 53409 +141
+ Misses 4082 4036 -46
Partials 2129 2129 |
|
Can you simplify the query and add a regression test? |
I tried and see that the most lean state of the query is as below. However, in this case, query lose its meaning. Therefore, I kept as is and added a test with a system table and see meaningful results in tests select
ct.conname as constraint_name,
a.attname as column_name,
fc.relname as foreign_table_name
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_attribute a on a.attrelid=ct.conrelid and a.attnum =
ct.conkey[ct.s]
left outer join pg_class fc on fc.oid=ct.confrelid |
|
@hanefi thanks for your review. There's a problem in code coverage in patch. I assume it is false positive. |
|
The test doesn't actually test anything. I added this test to v12.1.3 and it passed whereas the query itself (being ran in psql) fails |
The test added in #7604 doesn't reach the `HasRangeTableRef` function and thus doesn't test what it should. Co-authored-by: Karina Litskevich <litskevichkarina@gmail.com>
DESCRIPTION: Adds null check for node in HasRangeTableRef to prevent errors
When executing the query below, users encountered an error due to a null Node object. This PR adds a null check to handle this error.
Query:
Error:
Fixes #7603