[GENERAL] interperting type oid in C code

2015-10-19 Thread Ken Been
I'm working on a foreign data wrapper and I want to switch based on the column type. Specifically, if the column type in the external table is the same as in the (locally defined) foreign table then I can get some speedup for some types. Through the ForeignScanState object I can get TupleDesc and

Re: [GENERAL] interperting type oid in C code

2015-10-19 Thread Ken Been
n, Oct 19, 2015 at 2:36 PM, Ken Been wrote: > >> I'm working on a foreign data wrapper and I want to switch based on the >> column type. Specifically, if the column type in the external table is the >> same as in the (locally defined) foreign table then I can get some spe

Re: [GENERAL] interperting type oid in C code

2015-10-19 Thread Ken Been
Those are more complicated, and it's not obvious to me how to use them. I really think that all I need is something as simple as "if (my_oid == INT4OID) {...}". Is there any reason why I shouldn't just do that? On Mon, Oct 19, 2015 at 7:08 PM, Alvaro Herrera wrot

Re: [GENERAL] interperting type oid in C code

2015-10-19 Thread Ken Been
Well, it's a few types, but the logic is different for each one, so they have to be handled independently anyway. On Mon, Oct 19, 2015 at 7:40 PM, Alvaro Herrera wrote: > Ken Been wrote: > > Those are more complicated, and it's not obvious to me how to use them. > I >

[GENERAL] carray_to_bytea?

2015-10-22 Thread Ken Been
I'd like to propose a carray_to_bytea function, similar to cstring_to_text_with_len, declared in src/include/utils.h and implemented in src/backend/utils/adt/varlena.c. The implementation would be the same as cstring_to_text_with_len, but with a different return type. I have put the implementatio

Re: [GENERAL] carray_to_bytea?

2015-10-22 Thread Ken Been
On Thu, Oct 22, 2015 at 4:12 PM, Tom Lane wrote: > Ken Been writes: > > I'd like to propose a carray_to_bytea function, similar to > > cstring_to_text_with_len, declared in src/include/utils.h and implemented > > in src/backend/utils/adt/varlena.c. The implementatio

Re: [GENERAL] carray_to_bytea?

2015-10-22 Thread Ken Been
at 5:16 PM, Jim Nasby wrote: > On 10/22/15 12:13 PM, Ken Been wrote: > >> My input is a byte array with a length. >> I can't assume zero-termination for varchar fields, so >> cstring_to_text_with_len >> is exactly what I need for those. For varbinary (i.e., byte