I created a function that returns an
text[]
which works as it should
CREATE OR REPLACE FUNCTION another_function_array()
RETURNS text[] AS $$
SELECT array_agg(column_name::text)
FROM information_schema.columns
WHERE table_schema = 'abc' AND table_name = 'xyz'
$$
LANGUAGE SQL;
Now I want to use that function in another function:
CREATE OR REPLACE FUNCTION get_array()
RETURNS VOID AS $$
DECLARE
arr text[] := another_function_array()
$$ LANGUAGE plpgsql;
and it gives me the output
Error: ERROR: syntax error at end of input Position: 107 SQLState: 42601 ErrorCode: 0
Ok so the
;
at the end of
arr text[] := another_function_array()
is missing was my first guess but when I add it I get the error
java.lang.ArrayIndexOutOfBoundsException Error occurred in: CREATE OR REPLACE FUNCTION get_array() RETURNS VOID AS $$ DECLARE arr text[] := another_function_array()
and now I'm a little bit confused cause I must be missing something fundamental here
the problem with the assignment is, that SQUIRREL is looking for a separator which is
;
a solution to that problem can be found here