Adriaan Joubert <adriaan.joubert@gmail.com> writes:
> I've implemented an aggregation function to compute quartiles in C
> borrowing liberally from orafce code. I uses this code in a windowing
> context and it worked fine until today - and I'm not sure what
> changed. This is on 9.1.2 and I have also tried it on 9.1.4.
Hm, it doesn't look very different from what's done in e.g. array_agg.
You do have the transition datatype declared as "internal", no?
I notice that your transition function is sloppy about returning a null
pointer (as opposed to a SQL null) if both input arguments are null.
If all the aggregated values were nulls then the null pointer would
reach the final function and cause a crash similar to the one described.
But that's hardly "not data specific".
> I've recompiled postgres with debugging enabled and have connected to
> the backend with gdb, but haven't had any joy in persuading gdb to
> actually stop in the correct file so that I can step through. I'll
> keep on trying to make some headway with that.
I've found that gdb takes extra persuasion to notice shared libraries
that are loaded after it attaches to the process. Usually the path
of least resistance is to ensure that the library is loaded before
you attach. Use LOAD, or just CREATE OR REPLACE one of the functions
in your library.
regards, tom lane