Re: [SQL] How do you do the opposite of regexp_split_to_table?

2010-08-03 Thread Alvaro Herrera
Excerpts from John Gage's message of mar ago 03 16:21:58 -0400 2010: > Grouping by summing numerical fields seems to be straightforward, but > grouping by concatenating text fields escapes my search of the > documentation. You can create a new custom aggregate function that does this. It's p

[SQL] How do you do the opposite of regexp_split_to_table?

2010-08-03 Thread John Gage
I would like to take several rows from a select and have them grouped into one row with the text contents of one field in all the rows concatenated into one field in the single row of the group group. The contents of the other fields are identical across the rows. This is the complementary

Re: [SQL] Backslash characters in PLPGSQL

2010-08-03 Thread Tom Lane
"Garrett Murphy" writes: > We recently upgraded from 8.3 to 8.4 and are noticing a change in > behavior that we can't seem to associate with a particular server > setting. I think you're seeing the effects of this 8.4 patch: http://archives.postgresql.org/pgsql-committers/2009-04/msg00216.php in

[SQL] Backslash characters in PLPGSQL

2010-08-03 Thread Garrett Murphy
We recently upgraded from 8.3 to 8.4 and are noticing a change in behavior that we can't seem to associate with a particular server setting. In 8.3, the following compiles and works perfectly: CREATE OR REPLACE FUNCTION test_function2(tText TEXT) RETURNS TEXT AS $BODY$ BEGIN

Re: [SQL] aggregate function

2010-08-03 Thread Tom Lane
=?UTF-8?Q?Viktor_Bojovi=C4=87?= writes: > I tried to write this part below, but something is wrong (ERROR: function > grafika.pov_sphere(character varying, numeric, numeric, numeric, numeric, > character varying) does not exist) so I wanted to ask if someone knows how > to solve this problem. Wel

[SQL] aggregate function

2010-08-03 Thread Viktor Bojović
I am trying to make aggregate function of existing function which looks like this. CREATE OR REPLACE FUNCTION "grafika"."pov_sphere" (x numeric, y numeric, z numeric, rad numeric, pigment varchar) RETURNS varchar AS $body$ DECLARE _pov varchar; BEGIN _pov:='sphere {<'||x||','||y||','||z||'>,'||rad|