Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-06-09 Thread Christopher Kings-Lynne
> Tom Lane wrote: > > Well, we're not doing that; and I see no good reason to make the thing > > be a builtin function at all. Since it's just an example, it can very > > well be a contrib item with a creation script. Probably *should* be, > > in fact, because dynamically created functions are w

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-06-09 Thread Tom Lane
Joe Conway <[EMAIL PROTECTED]> writes: > Returning GUC variable "SHOW ALL" results as a query result has been > discussed before, and I thought there was agreement that it was a > desirable backend feature. So it is, but I had expected it to be implemented by changing the behavior of SHOW, same

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-06-08 Thread Joe Conway
Tom Lane wrote: > Well, we're not doing that; and I see no good reason to make the thing > be a builtin function at all. Since it's just an example, it can very > well be a contrib item with a creation script. Probably *should* be, > in fact, because dynamically created functions are what other

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-06-08 Thread Tom Lane
Joe Conway <[EMAIL PROTECTED]> writes: > The question is how to best bootstrap this new function. In order to > create the pg_proc entry I need the return type oid. If I understand > correctly, in order to get a composite return type, with a known oid, I > would need to create a bootstrapped re

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-06-07 Thread Joe Conway
Tom Lane wrote: > Definitely better. I'd suggest also thinking about whether the > same/similar macros can support functions that return a set of a > scalar (non-tuple) datatype. In my mind, the cleanest design would > be some base macros that support functions-returning-set (of anything), > and

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-06-06 Thread Joe Conway
Tom Lane wrote: > Definitely better. I'd suggest also thinking about whether the > same/similar macros can support functions that return a set of a > scalar (non-tuple) datatype. In my mind, the cleanest design would > be some base macros that support functions-returning-set (of anything), > and

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-05-28 Thread Tom Lane
Joe Conway <[EMAIL PROTECTED]> writes: > What if we also had something like: > FUNC_BUILD_TUPLE(values, funcctx); > which returns a tuple for the less experienced folks Sure, as long as it's not getting in the way when you don't want it. For that matter the FUNC stuff shouldn't get in the way

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-05-27 Thread Joe Conway
Tom Lane wrote: > Joe Conway <[EMAIL PROTECTED]> writes: > >> If not, prepare an array of C strings representing the attribute >> values of your return tuple, and call: FUNC_BUILD_SLOT(values, >> funcctx); > > I think that's a poor choice of abstraction, as it forces the user > into the le

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-05-27 Thread Joe Conway
Peter Eisentraut wrote: > We need a function like this in the main line. The "show all" variety > isn't top priority, but we need something that gets you the "show" result > as a query output. The original idea was to make SHOW return a query > result directly, but a function is fine with me too

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-05-27 Thread Peter Eisentraut
Joe Conway writes: > Here is a revised patch for a sample C function returning setof > composite. (Same comments as last time -- It is a clone of SHOW ALL as > an SRF. For the moment, the function is implemented as contrib/showguc, > although a few minor changes to guc.c and guc.h were required t

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-05-27 Thread Tom Lane
Joe Conway <[EMAIL PROTECTED]> writes: > If not, prepare an array of C strings representing the > attribute values of your return tuple, and call: > FUNC_BUILD_SLOT(values, funcctx); I think that's a poor choice of abstraction, as it forces the user into the least-efficient-possible way of b

Re: [HACKERS] revised sample SRF C function; proposed SRF API

2002-05-26 Thread Joe Conway
Joe Conway wrote: > Here is a revised patch for a sample C function returning setof > composite. (Same comments as last time -- It is a clone of SHOW ALL as > an SRF. For the moment, the function is implemented as contrib/showguc, > although a few minor changes to guc.c and guc.h were required