build array of composites in SPI

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: build array of composites in SPI
Date: 2009-11-17 17:10:02
Message-ID: b42b73150911170910k2d4ebec0gdd6b1d5b60685e4a@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Trying to formulate a good strategy for $subject. The code is
performance critical.

The composite type is simple: (text, text), that needs to be routed to
function call in array form. The #elements in the array is small,
generally less than 10.

The approach I have now is this:
1) look up the oid for the composite and prepare tupledesc:
1a) TypeGetTupleDesc
2b) BlessTupleDesc

2) build the composite via:
2a) TupleDescGetAttInMetadata
2b) BuildTupleFromCStrings
2c) get datum/HeapTupleGetDatum

3) repeat to 2 until I have a Datum for each tuple

4) construct_array(datums, ndatums, comp_oid, -1, false, false)

5) PointerGetDatum directly on the ArrayType to get the oid to pass to SPI_execp

Does this look reasonable?

merlin

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Nick 2009-11-17 17:11:18 Re: Can anyone help setting up pgbouncer?
Previous Message Ivan Sergio Borgonovo 2009-11-17 16:36:09 impersonating a user/ownership problems