Re: new type question

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: new type question
Дата
Msg-id 20051016124933.GB5779@svana.org
обсуждение исходный текст
Ответ на new type question  ("Sim Zacks" <sim@compulab.co.il>)
Список pgsql-general
On Sun, Oct 16, 2005 at 11:03:52AM +0200, Sim Zacks wrote:
> I tried to create a new type with input and output functions in plpgsql and
> it didn't work.
> The error I got is there is no type uint2.
> Is this because plpgsql does not allow you to create input/output fuctions?
> It is a very simple function, so I didn't want to do it in C.
> Is there a reason that it only works in C and not plpgsql?

Unfortunatly, I don't think type input/output functions can be written
in anything other than C. IIRC, no other PL understands the cstring type.

As for why, well, because nobody has done the legwork yet. Oh yes, type
input/output functions are also called at various points, including
during parsing where there is no current snapshot. Whether the PLs are
affected by this I don't know, but you cannot do SPI at that point.

Hope this helps,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Patent. n. Genius is 5% inspiration and 95% perspiration. A patent is a
> tool for doing 5% of the work and then sitting around waiting for someone
> else to do the other 95% so you can sue them.

Вложения

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

Предыдущее
От: "Sim Zacks"
Дата:
Сообщение: new type question
Следующее
От: Lincoln Yeoh
Дата:
Сообщение: Re: PostgreSQL Gotchas