Waiting for 9.6 – Add psql \ev and \sv commands for editing and showing view definitions.

On 3rd of July, Tom Lane committed patch:

Add psql \ev and \sv commands for editing and showing view definitions.
 
These are basically just like the \ef and \sf commands for functions.
 
Petr Korobeinikov, reviewed by Jeevan Chalke, some changes by me

Continue reading Waiting for 9.6 – Add psql \ev and \sv commands for editing and showing view definitions.

Returning data in multiple columns

I was working today on some updates to client database. While doing it, I figured it would be simpler if I saw all “codenames" and ids of rows from dictionary table – not so big. But it was bigger than my screen – I have only 90 lines of text on screen, and there were ~ 200 rows of data in the table. So I started thinking – how to show this (codename, id) into more than one column, in psql.

Continue reading Returning data in multiple columns

Waiting for 9.5 – Add psql PROMPT variable showing which line of a statement is being edited.

On 2nd of September, Andres Freund committed patch:

Add psql PROMPT variable showing which line of a statement is being edited.
 
The new %l substitution shows the line number inside a (potentially
multi-line) statement starting from one.
 
Author: Sawada Masahiko, heavily editorialized by me.
Reviewed-By: Jeevan Chalke, Alvaro Herrera

Continue reading Waiting for 9.5 – Add psql PROMPT variable showing which line of a statement is being edited.

Waiting for 9.4 – Add support for wrapping to psql’s “extended” mode.

On 28th of April, Greg Stark committed patch:

Add support for wrapping to psql's "extended" mode. This makes it very
 
feasible to display tables that have both many columns and some large
data in some columns (such as pg_stats).
 
Emre Hasegeli with review and rewriting from Sergey Muraviov and
reviewed by Greg Stark

Continue reading Waiting for 9.4 – Add support for wrapping to psql's “extended" mode.

Waiting for 9.3 – Add \watch [SEC] command to psql.

On 4th of April, Tom Lane committed patch:

Add \watch [SEC] command to psql.
 
This allows convenient re-execution of commands.
 
Will Leinweber, reviewed by Peter Eisentraut, Daniel Farina, and Tom Lane

Continue reading Waiting for 9.3 – Add \watch [SEC] command to psql.

Variables in SQL, what, how, when?

One of the questions that gets asked quite a lot, is: how can you use variables in your queries? Other databases have them, does PostgreSQL?

Actually the answer is “no". But, it is actually very easy to work around, and what's more important – quite often, what you need are not variables in queries, but rather variables in client. What does it mean? Let's see.

Continue reading Variables in SQL, what, how, when?