Re: hstore: add hstore_length function
От | Fabrízio de Royes Mello |
---|---|
Тема | Re: hstore: add hstore_length function |
Дата | |
Msg-id | CAFcNs+o4s3EYqzNU+oDhOairwby2qi1K2SKxmGbfnsNqaQtEhw@mail.gmail.com обсуждение исходный текст |
Ответ на | hstore: add hstore_length function (Korbin Hoffman <k1@k1.io>) |
Список | pgsql-hackers |
<div dir="ltr"><br /><br />On Fri, Jun 3, 2016 at 7:58 AM, Korbin Hoffman <<a href="mailto:k1@k1.io">k1@k1.io</a>>wrote:<br />><br />> Hi there-<br />><br />> I've attached a small patchexposing HS_COUNT to the user as<br />> "hstore_length(hstore)". Documentation, upgrade sql files, and a few<br />>tests are also included.<br />><br />> Almost every hstore function calls HS_COUNT, but I couldn't determine<br/>> if there was a reason this exposure didn't already exist.<br />><br />> Without this function, I'vebeen converting an hstore into an array<br />> and then counting it - a more expensive operation (~30-40% slower than<br/>> SELECTing the hstore itself in a few of my tests).<br />><br />> I will add this thread and patch tothe next Commitfest.<br />><br /><br />Something goes wrong when applying against master:<br /><br />$ git apply ~/Downloads/hstore_length-v1.patch<br/>error: contrib/hstore/Makefile: already exists in working directory<br />error: contrib/hstore/expected/hstore.out:already exists in working directory<br />error: contrib/hstore/hstore--1.3.sql: alreadyexists in working directory<br />error: contrib/hstore/hstore.control: already exists in working directory<br />error:contrib/hstore/hstore_op.c: already exists in working directory<br />error: contrib/hstore/sql/hstore.sql: alreadyexists in working directory<br />error: doc/src/sgml/hstore.sgml: already exists in working directory<br /><br /><br/>Anyway I have some comments:<br /><br />1) I don't see any reason to add this sort of thing if you're adding a newfunction<br /><br />+ HSTORE_POLLUTE(hstore_length, length);<br /><br /><br />2) Shouldn't this declaration use 'uint32'instead of 'int' ??<br /><br />+ int count = HS_COUNT(hs);<br />+ <br />+ PG_RETURN_INT32(count);<br /><br />maybe<br/><br />+ uint32 count = HS_COUNT(hs);<br />+ <br />+ PG_RETURN_UINT32(count);<br /><br />Regards,<br /><br />--<br/>Fabrízio de Royes Mello<br />Consultoria/Coaching PostgreSQL<br />>> Timbira: <a href="http://www.timbira.com.br">http://www.timbira.com.br</a><br/>>> Blog: <a href="http://fabriziomello.github.io">http://fabriziomello.github.io</a><br/>>> Linkedin: <a href="http://br.linkedin.com/in/fabriziomello">http://br.linkedin.com/in/fabriziomello</a><br/>>> Twitter: <a href="http://twitter.com/fabriziomello">http://twitter.com/fabriziomello</a><br/>>> Github: <a href="http://github.com/fabriziomello">http://github.com/fabriziomello</a><br/></div>
В списке pgsql-hackers по дате отправления: