Skip to content

Commit

Permalink
Move check inside if stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
timchang514 committed Jan 25, 2024
1 parent a2ab368 commit d8da079
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions contrib/babelfishpg_tsql/runtime/functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,10 @@ object_id(PG_FUNCTION_ARGS)
{
result = enr->md.reliddesc;
}
else if (enr == NULL)
{
result = get_relname_relid((const char *) object_name, LookupNamespaceNoError("pg_temp"));
}
}
else if (!strcmp(object_type, "r") || !strcmp(object_type, "ec") || !strcmp(object_type, "pg") ||
!strcmp(object_type, "sn") || !strcmp(object_type, "sq") || !strcmp(object_type, "tt"))
Expand Down Expand Up @@ -1614,6 +1618,10 @@ object_id(PG_FUNCTION_ARGS)
if (enr != NULL && enr->md.enrtype == ENR_TSQL_TEMP)
{
result = enr->md.reliddesc;
}
else if (enr == NULL)
{
result = get_relname_relid((const char *) object_name, LookupNamespaceNoError("pg_temp"));
}
}
else
Expand Down Expand Up @@ -1646,11 +1654,6 @@ object_id(PG_FUNCTION_ARGS)
}
}

if (is_temp_object && !result)
{
result = get_relname_relid((const char *) object_name, LookupNamespaceNoError("pg_temp"));
}

pfree(object_name);
if (object_type)
pfree(object_type);
Expand Down

0 comments on commit d8da079

Please sign in to comment.