3

i would like to be able to do something like

CREATE TABLESPACE bob location 'C:\a\b\c\d\e\f\bob'

without needing to create all the directory tree beforehand. this is because i have java code that creates tablespaces on the fly and i would like to be able to run it on a separate machine (so it couldnt mkdir() or anything).

is there any sort of postgres configuration that would allow me to make postgres create the appropriate directory tree by itself?

1 Answer 1

1

You could try do mkdir directly in postgres stored procedure using PL/sh or any of your favorite PL/* languages that are available for PostgreSQL

Sign up to request clarification or add additional context in comments.

3 Comments

could you please point me to info on how i can do this using the built-in pl/pgsql ? i cant install any extensions on the db unfortunately, and the posgres docs for pl/pgsql only talk about dealing with tables
I believe that PL/pgSQL is for data manipulation only. You could try to write your function in C (postgresql.org/docs/9.1/static/xfunc-c.html) - it needs no extensions and directly supported by postgresql
You can't do it in pl/pgsql but you can with pm/perlu or pl/pythonu, both of which preinstalled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.