Thread: capitals in fieldnames
Hi! I use postgres 7.0.3 on Linux and have the following problem: there is a field with the name 'BGF' and I can access it only with: SELECT "BGF" FROM <table>; Neither SELECT BGF ... nor SELECT bgf ... work. But AFAIK all three should do. Whats wrong here? thanks markus
It was initially created with quotes. If you want to access it the other way, you need to rename it: ALTER TABLE foo RENAME COLUMN "BGF" TO BGF; Hope that helps, Mike Mascari -----Original Message----- From: Markus Mohr [SMTP:markus@johalla.de] Sent: Saturday, March 31, 2001 5:02 PM To: pgsql-general@postgresql.org Subject: [GENERAL] capitals in fieldnames Hi! I use postgres 7.0.3 on Linux and have the following problem: there is a field with the name 'BGF' and I can access it only with: SELECT "BGF" FROM <table>; Neither SELECT BGF ... nor SELECT bgf ... work. But AFAIK all three should do. Whats wrong here? thanks markus ---------------------------(end of broadcast)--------------------------- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to majordomo@postgresql.org so that your message can get through to the mailing list cleanly
Markus Mohr wrote: > > Hi! > > I use postgres 7.0.3 on Linux and have the following problem: > there is a field with the name 'BGF' and I can access it only with: > > SELECT "BGF" FROM <table>; > > Neither > > SELECT BGF ... nor > SELECT bgf ... > > work. But AFAIK all three should do. Whats wrong here? PostgreSQL lower-cases everything as it is used unless you put it in double-quotes. The two examples should work if your field was 'bgf' - you must have created it with double-quotes or imported it from another system e.g. MS-Access. It can be irritating, I agree and does make porting from Access more difficult but I can't see it changing. - Richard Huxton