I am confused about the passing process of the parameter from functions created in Postgres:
create type IncorrectRecord as (pattern_number integer, uoc_number integer); create or replace function text1(pattern text, uoc_threshold integer) returns setof IncorrectRecord as $$ begin return next count(v1.code) as pattern_number, count(v2.code) as uoc_number from (select * from q1_1 where code like pattern) as v1, (select * from q1_1 where code like pattern and uoc > uoc_threshold) as v2; return; end $$ language plpgsql; I have modified some, there is no parameters errors but it still does not work. when I tested it with
select * from test1('ECO%', 8) error: function returns two columns.
Is there any thing wrong with the type? How can I fix it?.
returns IncorrectRecord- What isIncorrectRecord?code like patternand the second one is the count wherecode like pattern and uoc > uoc_threshold- you are using the wrong approach. Answering to your question, in short, it is impossible to use parameters in DDLs.