Re: Reserved words
Posted in 1993
>From: gaffer@rec.com (Andrew Beattie)
>Subject: Reserved words
>Date: Thu, 11 Nov 1993 08:44:11 GMT
>X-Informix-List-Id: <news.4859>
>
>Something that's been irritating me of late...
>
>ISQL will let me do this:
> create table foo (
> absolute char(1),
> accept char(1),
> after char(1),
> array char(1),
> ascending char(1),
> ascii char(1),
> at char(1),
> attribute char(1),
> attributes char(1),
> average char(1)
> );>
>But I think that you would agree that it is rather of a bad idea :-)
>(This example is contrived, but it reflects a technique that I often use
>for shooting myself in the foot).
>
>It would be rather nice if the back end refused to create tables or fields
>with names that are reserved words in *any* Informix product (or at least
>warned you that it was probably a bad idea).
>
>Any hope?
Hi, Mr Beattie,
No.
Or rather, there are very few places where using a keyword as an identifier
still causes trouble, and these are documented in places like the 4.10
supplement. Considerable effort was put into making keywords re-usable,
largely to protect the innocents who have things like a column called
REFERENCES -- an impeccable column name up until the 5.0 engines arrived on
the scene. It also means that you should be able to design code (domain)
tables with the structure: CREATE TABLE Domain (Code CHAR(n) NOT NULL
PRIMARY KEY CONSTRAINT Pk_domain, Name CHAR(60) NOT NULL); where the
keyword Name, used in I4GL, should not cause troubles. The keyword
sensitivity was removed in 4.10 -- don't try it with 4.00.
Incidentally, I think your table was too modest in its attempt to confuse.
What's wrong with:
CREATE TABLE Table
(
Char DECIMAL(16,4),
Null CHAR(10) NOT NULL,
Serial DATE,
Default CHAR(10) DEFAULT "default" NOT NULL,
Decimal SERIAL(1000) NOT NULL PRIMARY KEY CONSTRAINT pk_table,
Column CHAR(3) NOT NULL
);
-- Yes, this works with a 5.01.UC2 database. But I tried adding a column
-- called PRIMARY and that didn't work. I'd assume that a column called
-- FOREIGN is also out of the question, and ditto UNIQUE and CHECK.
Yours,
Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>