Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Report some errors after using new user-defined access methods #195

Open
1 of 2 tasks
hw118118 opened this issue Sep 7, 2023 · 1 comment
Open
1 of 2 tasks
Labels
type: Bug Something isn't working

Comments

@hw118118
Copy link
Contributor

hw118118 commented Sep 7, 2023

Cloudberry Database version

Any version

What happened

After add new like-intrenal index access method ( as like-btree, like-hash..), there are several problems as below.

  • If you create a new op class by new access method and you create a table in partition key that include new defined op class, you will get a error. For example:
    CREATE FUNCTION my_int4_sort(int4,int4) RETURNS int LANGUAGE sql
    AS $$ SELECT CASE WHEN $1 = $2 THEN 0 WHEN $1 > $2 THEN 1 ELSE -1 END; $$;
    CREATE OPERATOR CLASS test_int4_ops FOR TYPE int4 USING usbtree AS
    OPERATOR 1 < (int4,int4), OPERATOR 2 <= (int4,int4),
    OPERATOR 3 = (int4,int4), OPERATOR 4 >= (int4,int4),
    OPERATOR 5 > (int4,int4), FUNCTION 1 my_int4_sort(int4,int4);
    CREATE TABLE partkey_t (a int4) PARTITION BY RANGE (a test_int4_ops);
    Because cbdb core will find a op class by BTREE_AM_OID when using partition key and not identify new defined opclass.

  • When use onconflict clause , it still has the problem. For example:
    create table insertconflicttest(key int4, fruit text);
    create unique index op_index_key on insertconflicttest(key, fruit text_pattern_ops);
    insert into insertconflicttest values(0, 'Crowberry') on conflict (key, fruit text_pattern_ops) do nothing;
    In onconflict clause, it will find text_pattern_ops opclass by BTREE_AM_OID and compare result and existing index info. So it report a error that unmatched.

What you think should happen instead

Core idea is add a new hook that catch correct opclasses. For example, you can get all opclasses of BTREE_AM_OID firstly, if you can find target , you can find other opclasses in like-btree index access method(maybe user-defined).

How to reproduce

Please refer exmaples as above.

Operating System

Linux

Anything else

No response

Are you willing to submit PR?

  • Yes, I am willing to submit a PR!

Code of Conduct

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

Hey, @hw118118 welcome!🎊 Thanks for taking the time to point this out.🙌

@hw118118 hw118118 changed the title [Bug] [Bug] Report some errors after using new user-defined access methods Sep 7, 2023
@hw118118 hw118118 added the type: Bug Something isn't working label Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant