Re: Dealing with table names in functions

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: Dealing with table names in functions
Дата
Msg-id a602c626f7243db24a58c4e0f80b5f9e@biglumber.com
обсуждение исходный текст
Ответ на Dealing with table names in functions  (Jim Nasby <decibel@decibel.org>)
Список 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 по дате отправления:

Предыдущее
От: "Merlin Moncure"
Дата:
Сообщение: Re: Dealing with table names in functions
Следующее
От: "Andy Dale"
Дата:
Сообщение: xpath_list() function