Skip to content

'Invalid unicode (byte sequence mismatch) detected in value construction' for JS UDF returning more than 12 characters #5670

@chrisbrain

Description

@chrisbrain

What happens?

Getting `Invalid unicode (byte sequence mismatch) detected in value construction' when our UDF returns more than 12 characters.

I assume this is a bug, have not seen anywhere in docs or code where we can specify the UDF should return more.

To Reproduce

Try running this test:

const duckdb = require('duckdb');
const assert = require('node:assert/strict');

it('0ary string > 12 characters', function(done) {

    db = new duckdb.Database(':memory:');

    // Works if string is 12 characters or less 
    const str = '0123456789123';

    db.register_udf("udf", "varchar", () => str);
    db.all("select udf() v", function(err, rows) {
        if (err) throw err;
        assert.equal(rows[0].v, str);
        done();
    });
    
});

OS:

Ubuntu running on WSL on Windows x64

DuckDB Version:

0.6.1

DuckDB Client:

nodejs

Full Name:

Chris Brain

Affiliation:

None

Have you tried this on the latest master branch?

  • I agree

Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

  • I agree

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions