Skip site navigation (1) Skip section navigation (2)

Re: Test for file exists?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Test for file exists?
Date: 2004-09-20 16:30:44
Message-ID: 200409200930.44193.josh@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-sql
Richard,

> But only if 'sometable.csv' exists;
>
> If 'sometable.csv' does not exist as an input table I want to continue
> the next command.

Sorry, can't be done in plpgsql.   Regular procedural languages are 
deliberately kept ignorant of the host filesystem in order to prevent 
database users from being able to compromise it.   It's a security thing.

You could easily write a function in an "untrusted" language, like PL/PerlU or 
PL/PythonU, which would test for file existence and return a true/false 
value.

-- 
Josh Berkus
Aglio Database Solutions
San Francisco

In response to

pgsql-sql by date

Next:From: Rod TaylorDate: 2004-09-20 16:31:36
Subject: Re: COUNT(*) to find records which have a certain number of
Previous:From: T E SchmitzDate: 2004-09-20 16:19:11
Subject: Re: COUNT(*) to find records which have a certain number of

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group