Nishadh KA

PostGresql table edit in command line

2013-11-05


To edit the Istsos database table “measures” in PostgreSQL it is to overcome to the error in istsos import saying the Dylos reading is exceeding the digit limit of the column val_meas in the table. Normally it is easy to change column digit size through pgadmin. However, for command line, it requires following commands.

  1. Get access to PostgreSQL

    sudo -u postres psql
    
  2. To view the database in PostgreSQL

    \dt
    
  3. To connect with a particular database

    \c istsos      here istsos is database
    
  4. To display the details of table

    \d dlyosecbe.measrues        here dlyosecbe.measrues is the table name
    
  5. To change the columns digit size use the SQl command got from pgadmin

    ALTER TABLE dyloscbe.measures k ALTER COLUMN val_msr TYPE numeric(14,6);