Re: Simplifying OID lookups in the presence of namespaces

From: Joe Conway <mail(at)joeconway(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Simplifying OID lookups in the presence of namespaces
Date: 2002-04-23 03:35:03
Message-ID: 3CC4D667.4070302@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-04-23 03:46:34 Re: Simplifying OID lookups in the presence of namespaces
Previous Message Michael Loftis 2002-04-22 23:47:59 Re: What is wrong with hashed index usage?