Menu

Windows, Linux, psql…

As for me I’m pretty sure that it’s not cool to use non-Latin letters for database objects names. In other words this is true Mauvais Ton.

However the reality dictates its own rules. I saw a lot of databases with names in Hebrew, Russian etc. What is the disadvantage of such names using?

Linux console

If we’re talking about Linux console then the answer most likely will be: “There is no disadvantage at all”, though I haven’t every existing distributive tested, but only a few. In this article we will use pg_live – a Xubuntu-based live CD designed and optimized expressly for the PostgreSQL Database administrator and enthusiast.

Let’s create database with Cyrillic letters under gorgeous name of “Колбаса”. First of all start psql. You may use such command:

$psql -h /tmp -U ubuntu ubuntu

After psql started we’ll create and connect to “Колбаса” database:

Creating database with Cyrillic letters in Ubuntu

As you can see no magic is needed. In Windows it’s quite the contrary.

Windows console

Just for information: I’m using WinXP with SP3 installed.

Let’s the wizardry begin. First of all we must set code page used in the Windows console :

C:\Program Files\PostgreSQL\8.3\bin\>chcp 1251
Active code page: 1251

Could not find this for three days, was cursing up hill and down dale. But it turnes out the only thing needed is the Notes for Windows users chapter in the psql manual.

Do not forget to set Lucida Console font either:

Setting Lucida Console font

Starting psql:

C:\Program Files\PostgreSQL\8.3\bin\>psql -U pasha "Test"
Welcome to psql 8.3.5, the PostgreSQL interactive terminal.
Type: copyright for distribution terms
h for help with SQL commands
? for help with psql commands
g or terminate with semicolon to execute query
q to quit
Test=#