PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 11th, 2003, 11:57 PM
CptPicard CptPicard is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 5 CptPicard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
PostgreSQL allergic to "user"?

I'm a relative beginner with PostgreSQL, and tonight I have been dealing with a mystical problem debugging a totally trivial Hibernate demo application I was putting together... eventually I traced the bug to an SQL fragment being fed to the database:

SELECT user.uid as uid, user.email as email, user.last_login as last_login FROM USERS user;

It turns out that the parser barfs every time it is asked to "select" something that starts with "user.", returning the rather unhelpful message

ERROR: parser: parse error at or near "." at character 12

I experimented with this for a while, and even nonsensical stuff like "select user.userid from foo" returns a parser error "at character 12"...

Not only that, but "select something from user;" comes back with a "parse error at or near "user" at character 17", and not a complaint that relation user doesn't even exist!

I would like to have some insight into this, because it just seems so stupid... a lot of applications will most definitely want to have an entity called "user", so I would assume either a lot of people have seen this before or I just have something pretty fundamentally wrong here!

Postgresql version is 7.3.2.

Reply With Quote
  #2  
Old August 12th, 2003, 12:02 AM
CptPicard CptPicard is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 5 CptPicard User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
After some more research...

Turns out that postgresql complains about the use of a reserved word (such as "user") even if that reserved word is used in a place where it syntactically speaking could exist quite happily... a bit silly, but I guess one just has to live with it?

Reply With Quote
  #3  
Old August 12th, 2003, 10:29 AM
bcyde's Avatar
bcyde bcyde is offline
Me likey breadsticks...
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2003
Location: Los Angeles
Posts: 1,189 bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level)bcyde User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 3 Days 1 h 12 m 58 sec
Reputation Power: 12
Send a message via AIM to bcyde Send a message via Yahoo to bcyde
If you have to use Postgres reserved words enclose them in quotes. So you'd do SELECT "user".fieldname FROM "user" WHERE "user".fieldname2 = 'blah'

BTW, use quotes also if you're using tables that aren't all in lowercase.

HTH
-b
__________________
PostgreSQL, it's what's for dinner...

Last edited by bcyde : August 12th, 2003 at 10:32 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > PostgreSQL allergic to "user"?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT