Re: [HACKERS] iterating over relation's attributes

2007-05-05 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> Andrew Dunstan <[EMAIL PROTECTED]> writes:
>>> What is the approved way to iterate over a relation's attributes?
>> 
>> Most places scan through the relation's tuple descriptor, rather
>> than expending multiple catalog lookups in pg_attribute.

> Doesn't that require me to open the relation? Is that a good thing if I 
> wouldn't otherwise be doing that?

Sure, because whatever work gets done is likely to be amortized across
multiple uses of the relcache entry anyway.

regards, tom lane

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings


Re: [HACKERS] iterating over relation's attributes

2007-05-05 Thread Andrew Dunstan



Tom Lane wrote:

Andrew Dunstan <[EMAIL PROTECTED]> writes:
  

What is the approved way to iterate over a relation's attributes?



Most places scan through the relation's tuple descriptor, rather
than expending multiple catalog lookups in pg_attribute.


  


Doesn't that require me to open the relation? Is that a good thing if I 
wouldn't otherwise be doing that?


This is in the context of making CheckAttributeType recurse into 
composite types.


cheers

andrew

---(end of broadcast)---
TIP 2: Don't 'kill -9' the postmaster


Re: [HACKERS] iterating over relation's attributes

2007-05-05 Thread Tom Lane
Andrew Dunstan <[EMAIL PROTECTED]> writes:
> What is the approved way to iterate over a relation's attributes?

Most places scan through the relation's tuple descriptor, rather
than expending multiple catalog lookups in pg_attribute.

regards, tom lane

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly


[HACKERS] iterating over relation's attributes

2007-05-05 Thread Andrew Dunstan


What is the approved way to iterate over a relation's attributes? I see 
that lsyscache.c::get_relnatts() is marked NOT_USED and has been for 
nearly seven years. Maybe it's time to remove that code ;-)


cheers

andrew

---(end of broadcast)---
TIP 5: don't forget to increase your free space map settings