2

I have this function:

create or replace function insert_aereo( aereo_type[] ) returns text as $$
begin
   return 'ok';
end
$$ language plpgsql;

and this is the parameter type that I created:

create type aereo_type as (codice int, modello varchar, marca varchar);

Then I call my function:

select insert_aereo('{123, "ciao", "pippo"}');

but I get this error:

ERROR:  function insert_aereo(unknown) is not unique at character 8
HINT:  Could not choose a best candidate function. You might need to add explicit type casts.
STATEMENT:  select insert_aereo('{123, "ciao", "pippo"}');
ERROR:  function insert_aereo(unknown) is not unique
LINE 1: select insert_aereo('{123, "ciao", "pippo"}');
               ^
HINT:  Could not choose a best candidate function. You might need to add explicit type casts.

How can I fix it? What am I doing wrong?

1 Answer 1

1

You are using a bad format for composed types:

The correct format is:

'{"(123, ciao, pippo)", "(...)"}

see: http://www.postgresql.org/docs/8.4/interactive/rowtypes.html

or ARRAY[(1,'ciao','pippo')]::t[]

Pavel

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.