Re: How to convert a double value to a numeric datum type in pgsql?
От | Pavel Stehule |
---|---|
Тема | Re: How to convert a double value to a numeric datum type in pgsql? |
Дата | |
Msg-id | CAFj8pRBTnxdEx+DtWeEq6JGuJVgpUb0KJYfm81=Zz4Bu_L6frA@mail.gmail.com обсуждение исходный текст |
Ответ на | How to convert a double value to a numeric datum type in pgsql? (Felix.徐 <ygnhzeus@gmail.com>) |
Список | pgsql-general |
hello
you have to look to postgresql/src/backend/utils/adt/numeric.c functions - Pavel
2014-02-24 7:45 GMT+01:00 Felix.徐 <ygnhzeus@gmail.com>:
Hi all,I'm talking about the source code of pgsql and I want to know how the typing system works in pgsql.A few functions can help us do the type conversion, for example:Int32GetDatum -- convert a integer to a datumFloat8GetDatum -- convert double to a datumcstring_to_text -- convert a string to a text...but there are a lot of types in pgsql,how to choose the corresponding function? or is there a more automatic way to do the type conversion(raw chars to a datum, suppose I have the corresponding Form_pg_type instance)?I ask this question because I don't know how to convert a double value to a numeric datum(the field's type is numeric(10,2)), pg_type shows that numeric's typlen is -1 whose length is variable thus Float8GetDatum is not working..
В списке pgsql-general по дате отправления: