some namespace.c refactoring - Mailing list pgsql-hackers

From Peter Eisentraut
Subject some namespace.c refactoring
Date
Msg-id 12f1b1d2-f8cf-c4a2-72ec-441bd79546cb@enterprisedb.com
Whole thread Raw
Responses Re: some namespace.c refactoring
Re: some namespace.c refactoring
List pgsql-hackers
Here are two patches that refactor the mostly repetitive "${object} is 
visible" and get_${object}_oid() functions in namespace.c.  This uses 
the functions in objectaddress.c to look up the appropriate per-catalog 
system caches and attribute numbers, similar to other refactoring 
patches I have posted recently.

In both cases, there are some functions that have special behaviors that 
are not easy to unify, so I left those alone for now.

Notes on 0001-Refactor-is-visible-functions.patch:

Among the functions that are being unified, some check temp schemas and 
some skip them.  I suppose that this is because some (most) object types 
cannot normally be in temp schemas, but this isn't made explicit in the 
code.  I added a code comment about this, the way I understand it.

That said, you can create objects explicitly in temp schemas, so I'm not 
sure the existing code is completely correct.

Notes on 0002-Refactor-common-parts-of-get_-_oid-functions.patch:

Here, I only extracted the common parts of each function but left the 
actual functions alone, because they each have to produce their own 
error message.  There is a possibility to generalize this further, 
perhaps in the style of does_not_exist_skipping(), but that looked like 
a separate step to me.

Attachment

pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: appendBinaryStringInfo stuff
Next
From: Pradeep Kumar
Date:
Subject: Extensible Rmgr for Table Ams