Re: What is the meaning of the N string operator ?

Поиск
Список
Период
Сортировка
От Andreas Seltenreich
Тема Re: What is the meaning of the N string operator ?
Дата
Msg-id 87bngrp5l0.fsf@ex.ansel.ydns.eu
обсуждение исходный текст
Ответ на What is the meaning of the N string operator ?  (Danilo Fortunato <danilo.fortunato.2@gmail.com>)
Список pgsql-docs
Danilo Fortunato writes:

> Can anybody explain the meaning of the N string operator ?
> Is there a section in the PostgreSQL documentation that describes it ?

I couldn't find it in the manual either, but using it seems to yield
values of type char instead of varchar/text:

,----
| scratch=# select N'foo   ';
|  bpchar
| --------
|  foo
|
| scratch=# \dT bpchar
|                                 List of data types
|    Schema   |   Name    |                       Description
| ------------+-----------+---------------------------------------------------------
|  pg_catalog | character | char(length), blank-padded string, fixed storage length
`----

In contrast to the N'' input syntax, the blank-padding type itself is
documented under "Character Types" and leads to different semantics with
various operators/functions.  E.g.:

,----
| scratch=# select length(N'foo   '), length('foo   ');
|  length | length
| --------+--------
|       3 |      6
| (1 row)
`----

regards,
Andreas


В списке pgsql-docs по дате отправления:

Предыдущее
От: Danilo Fortunato
Дата:
Сообщение: What is the meaning of the N string operator ?
Следующее
От: Tom Lane
Дата:
Сообщение: Re: What is the meaning of the N string operator ?