Thread: ...

...

From
Postgres
Date:
Hi all

How can i put limited length varchar(20) to SQL function?
I have:
create table bb (
        c       varchar(20),
        d       int4
);

create function ins ( ???varchar???, int4) returns int4
    as 'insert into bb (c, d) values ($1, $2);
            select 1;
           '
        language 'sql'
;

but if i:
select ins('foo', 1);

then:
 select * from bb;
c  |     d
---+------
foo|340322
(1 row)

340322 != 1 ?????

How can i fix this ?

Thank you for reading !
And many many thanks for answering !

Bye
    kep:)