Hi,

I thought DESCRIPTION is a reserved word. That would explain why it is colored in Interactive SQL to indicate that it is a keyword.

However, it looks that it is not a reserved keyword because the following only returns 'desc': select * from sa_reserved_words() where reserved_word like '%desc%'

So why do you think this is?

(Using SQL Anywhere 17)

asked 06 Feb, 08:04

tzup's gravatar image

tzup
360111426
accept rate: 0%

edited 06 Feb, 08:06

FWIW description has never been a reserved word, where "never" includes V5.

ISQL 10 (for example) also color highlights description in blue, just like ISQL 17.

In other words, "blue" is meaningless, always has been, like "carrots will help you see in the dark" :)

(06 Feb, 08:47) Breck Carter

"desc" is reserved but "description" is what we call a "keyword/identifier". That is, "description" could be used as an identifier in some contexts and as a keyword (ie, reserved word that is part of SQL syntax) in other contexts. Wherever possible, we don't create new truly reserved words because we don't want to break any existing SQL statements, stored procedures, etc by reserving a word that someone might already be using as a variable name, table name, column name, etc. sa_reserved_words() only returns strings that can never be used as identifiers and are always reserved.

permanent link

answered 06 Feb, 08:48

John%20Smirnios's gravatar image

John Smirnios
10.4k387136
accept rate: 38%

In what context(s) is description "used as ... a keyword (ie, reserved word that is part of SQL syntax) in other contexts"?

I suspect the answer is "none, ever".

(06 Feb, 09:07) Breck Carter
Replies hidden

Well, "description" in particular is used in the context of a dialect that isn't exposed. However, there are many other "keyword identifiers": load, unload, datatype, quote, quotes, escape, publish, publisher, ... There are almost 600 of them.

(06 Feb, 09:16) John Smirnios

OK then... if one accepts the usefulness of color highlighting (I don't), the highlighting of these words is justified because in most cases the words load, unload, etcetera, will be used as keywords rather than identifiers.

Having said that... if ISQL can't parse SQL (apparently it can't) then it shouldn't pretend that it can... computers aren't supposed to make mistakes, not even some of the time, so when ISQL gets the highlighting wrong it loses credibility.

(06 Feb, 10:51) Breck Carter

ISQL is probably getting the list of tokens from the same place as the database server... and although "DESCRIPTION" is not in a dialect that happens to be exposed, it is in the list of tokens.

(06 Feb, 12:37) John Smirnios
2

Actually, out of curiosity I dug a bit deeper. A long time ago (1999), one could create event 'types' along with a description for a scheduled event though I don't know if we ever shipped that. It might have been a work in progress.

create_event_type: T_CREATE event_type

event_type: T_EVENT T_TYPE identifier T_DESCRIPTION T_STRING

So there was a statement of the form

CREATE EVENT TYPE foo DESCRIPTION 'do stuff'

The ability to manage a distinct set of event types (probably in a system table) and have associated descriptions seems to have been removed and the event type is specified when you create the event (sans description).

(06 Feb, 20:09) John Smirnios
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×171
×41
×17
×15
×2

question asked: 06 Feb, 08:04

question was seen: 166 times

last updated: 06 Feb, 20:09