[GENERAL] Error with word 'desc'

2003-06-24 Thread Reuben D. Budiardja

Hi,
Seems that everytime I use the word 'desc' I got an error. For example, this 
query:
SELECT code, desc FROM or_code_table WHERE tr = 'FORMAT' 
gave me
ERROR:  parser: parse error at or near desc

When I created the table I got the same error too. I got around that by 
creating the table using pgaccess instead of using psql console.

Is 'desc' a reserved key word of some kind ? Even if yes (like in mysql or 
oracle), the parser should understand the context in which it's mentioned. I 
don't remember I got that kind of error with mysql / oracle.

Here is the table:

lightcone=# \d or_code_table;
Table or_code_table
  Column  |   Type   |   Modifiers   
--+--+---
 code | character varying(2) | not null
 tr   | character varying(10)| not null
 desc | character varying(100)   | 
 mod_user | character varying(15)| 
 mod_time | timestamp with time zone | default now()
Primary key: or_code_table_pkey


Any help is greatly appreciated.

Thanks.

RDB

-- 
Reuben D. Budiardja
Department of Physics and Astronomy
The University of Tennessee, Knoxville, TN
-
/\  ASCII Ribbon Campaign against HTML
\ /  email and proprietary format  
 X   attachments.
/ \
-
Have you been used by Microsoft today? 
Choose your life. Choose freedom. 
Choose LINUX.
-


---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


Re: [GENERAL] Error with word 'desc'

2003-06-24 Thread Stephan Szabo
On Tue, 24 Jun 2003, Reuben D. Budiardja wrote:

 Hi,
 Seems that everytime I use the word 'desc' I got an error. For example, this
 query:
 SELECT code, desc FROM or_code_table WHERE tr = 'FORMAT'
 gave me
 ERROR:  parser: parse error at or near desc

 When I created the table I got the same error too. I got around that by
 creating the table using pgaccess instead of using psql console.

 Is 'desc' a reserved key word of some kind ? Even if yes (like in mysql or
 oracle), the parser should understand the context in which it's mentioned. I
 don't remember I got that kind of error with mysql / oracle.

Desc is a reserved word.  You'll need to double quote it (desc) in the
query for it to be legal.


---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html