Re: Dealing with table names in functions - Mailing list pgsql-general

From Greg Sabino Mullane
Subject Re: Dealing with table names in functions
Date
Msg-id a602c626f7243db24a58c4e0f80b5f9e@biglumber.com
Whole thread Raw
In response to Dealing with table names in functions  (Jim Nasby <decibel@decibel.org>)
List pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> Is there a safe way to deal with tables being passed into a function,
> specifically in terms of what schema they're in?

Pass in the schema and tablename together as a string:
select foobar('public.baz');

or (better, IMO) make it two separate arguments:

select foobar('baz', 'public');

I usually put the table first as it allows me to overload the function
with a single arg and a default schema.

- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200703220923
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8

-----BEGIN PGP SIGNATURE-----

iD8DBQFGAoOGvJuQZxSWSsgRAxYOAJ9kuyz8YY+LvMsVxHSuqFbintcSAQCfWX6y
zk5PVMhN9Pqxxkwvy/erCbw=
=ZTzZ
-----END PGP SIGNATURE-----



pgsql-general by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: Dealing with table names in functions
Next
From: "Andy Dale"
Date:
Subject: xpath_list() function