From: | John R Pierce <pierce(at)hogranch(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Getting my Database name in a C Extension |
Date: | 2014-10-02 23:01:03 |
Message-ID: | 542DD92F.1070502@hogranch.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Barwick | 2014-10-02 23:21:03 | Re: installing on mac air development machine |
Previous Message | john.tiger | 2014-10-02 22:50:24 | installing on mac air development machine |