4

I have the following function (using postgres 9.4)

create or replace function toto()  RETURNS text[] AS $$
  DECLARE
    threed text[];
  BEGIN
    select array (select tata from hello)  into threed;
    raise notice 'HERE %',threed;
    return threed;
  END;
$$ LANGUAGE plpgsql;

No problem on creation, I ran the function in psql and I get:

 select from toto();
 NOTICE:  HERE {055,056,057,058,059}
 --
 (1 row)

The notice displays the correct results. What I do not understand is why the results themselves are not displayed ? Where am I wrong ? Thanks for any pointer and help

2
  • 1
    select toto() or select * from toto() Commented Mar 6, 2017 at 17:30
  • For me UNNEST did the trick SELECT * FROM UNNEST(toto()) Commented Jul 29, 2021 at 7:48

1 Answer 1

2

Sorry stupid error I was calling the function as select toto() instead of select * toto();

took me a day to find out :(

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.