Add column type check before UUID insertion in MsgPack format

This commit is contained in:
avogar 2022-09-14 11:15:10 +00:00
parent 12e7cd6b19
commit 59e7eb084c
3 changed files with 7 additions and 1 deletions

View File

@ -235,8 +235,10 @@ static void insertNull(IColumn & column, DataTypePtr type)
assert_cast<ColumnNullable &>(column).insertDefault();
}
static void insertUUID(IColumn & column, DataTypePtr /*type*/, const char * value, size_t size)
static void insertUUID(IColumn & column, DataTypePtr type, const char * value, size_t size)
{
if (!isUUID(type))
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Cannot insert MessagePack UUID into column with type {}.", type->getName());
ReadBufferFromMemory buf(value, size);
UUID uuid;
readBinaryBigEndian(uuid.toUnderType().items[0], buf);

View File

@ -0,0 +1,4 @@
-- Tags: no-parallel, no-fasttest
insert into function file(02422_data.msgpack) select toUUID('f4cdd80d-5d15-4bdc-9527-adcca635ec1f') as uuid settings output_format_msgpack_uuid_representation='ext';
select * from file(02422_data.msgpack, auto, 'x Int32'); -- {serverError ILLEGAL_COLUMN}