Обсуждение: Integrating New Data Type

Поиск
Список
Период
Сортировка

Integrating New Data Type

От
Nick Raj
Дата:
Hi all,
I have defined a new data type. I have defined in and out function for that data type.
But i want to know how to integrate this data type with postgres (how postgres compile my code or know my datatype) ?

Thanks,
Nirmesh

Re: Integrating New Data Type

От
Pavel Stehule
Дата:
Hello

2011/4/5 Nick Raj <nickrajjain@gmail.com>:
> Hi all,
> I have defined a new data type. I have defined in and out function for that
> data type.
> But i want to know how to integrate this data type with postgres (how
> postgres compile my code or know my datatype) ?

you have to register in, out functions, you have to register new type

look to postgresql sources - contrib, there is very simple type citext

http://doxygen.postgresql.org/dir_23dd6926f287bddac2c9dcb7db5b1712.html

http://doxygen.postgresql.org/citext_8c-source.html

Any contrib module has sql file with registrations

Regards

Pavel Stehule


>
> Thanks,
> Nirmesh
>

Re: Integrating New Data Type

От
Radosław Smogura
Дата:
Pavel Stehule <pavel.stehule@gmail.com> Tuesday 05 April 2011 10:11:02
> Hello
>
> 2011/4/5 Nick Raj <nickrajjain@gmail.com>:
> > Hi all,
> > I have defined a new data type. I have defined in and out function for
> > that data type.
> > But i want to know how to integrate this data type with postgres (how
> > postgres compile my code or know my datatype) ?
>
> you have to register in, out functions, you have to register new type
>
> look to postgresql sources - contrib, there is very simple type citext
>
> http://doxygen.postgresql.org/dir_23dd6926f287bddac2c9dcb7db5b1712.html
>
> http://doxygen.postgresql.org/citext_8c-source.html
>
> Any contrib module has sql file with registrations
>
> Regards
>
> Pavel Stehule
>
> > Thanks,
> > Nirmesh

As well creating and registering new type is well documented - I think
somewhere about types and C procedures.
http://www.postgresql.org/docs/9.0/static/sql-createtype.html
http://www.postgresql.org/docs/9.0/static/xtypes.html
Regards,
Radek