Re: [GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-06 Thread immersive.ex...@gmail.com
A (final?) version using COALESCE (It wasn't too long to post at the blog now; I am also posting here for belt and suspenders reasons...): -- group_concat.sql -- permutation of GROUP_CONCAT parameter types with delimiter parameter furnished: CR

Re: [GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-06 Thread immersive.ex...@gmail.com
You're saying as oppose to straight SQL? I don't think so; but I had defined it as such just in case there was some functional benefit that I might be unaware of... On 08/06/2013 01:26 AM, Alvaro Herrera wrote: > Pavel Stehule escribió: > >> you code can be translated to >

Re: [GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-06 Thread immersive.ex...@gmail.com
/2013 12:49 AM, Pavel Stehule wrote: > Hello > > 2013/8/3 immersive.ex...@gmail.com : >> I needed a GROUP_CONCAT to port some queries to postgres. >> >> In discussions online, I found repeated advice for rewriting the queries, >> but no solid way to formulate the GR

Re: [GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-05 Thread immersive.ex...@gmail.com
No luck on posting at that blog; comments are limited to X characters. Here is the final version with the minor update to the variable names and comments: -- group_concat.sql -- permutation of GROUP_CONCAT parameter types with delimiter parameter furnished: CREATE OR REPLACE FUNCTION GROUP_CONCAT

Re: [GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-05 Thread immersive.ex...@gmail.com
Well after testing, this is what I found: When you try to use ANYELEMENT parameters, and even just a VARIADIC TEXT[] parameter to support the optional delimiter argument: FUNCTION GROUP_CONCAT_ATOM(ANYELEMENT, ANYELEMENT, VARIADIC delimiters TEXT[]) when you go to create the aggregates, post

Re: [GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-05 Thread immersive.ex...@gmail.com
.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 <alvhe...@2ndquadrant.com> wrote: immersive

Re: [GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-05 Thread immersive.ex...@gmail.com
:04 PM, Alvaro Herrera wrote: > immersive.ex...@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 woul

[GENERAL] Seamless replacement to MySQL's GROUP_CONCAT function...

2013-08-05 Thread immersive.ex...@gmail.com
I needed a GROUP_CONCAT to port some queries to postgres. In discussions online, I found repeated advice for rewriting the queries, but no solid way to formulate the GROUP_CONCAT as a postgres function. Rewrite perhaps hundreds of queries that happen to be in the app