We had the same problem 2 times on two different computer, in just a few days of interval.
PgAdmin started to crash each time we open query builder.
Restarting the computer, reinstalling pgAdmin with differents versions... Nothing resolved the problem. But we found the solution to this problem!
PgAdmin uses a file where it saves the last queries (kind of history) and this file was probably corrupted (or one of the queries was).
This file is in the Application Data of your Windows User, that's why reinstalling pgAdmin doesn't work: this corrupted file is common for every postgres install.
So you just got to rename or delete the file pgadmin_histoqueries.xml
located in your AppData (for us, D:\Documents and Settings\XXXXX\Application Data\postgresql
) and relaunch pgAdmin, this should be OK.
I found the answer to my problem. The pgadmin3 tool won't let you specify both a server and a database. The server itself HAS a default database and when you select it with the --server
option, it won't let you pick a database. An error message would have been nice!
The 'defiant' server I made has in itself a default connection to a database, you have to set that default database, and you can't use commandline options to change it.
First, you must be disconnected from the default connection to the server you want to edit. Either make a new connection to a server or edit your existing one by right clicking your server, mine is: defiant(localhost:5432)
.
Then right click it, go to properties, you'll see a field called `maintenance DB', make that the connection to the database you want to be the default for this server connection. I set mine to kurz_prod. Click OK and restart.
Then the following command works. It opens pgadmin3, it gets a connection to the server and database that I specify, it opens a query window, it loads a previous file I specify into it. And immediately I can run statements against it.
This command is correct in opening an sql file with a connection to a server and database:
pgadmin3 --file=/home/el/Desktop/sqlfile_for_postgresql.sql --query --server=defiant
Best Answer
There is no explicit switch to just export functions. I did some research since it's a nice question.
I can think of some ways to do this:
Exporting the schema and importing only the functions you need (tedious, since you need the exact name and arguments of the function. This blog post explains it:
pg_dump -Fc -s | pg_restore -P 'funcname(args)'
Do some querying in the schema/pg_proc and export the results. This could be another function that just exports the functions...