diff --git a/src/binder/bind/bind_ddl.cpp b/src/binder/bind/bind_ddl.cpp index 9e026ad4c5..901a9ef7b2 100644 --- a/src/binder/bind/bind_ddl.cpp +++ b/src/binder/bind/bind_ddl.cpp @@ -193,9 +193,12 @@ DataType Binder::bindDataType(const std::string& dataType) { "The number of elements in a fixed list must be greater than 0. Given: " + std::to_string(boundType.fixedNumElementsInList) + "."); } - if (Types::getDataTypeSize(boundType) > common::BufferPoolConstants::PAGE_4KB_SIZE) { - throw common::BinderException("The size of fixed list is larger than a " - "DEFAULT_PAGE_SIZE, which is not supported yet."); + auto numElementsPerPage = storage::PageUtils::getNumElementsInAPage( + Types::getDataTypeSize(boundType), true /* hasNull */); + if (numElementsPerPage == 0) { + throw common::BinderException( + StringUtils::string_format("Cannot store a fixed list of size {} in a page.", + Types::getDataTypeSize(boundType))); } } return boundType; diff --git a/test/binder/binder_error_test.cpp b/test/binder/binder_error_test.cpp index 73f134099f..d34232f3c7 100644 --- a/test/binder/binder_error_test.cpp +++ b/test/binder/binder_error_test.cpp @@ -483,3 +483,10 @@ TEST_F(BinderErrorTest, InvalidFixedListNumElements) { auto input = "create node table test1(ID INT64, marks INT64[0], PRIMARY KEY(ID))"; ASSERT_STREQ(expectedException.c_str(), getBindingError(input).c_str()); } + +TEST_F(BinderErrorTest, InvalidFixedListSize) { + std::string expectedException = + "Binder exception: Cannot store a fixed list of size 4096 in a page."; + auto input = "create node table test1(ID INT64, marks INT64[512], PRIMARY KEY(ID))"; + ASSERT_STREQ(expectedException.c_str(), getBindingError(input).c_str()); +}