Search Postgresql Archives

Re: Getting my Database name in a C Extension

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux