Re: nvarchar notation accepted?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Jaime Casanova <jaime(at)2ndquadrant(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: nvarchar notation accepted?
Date: 2010-05-14 04:16:16
Message-ID: 1273810576.1066.0.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On tor, 2010-05-13 at 23:52 -0400, Tom Lane wrote:
> Takahiro Itagaki <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp> writes:
> > Jaime Casanova <jaime(at)2ndquadrant(dot)com> wrote:
> >> i migrate a ms sql server database to postgres and was trying some
> >> queries from the application to find if everything works right...
> >> when i was looking to those queries i found some that has a notation
> >> for nvarchar (ej: campo = N'sometext')
>
> > Do you have documentation for N'...' literal in SQLServer?
> > Does it mean unicode literal? What is the difference from U& literal?
> > http://developer.postgresql.org/pgdocs/postgres/sql-syntax-lexical.html
>
> > PostgreSQL doesn't have nvarchar types (UTF16 in MSSQL), and only
> > have mutlti-tyte characters. So I think you can remove N and just
> > use "SET client_encoding = UTF8" in the cases.
>
> Actually, the lexer translates N'foo' to NCHAR 'foo' and then the
> grammar treats that just like CHAR 'foo'. In short, the N doesn't do
> anything very useful, and it certainly doesn't have any effect on
> encoding behavior. I think this is something Tom Lockhart put in ten or
> so years back, and never got as far as making it actually do anything
> helpful.

This should maybe changed to just ignoring the N and treating N'' like
''.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Marc G. Fournier 2010-05-14 05:29:39 Re: List traffic
Previous Message Takahiro Itagaki 2010-05-14 04:03:45 Generalized Inverted Generalized Search Tree