From: | Andreas Seltenreich <seltenreich(at)gmx(dot)de> |
---|---|
To: | Danilo Fortunato <danilo(dot)fortunato(dot)2(at)gmail(dot)com> |
Cc: | pgsql-docs(at)postgresql(dot)org |
Subject: | Re: What is the meaning of the N string operator ? |
Date: | 2015-06-07 21:32:43 |
Message-ID: | 87bngrp5l0.fsf@ex.ansel.ydns.eu |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-06-07 21:37:21 | Re: What is the meaning of the N string operator ? |
Previous Message | Danilo Fortunato | 2015-06-07 20:44:18 | What is the meaning of the N string operator ? |