Thread: Built in function question

Built in function question

From
Tony Caduto
Date:
Does anyone know if there is a function that can return the path to the
data directory?

I was looking through the docs, but could not find anything.

Thanks,

--
Tony Caduto
http://www.amsoftwaredesign.com
Home of PG Lightning Admin for Postgresql 8.x


Re: Built in function question

From
Tom Lane
Date:
Tony Caduto <tony_caduto@amsoftwaredesign.com> writes:
> Does anyone know if there is a function that can return the path to the
> data directory?

In 8.0 and later,
    SHOW data_directory;
or the equivalent function call.

            regards, tom lane

Re: Built in function question

From
Tony Caduto
Date:
 I found it in the pg_settings view, but if there is another way I would
like to know about it.

Thanks,

Tony

Tony Caduto wrote:

> Does anyone know if there is a function that can return the path to
> the data directory?
>
> I was looking through the docs, but could not find anything.
>
> Thanks,
>

--
Tony Caduto
http://www.amsoftwaredesign.com
Home of PG Lightning Admin for Postgresql 8.x


Re: Built in function question

From
Joe Conway
Date:
Tony Caduto wrote:

[question about finding data directory]

> I found it in the pg_settings view, but if there is another way I would
> like to know about it.
>

As Tom aluded, you can also do this:

regression=# select current_setting('data_directory');
       current_setting
---------------------------
  /usr/local/pgsql-8.0/data
(1 row)

Joe