Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New reserved word?

29 views
Skip to first unread message

Eliot Everingham

unread,
Nov 2, 1994, 11:24:14 AM11/2/94
to
I'm running 4.12. ISQL and 5.02. Online for OSF/1 v2.0 and having a problem
that seems to be caused by the use of a reserved word. The following SQL
statement produces a syntax error (the same statement works fine if "primary"
is changed to some other, unreserved word).

create table foo (primary char(1));

Can anyone verify this? Does the syntax error generated by the use of the
reserved word come from ISQL, or from the engine?

Thanks.

- Eliot

--
"I sold a quart of blood and bought a half a pint of scotch" - Tom Waits
Eliot Everingham - Raytheon Engineers and Constructors - e...@trac3000.ueci.com

Eliot Everingham

unread,
Nov 2, 1994, 12:23:06 PM11/2/94
to
Oops. Sorry for the repost. I forgot to fill in the versions.

I'm running 4.12.UE1 ISQL and 5.02.UC8 Online for OSF/1 v2.0 and having a

Jonathan Leffler

unread,
Nov 2, 1994, 12:38:06 PM11/2/94
to
>From: Eliot Everingham <e...@trac3000.ueci.com>
>Subject: New reserved word?
>Date: Wed, 2 Nov 1994 11:05:38 -0500 (EST)
>X-Informix-List-Id: <list.4971>
>
>I'm running 4.12. ISQL and 5.02. Online for OSF/1 v2.0 and having a problem

>that seems to be caused by the use of a reserved word. The following SQL
>statement produces a syntax error (the same statement works fine if "primary"
>is changed to some other, unreserved word).
>
>create table foo (primary char(1));
>
>Can anyone verify this? Does the syntax error generated by the use of the
>reserved word come from ISQL, or from the engine?

Yes, this is a genuine reserved reserved word. The error is produced by
the engine. In general, you can do ludicrous things in your create table
statements:

CREATE TABLE VIEW
(
DECIMAL CHAR(30),
NOT INTEGER NOT NULL,
SERIAL DATE NOT NULL,
NULL CHAR(1) NOT NULL,
INTEGER DECIMAL(13,6) NOT NULL
);

However, you cannot use the names PRIMARY, CHECK, FOREIGN, UNIQUE or
DISTINCT as column names. The detailed reasons for this must have to do
with the Yacc grammars used to parse the SQL, but these words are the
keywords used to introduce the 'Constraint-Definition Option' (p1-93 of the
6.00 Guide to SQL: Syntax Manual or p7-77 of the Informix Guide to SQL:
Reference Dec 1991 Manual). It does not document there that these words
are reserved. I don't know of any other reserved reserved words.

Yours,
Jonathan Leffler (jo...@informix.com) #include <disclaimer.h>

Eliot Everingham

unread,
Nov 2, 1994, 1:08:04 PM11/2/94
to
As Jonathan Leffler wrote:

>Yes, this is a genuine reserved reserved word. The error is produced by
>the engine. In general, you can do ludicrous things in your create table
>statements:

[...]


>(p1-93 of the
>6.00 Guide to SQL: Syntax Manual or p7-77 of the Informix Guide to SQL:
>Reference Dec 1991 Manual).

1991? I haven't had a problem with columns called "primary" with Online
4.0 or 4.1. With which version does this become an issue?

David I. Berg

unread,
Nov 2, 1994, 1:50:26 PM11/2/94
to
e...@trac3000.ueci.com (Eliot Everingham) writes:

>I'm running 4.12. ISQL and 5.02. Online for OSF/1 v2.0 and having a problem
>that seems to be caused by the use of a reserved word. The following SQL
>statement produces a syntax error (the same statement works fine if "primary"
>is changed to some other, unreserved word).

>create table foo (primary char(1));

>Can anyone verify this? Does the syntax error generated by the use of the
>reserved word come from ISQL, or from the engine?

"primary" is a reserved word for use in the syntax "primary key". This
is used by the engine for declaritive referential integrity in versions 5.0
and later.

- David

Jonathan Leffler

unread,
Nov 2, 1994, 4:23:05 PM11/2/94
to
As Eliot Everingham wrote:
>As Jonathan Leffler wrote:
>>Yes, this is a genuine reserved reserved word. The error is produced by
>>the engine. In general, you can do ludicrous things in your create table
>>statements:
>[...]
>>(p1-93 of the
>>6.00 Guide to SQL: Syntax Manual or p7-77 of the Informix Guide to SQL:
>>Reference Dec 1991 Manual).

>1991? I haven't had a problem with columns called "primary" with Online
>4.0 or 4.1. With which version does this become an issue?

The Dec 1991 manual is the 5.00 Manual. I'm not sure why the nomenclature
changed, but it did, for the one release. The Version 6 manuals have the
version number back again. Sorry, I forgot that this isn't obvious to
everybody.

0 new messages