Trace: • postgresql
PostgreSQL
Using pgAdmin 3 you can import a database using the command line:
\i <database path>
You access the commandline through Plugins > Console.
Alternatively, you can of course use the bash shell as well:
psql DATABASE_NAME < DUMP_FILE
(You also have the option to specify the user: psql -U PSQL_USER DATABASE_NAME < DUMP_FILE
)
If you're having problems with connecting your Moodle to your database you should consider adding the port of the database behind the host string in the config.php, like this:
$CFG→host = 'localhost:5433'
phpPgAdmin
Just like MySQL has phpmyadmin, PostgreSQL has its own web-based tool: phpPgAdmin. Under Ubuntu, installing it should be easy:
sudo apt-get install phppgadmin
The tool should now be available under http://localhost/phpPgAdmin
. You might run into trouble however, if your php settings display too many notices and warnings. To suppress this, edit /usr/share/phppgadmin/conf/config.inc.php
. Add this code to the top of the file:
// per Ubuntu bug 614481 error_reporting(E_ALL & ~E_DEPRECATED);
… and you should be good to go.
SchemaSpy
Use schemaSpy to graph tables: http://schemaspy.sourceforge.net/ (not just for PostgreSQL; a lot of other databases are supported too).
Download the jdbc driver for PostgreSQL here: http://jdbc.postgresql.org/download.html
(use java -version
to check what jvm version you've got)
onno@solin-amd64:~/schemaspy$ java -jar schemaSpy.jar -t pgsql -db nuon_clean -host localhost:5432 -u onno -o /home/onno/temp/schema -i "(.*quiz.*)|(.*question.*)" -dp postgresql-9.1-902.jdbc4.jar -p PASSWORD -s public -hq
(-hq
is high quality graphics)
You are here: start » postgresql