July 31st, 2012 by depesz | Tags: , , , , , | 8 comments »

Some time ago I was looking (warning: post in polish) for someone to teach me proper parsing. One of really great polish Perl programmers - Dozzie - reached out, and helped me. By the way - thanks a lot, Dozzie. Based on ...

On 5th of February, Tom Lane committed patch: Allow SQL-language functions to reference parameters by name. Matthew Draper, reviewed by Hitoshi Harada

Today some guy on IRC asked question, which I didn't fully understand, but which could (probably) be summarized: how to group data into 5 minute intervals, based on some timestamp column. Well, it seems trivial (as long as you know how ...

On 25th Robert Haas committed patch which adds first of 'CREATE IF NOT EXISTS' commands: Log Message: ----------- CREATE TABLE IF NOT EXISTS.   Reviewed by Bernd Helmle.

November 1st, 2009 by depesz | Tags: , , , , , | 2 comments »

On 22nd of September, Tom Lane committed a patch by Petr Jelinek: Log Message: ----------- Implement the DO statement to support execution of PL code without having to create a function for it.   Procedural languages now have an additional entry point, namely a function to execute ...

This post has been updated with new code that uses temporary table - the code is at the end of post! There was this question on Stack Overflow. For future reference: guy asked how to do session variables - i.e. something he ...

On 205h of July Andrew Dunstan committed patch by Andres Freund : Log Message: ----------- DROP IF EXISTS for columns and constraints. Andres Freund.

July 13th, 2009 by depesz | Tags: , , , , , , | 1 comment »

Today, on irc (#postgresql on freenode.net) Dim mentioned about writing median calculation code. It got me thinking, and consequently writing my version of median calculation code.

Let's say you imported some data, but it contains duplicates. You will have to handle them in some way, but to make sensible choice on how to handle it, you need more information. So, let's start. We have table: # \d users ...

March 12th, 2009 by depesz | Tags: , , , , , , | 6 comments »

I had this interesting case at work. We have imports of objects. Each object in import file has its "ID" (which can be any string). Same "ID" is in database. So the idea is pretty simple - we can/should check how ...