Re: Case Preservation disregarding case sensitivity?

Поиск
Список
Период
Сортировка
От Richard Broersma Jr
Тема Re: Case Preservation disregarding case sensitivity?
Дата
Msg-id 467277.20359.qm@web31812.mail.mud.yahoo.com
обсуждение исходный текст
Ответ на Case Preservation disregarding case sensitivity?  (beau hargis <beauh@bluefrogmobile.com>)
Список 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.


В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Broersma Jr
Дата:
Сообщение: Re: How to query information schema from shell script
Следующее
От: Richard Broersma Jr
Дата:
Сообщение: Re: Case Preservation disregarding case sensitivity?