Re: What is the meaning of the N string operator ? - Mailing list pgsql-docs

From Andreas Seltenreich
Subject Re: What is the meaning of the N string operator ?
Date
Msg-id 87bngrp5l0.fsf@ex.ansel.ydns.eu
Whole thread Raw
In response to What is the meaning of the N string operator ?  (Danilo Fortunato <danilo.fortunato.2@gmail.com>)
List 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 by date:

Previous
From: Danilo Fortunato
Date:
Subject: What is the meaning of the N string operator ?
Next
From: Tom Lane
Date:
Subject: Re: What is the meaning of the N string operator ?