Re: Beta time

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Beta time
Date: 2001-09-22 15:46:01
Message-ID: 14357.1001173561@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Christopher Kings-Lynne <chriskl(at)familyhealth(dot)com(dot)au> writes:
>> I'd suggest issuing the NOTICE inside the loop, actually,
>> and not breaking at all. (See also #4)

> I don't quite understand what you mean here?

Just do elog(NOTICE) inside the loop over indexes, rather than setting a
flag to do it later. For that matter, I see no reason not to raise the
elog(ERROR) condition inside the loop, rather than setting a flag to
do it later.

> I admit I was confused as to why it's keyno - 1??

To make a zero-based C array index from the one-based attribute number.
But the problem with this code is it doesn't handle indexes on system
attributes such as OID, which have negative attribute numbers and are
not shown in rel->rd_att->attrs. I'd be inclined to use get_attname,
and not bother with looking into the relcache rd_att structure at all.

> I was going to do this, but then realised all I had access to in the
> indexStruct was the oid of the index relation? What's the easiest way of
> retrieving the name of an index given it's oid, or the oid of it's
> relation?

get_rel_name

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Matti.Lehtonen 2001-09-22 19:35:32 DROP TABLE and DROP INDEX hangs up in version 7.1.3, when...
Previous Message Bruce Momjian 2001-09-22 14:34:17 Re: patch for contrib/intarray (CVS)