Re: AW: [HACKERS] varchar() vs char16 performance - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: AW: [HACKERS] varchar() vs char16 performance
Date
Msg-id 3511558A.CF8A0A83@alumni.caltech.edu
Whole thread Raw
In response to AW: [HACKERS] varchar() vs char16 performance  (Zeugswetter Andreas <andreas.zeugswetter@telecom.at>)
Responses Re: AW: [HACKERS] varchar() vs char16 performance
List pgsql-hackers
> I had thought that char2-16 add _no_ functionality over the char() and
> varchar() types; Tatsuo points out at least one capability which they
> have. Are there any others?
>
> They give and take a char * pointer to a C function like
> create function upper(char16)
> returning char16 as '/u/my/upper.so' language 'sql';
> whereas char() gives a varlena pointer.

I don't really see this as a big deal since, for example, only 16 bytes
are allocated for a char16, so it is not guaranteed to be zero delimited
and you have to make a working copy to use libc functions anyway. Also,
that is really an implementation detail or annoyance rather than a
user-visible feature.

With the macros that are provided for the varlena structure
manipulations, things are pretty convenient. Are there more macros which
could be helpful here??

                       - Tom

pgsql-hackers by date:

Previous
From: Massimo Dal Zotto
Date:
Subject: Re: [HACKERS] Re: [PATCHES] patches for 6.2.1p6
Next
From: Zeugswetter Andreas
Date:
Subject: Re: [HACKERS] varchar() vs char16 performance