Re: How to return argument data type from sql function

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: How to return argument data type from sql function
Дата
Msg-id CAKFQuwYd_B6wjgFFUa9_tB14qXw1m8k9Ss1cMFLcAiuLH=SpAA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How to return argument data type from sql function  (Andrus <kobruleht2@hot.ee>)
Список pgsql-general
On Fri, Oct 14, 2022 at 2:56 PM Andrus <kobruleht2@hot.ee> wrote:

select torus(charcol) :: CHAR( ColWidth('public', 'test',  'charcol')  ) from test

This throws error in Postgres. ColWidth is immutable and called with constant arguments so it should work. How to fix postgres to allow constant ColWidth() expression in cast ?

ColWidth is NOT IMMUTABLE, your declaration of that property is a lie (the function in your email actually defines it as volatile though...).  It is STABLE.

You are basically stuck dealing with this one layer up, outside the server.  You would need to execute ColWidth then write the returned value of the function call into the text body of the SQL Command.

David J.

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

Предыдущее
От: Andrus
Дата:
Сообщение: Re: How to return argument data type from sql function
Следующее
От: Tom Lane
Дата:
Сообщение: Re: How to return argument data type from sql function