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

2012-09-05 Thread Tom Lane
jam3  writes:
> I have searched and searched and just cannot find the maximum lengths for
> input variables in a function

> CREATE FUNCTION test(input1 char(5), input2 varchar(50))
> RETURNS void AS
> $$RAISE NOTICE('%,%'), $1, $2;$$
> LANGUAGE plpgsql;

> Where do I find the 5 and the 50 it has to be somewhere

No, it doesn't have to be, and it isn't.  As far as PG is concerned,
the inputs to this function are just of type "char" and "varchar".
You're allowed to write extra decoration but it's ignored.

regards, tom lane


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


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

2012-09-05 Thread Pavel Stehule
2012/9/5 Pavan Deolasee :
>
>
> On Wed, Sep 5, 2012 at 9:10 PM, jam3  wrote:
>>
>> I have searched and searched and just cannot find the maximum lengths for
>> input variables in a function
>>
>> i.e.
>>
>> CREATE FUNCTION test(input1 char(5), input2 varchar(50))
>> RETURNS void AS
>> $$RAISE NOTICE('%,%'), $1, $2;$$
>> LANGUAGE plpgsql;
>>
>>
>> Where do I find the 5 and the 50 it has to be somewhere I have searched
>> through
>> pg_proc
>> pg_type
>> pg_attribute (whose attlen only relates to tables)
>> pg_type
>>
>> and all possible manner of joining these tables.
>>
>
> Hmm. I only looked at the code and hence don't have a definite answer. But
> it seems that information is not stored anywhere. That might explain why the
> function you mentioned accepts parameters with any character length.
>

yes, this information is just ignored - functions drops typmods

Regards

Pavel

> Thanks,
> Pavan
>
>


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


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

2012-09-05 Thread Pavan Deolasee
On Wed, Sep 5, 2012 at 9:10 PM, jam3  wrote:

> I have searched and searched and just cannot find the maximum lengths for
> input variables in a function
>
> i.e.
>
> CREATE FUNCTION test(input1 char(5), input2 varchar(50))
> RETURNS void AS
> $$RAISE NOTICE('%,%'), $1, $2;$$
> LANGUAGE plpgsql;
>
>
> Where do I find the 5 and the 50 it has to be somewhere I have searched
> through
> pg_proc
> pg_type
> pg_attribute (whose attlen only relates to tables)
> pg_type
>
> and all possible manner of joining these tables.
>
>
Hmm. I only looked at the code and hence don't have a definite answer. But
it seems that information is not stored anywhere. That might explain why
the function you mentioned accepts parameters with any character length.

Thanks,
Pavan


[GENERAL] Where is the char and varchar length in pg_catalog for function input variables

2012-09-05 Thread jam3
I have searched and searched and just cannot find the maximum lengths for
input variables in a function

i.e.

CREATE FUNCTION test(input1 char(5), input2 varchar(50))
RETURNS void AS
$$RAISE NOTICE('%,%'), $1, $2;$$
LANGUAGE plpgsql;


Where do I find the 5 and the 50 it has to be somewhere I have searched
through 
pg_proc
pg_type
pg_attribute (whose attlen only relates to tables)
pg_type

and all possible manner of joining these tables.



--
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-tp5722845.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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