Re: Seamless replacement to MySQL's GROUP_CONCAT function...
От | immersive.excel@gmail.com |
---|---|
Тема | Re: Seamless replacement to MySQL's GROUP_CONCAT function... |
Дата | |
Msg-id | 51FFE994.8050701@gmail.com обсуждение исходный текст |
Ответ на | Re: Seamless replacement to MySQL's GROUP_CONCAT function... (Richard Broersma <richard.broersma@gmail.com>) |
Ответы |
Re: Seamless replacement to MySQL's GROUP_CONCAT function...
|
Список | pgsql-general |
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type"> I believe his VARIADIC might cover the optional delimiter use, but he suggests using an array aggregation function instead -which does not return a string list, so you would still have to rework the original queries. Now you could write a GROUP_CONCAT aggregate that uses a final function to convert the array to a string list -but correct me if I'm wrong, I believe the way I am concatenating as I go uses less resources (an array of, say, 5000 elements versus a string...) But while I am testing use of the ANYELEMENT, I will see if VARIADIC can simplify things a tad more... ======================== On 08/05/2013 01:15 PM, Richard Broersma wrote: <blockquote cite="mid:CABvLTWEZyie9+zZZ9+xJNgaPsNLOL=OfOn2KROSrbryyQY2QEg@mail.gmail.com" type="cite"> <meta http-equiv="Context-Type" content="text/html; charset=ISO-8859-1"> For posterity that finalized function could be posted here: <a moz-do-not-send="true" href="http://okbob.blogspot.com/2009/08/mysql-functions-for-postgresql.html">http://okbob.blogspot.com/2009/08/mysql-functions-for-postgresql.html There's already a GROUP_CONCAT, listed there, but I guess this one was lacking in some way. On Mon, Aug 5, 2013 at 10:04 AM, Alvaro Herrera <<a moz-do-not-send="true" href="mailto:alvherre@2ndquadrant.com">alvherre@2ndquadrant.com> wrote: <a moz-do-not-send="true" href="mailto:immersive.excel@gmail.com">immersive.excel@gmail.com escribió: > Note: I found some close-but-no cigar aggregates shared online, but > they would not accept integer arguments, nor would they handle the > optionally furnished delimiter. People would suggesting casting the > argument to the pseudo-GROUP_CONCAT. Again: Rewrite perhaps hundreds > of queries?<br> I don't think you need all the variations; you should be able to make them all work with a single set of functions, taking ANYELEMENT instead of text/int8/int4 etc. -- Álvaro Herrera <a moz-do-not-send="true" href="http://www.2ndQuadrant.com/">http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-general mailing list (<a moz-do-not-send="true" href="mailto:pgsql-general@postgresql.org">pgsql-general@postgresql.org) To make changes to your subscription: <a moz-do-not-send="true" href="http://www.postgresql.org/mailpref/pgsql-general">http://www.postgresql.org/mailpref/pgsql-general -- Regards, Richard Broersma Jr.
В списке pgsql-general по дате отправления: