Thread: Error message: Ralation X does not have attribute Y
Hi, I'm a very new user of the PostgreSQL database, but I've quickly encountered what I consider an pretty odd error. Let it be said, this is using the PeerDirect PostgreSQL Beta 4 using Win2K SP3, so it's bound to have certain issues. The following is from a simple console session with psql. pgtestdb=# CREATE TABLE SMT_PROPERTIES ( "PropertyKey" varchar (50) NOT NULL,"PropertyValue" varchar (255) ) WITHOUT OIDS; CREATE pgtestdb=# select * from smt_properties; PropertyKey | PropertyValue -------------+--------------- (0 rows) pgtestdb=# \d smt_properties Table "smt_properties" Column | Type | Modifiers ---------------+------------------------+----------- PropertyKey | character varying(50) | not null PropertyValue | character varying(255) | pgtestdb=# INSERT INTO SMT_PROPERTIES (propertykey, propertyvalue) VALUES ('schemaversion','none'); ERROR: Relation 'smt_properties' does not have attribute 'propertykey' The error simply can't be true :-) I've also tried using "correct" case on the various letters in both table and column names, but without any luck so far. Any help is appreciated. Best regards Jan Oksfeldt Jonasen Northmann A/S web: http://www.northmann.com newsgroup: news:news.northmann.com
Jan Oksfeldt Jonasen writes: > The error simply can't be true :-) I've also tried using "correct" case on > the various letters in both table and column names, but without any luck so > far. You need to double-quote the names or they will be converted to lower case. -- Peter Eisentraut peter_e@gmx.net
On 6 Aug 2003 at 14:34, Jan Oksfeldt Jonasen wrote: > Hi, > I'm a very new user of the PostgreSQL database, but I've quickly > encountered what I consider an pretty odd error. Let it be said, this is > using the PeerDirect PostgreSQL Beta 4 using Win2K SP3, so it's bound to > have certain issues. The following is from a simple console session with psql. > > pgtestdb=# CREATE TABLE SMT_PROPERTIES ( "PropertyKey" varchar (50) NOT > NULL,"PropertyValue" varchar (255) ) WITHOUT OIDS; > CREATE Why are you quoting column names? Is that required? What happens if you don't? Bye Shridhar -- understand, v.: To reach a point, in your investigation of some subject, at which you cease to examine what is really present, and operate on the basis of your own internal model instead.
At 01:40 PM 8/6/2003, Peter Eisentraut wrote: >You need to double-quote the names or they will be converted to lower >case. > Thank you both. The reason why the initial table creation have quoted columns names is that it's generated by a program we use for schema creation. I'm currently adding to it so it can support Postgres too and the way columns are set up was more or less copied from the MS Sql implementation. I'm really not used to databases being so case sensitive, neither Oracle or MS Sql Server is that, but I'll keep this thing in mind moving along. Quite impressed with the response time, or maybe it was just a too easy question :-) Best regards Jan Oksfeldt Jonasen Northmann A/S web: http://www.northmann.com newsgroup: news:news.northmann.com
On Wed, Aug 06, 2003 at 03:06:12PM +0100, Jan Oksfeldt Jonasen wrote: > At 01:40 PM 8/6/2003, Peter Eisentraut wrote: > >You need to double-quote the names or they will be converted to lower > >case. > > > > Thank you both. The reason why the initial table creation have quoted > columns names is that it's generated by a program we use for schema > creation. I'm currently adding to it so it can support Postgres too and the > way columns are set up was more or less copied from the MS Sql > implementation. > > I'm really not used to databases being so case sensitive, neither Oracle or > MS Sql Server is that, but I'll keep this thing in mind moving along. Quite > impressed with the response time, or maybe it was just a too easy question > :-) Well, it's only case-sensetive if you ask for it, ie by quoting. The basic rule is: Either always quote or never quote. Always quote = case-sensetive Never quote = case-insensetive -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > "All that is needed for the forces of evil to triumph is for enough good > men to do nothing." - Edmond Burke > "The penalty good people pay for not being interested in politics is to be > governed by people worse than themselves." - Plato