Re: Method to pass data between queries in a multi-statement transaction

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Souvik Bhattacherjee <kivuosb(at)gmail(dot)com>
Cc: "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: Method to pass data between queries in a multi-statement transaction
Date: 2019-04-17 22:16:24
Message-ID: CAKFQuwbcu84T9rEfrfWycF0PhScEyQNztbLiWY-N7wgVn6BaNg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Apr 17, 2019 at 3:04 PM Souvik Bhattacherjee <kivuosb(at)gmail(dot)com>
wrote:

> Hello,
>
> I'm trying to pass some values between queries in a multi-statement
> transaction. For example, consider the following representative
> multi-statement transaction:
>
> begin;
> select * from table1 t1, table2 t2 where t1.cid = t2.cid;
> delete from table1 where cid in
> (values-to-be-populated-from-the-previous-query);
> commit;
>

There are few if any situations where you need to immediately and
completely pass all values from one query to another in the same
transaction where the queries cannot just be combined into a single
statement. Your representative example is one that is easily combined into
a single statement.

Now, the stuff you are trying seems to indicate you are trying to do
something in C, inside the engine itself, with all of this. If that is the
case you may want to be more clear as to what you are attempting to do.
But as far as server SQL goes the only persistence area are
tables/relations - including temporary ones.

David J.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2019-04-17 22:19:15 Re: is it possible to create partitioned tables using tables from different schemas
Previous Message Souvik Bhattacherjee 2019-04-17 22:04:01 Method to pass data between queries in a multi-statement transaction