Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix vctb not found bug
  • Loading branch information
Pengrongkun committed Dec 4, 2025
commit ec2c995ff41caa00ace541ec646af9de3ece7d5f
6 changes: 4 additions & 2 deletions source/client/test/stmt2Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4278,7 +4278,7 @@ TEST(stmt2Case, vtable) {
TAOS_STMT2* stmt = taos_stmt2_init(taos, &option);
ASSERT_NE(stmt, nullptr);

const char* sql = "select tbname from vstb where ts = ? order by tbname";
const char* sql = "select tbname,c1 from vstb where ts = ? order by tbname";
int code = taos_stmt2_prepare(stmt, sql, 0);
checkError(stmt, code, __FILE__, __LINE__);

Expand All @@ -4304,9 +4304,11 @@ TEST(stmt2Case, vtable) {
TAOS_ROW row = taos_fetch_row(pRes);
ASSERT_NE(row, nullptr);
ASSERT_EQ(strncmp((char*)row[0], "vtb_0", 5), 0);
ASSERT_EQ(*(int*)row[1], 1);
row = taos_fetch_row(pRes);
ASSERT_NE(row, nullptr);
ASSERT_EQ(strncmp((char*)row[0], "vtb_1", 5), 0);
ASSERT_EQ(*(int*)row[1], 1);
taos_stmt2_close(stmt);

do_query(taos, "select c1 from vtb_0 where ts = 1591060628000 order by c1");
Expand All @@ -4322,7 +4324,7 @@ TEST(stmt2Case, vtable) {
ASSERT_NE(pRes, nullptr);
row = taos_fetch_row(pRes);
ASSERT_NE(row, nullptr);
ASSERT_EQ(strncmp((char*)row[0], "1", 1), 0);
ASSERT_EQ(*(int*)row[0], 1);

taos_stmt2_close(stmt);

Expand Down
2 changes: 2 additions & 0 deletions source/libs/catalog/src/ctgCache.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,8 @@ int32_t ctgCopyTbMeta(SCatalog *pCtg, SCtgTbMetaCtx *ctx, SCtgDBCache **pDb, SCt
if (colRefSize != 0) {
(*pTableMeta)->colRef = (SColRef *)((char *)*pTableMeta + metaSize + schemaExtSize);
TAOS_MEMCPY((*pTableMeta)->colRef, tmpRef, colRefSize);
(*pTableMeta)->numOfColRefs = numOfColRefs; // Set numOfColRefs for virtual child table
(*pTableMeta)->rversion = rversion; // Set rversion for virtual child table
} else {
(*pTableMeta)->colRef = NULL;
}
Expand Down