这是indexloc提供的服务,不要输入任何密码
Skip to content

ERROR: operator is not unique: utils.ulid = utils.ulid in PG 16 #45

@kydemy-fran

Description

@kydemy-fran

We have installed the extension in a schema called utils:

CREATE SCHEMA utils;
CREATE EXTENSION ULID SCHEMA utils;

The function utils.gen_monotonic_ulid() works fine.

If I run the following query in postgresql 16.1:

SELECT CAST('01HTHV582X9B5YBFP7GRBWXRHX' AS utils.ulid) = CAST('01HTHV582X9B5YBFP7GRBWXRHX' AS utils.ulid)

Same result if we do:

SELECT utils.gen_monotonic_ulid() = utils.gen_monotonic_ulid();

I am getting the following error:

[2024-05-22 16:28:51] [42725] ERROR: operator is not unique: utils.ulid = utils.ulid
[2024-05-22 16:28:51] Hint: Could not choose a best candidate operator. You might need to add explicit type casts.

I have checked and I have the = operator defined in the DB for ulid types:

SELECT
    n.nspname,
    o.oprname,
    o.oprleft,
    o.oprright,
    o.oprresult,
    p.proname
FROM
    pg_operator o
        JOIN
    pg_namespace n ON o.oprnamespace = n.oid
        JOIN
    pg_proc p ON o.oprcode = p.oid
WHERE
    n.nspname = 'utils' AND oprname = '=';

Returns:

nspname oprname oprleft oprright oprresult proname
utils = 1403350 1403350 16 ulid_eq
utils = 1403766 1403766 16 geometry_eq
utils = 1404472 1404472 16 geography_eq

We are having that same error I reported when joining tables by ULID ids.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: operatorContext: OperatorD2: mediumDifficulty: Medium to implementT: bugType: Bug fixW: confirmWaiting: Needs confirmation

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions