Re: How to extract a value from a record using attnum or attname?

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: "Andrew Dunstan" <andrew(at)dunslane(dot)net>
Cc: "Dimitri Fontaine" <dimitri(at)2ndQuadrant(dot)fr>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to extract a value from a record using attnum or attname?
Date: 2011-02-22 23:29:26
Message-ID: 4D63F276020000250003AE77@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> wrote:

> Have you performance tested it? Scanning pg_index for index
> columns for each row strikes me as likely to be unpleasant.

I haven't, yet. I had rather assumed that the index info for a
relation would have a high probability of being cached during
execution of an AFTER trigger for that relation, so I think we're
talking RAM access here. It didn't seem sane to try to create an
HTAB for this and worry about invalidation of it, etc. If there's a
faster way to get to the info without going to such extremes, I'd be
happy to hear them. (At least I avoided building and parsing a
query to get at it.)

> Also, the error messages seem to need a bit of work (no wonder
> they seemed familiar to me :) )

[blush] I was just trying to write code with "fits in with
surrounding code", as recommended. You mean I should change the
function name in the message from the name of the function I copied
*from* to the name of the function I copied *to*? Well, I *guess*
it still fits in.... ;-)

Seriously, thanks for pointing that out. Will fix.

-Kevin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrej 2011-02-23 00:05:36 Re: regexp match in plpgsql
Previous Message Gauthier, Dave 2011-02-22 22:55:57 regexp match in plpgsql

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-02-22 23:54:49 Re: SSI bug?
Previous Message Dan Ports 2011-02-22 23:20:54 Re: SSI bug?