Re: get column name passed to a function

Поиск
Список
Период
Сортировка
От Rob Sargent
Тема Re: get column name passed to a function
Дата
Msg-id 50ABED54.3030501@gmail.com
обсуждение исходный текст
Ответ на Re: get column name passed to a function  (Adrian Klaver <adrian.klaver@gmail.com>)
Ответы Re: get column name passed to a function  (Adrian Klaver <adrian.klaver@gmail.com>)
Список pgsql-general
On 11/20/2012 01:35 PM, Adrian Klaver wrote:
> On 11/20/2012 11:36 AM, Rhys A.D. Stewart wrote:
>> Greetings,
>>
>> I'm looking to obtain the name of a column that is passed to a function,
>> similar to xmlforest. Suggestions?
>
> This is going to require some more information.
>
> 1) What language is the function written in?
>
> 2) Trigger function or not?
>
> 3) A sample of the code?
>
>>
>> Regards,
>>
>>
>> Rhys
>
>

Is this along the right line(s)?


create or replace function f(cname text) returns table(c text)
as
$$
declare
   v text;
begin
   select 'hello' into v;
   raise notice 'Column  name is %', v;
   execute 'select ' || v || ' as ' || cname;
end;
$$ language plpgsql;



В списке pgsql-general по дате отправления:

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: get column name passed to a function
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: get column name passed to a function