I have the following problem:
A database server and another client machine. I have to execute several \copy commands in psql on the client machine to retrieve data and store the output in CSV files. The PostgreSQL COPY command is not an option because it stores the results on the database server, not the client machine. All \copy commands are executed from several files containing SQL commands, which are concated together by a Makefile and feeded into psql. So far so good.
I want to drop a ROLE (previously USER/GROUPs) which is still referenced by object(s) in my database. But PostgreSQL has objections:
I have seen this question more than once in the past: “How much storage space do I need for my table?”
PostgreSQL can give you this information.
Because I always forget how to stop psql on the first error:
| |
You can include this at the top of your script/file, psql will stop right after the first error and will not try to continue any other commands in the chain.
If you have a table with an unique key field, want to insert new values but you don’t know if the value may already be in the table, you can use the following query:
I’m always searching for a reverse function in PostgreSQL, so here is the link: