array questions still stands

Started by Brett McCormickalmost 28 years ago2 messages
#1Brett McCormick
brett@abraxas.scene.com

silly me, it turned out the function had two arguments, and the second
argument just happened to coincide with the type of the array.

When writing a c function to be dynamically loaded and called from
postgres, how do you find out the base element type of an array that
you're accepting as an arugment (getting called with). array_in/out
seem to get passed this value, wheras my function just gets the
pointer without knowing what the underlying data is. do I have to
look this up once inside the function? or, if I know what I'm
getting, can I fudge it? (i.e. treat them as what I expect them to be
(int4s) without regard for what they actually are). that doesn't
sound so good to me.

I'd appreciate any help!

--brett

#2Brett McCormick
brett@abraxas.scene.com
In reply to: Brett McCormick (#1)
Re: [HACKERS] array questions still stands

Okay, I suppose more obviously i've just got an array of integers (by
value) @ ARR_DATA_PTR(array), so I don't have much to worry about.

On Sun, 25 January 1998, at 11:10:21, Brett McCormick wrote:

Show quoted text

silly me, it turned out the function had two arguments, and the second
argument just happened to coincide with the type of the array.

When writing a c function to be dynamically loaded and called from
postgres, how do you find out the base element type of an array that
you're accepting as an arugment (getting called with). array_in/out
seem to get passed this value, wheras my function just gets the
pointer without knowing what the underlying data is. do I have to
look this up once inside the function? or, if I know what I'm
getting, can I fudge it? (i.e. treat them as what I expect them to be
(int4s) without regard for what they actually are). that doesn't
sound so good to me.

I'd appreciate any help!

--brett