From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Dann Corbit <DCorbit(at)connx(dot)com> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Richard_D_Levine(at)raytheon(dot)com, general(at)postgresql(dot)org, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [GENERAL] 'a' == 'a ' |
Date: | 2005-10-21 02:42:53 |
Message-ID: | 435855AD.6060207@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Dann Corbit wrote:
>>-----Original Message-----
>>From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
>>Sent: Thursday, October 20, 2005 2:54 PM
>>To: Dann Corbit
>>Cc: Richard_D_Levine(at)raytheon(dot)com; general(at)postgresql(dot)org; pgsql-
>>hackers(at)postgresql(dot)org
>>Subject: Re: [GENERAL] [HACKERS] 'a' == 'a '
>>
>>"Dann Corbit" <DCorbit(at)connx(dot)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
>
>
>
>
Yech.
What does one do in such a system if you want trailing blanks to be
significant, or even kept?
Anyway, the consensus seems to be that Postgresql's behavious is
consistent with a reasonable reading of the standard, so is there
anything really left to discuss, other than a possible addition to
documentation?
cheers
andrew
From | Date | Subject | |
---|---|---|---|
Next Message | Qingqing Zhou | 2005-10-21 06:39:26 | Win32 CHECK_FOR_INTERRUPTS() performance tweak |
Previous Message | William ZHANG | 2005-10-21 02:36:14 | Re: libpq's pollution of application namespace |