Determining current database programmatically

Поиск
Список
Период
Сортировка
От Fran Fabrizio
Тема Determining current database programmatically
Дата
Msg-id 3C0B9951.823445F7@mmrd.com
обсуждение исходный текст
Ответы Re: Determining current database programmatically  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hello,

I am writing a stored procedure that should ideally alter its behavior
depending on the database that it is in. (If it's being used in the test

database it should do one thing, and in production it should do another
- it uses pgMail to send email alerts and I don't want to be sending
the support folks emails from my own testing).  I want to keep the
procedure generic, so is there a way to figure out the name of the
current database programmatically?  Like the Postgres equivalent of an
environment variable or something?  I've been poking around the docs but
I don't even know
what it is that I am looking for. :-)

One alternative I can think of is to have a column in the databases that
list the email address that the message should go to, but this means
that
I would no longer be able to use the same data loading scripts on both
databases like I can do now.  I can do it this way if necessary but
I was
looking for something a little more dynamic.

Thanks,
Fran


В списке pgsql-general по дате отправления:

Предыдущее
От: bombadil@wanadoo.es
Дата:
Сообщение: Re: Problem (bug?) with like
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Problem (bug?) with like