Testing v1.7: Reverse engineering of multiparameter aggregate functions fails - Mailing list pgadmin-hackers

From Leszek Trenkner
Subject Testing v1.7: Reverse engineering of multiparameter aggregate functions fails
Date
Msg-id 5ced0$4654d095$594f4043$24425@news.chello.pl
Whole thread Raw
Responses Re: Testing v1.7: Reverse engineering of multiparameter aggregate functions fails
List pgadmin-hackers
Hello,

I've found something missing in multiparameter aggregates SQL reverse-
engineering. I defined multiparameter aggregate function + aggregate
itself as:

Function:
CREATE OR REPLACE FUNCTION agg_text_sum(in_base TEXT, new_text TEXT,
separator TEXT) RETURNS TEXT AS $BODY$
DECLARE
BEGIN
IF in_base IS NULL THEN
RETURN new_text;
END IF;
RETURN in_base || separator || new_text;
END;
$BODY$ language 'plpgsql';

And aggregate:
CREATE aggregate sum(TEXT, TEXT) (
sfunc = agg_text_sum,
stype = TEXT
);

(SQL code from depesz.com) All goes well, aggregate works as expected
(think of it rather as PHP implode() than real sum()).

Unfortunately, SQL code of reverse engineered aggregate in pgAdmin3 1.7.0
(6301M) is as follows:

-- Aggregate: sum

-- DROP AGGREGATE sum(text);

CREATE AGGREGATE sum(
  BASETYPE=text,
  SFUNC=agg_text_sum,
  STYPE=text
);
ALTER AGGREGATE sum(text) OWNER TO postgres;

It has lost one attribute, and so it is impossible to recreate aggregate
(as agg_text_sum function has 3 text attributes, not two as reverse-
engineered definiton requires). I guess pgAdmin needs to support newer
aggregate definition syntax...
--
Greetings,
Leszek Trenkner

pgadmin-hackers by date:

Previous
From: svn@pgadmin.org
Date:
Subject: SVN Commit by guillaume: r6324 - trunk/pgadmin3/i18n/fr_FR
Next
From: Leszek Trenkner
Date:
Subject: Re: Testing v1.7: Server restart/crash crashes pgAdmin