Re: [GENERAL] 'a' == 'a ' - Mailing list pgsql-hackers

From Dann Corbit
Subject Re: [GENERAL] 'a' == 'a '
Date
Msg-id D425483C2C5C9F49B5B7A41F8944154757D222@postal.corporate.connx.com
Whole thread Raw
Responses Re: [GENERAL] 'a' == 'a '
List pgsql-hackers
> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Thursday, October 20, 2005 2:54 PM
> To: Dann Corbit
> Cc: Richard_D_Levine@raytheon.com; general@postgresql.org; pgsql-
> hackers@postgresql.org
> Subject: Re: [GENERAL] [HACKERS] 'a' == 'a '
>
> "Dann Corbit" <DCorbit@connx.com> writes:
> > I guess that additional ambiguity arises if you add additional
spaces to
> > the end.  Many database systems solve this by trimming the
characters
> > from the end of the string upon storage and the returned string will
not
> > have any trailing blanks.
>
> Can you document that?  ISTM that that would effectively make char(n)
> and varchar(n) exactly equivalent, which is ... um ... a bit stupid.

This is SQL*Server:

drop table test_char
go
create table test_char( fixed_30 char(30), varch_30 varchar(30), nchar_30  nchar(30), nvarc_30 nvarchar(30)
)
go
insert into test_char values('Dann ', 'Dann ', 'Dann ', 'Dann ')
go
select len(fixed_30), len(varch_30), len(nchar_30), len(nvarc_30)
from test_char
go

Result set:
4    4    4    4



pgsql-hackers by date:

Previous
From: Christopher Kings-Lynne
Date:
Subject: Re: [COMMITTERS] pgsql: Clean up some obsolete statements about GiST
Next
From: "William ZHANG"
Date:
Subject: Re: libpq's pollution of application namespace