Waiting for 9.1 – KNNGIST

On 4th of December, Tom Lane committed really cool patch:

KNNGIST, otherwise known as order-by-operator support for GIST.

This commit represents a rather heavily editorialized version of
Teodor's builtin_knngist_itself-0.8.2 and builtin_knngist_proc-0.8.1
patches.  I redid the opclass API to add a separate Distance method
instead of turning the Consistent method into an illogical mess,
fixed some bit-rot in the rbtree interfaces, and generally worked over
the code style and comments.
 
There's still no non-code documentation to speak of, but I'll work on
that separately.  Some contrib-module changes are also yet to come
(right now, point <-> point is the only KNN-ified operator).
 
Teodor Sigaev and Tom Lane

Continue reading Waiting for 9.1 – KNNGIST

Named interfaces for OpenVPN and Cisco VPN

I use quite a lot of vpns. On any given moment I have between 3 and 10 active vpn connections from the machine I'm working on.

I generally tend to use OpenVPN, but I also do use vpnc (Cisco VPN client).

One thing that I noticed is not very commonly known, and ( in my case – helps a lot ), is that you don't have to have your tunnel interfaces named tun0, tun1, tun2 and so on.

You can do something like this:

in /etc/vpnc/tunnel.conf, add such line:

Interface name <strong>depesz</strong>

and enable the tunnel – you will see that instead of boring, and somewhat cryptic “tunX" interface you'll have interface named “depesz“.

Similar thing for openvpn – in it's conf file for tunnel add these 2 lines:

dev-type tun
dev <strong>smart</strong>

First line is new one (usually), and is required so that OpenVPN can know if you want TUN or TAP tunnels. “dev" is usually “tun", but it can be changed, and with above lines, will make the tunnel interface named “smart“.

Auto refreshing password file for pgbouncer

As you perhaps know I'm fan of pgbouncer – connection pooling solution for PostgreSQL.

It can do many really cool things, but has one slight issue.

Since it can reuse connections – it has to provide a way to check if user supplied password is correct without consulting database. And it lately (since 9.0 to be exact) became somewhat of a problem.

Continue reading Auto refreshing password file for pgbouncer

Waiting for 9.1 – format()

On 21st of November Robert Haas committed new patch, which adds new function:

Add new SQL function, format(text).

Currently, three conversion format specifiers are supported: %s for a
string, %L for an SQL literal, and %I for an SQL identifier.  The latter
two are deliberately designed not to overlap with what sprintf() already
supports, in case we want to add more of sprintf()'s functionality here
later.
 
Patch by Pavel Stehule, heavily revised by me.  Reviewed by Jeff Janes
and, in earlier versions, by Itagaki Takahiro and Tom Lane.

Continue reading Waiting for 9.1 – format()

Waiting for 9.1 – Removed autocast footgun

On 8th of November, Tom Lane committed patch, which doesn't provide any new features, but removes one of the more annoying footguns in PostgreSQL:

Prevent invoking I/O conversion casts via functional/attribute notation.
 
PG 8.4 added a built-in feature for casting pretty much any data type to
string types (text, varchar, etc).  We allowed this to work in any of the
historically-allowed syntaxes: CAST(x AS text), x::text, text(x), or
x.text.  However, multiple complaints have shown that it's too easy to
invoke such casts unintentionally in the latter two styles, particularly
field selection.  To cure the problem with the narrowest possible change
of behavior, disallow use of I/O conversion casts from composite types to
string types via functional/attribute syntax.  The new functionality is
still available via cast syntax.
 
In passing, document the equivalence of functional and attribute syntax
in a more visible place.

Continue reading Waiting for 9.1 – Removed autocast footgun

Understanding postgresql.conf : checkpoint_completion_target

Starting new blog series – explanation of various configuration parameters.

I will of course follow no schedule or order – if I'd had to – it would be my job, and in this way – it's fun.

First configuration parameter to write about is checkpoint_completion_target.

Continue reading Understanding postgresql.conf : checkpoint_completion_target

What would Roy Merritt do?

Some time ago, I was listening to This week in tech and I heard Leo Laporte raving about book Daemon by Daniel Suarez. Did some research, got the book, read it. Relatively soon I heard that there is second part – Freedom ™ (polish comment: czemu polski tłumacz wywalił to “tm" z tytułu?!). Of couse I read it too. Well – it's more like devoured it as I found it simply amazing, and read it all in one go.

Today, I got information from alerts that somebody wrote about it on blog. Went to read, and was astounded to read this sentence:

Turns out it’s only half the story because there is apparently a sequel. I don’t think I’m going to read the next book.

(this is about Daemon).

Well, I did comment there, but just in case, and for Google purposes let me put my answer in here:

Freedom ™ is not a sequel in common meaning of the word. Personally, I think about them as of single text with single story, that was just printed (for whatever reason) as two separate volumes.

Personally I found Freedom ™ much more enjoyable, as it takes the ideas presented in Daemon much further. Daemon is short-time extrapolation “what-if", with common gadgets, and todays technology (well, after some tweaking). Freedom ™ shows what it can lead to – it's social and political consequences.

So, if you haven't yet read these books – go get them. And if you, for some unknown reason, read just the Daemon – get also this “sequel".

Just one warning – if you read Daemon long ago, and now you'll get Freedom ™ – reread Daemon first, as Freedom ™ is literally next part of the same book – with no re-introduction, reminding of events, people, items – nothing like this.

If you don't understand the tile – well – get the books 🙂

Waiting for 9.1 – adding values to enums

Finally, on 25th of October, Tom Lane committed patch which does:

Allow new values to be added to an existing enum type.
 
After much expenditure of effort, we've got this to the point where the
performance penalty is pretty minimal in typical cases.
 
Andrew Dunstan, reviewed by Brendan Jurd, Dean Rasheed, and Tom Lane

Continue reading Waiting for 9.1 – adding values to enums