•  
Results 1 to 2 of 2

Thread: lowercase column name

Hybrid View

  1. #1
    Join Date
    Oct 2009
    Posts
    54

    Default lowercase column name

    Hi All,

    I try to create the table and the DDL is like below:-

    Example:-

    CREATE TABLE STUDENT( STUDENT_ID INT);

    then, when i try to describe the table, it return like this

    Column | Type | Modifiers
    -------------+---------+-----------
    student_id | integer |


    that in the lowercase mode.

    I want it maintain that what i map in the script.

    Anybody know how to solve that..


    Thanks.

  2. #2
    Join Date
    Nov 2009
    Location
    Silicon Valley
    Posts
    30

    Default

    Greenplum will downcase by default.

    Upper case may be preserved with quotes.

    Keep in mind, you will always need to use quotes to reference the upper case table (as seen in the last few examples below)

    Code:
    gpadmin=# create table "STUDENT" ("STUDENT_ID" int);
    NOTICE:  Table doesn't have 'DISTRIBUTED BY' clause -- Using column named 'STUDENT_ID' as the Greenplum Database data distribution key for this table.
    HINT:  The 'DISTRIBUTED BY' clause determines the distribution of data. Make sure column(s) chosen are the optimal data distribution key to minimize skew.
    CREATE TABLE
    gpadmin=# \d "STUDENT"
          Table "public.STUDENT"
       Column   |  Type   | Modifiers 
    ------------+---------+-----------
     STUDENT_ID | integer | 
    Distributed by: (STUDENT_ID)
    
    gpadmin=# \d STUDENT
    Did not find any relation named "STUDENT".
    gpadmin=# \d student
    Did not find any relation named "student".
    gpadmin=#
    gpadmin=# select STUDENT_ID from "STUDENT";
    ERROR:  column "student_id" does not exist
    LINE 1: select STUDENT_ID from "STUDENT";
                   ^
    gpadmin=# select "STUDENT_ID" from "STUDENT";
     STUDENT_ID 
    ------------
    (0 rows)
    Last edited by obarrett; 07-25-2011 at 08:16 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •