diff --git a/src/binder/bind/bind_ddl.cpp b/src/binder/bind/bind_ddl.cpp index 99995f7917e..664163cf77e 100644 --- a/src/binder/bind/bind_ddl.cpp +++ b/src/binder/bind/bind_ddl.cpp @@ -107,8 +107,14 @@ std::unique_ptr Binder::bindCreateNodeTableInfo(const Crea std::unique_ptr Binder::bindCreateRelTableInfo(const CreateTableInfo* info) { auto boundProperties = bindProperties(info->propertyNameDataTypes); for (auto& boundProperty : boundProperties) { - if (boundProperty->getDataType()->getLogicalTypeID() == LogicalTypeID::SERIAL) { - throw BinderException("Serial property is not supported in rel table."); + if (boundProperty->getDataType()->getLogicalTypeID() == LogicalTypeID::SERIAL || + boundProperty->getDataType()->getLogicalTypeID() == LogicalTypeID::UNION || + boundProperty->getDataType()->getLogicalTypeID() == LogicalTypeID::STRUCT || + boundProperty->getDataType()->getLogicalTypeID() == LogicalTypeID::MAP) { + throw BinderException( + StringUtils::string_format("{} property is not supported in rel table.", + LogicalTypeUtils::dataTypeToString( + boundProperty->getDataType()->getLogicalTypeID()))); } } auto extraInfo = (ExtraCreateRelTableInfo*)info->extraInfo.get(); diff --git a/test/test_files/exceptions/binder/binder_error.test b/test/test_files/exceptions/binder/binder_error.test index b75fd1cd2ee..8e094526dd4 100644 --- a/test/test_files/exceptions/binder/binder_error.test +++ b/test/test_files/exceptions/binder/binder_error.test @@ -470,7 +470,7 @@ Binder exception: Serial property in node table must be the primary key. -LOG SerialInRelTable -STATEMENT CREATE REL TABLE test(FROM person TO person, seq SERIAL) ---- error -Binder exception: Serial property is not supported in rel table. +Binder exception: SERIAL property is not supported in rel table. -LOG MatchBuiltIn -STATEMENT MATCH (a:person) RETURN a.age + 'hh' diff --git a/test/test_files/issue/issue.test b/test/test_files/issue/issue.test index 7dfddf8ae11..adfef991867 100644 --- a/test/test_files/issue/issue.test +++ b/test/test_files/issue/issue.test @@ -27,3 +27,21 @@ -STATEMENT MATCH (t:Test) RETURN t; ---- 1 {_ID: 0:0, _LABEL: Test, id: 0, content: mycontent} + +-CASE 2184 +-STATEMENT CREATE NODE TABLE T(name STRING, PRIMARY KEY(name)); +---- ok +-STATEMENT CREATE NODE TABLE T2(name STRING, myprops MAP(STRING,STRING), PRIMARY KEY(name)); +---- ok +-STATEMENT CREATE REL TABLE KIND_OF3(FROM T TO T, myprops MAP(STRING,STRING)); +---- error +Binder exception: MAP property is not supported in rel table. +-STATEMENT CREATE REL TABLE KIND_OF3(FROM T TO T, myprops SERIAL); +---- error +Binder exception: SERIAL property is not supported in rel table. +-STATEMENT CREATE REL TABLE KIND_OF3(FROM T TO T, myprops STRUCT(v INT64)); +---- error +Binder exception: STRUCT property is not supported in rel table. +-STATEMENT CREATE REL TABLE KIND_OF3(FROM T TO T, myprops UNION(v1 STRING, v2 INT64)); +---- error +Binder exception: UNION property is not supported in rel table.