Re: table functions
От | Eric B.Ridge |
---|---|
Тема | Re: table functions |
Дата | |
Msg-id | ED619C3E-0B3F-11D7-A9FB-0003930C70D8@tcdi.com обсуждение исходный текст |
Ответ на | Re: table functions (Joe Conway <mail@joeconway.com>) |
Список | pgsql-general |
On Monday, December 9, 2002, at 01:01 AM, Joe Conway wrote: > Eric B.Ridge wrote: >> Let's say I've defined a table function named: myTableFunc() (written >> in C), and that I do this: >> select a, b, c >> from myTableFunc() as foo (a integer, b varchar(255), c text) >> where a = 2; >> Is it possible for me to get the FROM, WHERE, and AS ... clauses from >> within my table function code? I'd like to do this so my table >> function can be a little smarter about what it does and what it >> returns. > > You can get the information related to the "as foo (a integer, b > varchar(255), c text)" aka column definition clause. It is passed in > to the function. See contrib/tablefunc/tablefunc.c:connectby_text(). > The ReturnSetInfo structure handed to the function includes a copy of > the tupdesc formed by the parser (expectedDesc). great! I was snooping through tablefunc.c, but didn't really know what I was looking for. Thanks! <snip> > As far as the FROM and WHERE clauses, I don't think there is any > information available to the function. Not sure it would be practical > or even possible to change that -- maybe someone else will comment on > this. hmm. eric
В списке pgsql-general по дате отправления: