Variable length custom data types help
От | Morgan Kita |
---|---|
Тема | Variable length custom data types help |
Дата | |
Msg-id | 08B420FF5BF7BC42A064212C2EB768801C1091@neutron.verseon.com обсуждение исходный текст |
Ответы |
Re: Variable length custom data types help
|
Список | pgsql-novice |
Ok I am creating some important custom data types for my DB. The data should be stored as an array of strucs, which themselvescontain a few different data fields. Anyways I wrote the input function in C when I realized I had a problem. The arrays will not always contain the same number of structures, and as such should be variable length. I read the pagesin the manual on custom data type creation, and I noticed that you can do this by setting the first word of the storedbytes to be the total length in bytes of the stored object. So my question is, given that this is a typed array, whatis the best way to represent this in the c code? In the end I am returning a pointer correct? What is the type of thepointer I should be returning? I guess I really don't understand how the memory returned by the pointer is going to beparsed by Postgres. I thought of making the first member of the array a dummy structure whose first data field would containthe length. However, that doesn't sound implementation independant and I think it would be better if I actually understoodhow the DB will actually parse the pointer that my function returns. Also I have a related question... from what I read in the manual; by creating the type as variable length that automaticallymakes it toasted in the DB. Is that the case, and if so, do I have to do anything else other than untoast itin my output function? Thanks, Morgan
В списке pgsql-novice по дате отправления: