Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux