On 11/23/2016 11:52 PM, ???? wrote:
> Hello ??
>       
>         I'am a  Postgre fan.
>         Now, I have a problem, the table name is stored in lower case ,
> but i want to change it into  upper case. Can i have a simple method?
> Such as modify a parameter.

https://www.postgresql.org/docs/9.5/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

"Quoting an identifier also makes it case-sensitive, whereas unquoted names are 
always folded to lower case. For example, the identifiers FOO, foo, and "foo" 
are considered the same by PostgreSQL, but "Foo" and "FOO" are different from 
these three and each other. (The folding of unquoted names to lower case in 
PostgreSQL is incompatible with the SQL standard, which says that unquoted 
names should be folded to upper case. Thus, foo should be equivalent to "FOO" 
not "foo" according to the standard. If you want to write portable applications 
you are advised to always quote a particular name or never quote it.)"

There is no parameter to set. If you want upper case names then you need to 
quote them:

test[5432]=# create table FOLD_LOWERCASE ();
CREATE TABLE
test[5432]=# create table "QUOTE_UPPERCASE" ();
CREATE TABLE

test[5432]=# \d fold_lowercase 
Table "public.fold_lowercase"
 Column | Type | Modifiers 
--------+------+-----------

test[5432]=# \d FOLD_LOWERCASE
Table "public.fold_lowercase"                                                   
                                                                             
 Column | Type | Modifiers                                                      
                                                                             
--------+------+-----------    

test[5432]=# \d QUOTE_UPPERCASE                                                 
                                                           
Did not find any relation named "QUOTE_UPPERCASE".         
                                                                                
                  
test[5432]=# \d quote_uppercase                                                 
                                                                             
Did not find any relation named "quote_uppercase".                              
                                                                             

test[5432]=# \d "QUOTE_UPPERCASE"                                               
                                                                             
Table "public.QUOTE_UPPERCASE"                                                  
                                                                             
 Column | Type | Modifiers                                                      
                                                                             
--------+------+-----------             

The above also shows what happens when you quote, you are committed 
to that case.

If you still want to do this then:

test[5432]=# ALTER table fold_lowercase rename to "MAKE_UPPERCASE";
ALTER TABLE

test[5432]=# \d "MAKE_UPPERCASE"
Table "public.MAKE_UPPERCASE"
 Column | Type | Modifiers 
--------+------+-----------





>       
>         Thank you!
> 
>   
> 


-- 
Adrian Klaver
adrian.kla...@aklaver.com


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to