Skip to content

Like operator returns wrong result if string ends with a number #462

@johannesrue

Description

@johannesrue

What happens?

Hi there,

i think we identified a bug related to the like operator.

Given the example:

attach 'postgres://postgres:1234@localhost:5432/postgres' as "pg" (type postgres, SCHEMA 'my_schema');

use "pg";

create or replace table test as select '2F98ED5A409F4B35B36AF72773618FC9_P1' as id;
select * from test where id like '2F98ED5A409F4B35B36AF72773618FC9%';

The result set is empty for the search string 2F98ED5A409F4B35B36AF72773618FC9%.

If the string ends with a character it just works fine 2F98ED5A409F4B35B36AF72773618FCX%:

attach 'postgres://postgres:1234@localhost:5432/postgres' as "pg" (type postgres, SCHEMA 'my_schema');

use "pg";

create or replace table test as select '2F98ED5A409F4B35B36AF72773618FCX_P1' as id;
select * from test where id like '2F98ED5A409F4B35B36AF72773618FCX%';

We did the test too with the pg client and both cases worked, so we assume the bug can be found in the duckdb_postgres extension.

Thank you for your support.

Cheers
Johannes

To Reproduce

attach 'postgres://postgres:1234@localhost:5432/postgres' as "pg" (type postgres, SCHEMA 'my_schema');

use "pg";

create or replace table test as select '2F98ED5A409F4B35B36AF72773618FC9_P1' as id;
select * from test where id like '2F98ED5A409F4B35B36AF72773618FC9%';

OS:

Linux

PostgreSQL Version:

18.1

DuckDB Version:

1.5.2

DuckDB Client:

JAR (Dbeaver)

Full Name:

Johannes Rückert

Affiliation:

IBIS Prof Thome AG

Have you tried this on the latest main 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions