pass Form_pg_attribute to examine_attribute rather than Relation structure.

Started by amul sulalmost 12 years ago2 messageshackers
Jump to latest
#1amul sul
sul_amul@yahoo.co.in

Hi,

examine_attribute() function accept Relation type argument, and extract attribute from it.

For more granularity, I think passing Form_pg_attribute to examine_attribute() function  rather than passing Relation will be more relevant & makes it simple to understand.

Thinking to change examine_attribute as,

- examine_attribute(Relation onerel, int attnum, Node *index_expr)
+examine_attribute(Form_pg_attribute attr, Node *index_expr)
 

I think there wont any loss or gain except little optimization of function call stack space. 

Thoughts? comments?

Please have look attached patch.

Regards,

Amul Sul

Attachments:

0001-examine_attribute-function-s-arguments-changed.patchapplication/octet-stream; name=0001-examine_attribute-function-s-arguments-changed.patchDownload+11-11
#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: amul sul (#1)
Re: pass Form_pg_attribute to examine_attribute rather than Relation structure.

amul sul <sul_amul@yahoo.co.in> writes:

For more granularity,�I think passing�Form_pg_attribute to�examine_attribute() function �rather than passing Relation will be more relevant & makes it simple to understand.

I don't find that to be a good idea at all. It makes examine_attribute
inconsistent with most other functions in analyze.c, and it limits our
ability to add logic inside that function that might want to look at
other properties of the relation.

Even without that argument, moving the responsibility for initializing
stats->tupattnum to the callers of examine_attribute is certainly a
net loss in readability and reliability.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers