pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Susanne Ebrecht <susanne@2ndQuadrant.com>
To: Boszormenyi Zoltan <zb@cybertec.at>
Cc: pgsql-bugs@postgresql.org
Subject: Re: char(0)
Date: Mon, 17 Oct 2011 15:57:20 +0200
Message-ID: <4E9C3440.8090703@2ndQuadrant.com> (raw)
In-Reply-To: <4E9C3132.5060703@cybertec.at>
References: <4E9BD9E2.2010305@2ndQuadrant.com>
	<CA+U5nMLUFEDppTd_xbcfMQDVsh_AnNas-_CM-_A9OgJPYNZ_TA@mail.gmail.com>
	<4E9C1F5E.7000303@2ndQuadrant.com>
	<4E9C3132.5060703@cybertec.at>

Hello,

On 17.10.2011 15:44, Boszormenyi Zoltan wrote:
> 2011-10-17 14:28 keltezéssel, Susanne Ebrecht írta:
>> On 17.10.2011 10:30, Simon Riggs wrote:
>>> On Mon, Oct 17, 2011 at 8:31 AM, Susanne Ebrecht
>>> <susanne@2ndquadrant.com> wrote:
>>>
>>>> PostgreSQL isn't supporting CHAR(0).
>>> What does the SQL Standard say?
>>>
>>
>> Document: 02-Foundation
>>
>> Section: 4.2.1 Introduction to character strings
>>
>> Begin quoting
>> A character string is a sequence of characters. All the characters in 
>> a character string are taken from a single
>> character set. A character string has a length, which is the number 
>> of characters in the sequence. The length is
>> 0 (zero) or a positive integer.
>> End quoting
>
> I am looking at 6WD2_02_Foundation_2007-12.pdf.
> Search for "<character length>" that is used in section "6.1 <data 
> type>":
>
> <character length> := <unsigned integer> [ <char length units> ]
>
> Section 6.1 doesn't talk about limiting the definition to > 0 values
>
> But in page 157, section "5.3 <literal>":
>
> ============================================================
> 17) The declared type of a <character string literal> is fixed-length 
> character string. The length of a <character
> string literal> is the number of <character representation>s that it 
> contains. Each <quote symbol> contained
> in <character string literal> represents a single <quote> in both the 
> value and the length of the <character
> string literal>. The two <quote>s contained in a <quote symbol> shall 
> not be separated by any <separator>.
>
> NOTE 92 — <character string literal>s are allowed to be zero-length 
> strings (i.e., to contain no characters) even though it is
> not permitted to declare a <data type> that is CHARACTER with 
> <character length> 0 (zero).
> ============================================================
>
> So, a table column is not allowed to be char(0) or varchar(0). It's 
> explicit in NOTE 92.
>

I looked this up again.

I found more passages in which is written that it should start with 0.

But in the section you mentioned here - 1 is given.

That is a bug in SQL Standard. SQL Standard is inconsistent here.
The next SQL Standard meeting is next week.
Of course I will bring up this problem.
We will see what will be the outcome of it.

Susanne

-- 
Susanne Ebrecht - 2ndQuadrant
PostgreSQL Development, 24x7 Support, Training and Services
www.2ndQuadrant.com




view thread (12+ messages)  latest in thread

Message-ID: <4E9C3440.8090703@2ndQuadrant.com>
Permalink:  ../4E9C3440.8090703@2ndQuadrant.com/
Also on:    postgresql.org/message-id/4E9C3440.8090703@2ndQuadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: susanne@2ndQuadrant.com, zb@cybertec.at
  Subject: Re: char(0)
  In-Reply-To: <4E9C3440.8090703@2ndQuadrant.com>
  References: <4E9BD9E2.2010305@2ndQuadrant.com> <CA+U5nMLUFEDppTd_xbcfMQDVsh_AnNas-_CM-_A9OgJPYNZ_TA@mail.gmail.com> <4E9C1F5E.7000303@2ndQuadrant.com> <4E9C3132.5060703@cybertec.at> <4E9C3440.8090703@2ndQuadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox