Tag Archives: PostgreSQL

How to generate different sql scripts through pom.xml

In this post, we will see how to generate different sql scripts using our pom.xml from maven project with a little help from hibernate.


Setting PostgreSQL psql Variable Based Upon Query Result

via Inspired by Actual Events: Setting PostgreSQL psql Variable Based Upon Query Result.

When using PostgreSQL‘s psql command-line tool to interact with a PostgreSQL database via operator interaction or script, it is not uncommon to want to set psql variables based on the results of a particular query. While PostgreSQL’s procedural language PL/pgSQL supports approaches such as SELECT INTO and assignment (:=) to set PL/pgSQL variables based on a query result, these approaches are not supported for psql variable assignment.

The typical way to make a psql variable assignment is via use of \set. This allows for the setting of the psql variable to a literal value. However, there are situations in which it is desirable to set the psql variable based upon the result of a query. This is done with the \gset option in psql. Unlike the \set operation in psql which sets a variable with an explicitly specified name to an explicitly specified literal value, \gset implicitly names the psql variables after the names of the columns (or aliases if columns are aliased) returned by the query to which the \gset is associated. The \gset is specified after the query (no semicolon generally on the query) and there is no semicolon after the \gset statement (just as no semicolon should be placed after a\set statement).

It is easier to see how \gset works with a code sample. The next code listing shows a small psql file that takes advantage of \gset to set a psql variable named “name” whose value that was set by the query is displayed using psql’s colon prefix notation to “echo” its value.

Building GitHub projects on Jenkins slaves on OpenShift

This post showed how to build GitHub projects with Jenkins, Maven and SonarQube 4 on OpenShift. For starters, it used the Jenkins master node for running build jobs. However, when running on a small gear, the master node might run out of memory pretty fast, resulting in a reboot of the node during builds. In […]


Installing PostgreSQL PL/Java as a PostgreSQL Extension.

via Invariant Properties » Installing PostgreSQL PL/Java as a PostgreSQL Extension..

In 2011 I wrote a series of articles on PostgreSQL PL/Java. The basic information is still solid but there is a now a much easier way to install PL/Java from source. This also eliminates the need to depend on third parties to create packages. These notes will be fairly brief since I assume my readers are already familiar with git and maven.

(Note: I’ve passed this information to the PL/Java team so it may already be handled by the time you read this.)

Polyglot Persistence: EclipseLink with MongoDB and Derby

via Polyglot Persistence: EclipseLink with MongoDB and Derby ~ Enterprise Software Development with Java.

Polyglot persistence has been in the news since some time now. Kicked off by the famous Fowler post from end 2011 I see more an more nice ideas coming up. Latest one was a company internal student project in which we used Scala as a backend persisting data into MongoDB, PostgreSQL and Apache Solr. I’m not a big fan of Scala and remembered EclipseLink’s growing support for NoSQL databases. Given that I simply had to try something like this.

PostgreSQL: Partitioned tables and Hibernate

Dieser Artikel auf Deutsch The posts PostgreSQL: Partitioning big tables Part 1 and Part 2 describe the implementation of this performance measure from the database view. In an enterprise Java environment often a database is integrated by a JPA framework and closely coupled with the application. This 3rd part about partitioned tables in PostgreSQL shows […]


Maven GWT Mojo, GWT, Hibernate and PostgreSQL

Currently I am working on a side GWT side project. My interest in GWT initially started during my days at college. I really find it to be an awesome way to create client-heavy internet applications (RIAs, Rich Internet Applications). It uses Java, which is just lovely, you get unit tests and you can use Java […]