[SQL] Building RPMS with plperl (solution)

2001-07-17 Thread Zot O'Connor

This is not the right mail list, but I wanted to get it into
google/archives (I will forget what I did in 15 minutes, and I could
find little documentation on this process).

To build the redhat 7.1 plperl rpm, you merely need to 

  rpm -Uvh postgresql-7.1.2-4PGDG.src.rpm

then there should be a command along the lines of

  rpm -bb /usr/src/redhat/SPECS/postgresql.spec --define 'forceplperl 1'

But that failed.

So I hand changed

%{?forceplperl:%define plperl %{expand:forceplperl}}
%{!?forceplperl:%define forceplperl 0}
%{!?plperl:%define plperl 0}

to 

%{!?pltcl:%define pltcl 1}
%{!?forceplperl:%define forceplperl 1}
%{!?plperl:%define plperl 1}

And it built.

Then I loaded it:

rpm -Uvh
/usr/src/redhat/RPMS/i386/postgresql-plperl-7.1.2-4PGDG.i386.rpm


Now to test it :)
-- 
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



[SQL] Execute permsissions on fuctions

2001-08-23 Thread Zot O'Connor

Other SQL servers have the concept of stored procedures having different
permissions.

For instance a procedure that can update a table.

Since a web site typically connects as the webuser (or equiv postgres
user), I do not want to offer update to the webuser.

The way I have done this elsewhere is to create a stored procedure that
could update the table, and allow the webuser to update the table.  The
procedure had perms of a user who could update the table, but the
webuser could not.

How can I do this in Postgres?

Thanks.

-- 
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



Re: [SQL] Execute permsissions on fuctions

2001-08-24 Thread Zot O'Connor

Christopher Sawtell wrote:
> 
> On Fri, 24 Aug 2001 06:52, Zot O'Connor wrote:
> > Other SQL servers have the concept of stored procedures having different
> > permissions.
> >
> > For instance a procedure that can update a table.
> >
> > Since a web site typically connects as the webuser (or equiv postgres
> > user), I do not want to offer update to the webuser.
> >
> > The way I have done this elsewhere is to create a stored procedure that
> > could update the table, and allow the webuser to update the table.  The
> > procedure had perms of a user who could update the table, but the
> > webuser could not.
> >
> > How can I do this in Postgres?
> 
> By not GRANTing the webuser write permission to the tables in question.

I guess I should have been more clear.  I want the webuser to
be able to upadte the table VIA the function, and but not directly.

Currently this does not work, since CREATE FUNCTION acts as any
old function:

zot=# CREATE TABLE testperms (id int4);
CREATE
zot=# CREATE FUNCTION effect_testperms (int4) RETURNS int4 AS 'INSERT INTO testperms 
(id) VALUES ($1); RETURN 1;' LANGUAGE 'sql';
SELECT effect_testperms(1);
 effect_testperms 
--
1
(1 row)
zot=# \connect - nobody
You are now connected as new user nobody.
zot=> select * from testperms;
ERROR:  testperms: Permission denied.
zot=> SELECT effect_testperms(2);
ERROR:  testperms: Permission denied.
zot=>

So it appears that FUCNTION effect_testperms() is taking on
the perms of the user calling it.

So it may be a generic issue with Postgres that other DBMS's
effectively run the stored procedure as SUID-like, in that it
takes on the perms of the owner of the procedure, not the
user calling the procedure.



-- 
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to [EMAIL PROTECTED] so that your
message can get through to the mailing list cleanly



[SQL] Finding entries not in table..differnce?

2000-07-10 Thread Zot O'Connor

I need to write a quick function that tells me all of the entriles in
table that are not in table2.

The tables are copies of each other, but 1 has been updated.  I know
this is easy, but I am running on little sleep :)

I want to due something like

select prodlang.prodlsku from prodland,prodlang2 WHERE prodlang.prodlsku
!= prodlang2.prodlsku

But of course I would get every record, several times since at some
point the sku does not equal another sku.

I tried !!= (NOT IN) but it did not like that at all, since sku is a
char field.

I am running an older version of postgress on this server, I do not know
if that is important.


-- 
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com



[SQL] Views on Unions

2000-07-24 Thread Zot O'Connor

under 6.5.3 I see that I cannot do Views on Unions.

Is this still true?  This seems odd since a UNION should be a an
R_Table

Also it seems that I could not do a SELECT INTO or CREATE TABLE AS with
a union (I get an error at union).

Is there a syntax (i.e. using ()'s) that will work?

-- 
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com



[SQL] [Fwd: I will be at Linux World]

2000-08-11 Thread Zot O'Connor


-- 
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com


I will be at Linux World in San Jose next week, Aug 15th, and 16th. 
This is a generic spam/post to see if anyone I know will be there, who
wants to meet with me.

I will also be in Atlanta the last week of September.

I am sending this since I hate going to an event, only to determine 2
weeks later an old friend, net friend, or friend of a friend was at the
same show, town, or area.  Even sometime people I work with :)

Last time I did this I did determine that some folks I had not seen in a
year were going to be in a booth across the Hall.  I might not have met
them.

Anyway, please make sure you respond to me, not any of the lists I am
crossposting to (especially since I will like not check my folders
before I go, so please change any prefixes as well :)

Apologies (mostly insincere) for the Spam.

-- 
Zot O'Connor

http://www.ZotConsulting.com
http://www.WhiteKnightHackers.com