new type question

Поиск
Список
Период
Сортировка
От Sim Zacks
Тема new type question
Дата
Msg-id dit533$b6k$1@news.hub.org
обсуждение исходный текст
Ответы Re: new type question
Re: new type question
Список 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';



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

Предыдущее
От: Sim Zacks
Дата:
Сообщение: Re: unsigned types
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: new type question