How to change location in Postgresql

Asked

Viewed 2,877 times

4

My database is with locale en_US.UTF-8, I need to change it to pt_BR.UTF-8 for the purposes of ordering consultations.

How can I do that only with phpPgAdmin?

1 answer

4

To change you will have to:

  1. Make a logical backup of your current base, maybe you have this option in phpPgAdmin, but unknown, via command line would be something like:

    $ pg_dump -d nome_da_base -f nome_da_base.sql
    
  2. Delete your current base:

    DROP DATABASE nome_da_base;
    
  3. Recreate it using the template0 and the locale correct:

    CREATE DATABASE nome_da_base
        TEMPLATE=template0
        LC_CTYPE="pt_BR.UTF-8"
        LC_COLLATE="pt_BR.UTF-8";
    
  4. Restore:

    $ psql -d nome_da_base -f nome_da_base.sql
    

If your bank is too big this process might be a little slow, in which case it would be better to use a binary backup (recommend -Fc, or -Fd to use parallelism) and restore with the pg_restore using parallelism.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.