Re: Where is the char and varchar length in pg_catalog for function input variables

Поиск
Список
Период
Сортировка
От jam3
Тема Re: Where is the char and varchar length in pg_catalog for function input variables
Дата
Msg-id 1346873633774-5722881.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: Where is the char and varchar length in pg_catalog for function input variables  (jam3 <jamorton3@gmail.com>)
Ответы Re: Where is the char and varchar length in pg_catalog for function input variables  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Re: Re: Where is the char and varchar length in pg_catalog for function input variables  ("David Johnston" <polobo@yahoo.com>)
Список pgsql-general
This is what I meant to post

drop table test_table;
create table test_table
(
    column1 char(20),
    column2 varchar(40)
) without oids;


drop function test1(char(10), varchar(20));
create or replace function test1(c1 char(10), c2 varchar(20))
returns void as
$$
BEGIN
insert into test_table values ($1, $2);
END
$$
language plpgsql

select
test1('12345678900123456789','ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCD')

select * from test_table;
12345678900123456789, ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789ABCD


Just showing that it does indeed not use the length in at all, and this just
seems wrong. I can definetly see situations where someone would put a length
on a in put var and get an an unexpected result, like the one above.



--
View this message in context:
http://postgresql.1045698.n5.nabble.com/Where-is-the-char-and-varchar-length-in-pg-catalog-for-function-input-variables-tp5722845p5722881.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


В списке pgsql-general по дате отправления:

Предыдущее
От: "Kevin Grittner"
Дата:
Сообщение: Re: max_connections
Следующее
От: "Kevin Grittner"
Дата:
Сообщение: Re: Where is the char and varchar length in pg_catalog for function input variables