Pages

Leif B. Kristensen: Small set-returning plpqsql function

My place list has grown to the point where it is useful to filter it, and operate with a subset. I first created a tiny table:

CREATE TABLE place_filter (
    level TEXT,
    filter TEXT
);
-- this table must be initialized
INSERT INTO place_filter VALUES ('level_3', '%');

Then I wrote my first set-returning function, by trial-and-error.

CREATE OR REPLACE FUNCTION filtered_places() RETURNS SETOF places AS $$
DECLARE
    fl place_filter%ROWTYPE;
    pl places%ROWTYPE;
BEGIN
    SELECT * FROM place_filter INTO fl;
    FOR pl IN EXECUTE
        'SELECT * FROM places WHERE ' || QUOTE_IDENT(fl.level) ||
        ' LIKE ' || QUOTE_LITERAL(fl.filter) || ' OR place_id = 1'
    LOOP
        RETURN NEXT pl;
    END LOOP;
    RETURN;
END
$$ LANGUAGE plpgsql STABLE;

One of the nice things with such a function is that you can call it just the same way as you would do with a table or a view:

$handle = pg_query("SELECT place_id, get_place_name(place_id) AS place_name
                            FROM filtered_places() WHERE place_id > 0 ORDER BY place_name");

I haven’t written a PHP interface for the place filter yet; for now I just issue an "UPDATE place_filter SET level = 'level_3', filter = '%Solum';" from the psql prompt. Usually I do long runs of research within one parish, so I don’t have to “change the filter” often.

Bruce Momjian: Professionalism at PGCon

At PGCon a few new Postgres users mentioned how surprised they were at the professionalism of the Postgres community. (I am not sure I want to know what they expected us to be like.) I assume they didn't mean professionalism as in proper office attire or use of business jargon, but rather our seriousness, dedication, and attention to detail. I think what really surprises people is that we are usually more professional in these areas than paid programmers.

David Wheeler: Thoughts Testing SQL Result Sets

I've been continuing hacking on pgTAP in order to add a lot more schema-testing functionality and a few other niceties. But back when I started the project, I using it to write tests for CITEXT, which was great for my sanity as I developed it, but proved a bit controversial. In a pgsql-hackers post, Tom Lane wrote:

Read More »

Scott Bailey: XML in Postgres – The Game Changer

scottrbailey

Selena Deckelmann: Offline community, PUGs updates

Just before heading off to PgCon, I wrote about offline community and how it has positively impacted the tech community in Portland, OR. Specifically, I talked about the factors I thought encouraged women to participate.

My own experience with Postgres has been incredibly positive and welcoming. I always wish that I had more time to contribute.

I did find a little time this weekend to upgrade the PostgreSQL User Group site to the latest supported version of Drupal. We’re still on version 5.x, and hopefully I’ll be able to upgrade that to version 6.x soon. We’ve had a few problems with spammers, but I added a CAPTCHA that I hope isn’t too annoying for everyone.

If you have ideas for how to display the information on the PUGs site in a better way, please get in touch. I have a couple things I’d like to add soon - like a map of locations, and a better preview of recently posted articles.

Bruce Momjian: Reflections on PGCon

This year's PGCon was a well-oiled machine. Many of the inconveniences of the logistics and venue were gone. Gone also was the self-consciousness of our having our own Postgres conference --- it all seems natural now.

Read More »

Pavel Golub: “PostgresDAC under Weaver” testers wanted


If you have been invited to join the Embarcadero Weaver Beta Test and you’re an owner of PostgresDAC license, you’ve got an opportunity for incredible PostgresDAC Licenses and Renewals discount for you and your friends or colleagues.

Details…

Jignesh Shah: Read Only Scalability Patch

Simon Riggs of 2nd Quadrant recently submitted a patch for testing which should improve read only scalability of Postgres. I took it for a test drive for my setup. In the first set of tests I used the same benchmark as previous ones so as to have the same reference point.

It seems changing the Number of Buffer Partitions for this workload does not have any impact. My dataset for this iGen benchmark is pretty small and should easily fit under 2GB size and hence may not be stressing the buffer partitions too much to warrant bigger number. The patch still helps to get good healthy 4-6% gain in peak values.


Pavel Golub: Non-obvious ALTER statements are gone


Decided to read PostgreSQL 8.4 Release notes before going to sleep and was pleasantly surprised. The fact of ALTER statements mess (which I described in my post) is now fixed:

Modify the ALTER TABLE syntax to allow all reasonable combinations for tables, indexes, sequences, and views (Tom)

This change allows the following new syntaxes:

  • ALTER SEQUENCE OWNER TO
  • ALTER VIEW ALTER COLUMN SET/DROP DEFAULT
  • ALTER VIEW OWNER TO
  • ALTER VIEW SET SCHEMA

There is no actual new functionality here, but formerly you had to say ALTER TABLE to do these things, which was confusing.

Cool! Way to go!

Hubert Lubaczewski: explain.depesz.com - update

I just modified the internals of explain.depesz.com. Now, it finally stores the plans in database (previously it stored the plans as files in dedicated directory). Effect for enduser is just that history page should load faster. But, having the data in database makes it possible to add more features. One such feature is already added - ability to [...]