Re: Quick hack for fetching the contents of a temp table - Mailing list pgsql-general

From Michel Pelletier
Subject Re: Quick hack for fetching the contents of a temp table
Date
Msg-id CACxu=vJdj2aonCpwhOmQhAvOiF91b5tEAujUsg0Rcaze3o-CfQ@mail.gmail.com
Whole thread Raw
In response to Quick hack for fetching the contents of a temp table  (Souvik Bhattacherjee <kivuosb@gmail.com>)
Responses Re: Quick hack for fetching the contents of a temp table  (Souvik Bhattacherjee <kivuosb@gmail.com>)
List pgsql-general
On Tue, Apr 23, 2019 at 2:56 PM Souvik Bhattacherjee <kivuosb@gmail.com> wrote:
Hi,

I need to use the return value of the function somefunction1() to modify a query and execute it.

While it is easy to fetch the desired result using plpgsql functions(), however modifying and rewriting the query using the plpgsql does not seem straightforward. Therefore I have already written the query modification function within the postgres server since I need to use the results from pg_parse_query() method.


This question seems related to the other thread you started on April 18th?  Several of us suggested you use a CTE to materialize your intermediate values.  Did you try that?  The example you provided was not complete, and I asked for a reproducible example of what you were trying to achieve and you didn't provide one.  I'm all for encouraging people to hack in the core, but it seems like you have the impression that your goal is not possible in SQL when it very likely is.  Changing the core is not only going to be a high maintenance burden on you, but it also implies you have a problem that no one else in 30 years of postgres development has had.  What's more likely is that it is possible to do what you want in SQL and we'd like to help you, but we need more information and you need to try the suggestions and answer the questions we ask back of you.

I'm happy to be wrong about this, because that means postgres can improve in some way, but first we need more information about what your problem actually is.

-Michel 

pgsql-general by date:

Previous
From: Souvik Bhattacherjee
Date:
Subject: Re: Is it possible to store the output of EXPLAIN into a table
Next
From: Souvik Bhattacherjee
Date:
Subject: Re: Quick hack for fetching the contents of a temp table