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 | 1346870989069-5722876.post@n5.nabble.com обсуждение исходный текст |
| Ответ на | Re: Where is the char and varchar length in pg_catalog for function input variables (Pavel Stehule <pavel.stehule@gmail.com>) |
| Ответы |
Re: Re: Where is the char and varchar length in pg_catalog for function input variables
|
| Список | pgsql-general |
How does postgres figure this out to throw the error msg?
create table test_table
(
column1 char(10),
column2 varchar(20)
) without oids;
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('1234567890','ABCDEFGHIJKLMNOPQRST')
select * from test_table;
-- 1234567890, ABCDEFGHIJKLMNOPQRST
select test1('this is way way longer than 10 characters','this is way way
way way way way way way way way way way longer than 20 characters')
ERROR: value too long for type character(10)
CONTEXT: SQL statement "insert into test_table values ($1, $2)"
PL/pgSQL function "test1" line 3 at SQL statement
********** Error **********
ERROR: value too long for type character(10)
--
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-tp5722845p5722876.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
В списке pgsql-general по дате отправления: