Skip to content

Commit

Permalink
[#11763] ysql: Correctly assign table descriptor in YbGetTableDescAnd…
Browse files Browse the repository at this point in the history
…Props() when table doesn't exist

Summary:
In YbGetTableDescAndProps(), when allow_missing is true, the func would assign NULL to the table descriptor when table doesn't exist.

However, since desc is declared as `YBCPgTableDesc *`, assigning to desc itself wouldn't achieve the goal.

We should assign to `*desc` when the table is absent.

Test Plan:
For YB instance created without D15799:
```
bin/yb-admin -timeout_ms 180000 upgrade_ysql
YSQL successfully upgraded to the latest version
```
Run ysqlsh to connect to the YB instance

Reviewers: alex

Reviewed By: alex

Subscribers: yql

Differential Revision: https://phabricator.dev.yugabyte.com/D16009
  • Loading branch information
tedyu committed Mar 16, 2022
1 parent b3965b8 commit 8474a0b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/postgres/src/backend/utils/misc/pg_yb_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ YbGetTableDescAndProps(Oid table_oid,
HandleYBStatus(YBCPgTableExists(MyDatabaseId, table_oid, &exists_in_yb));
if (!exists_in_yb)
{
desc = NULL;
*desc = NULL;
return;
}
}
Expand Down

0 comments on commit 8474a0b

Please sign in to comment.