Re: Equivalant of SQL Server's Nchar and NVARCHAR

Lists: pgsql-sql
From: "kumar" <sgnerd(at)yahoo(dot)com(dot)sg>
To: "pgsql" <pgsql-sql(at)postgresql(dot)org>
Subject: Equivalant of SQL Server's Nchar and NVARCHAR
Date: 2004-04-29 10:11:43
Message-ID: 011201c42dd2$69245f70$7502a8c0@hdsc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

Dear friends,
Is there any equivalent datatype of SQL Server's NCHAR and NVARCHAR, available with Postgres 7.3.4. I want to store characters, special characters and Numbers.
Please shed some light.

Thanks
Kumar


From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Equivalant of SQL Server's Nchar and NVARCHAR
Date: 2004-04-29 13:05:00
Message-ID: 20040429150500.C561@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

> Dear friends,
> Is there [...]

> Please shed some light.
http://www.postgresql.org/docs/7.4/static/index.html

> Thanks
You are welcome.

Karsten
--
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346


From: Rob <pgadmin(at)itsbeen(dot)sent(dot)com>
To: kumar <sgnerd(at)yahoo(dot)com(dot)sg>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Equivalant of SQL Server's Nchar and NVARCHAR
Date: 2004-04-29 14:18:36
Message-ID: 40910EBC.1090807@itsbeen.sent.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

kumar wrote:

> Dear friends,
> Is there any equivalent datatype of SQL Server's NCHAR and NVARCHAR,
> available with Postgres 7.3.4. I want to store characters, special
> characters and Numbers.
> Please shed some light.
>
> Thanks
> Kumar

I only only use ascii but...
I believe postgresql varchar is the same as Oracle/Sybase/MS SQL
nvarchar even though it doesn't explicitly say so here:

http://www.postgresql.org/docs/7.4/static/datatype-character.html

Here is a short example:
create table
nvctest (
utf8fld varchar(12)
);
insert into nvctest
select convert('PostgreSQL' using ascii_to_utf_8);
select * from nvctest;

text functions including encoding conversions are here:

http://www.postgresql.org/docs/current/static/functions-string.html
and
http://www.postgresql.org/docs/current/static/functions-string.html#CONVERSION-NAMES

Good Luck,

Rob


From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Rob <pgadmin(at)itsbeen(dot)sent(dot)com>, kumar <sgnerd(at)yahoo(dot)com(dot)sg>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Equivalant of SQL Server's Nchar and NVARCHAR
Date: 2004-04-29 19:20:01
Message-ID: 200404291220.01457.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

Kumar,

> I only only use ascii but...
> I believe postgresql varchar is the same as Oracle/Sybase/MS SQL
> nvarchar even though it doesn't explicitly say so here:

All of our TEXT datatypes are multibyte-capable, provided you've installed
PostgreSQL correctly. This includes:
TEXT (recommended)
VARCHAR
CHAR

--
-Josh Berkus
Aglio Database Solutions
San Francisco