Skip to content

Bug: Changing privileges of functions with enums include the qualified name of the temporal schema #366

@marioloko

Description

@marioloko

old.sql:

DO $$
BEGIN
    IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'app_user') THEN
        CREATE ROLE app_user;
    END IF;
END $$;

CREATE TYPE entity_kind AS ENUM ('person', 'company', 'organization');

CREATE FUNCTION create_entity(p_name text, p_kind entity_kind)
RETURNS uuid
LANGUAGE sql
AS $$ SELECT gen_random_uuid(); $$;

new.sql:

DO $$
BEGIN
    IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'app_user') THEN
        CREATE ROLE app_user;
    END IF;
END $$;

CREATE TYPE entity_kind AS ENUM ('person', 'company', 'organization');

CREATE FUNCTION create_entity(p_name text, p_kind entity_kind)
RETURNS uuid
LANGUAGE sql
AS $$ SELECT gen_random_uuid(); $$;

REVOKE ALL ON FUNCTION create_entity(text, entity_kind) FROM PUBLIC;
GRANT EXECUTE ON FUNCTION create_entity(text, entity_kind) TO app_user;

current plan.sql:

REVOKE EXECUTE ON FUNCTION create_entity(p_name text, p_kind pgschema_tmp_20260322_225736_e9508683.entity_kind) FROM PUBLIC;

GRANT EXECUTE ON FUNCTION create_entity(p_name text, p_kind pgschema_tmp_20260322_225736_e9508683.entity_kind) TO app_user

Notice the enum is pgschema_tmp_20260322_225736_e9508683.entity_kind

expected plan.sql:

REVOKE EXECUTE ON FUNCTION create_entity(p_name text, p_kind entity_kind) FROM PUBLIC;

GRANT EXECUTE ON FUNCTION create_entity(p_name text, p_kind entity_kind) TO app_user

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions