Merge pull request #41309 from Avogar/fix-msgpack

Add column type check before UUID insertion in MsgPack format
This commit is contained in:
Kruglov Pavel 2022-09-15 11:37:57 +02:00 committed by GitHub
commit 73cf72a5a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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}