ads' corner

Using Makefiles to build PostgreSQL

For a long time I was using a Makefile to quickly build, start, stop and then wipe a predefined PostgreSQL version. That comes handy if you just want to test something on an older version, without actually installing the software. Everything happens in a single directory, even a different port is assigned.

Single line input for psql copy command

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.

role ... cannot be dropped because some objects depend on it

I want to drop a ROLE (previously USER/GROUPs) which is still referenced by object(s) in my database. But PostgreSQL has objections:

create language if not exist

In a customer project I have to setup a database from a Makefile. Part of my problem: on Windows the installer may or may not install plpgsql into template1, therefore in consequence this language may or may not be activated in every new database. But that’s not predictable. This problem can appear on different Linux/Unix distributions too.

Create a newspaper in TeX

My problem: for our wedding I need a small magazine with a foto on the front, the agenda, some notes for the music and some more additional information. The decision was to create A5 sheets and print them doublesided on an A4 paper, so you need at least 4 A5 sheets to fill one paper.

Remove quotes from variable text

Just got the problem that a variable I want to substitute in a Makefile has quotes around the actual content. Thats bad, since this will break my script. I need to remove the quotes right before substituting the text: