Delimited identifier length

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: PostgreSQL Development <pgsql-hackers(at)postgresql(dot)org>
Subject: Delimited identifier length
Date: 2000-10-03 14:26:43
Message-ID: 17576.970583203@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> Tom Lane writes:
>> I don't see any clear statement in SQL92 that <delimited identifiers>
>> can't have zero length, so I'm not convinced there's anything wrong here.

> Hmm, I do:

> <delimited identifier> ::=
> <double quote> <delimited identifier body> <double quote>

> <delimited identifier body> ::= <delimited identifier part>...

> <delimited identifier part> ::=
> <nondoublequote character>
> | <doublequote symbol>

> As opposed to, say, an empty character string literal:

> <character string literal> ::=
> [ <introducer><character set specification> ]
> <quote> [ <character representation>... ] <quote>
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> [ { <separator>... <quote> [ <character representation>... ] <quote> }... ]

Hmm, you're right --- if they meant to allow zero-length identifiers
they'd have written something like

<delimited identifier> ::=
<double quote> [ <delimited identifier body> ] <double quote>

I stand corrected.

Next question is do we want to change it? I can't imagine any real good
use for a null-string name, but is there any risk of breaking existing
applications?

The actual fix would be trivial --- just introduce a complaint for
strlen(literalbuf)==0 into parser/scan.l's <xd>{xdstop} rule.
I'm just wondering if we should change or not.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2000-10-03 14:46:24 Re: Autoconf version discrepancies
Previous Message Martin A. Marques 2000-10-03 13:26:04 Re: backup and restore