Name type in postgres

Started by mohsen soodkhah mohammadiabout 12 years ago2 messages
#1mohsen soodkhah mohammadi
mohsensoodkhah@gmail.com

hello.
I want do understand that did can we have name without null-terminator?
in src/backend/util/adt/name.c in nameout() function is:
Name s = PG_GETARG_NAME(0);
PG_RETURN_CSTRING(pstrdup(NameStr(*s)));
what do the pstrdup() function?
do this function create string from name with null-terminate?

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: mohsen soodkhah mohammadi (#1)
Re: Name type in postgres

mohsen soodkhah mohammadi <mohsensoodkhah@gmail.com> writes:

I want do understand that did can we have name without null-terminator?

No. Possibly that was the original intention, but for many years the
system has enforced that Name contains at least one trailing null byte, ie
the maximum usable length of identifiers is NAMEDATALEN-1. So the code
you quote is valid.

regards, tom lane

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