No length checking for "name" input

Started by Donald Fraserabout 20 years ago2 messagesbugs
Jump to latest
#1Donald Fraser
postgres@kiwi-fraser.net

PostgreSQL versions: 7.4.x and 8.0.x
(I don't have a 8.1.x installation to test against)

There appears to be no length checking for data types of "name".

For example:
template1=# SELECT length('rpt_cisx_total_principal_amount_of_security_type_between_dates('::name) AS name_len;
name_len
----------
63
(1 row)

I get exactly the same result for this query which is obviously not the same length and yet I get no error?

template1=# SELECT length('rpt_cisx_total_principal_amount_of_security_type_between_dates(date,date)'::name) AS name_len;
name_len
----------
63
(1 row)

I don't know whether you consider this a bug, certainly most of the other data types appear to have range checking as part of the input.

Regards
Donald Fraser

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Donald Fraser (#1)
Re: No length checking for "name" input

"Donald Fraser" <postgres@kiwi-fraser.net> writes:

There appears to be no length checking for data types of "name".

What there is is automatic truncation to the maximum allowed length (63
by default). This is the same behavior specified for identifiers in the
SQL standard, and it's also the same behavior as for, say, casting to
varchar(63). So I don't see why you'd expect something different.

regards, tom lane