Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread Michael Lewis
You could also just return the name of the temp table, or return nothing and directly use that name manually outside the function to do select * from pg_temp.my_data

Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread Marc Millas
Hi, Just one question Isn't it possible to write a function that return an oid? So.. One can write a function which create a temp table, feed it according to parameters and then return the oid of the created temp table. No?? Le ven. 19 nov. 2021 à 23:48, David G. Johnston a écrit : > On Fri, No

Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread David G. Johnston
On Fri, Nov 19, 2021 at 3:37 PM Abdul Mohammed wrote: > I read somewhere that you could have a table as a return type. I, > therefore tried using the pivot table alias as the return type but got an > error along lines of the alias not being recognized. > A table in that context is something you

Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread Abdul Mohammed
Many thanks for the explanations David. My failed attempts and your explanations have forced me to realise that I need to spend some time learning to walk before attempting to run. Much regards On Fri, Nov 19, 2021 at 1:31 PM David G. Johnston < david.g.johns...@gmail.com> wrote: > On Thu, Nov 1

Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread Abdul Mohammed
Thank you very much for your response Tom. I will follow your recommendations. As for the 3rd one, I am actually trying to output the pivot table I am trying to create using crosstab. I read somewhere that you could have a table as a return type. I, therefore tried using the pivot table alias as th

Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread David G. Johnston
On Thu, Nov 18, 2021 at 4:24 AM Abdul Mohammed wrote: > The second part tries to use the string to build a pivot table using the > crosstab function. > Aside from the simple learning curve on how to write functions in PostgreSQL you also are dealing with the fact that you are dealing with a quer

Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread Tom Lane
Abdul Mohammed writes: > Sorry for the late response and thank you Pavel for answering. This is my > first exposure to pgsql, so please bear with me. I am still getting the > Context message. Here is the modified function: I tried this, and after creating a dummy "question" table I got ERROR:

Re: Execute command in PL/pgSQL function not executing

2021-11-19 Thread Abdul Mohammed
Sorry for the late response and thank you Pavel for answering. This is my first exposure to pgsql, so please bear with me. I am still getting the Context message. Here is the modified function: CREATE OR REPLACE FUNCTION survey_ct () RETURNS SETOF text AS $$ DECLARE rec RECORD; DECLARE str text;

Re: check scripts after database code change

2021-11-19 Thread Dennis
Thanks Ron; this is exactly what i was looking for. I would like to know if there are different things like this Dennis On Fri, Nov 19, 2021 at 11:07 AM Ron wrote: > There's a regression test suite. > https://www.postgresql.org/docs/current/regress.html > > On 11/19/21 2:01 AM, Dennis wrote: > >

Re: check scripts after database code change

2021-11-19 Thread Ron
There's a regression test suite. https://www.postgresql.org/docs/current/regress.html On 11/19/21 2:01 AM, Dennis wrote: > Who made what changes in what code? I want to make special developments in the database code. > Development of what and whose beta? to check after making changes and cu

Re: check scripts after database code change

2021-11-19 Thread Dennis
> Who made what changes in what code? I want to make special developments in the database code. > Development of what and whose beta? to check after making changes and customizations in the database code >This is going to need a more detailed explanation before there can be an answer more sophi