Re: new type question - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: new type question
Date
Msg-id 20051016124933.GB5779@svana.org
Whole thread Raw
In response to new type question  ("Sim Zacks" <sim@compulab.co.il>)
List 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.

Attachment

pgsql-general by date:

Previous
From: "Sim Zacks"
Date:
Subject: new type question
Next
From: Lincoln Yeoh
Date:
Subject: Re: PostgreSQL Gotchas