Re: Getting my Database name in a C Extension

Поиск
Список
Период
Сортировка
От John R Pierce
Тема Re: Getting my Database name in a C Extension
Дата
Msg-id 542DD92F.1070502@hogranch.com
обсуждение исходный текст
Ответ на Getting my Database name in a C Extension  (Cedric Berger <cedric@precidata.com>)
Список pgsql-general
On 10/2/2014 8:11 AM, Cedric Berger wrote:
I'm writing an extention (FDW), and I need, in my C code, the name of
my database ("contrib_regression_test" for example), and I've two
questions:

1) What is the easiest way to get that directly in C?

2) Is there a way to get this information in the SQL extension
installation/update scripts (like the @/extschema/@ substitution)?

you could SELECT CURRENT_CATALOG;  using the SPI_ functions from your C, or directly in your SQL extension script...   this returns the database name (the name is from the sql standard).   see http://www.postgresql.org/docs/current/static/functions-info.html for more info functions like this available in SQL.



-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

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

Предыдущее
От: "john.tiger"
Дата:
Сообщение: installing on mac air development machine
Следующее
От: Ian Barwick
Дата:
Сообщение: Re: installing on mac air development machine