On Wed, Nov 8, 2017 at 9:21 AM, Peter Eisentraut <peter.eisentr...@2ndquadrant.com> wrote: >> Why not use VOIDOID for the prorettype value? > > We need a way to distinguish functions that are callable by SELECT and > procedures that are callable by CALL.
I agree that we need this, but using prorettype = InvalidOid to do it might not be the best way, because it only works for procedures that don't return anything. If a procedure could return, say, an integer, then it would fail, because we have two ways to say that something in pg_proc returns nothing (InvalidOid, VOIDOID) but we have only one way to say that it returns an integer (INT4OID). Similarly, we'd have a problem if we ever tried to use procedures for handling triggers or (perhaps more likely) event triggers, since those special kinds of functions also signal their purpose via the return type - which may also not have been such a hot idea, but at least in those cases the idea of returning any sort of real result is more or less known to be nonsensical. Anyway, I think it would be better to invent an explicit way to represent whether something is a procedure rather than relying on overloading prorettype to tell us. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company