Is querying SPITupleTable with SQL possible?

From: Tom Mercha <mercha_t(at)hotmail(dot)com>
To: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Is querying SPITupleTable with SQL possible?
Date: 2019-10-02 02:36:07
Message-ID: AM0PR04MB473728B53DDB36FC30C1A090F49C0@AM0PR04MB4737.eurprd04.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Hackers

I am using PostgreSQL's SPI to execute a simple SQL query (SELECT * FROM
...) via SPI_exec. As a a result, I get an SPITupleTable with the
results of my query.

Now that I have the SPITupleTable, I was wondering if it would be
possible to later query over it further in my SQL statements using SPI,
for example, something a bit similar to SPI_Exec ("Select * FROM
:mySPITupleTable", 0);

My motivation is to treat, and use the SPITupleTable as 'intermediate'
or 'temporary' tables which I would discard early - I want to apply a
series of manipulations to my SPITupleTable before I would finally store
it in the tablespace. Therefore, minimization of any overheads is also
very important. I understand that I could introduce a CREATE TABLE to my
SQL query and reference a table in that way, but I am under the
impression that it would incur unnecessary overheads?

So, I would be grateful if anyone could help me understand how to
manipulate the SPITupleTable further with SQL or indicate if it is at
all possible. In the case that it is not possible, I would also be
interested in alternatives and discussion on overheads.

Thanks in advance.

Best,
Tom

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2019-10-02 03:20:44 Re: dropdb --force
Previous Message Larry Rosenman 2019-10-02 01:44:38 Re: Peripatus: Can someone look?