Skip site navigation (1) Skip section navigation (2)

Testing v1.7: Reverse engineering of multiparameter aggregate functions fails

From: Leszek Trenkner <olaf(at)post(dot)pl>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: Testing v1.7: Reverse engineering of multiparameter aggregate functions fails
Date: 2007-05-23 23:39:01
Message-ID: 5ced0$4654d095$594f4043$24425@news.chello.pl (view raw or flat)
Thread:
Lists: 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

Responses

pgadmin-hackers by date

Next:From: Leszek TrenknerDate: 2007-05-24 00:21:22
Subject: Re: Testing v1.7: Server restart/crash crashes pgAdmin
Previous:From: svnDate: 2007-05-23 21:59:54
Subject: SVN Commit by guillaume: r6320 - trunk/pgadmin3/pgadmin/ui

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group