Built in function question

Started by Tony Cadutoover 20 years ago4 messagesgeneral
Jump to latest
#1Tony Caduto
tony_caduto@amsoftwaredesign.com

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

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Tony Caduto (#1)
Re: Built in function question

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

#3Tony Caduto
tony_caduto@amsoftwaredesign.com
In reply to: Tony Caduto (#1)
Re: Built in function question

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

#4Joe Conway
mail@joeconway.com
In reply to: Tony Caduto (#3)
Re: Built in function question

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