Re: new type question

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Sim Zacks <sim(at)compulab(dot)co(dot)il>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: new type question
Date: 2005-10-16 12:49:39
Message-ID: 20051016124933.GB5779@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lincoln Yeoh 2005-10-16 14:00:25 Re: PostgreSQL Gotchas
Previous Message Sim Zacks 2005-10-16 09:03:52 new type question