Re: [SQL] simple problem???

2006-07-21 Thread Patrick Jacquot
ivan marchesini wrote: Dear users It's a simple problem I think (and I hope :-) I have a table like this: A|B|C 1|2|20 1|3|10 1|4|21 2|3|12 2|4|22 3|4|23 where the first two column are a combination without repetition (with k=2) of the numbers 1,2,3,4 for each pair I have a value in the c

Re: [SQL] Help with privilages please

2006-07-21 Thread Hilary Forbes
Tom Thank you - I think that the underlying problem is that I was trying out REVOKE ALL FROM TABLE suppliers FOR public; then connect as hilary and I can still see the table rows. I appear to have to revoke each type eg REVOKE SELECT FROM TABLE suppliers FOR public; etc and then the code works. Is

[SQL] System catalog table privileges

2006-07-21 Thread Hilary Forbes
Dear All Next question on privileges!  Can I safely remove all privileges from the system catalog tables for a user and still enable them to select from the public schema?  I guess the real question is what access rights does an ordinary user have to have to the system catalog tables in order for

Re: [SQL] System catalog table privileges

2006-07-21 Thread Aaron Bono
On 7/21/06, Hilary Forbes <[EMAIL PROTECTED]> wrote: Dear All Next question on privileges!  Can I safely remove all privileges from the system catalog tables for a user and still enable them to select from the public schema?  I guess the real question is what access rights does an ordinary user ha

Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread Kevin Nikiforuk
Many thanks to Stephan, Richard and George. When I was reading the documentation about FOR loops, I didn't realize that I was in the plpgsql section! CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ BEGIN DECLARE lv RECORD; FOR lv IN SELECT DISTINCT rg FROM ldevrg LOOP

Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread A. Kretschmer
am 21.07.2006, um 9:26:21 -0600 mailte Kevin Nikiforuk folgendes: > Many thanks to Stephan, Richard and George. When I was reading the > documentation about FOR loops, I didn't realize that I was in the plpgsql > section! > > CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ > BEGIN >

Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread Tom Lane
"Kevin Nikiforuk" <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ > BEGIN > DECLARE lv RECORD; > FOR lv IN SELECT DISTINCT rg FROM ldevrg LOOP > SELECT ldev FROM ldevrg WHERE ldevrg='$lv'; > END LOOP; > RETURN 1; > END; >

Re: [SQL] System catalog table privileges

2006-07-21 Thread Tom Lane
Hilary Forbes <[EMAIL PROTECTED]> writes: > Next question on privileges!  Can I safely remove all privileges > from the system catalog tables for a user Various people have experimented with doing that, but it tends to break a lot of stuff. I suggest you just revoke privileges on the tables you d

Re: [SQL] Error when trying to use a FOR loop

2006-07-21 Thread Stephan Szabo
On Fri, 21 Jul 2006, Kevin Nikiforuk wrote: > Many thanks to Stephan, Richard and George. When I was reading the > documentation about FOR loops, I didn't realize that I was in the plpgsql > section! > > CREATE OR REPLACE FUNCTION rgio() RETURNS integer as $$ > BEGIN > DECLARE lv RECORD

Re: [SQL] System catalog table privileges

2006-07-21 Thread Hilary Forbes
Aaron Thanks for this one - I had actually wondered about doing that but the trouble is that they say that they need up to the minute reports not "as of last night".  Indeed, I do have another app where I do just that because I find that reports indexes/requirements are very different to transacti

Re: [SQL] System catalog table privileges

2006-07-21 Thread Scott Marlowe
On Fri, 2006-07-21 at 11:19, Hilary Forbes wrote: > Aaron > > Thanks for this one - I had actually wondered about doing that but the > trouble is that they say that they need up to the minute reports not > "as of last night". Indeed, I do have another app where I do just > that because I find tha

[SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Kevin Nikiforuk
So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new table, but I can't figure out how to use a variable in the name of the new table

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Rodrigo De Leon
On 7/21/06, Kevin Nikiforuk <[EMAIL PROTECTED]> wrote: So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new table, but I can't figu

Re: [SQL] CREATE TABLE AS inside of a function

2006-07-21 Thread Erik Jones
Rodrigo De Leon wrote: On 7/21/06, Kevin Nikiforuk <[EMAIL PROTECTED]> wrote: So now that I've got my loops working, on to my next newbie question. I've created my function and in it, I want to loop through the results of a select and for each value of my loop counter, I want to create a new