Skip site navigation (1) Skip section navigation (2)

Some questions on user defined types and functions.

From: Jeffery Collins <collins(at)onyx-technologies(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Some questions on user defined types and functions.
Date: 2000-07-26 13:03:28
Message-ID: 397EE1A0.CAD634ED@onyx-technologies.com (view raw or flat)
Thread:
Lists: pgsql-generalpgsql-hackers
I was wondering if anyone could help me with the following questions.
They are all related to user defined types and functions.

    1. Environment variables in function pathname.  We would like to
have multiple environments (i.e. production, backup, reporting, test
etc) with each environment totally independent of the other
environments.  One thing that stands in the way of this is the absolute
pathname requirement in the CREATE FUNCTION syntax.  Obtimally we would
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.  Has anyone thought
about this before?  Is there another, better way to do this?

    2. tid assignment - We make extensive use of user defined types.
One, fairly painful, thing we have noticed is the following sequence
really doesn't work very well:

            CREATE FUNCTION mytype_in(opaque) RETURNS mytype AS
'/lib/libmyso.so' LANGUAGE 'c';
            CREATE FUNCTION mytype_out(opaque) RETURNS opaque AS
'/lib/libmyso.so' LANGUAGE 'c';
            CREATE TYPE mytype (internallength = VARIABLE,
input=mytype_in, output=mytype_out);
            CREATE TABLE mytable (t mytype);
            DROP TYPE mytype;
            then create the type again

        The reason for possibly wanting to do this is to fix a problem
with the implementation of the type mytype.  The reason this doesn't
seem to work is that the definition of mytable "knows" the TypeID of
mytype and, because it got dropped and recreated, the TypeID is now
different.  So the question is, is there a way to modify the definition
of a type without dropping and recreating all of the tables that use the
type.

    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.

Thank you,
Jeff Collins



Responses

pgsql-hackers by date

Next:From: Louis-David MitterrandDate: 2000-07-26 13:08:54
Subject: free auction project with Postgres
Previous:From: Zeugswetter Andreas SBDate: 2000-07-26 08:44:22
Subject: AW: AW: Vacuum only with 20% old tuples

pgsql-general by date

Next:From: Louis-David MitterrandDate: 2000-07-26 13:08:54
Subject: free auction project with Postgres
Previous:From: Steve HeavenDate: 2000-07-26 11:39:22
Subject: Re: Performance for seq. scans

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group