[Ur] [SOLVED: will now use Postgres instead] Can an Ur/Web server be made to create directories / write to files on the host Linux filesystem?

Stefan Scott Alexander stefanscottalexx at gmail.com
Mon May 18 10:58:46 EDT 2015


Thank you Sergey for the callback library, and thank you Timothy and Adam
for reminding me that I need to be worried more about issues such as
security, concurrency and transactions!

This got me thinking...

I should also clarify that the data will *already be in Posgres*.

It is originally created via users editing forms on the client side of an
Ur/Web app, but then it is stored by the Ur/Web server in the Postgresql
database.

So this data in SQL already satisfies certain transactional requirements
and uniqueness properties, due to the concurrency and transaction controls
in Postgresql.

This vastly simplifies my question - and now I see that it is a Postgres
question, not an UrWeb question. I just need to get that data from
*Postgres* to the filesystem.

Also, this data is already grouped in a "tree" of recordsets, with a single
top table containing a single record at the top each "tree".

Therefore I can use the primary key of the top table as a *unique*
identifier in the filesystem - to name the directory where all the child
recordsets will be stored.

I see there is a COPY command in Postgresql.

http://www.postgresql.org/docs/9.4/static/sql-copy.html

And if I need to create directories from Postgresl, I found 2 forum links
explaining how to do this. (Interesting how the responses in these threads
also heavily emphasized the security aspect.)

http://forums.devshed.com/postgresql-help-21/call-os-command-postgresql-function-216709.html

http://postgresql.nabble.com/Runnning-operating-system-commands-from-an-SPL-td2142302.html

Again, I'm thankful for people emphasizing the issues involving security
and concurrency and transactions!

I'd certainly much rather rely on the existing facilities for this in
Postgres rather than having to do it through C - even more so, via a
foreign-function interface.

And it's very interesting to now view Postgresql as the transactional
"gateway" to the underlying filesystem...

###
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150518/051707c5/attachment.html>


More information about the Ur mailing list