Re: Case Preservation disregarding case sensitivity?

From: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
To: beau hargis <beauh(at)bluefrogmobile(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Case Preservation disregarding case sensitivity?
Date: 2006-10-28 14:38:59
Message-ID: 467277.20359.qm@web31812.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

> Case was preserved. Now lets add the foreign key just as we did before (note
> that the case in the table definition and the ALTER TABLE query is the same):
>
> ALTER TABLE user_profile ADD CONSTRAINT fk_uproftype FOREIGN KEY
> (userProfileTypeId) REFERENCES user_profile_type (userProfileTypeId);
> ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
> ERROR: column "userprofiletypeid" referenced in foreign key constraint does
> not exist

When ever you defince a column with quotes, all references to it must also contain quotes. Try:
ALTER TABLE user_profile ADD CONSTRAINT fk_uproftype FOREIGN KEY
("userProfileTypeId") REFERENCES user_profile_type ("userProfileTypeId");

> OK, another query (perfectly valid SQL):
>
> insert into user_profile_type
> (userProfileTypeId,userProfileType) VALUES(1,'ABNORMAL');
> ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
> ERROR: column "userprofiletypeid" of relation "user_profile_type" does not
> exist

Try:
insert into user_profile_type
("userProfileTypeId","userProfileType") VALUES(1,'ABNORMAL');

>
> I am hoping that there is an easy way to obtain case-preservation with
> case-insensitivity, or at the very least, case-preservation and complete
> case-sensitivity, or case-preservation and a consistant case-conversion
> strategy.
>
> Again, I am looking for a way (magic, patches, whiskey, etc) that will give me
> case-preservation with EITHER case-sensitivity OR case-insensitivity, but not
> both as I am seeing.

Perhaps in your queries or views you use the AS keywork to respecify the column name with
upper/lower cases.

i.e.
mydb=# select id as "Id" from foo;
Id
---------
goodbye
(1 row)

Regards,

Richard Broersma Jr.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Richard Broersma Jr 2006-10-28 14:59:09 Re: Case Preservation disregarding case sensitivity?
Previous Message Gurjeet Singh 2006-10-28 14:31:00 Re: bug in on_error_rollback !?

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Broersma Jr 2006-10-28 14:59:09 Re: Case Preservation disregarding case sensitivity?
Previous Message Richard Broersma Jr 2006-10-28 04:09:35 Re: How to query information schema from shell script