public inbox for [email protected]
help / color / mirror / Atom feedWhat is the meaning of the N string operator ?
4+ messages / 3 participants
[nested] [flat]
* What is the meaning of the N string operator ?
@ 2015-06-07 20:44 Danilo Fortunato <[email protected]>
0 siblings, 3 replies; 4+ messages in thread
From: Danilo Fortunato @ 2015-06-07 20:44 UTC (permalink / raw)
To: pgsql-docs
In the SQL code related to Greenplum Database (which is based on
PostgreSQL) generated by a query and reporting tool, a noticed a "N"
operator put before a lot of strings.
For example:
case when column_a <> N'#' then column_a
when column_b <> N'#' then column_b
else NULL
end
I executed this SQL code, and I found out that it is valid.
In the PostgreSQL documentation I didn't find a description of this
operator (though it is not easy to search for).
However, I found a description of the E (escape) and B (binary) string
operators.
Can anybody explain the meaning of the N string operator ?
Is there a section in the PostgreSQL documentation that describes it ?
Thanks,
Danilo Fortunato
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: What is the meaning of the N string operator ?
@ 2015-06-07 21:32 Andreas Seltenreich <[email protected]>
parent: Danilo Fortunato <[email protected]>
2 siblings, 0 replies; 4+ messages in thread
From: Andreas Seltenreich @ 2015-06-07 21:32 UTC (permalink / raw)
To: Danilo Fortunato <[email protected]>; +Cc: 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
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: What is the meaning of the N string operator ?
@ 2015-06-07 21:37 Tom Lane <[email protected]>
parent: Danilo Fortunato <[email protected]>
2 siblings, 0 replies; 4+ messages in thread
From: Tom Lane @ 2015-06-07 21:37 UTC (permalink / raw)
To: Danilo Fortunato <[email protected]>; +Cc: pgsql-docs
Danilo Fortunato <[email protected]> writes:
> Can anybody explain the meaning of the N string operator ?
The SQL standard says that N'foo' is a literal of the data type NATIONAL
CHARACTER. PG supports this syntax (and the type name) but treats it the
same as plain character/varchar.
> Is there a section in the PostgreSQL documentation that describes it ?
I don't see it offhand. I think it's pretty much useless/deprecated
anyway so I'm not sure it's worth documenting.
regards, tom lane
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: What is the meaning of the N string operator ?
@ 2015-06-14 19:56 Danilo Fortunato <[email protected]>
parent: Danilo Fortunato <[email protected]>
2 siblings, 0 replies; 4+ messages in thread
From: Danilo Fortunato @ 2015-06-14 19:56 UTC (permalink / raw)
To: pgsql-docs
Thanks a lot for your support.
Danilo
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2015-06-14 19:56 UTC | newest]
Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-06-07 20:44 What is the meaning of the N string operator ? Danilo Fortunato <[email protected]>
2015-06-07 21:32 ` Andreas Seltenreich <[email protected]>
2015-06-07 21:37 ` Tom Lane <[email protected]>
2015-06-14 19:56 ` Danilo Fortunato <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox