PortalHeapMemoryFree with user functions - Mailing list pgsql-general

From Justen Marshall
Subject PortalHeapMemoryFree with user functions
Date
Msg-id 00Jul6.103512est.115208@gateway.al.com.au
Whole thread Raw
List pgsql-general
Hi

I've written a simple string concatenation procedure to build a list
of comma-separated values. It is actually just a minor variation on
one the sample concatenation code, and yes I did make sure to adjust
the call to palloc to include the extra space I need for the comma.

I then built an aggregate function from it, and it seems to do the
trick nicely. But I've noticed some warnings in my postgres log file.

The functions are simple...

  CREATE FUNCTION "csv" (text,text)
    RETURNS text
    AS 'cat.so'
    LANGUAGE 'C';

  CREATE AGGREGATE csvlist ( BASETYPE = text,
                             SFUNC1 = csv,
                             STYPE1 = text,
                             INITCOND1 = '' );

The warnings I get....

  DEBUG:  ExecInitAgg: could not find any aggregate functions
  NOTICE:  PortalHeapMemoryFree: 0x10312648 not in alloc set!

It actually works, though, that's the strange thing! But I'm not
certain it won't cause me problems later on, so I'd like to fix it.
And anyway, I'm a perfectionist, I don't like seeing warnings, and
since I'll be using this function in a heavy-load way, I think it's
fairly important that I find out what's wrong.

Your help would be appreciated!

BTW - If there is a better way to get a comma-separated value list
with some built-in aggregate function, feel free to fill me in! I
treated this as a learning exercise on building my own functions, but
I'd much prefer to do it natively if possible. I easily built an
equivalent of my 'csv' function in SQL, but discovered that SQL is not
a supported language for SFUNC's in aggregate functions. Bummer...

Justen
--
.-----------------------.------------.--------------------------.
| Justen Marshall       |            | e-mail: justen@al.com.au |
| Technical Director    |            | phone:   +61-2-9383-4800 |
| Animal Logic Pty Ltd  |            | fax:     +61-2-9383-4801 |
|-----------------------^------------^--------------------------|
| The beatings will continue until morale improves.             |
`---------------------------------------------------------------'

pgsql-general by date:

Previous
From: Jim Jennis
Date:
Subject: Re: responses to licensing discussion
Next
From: Chris Bitmead
Date:
Subject: Re: proposed improvements to PostgreSQL license