From: | Michel Pelletier <pelletier(dot)michel(at)gmail(dot)com> |
---|---|
To: | Michael Lewis <mlewis(at)entrata(dot)com> |
Cc: | Souvik Bhattacherjee <kivuosb(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, "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-18 17:52:43 |
Message-ID: | CACxu=v+Duk5QzJhW1LO1s5TD9XCS_dhO0GoGNfvWLOzUms-gZA@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, Apr 18, 2019 at 9:06 AM Michael Lewis <mlewis(at)entrata(dot)com> wrote:
> Thus, what I'm looking for here is way to store the information and then
>> pass that information to the next query efficiently.
>> For example, is it possible to define a struct of my choice, private to
>> the current transaction, that would store the data and then pass it around
>> to the next query in the transaction without having to materialize that
>> struct (or deal with concurrency issues as in the hash table approach
>> mentioned earlier) .
>>
>
> Perhaps I am missing something obvious, but why not use a temp table?
>
Right, or as Adrian and I pointed out, use a CTE (WITH) query, which will
materialize any results you want for the query. Perhaps if you give us a
working, reproducible, self contained example of what you expect we can
help you better.
From | Date | Subject | |
---|---|---|---|
Next Message | Ron | 2019-04-18 17:58:49 | Re: SQL query |
Previous Message | Adrian Klaver | 2019-04-18 17:01:44 | Re: SQL query |