RSKMR
RSKMR

Reputation: 1892

Postgresql + Select field name as upper and lowercase mixed

I am using this postgresql code,

SELECT   id as DT_RowId , title 
FROM table_name  
ORDER BY  title asc  
LIMIT 25 OFFSET 0

The results returned like this.

        +--------+-----+
        |dt_rowid|title|
        +--------------+
        |  1     |A    |
        |  2     |B    |
        |  3     |C    |
        |  4     |D    |
        |  5     |E    |
        |  6     |F    |
        +--------+-----+

But i want results should return like this.

        +--------+-----+
        |DT_RowId|title|
        +--------------+
        |  1     |A    |
        |  2     |B    |
        |  3     |C    |
        |  4     |D    |
        |  5     |E    |
        |  6     |F    |
        +--------+-----+

Note - DT_RowId field i want same like this(upper and lower case mixed).

Upvotes: 0

Views: 278

Answers (1)

user330315
user330315

Reputation:

As explained in the manual unquoted identifier are folded to lowercase (which violates the SQL standard where unquoted identifiers should be folded to uppercase).

You need to use a quoted identifier in order to preserve the case:

SELECT id as "DT_RowId", 
       title 
FROM table_name  
ORDER BY  title asc  
LIMIT 25 OFFSET 0

Upvotes: 1

Related Questions