Re: Some questions on user defined types and functions.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeffery Collins <collins(at)onyx-technologies(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Some questions on user defined types and functions.
Date: 2000-07-26 15:12:08
Message-ID: 11075.964624328@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Jeffery Collins <collins(at)onyx-technologies(dot)com> writes:
> like the following syntax to work:

> CREATE FUNCTION myfunc(mytype) RETURNS text AS
> '$HOME/lib/libmyso.so' LANGUAGE 'c':

> and have the environment variable $HOME "lazy" evaluated. I
> have looked at the fmgr code and this doesn't look too difficult to add
> as long as I could get the $HOME past the parser.

The parser doesn't know a thing about that, it's just seeing a string
literal. I think hacking in dfmgr.c would be sufficient. Whether it's
a good idea is another question --- you realize you'd be dealing with
postmaster environment variables, right, not those of the connected
user? The way we handle this in the distribution is by substituting
appropriate strings into a script before it's handed to psql; see the
regression tests directory for examples.

> 3. fid assignment - Basically the same question as above but with
> functions instead of types. If there is an index that uses a function,
> it appears that you can't drop and re-create the function without
> blowing away the index definition.

I think it would be a really bad idea to allow recycling of type and
function OIDs for what might be completely incompatible objects. But
something that's been on the TODO list for a while is to create an ALTER
FUNCTION command that would replace the body of an existing function
without changing the declared signature (parameters and return type).
That seems relatively safe, and it'd be awfully handy. Want to have a
go at it?

regards, tom lane

PS: you do realize that revising the function on which an index is
based probably renders the index useless anyway? Unless you can
guarantee that none of the stored values change...

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ernie 2000-07-26 16:02:11 performance help
Previous Message Jules Bean 2000-07-26 14:58:26 Re: Performance for seq. scans

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2000-07-26 15:18:06 Re: AW: AW: AW: Vacuum only with 20% old tuples
Previous Message Zeugswetter Andreas SB 2000-07-26 15:09:17 AW: AW: AW: Vacuum only with 20% old tuples