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

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Dealing with table names in functions


  • From: Reece Hart <reece(at)harts(dot)net>
  • To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
  • Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
  • Subject: Re: Dealing with table names in functions
  • Date: Thu, 22 Mar 2007 09:39:51 -0700
  • Message-id: <1174581591(dot)5096(dot)21(dot)camel(at)snafu(dot)site>

On Thu, 2007-03-22 at 09:40 -0400, Alvaro Herrera wrote:
> Pass the optionally qualified name and cast it to regclass.  It will
> work correctly when the name is not qualified, applying search_path,
> and it will also work when the name is qualified. 

Is there a way to get names that are always qualified, irrespective of
the search_path? Once one has the oid, it's an easy function to write,
but I suspect this machinery already exists.

For example, I'd like the hypothetical cast:
        rkh(at)csb-dev=> set search_path = 'unison';
        SET
        
        rkh(at)csb-dev=> select 'pseq'::regclass::oid::FQregclass;
         regclass 
        ----------
         unison.pseq
        (1 row)


-Reece

-- 
Reece Hart, http://harts.net/reece/, GPG:0x25EC91A0
./universe -G 6.672e-11 -e 1.602e-19 -protonmass 1.673e-27 -uspres bush
kernel warning: universe consuming too many resources. Killing.
universe killed due to catastrophic leadership. Try -uspres carter.




Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group