1
votes

I am trying to run the very last example from Table 7.49 in section 9.18. Array Functions and Operators 1:

SELECT unnest(ARRAY[1,2],ARRAY['foo','bar','baz']);

and it throws this error:

[42883] ERROR: function unnest(integer[], text[]) does not exist

Hint: No function matches the given name and argument types. You might need to add explicit type casts.

According to the results columns in table 7.49, it should give me:

--------------
| 1    | foo |
--------------
| 2    | bar |
--------------
| NULL | baz |
--------------

Is there something I missed in my configuration setup to cause this?

1

1 Answers

3
votes

You should use FROM clause:

SELECT * FROM unnest(ARRAY[1,2],ARRAY['foo','bar','baz']);

db<>fiddle demo