From: | "Sim Zacks" <sim(at)compulab(dot)co(dot)il> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | new type question |
Date: | 2005-10-16 09:03:52 |
Message-ID: | dit533$b6k$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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?
I was expecting a message like:
NOTICE: type "uint2" is not yet defined
DETAIL: Creating a shell type definition.
but instead I got:
ERROR: type "uint2" does not exist
create function uint_in(val cstring) returns uint2 as
$$
declare thisval int4;
begin
thisval=val::int4
if thisval between 0 and 65535 then
return (thisval-32768)::int2;
else
return 0;
end if;
end
$$ language 'plpgsql';
From | Date | Subject | |
---|---|---|---|
Next Message | Martijn van Oosterhout | 2005-10-16 12:49:39 | Re: new type question |
Previous Message | Sim Zacks | 2005-10-16 07:18:27 | Re: unsigned types |