Write to file from pgplsql function

Поиск
Список
Период
Сортировка
Искать

Write to file from pgplsql function

От:
"Sven Sporer" <s.sporer@gmx.net>
Дата:
Hello,

is there a way to write to a file in the filesystem from a pgplsql function?

The reason for this is the architecture of our user system: Each new database has a file in $PGDATA/users with a list of users who are allowed to connect to this database. In pg_hba.conf is a link to this file. As some users don't have filesystem privileges, but are allowed to add users, they have to be able to call a function in postgres which adds that user to the file.

I appreciate your help, or a tip to improve the user system.

Sven Sporer

Re: Write to file from pgplsql function

От:
"A. Kretschmer" <andreas.kretschmer@schollglas.com>
Дата:
am  Tue, dem 02.01.2007, um 10:09:06 +0100 mailte Sven Sporer folgendes:
> Hello,
> 
> is there a way to write to a file in the filesystem from a pgplsql function?

No, because plsql is a trusted language. You should use a untrusted
language, for instance plperlu.


Andreas
-- 
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net

Re: Write to file from pgplsql function

От:
Bruno Wolff III <bruno@wolff.to>
Дата:
On Tue, Jan 02, 2007 at 10:09:06 +0100,
  Sven Sporer  wrote:
> Hello,
> 
> is there a way to write to a file in the filesystem from a pgplsql function?
> 
> The reason for this is the architecture of our user system: Each new database has a file in $PGDATA/users with a list of users who are allowed to connect to this database. In pg_hba.conf is a link to this file. As some users don't have filesystem privileges, but are allowed to add users, they have to be able to call a function in postgres which adds that user to the file.
> 
> I appreciate your help, or a tip to improve the user system.

In 8.2, you might have another option. There is now a CONNECT privilege for
databases. So you don't need to list all of your users individually in
the pg_hba.conf file to give only some of them access to particular
databases.
FAQ