Thread: [PATCH] Add min/max aggregate functions to BYTEA
Hello. BYTEA type has the ability to use comparison operations. But it is absent of min/max aggregate functions. They are nice to have to provide consistency with the TEXT type. -- With best regards, Marat Bukharov
Attachment
V2 patch with fixed tests -- With best regards, Marat Bukharov ср, 3 июл. 2024 г. в 16:03, Marat Buharov <marat.buharov@gmail.com>: > > Hello. BYTEA type has the ability to use comparison operations. But it > is absent of min/max aggregate functions. They are nice to have to > provide consistency with the TEXT type. > > > -- > > With best regards, > Marat Bukharov
Attachment
V3 patch with fixed length comparison -- With best regards, Marat Bukharov > > V2 patch with fixed tests > > > > > Hello. BYTEA type has the ability to use comparison operations. But it > > is absent of min/max aggregate functions. They are nice to have to > > provide consistency with the TEXT type. > >
V3 patch with fixed length comparison -- With best regards, Marat Bukharov > > V2 patch with fixed tests > > > > > Hello. BYTEA type has the ability to use comparison operations. But it > > is absent of min/max aggregate functions. They are nice to have to > > provide consistency with the TEXT type. > >
Attachment
V4 path with fixed usage PG_GETARG_BYTEA_PP instead of PG_GETARG_TEXT_PP -- With best regards, Marat Bukharov > > V3 patch with fixed length comparison > > > > > V2 patch with fixed tests > > > > > > > > Hello. BYTEA type has the ability to use comparison operations. But it > > > is absent of min/max aggregate functions. They are nice to have to > > > provide consistency with the TEXT type. > > >
Attachment
Hi Marat, > V4 path with fixed usage PG_GETARG_BYTEA_PP instead of PG_GETARG_TEXT_PP Thanks for the patch. Please add it to the nearest open commitfest [1]. ``` +select min(v) from bytea_test_table; + min +------ + \xaa +(1 row) + +select max(v) from bytea_test_table; + max +------ + \xff +(1 row) ``` If I understand correctly, all the v's are of the same size. If this is the case you should add more test cases. [1]: https://commitfest.postgresql.org/ -- Best regards, Aleksander Alekseev
What part of commitfest should I put the current patch to: "SQL Commands", "Miscellaneous" or something else? I can't figure it out. -- With best regards, Marat Bukharov > Hi Marat, > > > V4 path with fixed usage PG_GETARG_BYTEA_PP instead of PG_GETARG_TEXT_PP > > Thanks for the patch. > > Please add it to the nearest open commitfest [1]. > > ``` > +select min(v) from bytea_test_table; > + min > +------ > + \xaa > +(1 row) > + > +select max(v) from bytea_test_table; > + max > +------ > + \xff > +(1 row) > ``` > > If I understand correctly, all the v's are of the same size. If this > is the case you should add more test cases. > > [1]: https://commitfest.postgresql.org/ > > -- > Best regards, > Aleksander Alekseev
Hi, > What part of commitfest should I put the current patch to: "SQL > Commands", "Miscellaneous" or something else? I can't figure it out. Personally I qualified a similar patch [1] as "Server Features", although I'm not 100% sure if this was the best choice. [1]: https://commitfest.postgresql.org/48/4905/ -- Best regards, Aleksander Alekseev
V5 patch. I've added more tests with different bytea sizes -- With best regards, Marat Bukharov чт, 4 июл. 2024 г. в 15:29, Aleksander Alekseev <aleksander@timescale.com>: > > Hi Marat, > > > V4 path with fixed usage PG_GETARG_BYTEA_PP instead of PG_GETARG_TEXT_PP > > Thanks for the patch. > > Please add it to the nearest open commitfest [1]. > > ``` > +select min(v) from bytea_test_table; > + min > +------ > + \xaa > +(1 row) > + > +select max(v) from bytea_test_table; > + max > +------ > + \xff > +(1 row) > ``` > > If I understand correctly, all the v's are of the same size. If this > is the case you should add more test cases. > > [1]: https://commitfest.postgresql.org/ > > -- > Best regards, > Aleksander Alekseev
Attachment
Added patch to commitfest https://commitfest.postgresql.org/49/5138/ -- With best regards, Marat Bukharov > > Hi, > > > What part of commitfest should I put the current patch to: "SQL > > Commands", "Miscellaneous" or something else? I can't figure it out. > > Personally I qualified a similar patch [1] as "Server Features", > although I'm not 100% sure if this was the best choice. > > [1]: https://commitfest.postgresql.org/48/4905/ > > -- > Best regards, > Aleksander Alekseev
> On 24 Jul 2024, at 17:42, Marat Bukharov <marat.buharov@gmail.com> wrote: > > V5 patch. I've added more tests with different bytea sizes Hi Marat! This looks like a nice feature to have. I’ve took a look into the patch and have few suggestions: 0. Please write more descriptive commit message akin to [0] 1. Use oids from development range 8000-9999 2. Replace VARDATA_ANY\memcmp dance with a call to varstrfastcmp_c(). Thank you! Best regards, Andrey Borodin. [0] https://github.com/postgres/postgres/commit/a0f1fce80c03