Trying to avoid a simple temporary variable declaration in a pl/pgsql function

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Trying to avoid a simple temporary variable declaration in a pl/pgsql function
Дата
Msg-id CAKFQuwaeOM0RTeYjCSozYTc83MEN==kJ2OKhtWk+LZtNoPSo-A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Trying to avoid a simple temporary variable declaration in a pl/pgsql function  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
I know this could be written quite easily in sql but was wondering if it is possible in pl/pgsql.

CREATE FUNCTION test_func()
RETURNS text
LANGUAGE 'plpgsql'
AS $$
BEGIN
SELECT 'text_to_return' INTO <what_goes_here?>; --with or without a cast
RETURN <what_goes_here?>;
END;
$$;

The goal is to return the value of text_to_return without declaring an explicit variable to name in the INTO clause.

I thought there was an implicit variable available to me but cannot figure out what it is nor find it in the documentation.

Using 9.3 but figuring if it is possible its likely the same in all supported releases...

Thanks!

David J.

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

Предыдущее
От: Sameer Kumar
Дата:
Сообщение: Re: WAL log archival on standby
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Trying to avoid a simple temporary variable declaration in a pl/pgsql function