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

Re: ALTER OBJECT any_name SET SCHEMA name

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Dimitri Fontaine <dimitri(at)2ndQuadrant(dot)fr>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: ALTER OBJECT any_name SET SCHEMA name
Date: 2010-10-31 16:59:45
Message-ID: 4CCDA081.40403@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackers
On 31.10.2010 14:46, Dimitri Fontaine wrote:
> What we could do is offer extension's author a way to find their
> operator or functions or whatever dynamically in SQL, so that writing
> robust pure-SQL functions is possible. What comes to mind now would be a
> way to call a function/operator/... by OID at the SQL level. Not pretty
> but with the pg_extension_objects() SRF and maybe a layer atop that,
> that would do the trick. Brain dumping still.

How about something like:

CREATE EXTENSION myextension ... SCHEMA myschema;

And in the .sql file in the extension you could have special markers for 
the schema, something like:

CREATE FUNCTION otherfunction() AS ...;
CREATE FUNCTION foo() AS $$ SELECT 'foo', @extschema(at)(dot)otherfunction() $$;

@extschema@ would be search&replaced at CREATE EXTENSION time with the 
schema specified by the user.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

In response to

Responses

pgsql-hackers by date

Next:From: Tom LaneDate: 2010-10-31 17:01:55
Subject: Re: type info refactoring
Previous:From: Heikki LinnakangasDate: 2010-10-31 16:50:21
Subject: Re: type info refactoring

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