Pular navegação

Tag Archives: postgresql

Download psycopg2 at http://initd.org/pub/software/psycopg/

To install  (I’m using the version 2.0.10) you need to run two commands:

# python setup.py build

and after the build is complete:

# python setup.py install

Well, but it’s not so easy if you do not have the dependencies already installed.In my case I got errors like:

NameError: global name ‘w’ is not defined psycopg2

or

error: Setup script exited with error: command ‘gcc’ failed with exit status 1

To solve this I have to install the libpq-dev library and the python development package:

# apt-get install libpq-dev

# apt-get install python2.5-dev

After that I just run the usual python setup.py install and all done.

Esse problema na realidade não é do Django, e sim do módulo psycopg2 que faz acesso ao PostgreSQL (No meu caso eu estava utilizando a versão 2.0.6 deste módulo). Para resolver este problema é preciso atualizá-lo para o 2.0.7.

Read More »

Para criar um arquivo SQL com os inserts de uma base de dados do PosgreSQL (versão 8.3) execute o comando:

# pg_dump -i -h localhost -p 5432 -U <usuário> -F p -a -D -v -f “<nome do arquivo>.sql” -t ‘<schema>.*’ <database>

o executável normalmente se localiza em /usr/local/pgsql/bin/