public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andreas Seltenreich <[email protected]>
To: Danilo Fortunato <[email protected]>
Cc: [email protected]
Subject: Re: What is the meaning of the N string operator ?
Date: Sun, 07 Jun 2015 23:32:43 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-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


-- 
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs



view thread (4+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: What is the meaning of the N string operator ?
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox