Unix Technical Forum

Re: AGGREGATE SYNTAX MISSING IN REVERSE ENGINEERED SQL

This is a discussion on Re: AGGREGATE SYNTAX MISSING IN REVERSE ENGINEERED SQL within the pgsql Interfaces Pgadmin Support forums, part of the PostgreSQL category; --> Thanks James - fixed in CVS tip and the stable branch. Regards, Dave. > -----Original Message----- > From: pgadmin-support-owner@postgresql.org ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Interfaces Pgadmin Support

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 06:59 PM
Dave Page
 
Posts: n/a
Default Re: AGGREGATE SYNTAX MISSING IN REVERSE ENGINEERED SQL

Thanks James - fixed in CVS tip and the stable branch.

Regards, Dave.

> -----Original Message-----
> From: pgadmin-support-owner@postgresql.org
> [mailtogadmin-support-owner@postgresql.org] On Behalf Of
> James Prichard
> Sent: 04 March 2005 11:42
> To: pgadmin-support@postgresql.org
> Subject: [pgadmin-support] AGGREGATE SYNTAX MISSING IN
> REVERSE ENGINEERED SQL
>
>
> pgAdmin3 Version 1.3.0 (Mar 3 2005)
>
> running on Win 2000 Pro (IA32)
>
> MINOR GLITCH REPORT
> - the "aggfunction(argtype)" is necessary for changing owner whereas
> the reverse engineered sql display shows just the "aggfunction"
>
> - a prior version of pgAdmin3 had a similar error in the sql to drop
> the function, this is fixed in 1.3.0, except not terminated by a
> semicolon - note, that version is not yet bundled with the Win32
> installer for Postgres
>
> - "ffunc" is shown instead of "finalfunc" (maybe confused
> by the help
> page's example)
>
> == from pgAdmin screen ====================================
>
> -- Aggregate: my_aggfunc
>
> -- DROP AGGREGATE my_aggfunc(int) <<<< missing ';'
>
> CREATE AGGREGATE my_aggfunc(
> BASETYPE=int,
> SFUNC=my_aggfunc_item,
> STYPE=int[],
> FFUNC=my_aggfunc_final,
> INITCOND='{0,0,99,99,0,0,0}'
> );
> ALTER AGGREGATE my_aggfunc OWNER TO my_username; <<<< missing '(int)'
>
> Here is what the interface shows me
> -- Aggregate: my_aggfunc
>
> -- DROP AGGREGATE my_aggfunc(int)
>
> CREATE AGGREGATE my_aggfunc(
> BASETYPE=int,
> SFUNC=my_aggfunc_item,
> STYPE=int[],
> FFUNC=my_aggfunc_final,
> INITCOND='{0,0,99,99,0,0,0}'
> );
> ALTER AGGREGATE my_aggfunc OWNER TO my_username;
>
> == corrected version ====================================
>
> -- Aggregate: my_aggfunc
>
> -- DROP AGGREGATE my_aggfunc(int);
>
> CREATE AGGREGATE my_aggfunc(
> BASETYPE=int,
> SFUNC=my_aggfunc_item,
> STYPE=int[],
> FINALFUNC=my_aggfunc_final,
> INITCOND='{0,0,99,99,0,0,0}'
> );
> ALTER AGGREGATE my_aggfunc(int) OWNER TO my_username;
>
> ===================
> to help test the syntax here are trivial working functions
>
> /*
> DROP AGGREGATE my_aggfunc(int);
> DROP FUNCTION my_aggfunc_item(int[],int);
> DROP FUNCTION my_aggfunc_final(f int[]);
> */
>
> CREATE FUNCTION my_aggfunc_item(int[],int)
> RETURNS int[] AS 'BEGIN IF $2<$1[1] THEN return array[$2]||$1[2];
> ELSE IF $2<=$1[2] THEN return $1;
> ELSE return $1[1:1]||$2;END IF;END IF;END'
> LANGUAGE 'plpgsql' IMMUTABLE;
> CREATE FUNCTION my_aggfunc_final(x int[]) RETURNS varchar(3) AS 'BEGIN
> return array_to_string(x,''-'');END' LANGUAGE 'plpgsql' IMMUTABLE;
> CREATE AGGREGATE
> my_aggfunc(BASETYPE=int,SFUNC=my_aggfunc_item,STYP E=int[],FINA
> LFUNC=my_a
> ggfunc_final,INITCOND='{100,100}');
>
> SELECT my_aggfunc(cast(200*random() as int));
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
> (send "unregister YourEmailAddressHere" to
> majordomo@postgresql.org)
>


---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:32 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com