From: | Miles Elam <miles(dot)elam(at)productops(dot)com> |
---|---|
To: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Cc: | mohand oubelkacem makhoukhene <mohand-oubelkacem(at)outlook(dot)com>, "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Implement a new data type |
Date: | 2020-08-11 13:38:39 |
Message-ID: | CAALojA__cLQag+VkvXr0CXq4fDiSyDziDjSCHNwk4Dt3VUQ3oA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Also of note: PostgreSQL already has a money type (
https://www.postgresql.org/docs/current/datatype-money.html)
But you shouldn't use it (
https://wiki.postgresql.org/wiki/Don%27t_Do_This#Don.27t_use_money)
I only bring it up so that you can know to make your money type a slightly
different name to avoid a conflict. Money is deceptively hard to implement
correctly. I'd recommend reading the second link if you have not already to
avoid previously known issues.
On Tue, Aug 11, 2020 at 5:02 AM Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
wrote:
> Hi
>
> út 11. 8. 2020 v 13:31 odesílatel mohand oubelkacem makhoukhene <
> mohand-oubelkacem(at)outlook(dot)com> napsal:
>
>> Hello;
>> I whould like to implement a new data type next to char, number,
>> varchar... A Money type.
>> So i'll have to change the source code, but i don't know which fonctions
>> i need to change and which part to work on.
>> I need some help to implement this new data type.
>>
>
> If you need to implement just a new data type, then you don't need to
> modify Postgres source code. You can write your own extension.
>
> For own custom type you need to write minimally "in" and "out" function,
> and then you can run "CREATE TYPE" statement
>
> one example of custom type can be a extension
> https://github.com/okbob/pgDecimal
>
> Regards
>
> Pavel
>
>
> Thank you and best regards
>> Mohand
>>
>>
>>
>>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2020-08-11 13:39:10 | Re: Implement a new data type |
Previous Message | Pavel Stehule | 2020-08-11 12:01:27 | Re: Implement a new data type |