[SQL] lo_export and files permissions

2000-08-16 Thread mike . baroukh

De: Mike Baroukh <[EMAIL PROTECTED]>
À: <[EMAIL PROTECTED]>
Objet: lo_export and files permissions
Date : lundi 14 août 2000 10:44

Hi everybody.

Who can help me with a lo_export() problem ? :

I'm using lo_export function in sql statement with pgsql 6.5 on Linux RH 6.2.
Data are exported fine.
My problem is I can't delete created objects cause they have writing permissions for 
user postgres only.
I tried changing umask for postmaster with no success.
When I try to delete, it's within a servlet so running as user nobody.what would be 
fine is adding write permissions to group postgres so I can add nobody to this group 
...

Thanks in advance for your help.


Mike Baroukh
i-panema - 14 Rue Ballu Paris IXeme
06 63 57 27 22

Mike Baroukh
i-panema - 10 rue Ballu - 75009 Paris
06 63 57 27 22

- La messagerie itinérante sans abonnement NetCourrier -
Web : www.netcourrier.com Minitel : 3615 et 3623 NETCOURRIER
  Tél : 08 36 69 00 21



Re: [SQL] lo_export and files permissions

2000-08-16 Thread Mike Baroukh

 Hi,

>   I was using sql lo_export function before upgraded to
> 7.0 (which doesn't allow non-admin to call it). So if
> possible, you can use the client function lo_export to
> extract the blob. I know it's simple in Perl DBI but
> not sure about java.

I actually use lo_export with java. But this only allow to export dta, not
to delete exported data ??

>   Another work-around might be to lo_export the file
> to a directory writable by nobody.

I tried, don't work.
In fact, I can delete by hand, even if i'm not root or postgres by using
command "rm -f".
But I can't delete using Java's File object.

Mike


- Original Message -
From: Guo Bin <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, August 16, 2000 11:31 AM
Subject: Re: [SQL] lo_export and files permissions


> Hi,
>   I was using sql lo_export function before upgraded to
> 7.0 (which doesn't allow non-admin to call it). So if
> possible, you can use the client function lo_export to
> extract the blob. I know it's simple in Perl DBI but
> not sure about java.
>   Another work-around might be to lo_export the file
> to a directory writable by nobody.
>
> Regards,
> --
> Guo Bin
>
> --- [EMAIL PROTECTED] wrote:
> > De: Mike Baroukh <[EMAIL PROTECTED]>
> > À: <[EMAIL PROTECTED]>
> > Objet: lo_export and files permissions
> > Date : lundi 14 août 2000 10:44
> >
> > Hi everybody.
> >
> > Who can help me with a lo_export() problem ? :
> >
> > I'm using lo_export function in sql statement with pgsql
> > 6.5 on Linux RH 6.2.
> > Data are exported fine.
> > My problem is I can't delete created objects cause they
> > have writing permissions for user postgres only.
> > I tried changing umask for postmaster with no success.
> > When I try to delete, it's within a servlet so running as
> > user nobody.what would be fine is adding write
> > permissions to group postgres so I can add nobody to this
> > group ...
> >
> > Thanks in advance for your help.
> >
> >
> > Mike Baroukh
> > i-panema - 14 Rue Ballu Paris IXeme
> > 06 63 57 27 22
> >
> > Mike Baroukh
> > i-panema - 10 rue Ballu - 75009 Paris
> > 06 63 57 27 22
> >
> > - La messagerie itinérante sans abonnement
> > NetCourrier -
> > Web : www.netcourrier.com Minitel : 3615 et 3623
> > NETCOURRIER
> >   Tél : 08 36 69 00 21
>
>
> __
> Do You Yahoo!?
> Send instant messages & get email alerts with Yahoo! Messenger.
> http://im.yahoo.com/
>




Re: [SQL] Trigger

2000-09-10 Thread Mike Baroukh


There is a sample in postgres documentation. (See below).
the only problem is for using langage plpgsql.
If it is not understand by your database, you must use command

createlang plpgsql dbname

as the owner of the database.

CREATE TABLE emp (
empname text,
salary int4,
last_date datetime,
last_user name);

CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS
BEGIN
-- Check that empname and salary are given
IF NEW.empname ISNULL THEN
RAISE EXCEPTION ''empname cannot be NULL value'';
END IF;
IF NEW.salary ISNULL THEN
RAISE EXCEPTION ''% cannot have NULL salary'', NEW.empname;
END IF;

-- Who works for us when she must pay for?
IF NEW.salary < 0 THEN
RAISE EXCEPTION ''% cannot have a negative salary'',
NEW.empname;
END IF;

-- Remember who changed the payroll when
NEW.last_date := ''now'';
NEW.last_user := getpgusername();
RETURN NEW;
END;
' LANGUAGE 'plpgsql';

CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp
FOR EACH ROW EXECUTE PROCEDURE emp_stamp();




- Original Message -
From: Craig May <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 06, 2000 10:27 PM
Subject: [SQL] Trigger


>
> Could someone send me a quick example of a trigger.
>