Tom Lane wrote: > A variant of the idea of inventing functions is to extend the existing > datatype 'regproc' to do this, and invent also 'regclass', 'regtype', > 'regoperator' datatypes to do the lookups for the other object kinds. > I proposed this in a different context last year, > http://archives.postgresql.org/pgsql-hackers/2001-08/msg00589.php > but it seemed too late to do anything with the idea for 7.2. >
Interesting thread. It seems like the same basic facility could also support an enum datatype that people migrating from mysql are always looking for. > One question is what to do with invalid input. For example, if table > foo doesn't exist then what should 'foo'::regclass do? The existing > regproc datatype throws an error, but I wonder whether it wouldn't be > more useful to return NULL. Any thoughts on that? NULL makes sense. > > Also, for functions and operators the name alone is not sufficient to > uniquely identify the object. Type regproc currently throws an error > if asked to convert a nonunique function name; that severely limits its > usefulness. I'm toying with allowing datatypes in the input string, > eg > 'sum(bigint)'::regproc > but I wonder if this will create compatibility problems. In particular, > should the regproc and regoperator output converters include datatype > indicators in the output string? (Always, never, only if not unique?) I'd be inclined to include datatype always. If you don't, how can you use this for pg_dump, etc? Joe ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]