Re: [GENERAL] Secret Santa List

2015-12-23 Thread Lou Duchez
Why not generate the required results in a SELECT then update from that. row_number() could allow you to generate a random number to each giver, then we can generate another random number and join to each random number. That'll give you a giver and recipient combination. e.g: select giver,r

Re: [GENERAL] Secret Santa List

2015-12-23 Thread Lou Duchez
Of course: you can't UPDATE a field with a query returning more than one result, as you can check easily trying: I understand that, and my query does not return more than one result. The problem is that it returns THE SAME result each time, most likely because the subquery is evaluated exactl

[GENERAL] Secret Santa List

2015-12-22 Thread Lou Duchez
I have a company with four employees who participate in a Secret Santa program, where each buys a gift for an employee chosen at random. (For now, I do not mind if an employee ends up buying a gift for himself.) How can I make this work with an SQL statement? Here is my Secret Santa table:

Re: [GENERAL] requests / suggestions to help with backups

2007-02-16 Thread Lou Duchez
> >Certainly, I've > >tried "grant select on database mydatabase to user myuser"; it doesn't > >work, because "select" is not a database-level privilege. > Sorry, you're right on that one. I misread it. However, it shouldn't > be too hard to write a script, either in a procedural language or hi

Re: [GENERAL] requests / suggestions to help with backups

2007-02-16 Thread Lou Duchez
> Lou Duchez wrote: > >Like everyone else, I use pg_dump for backup purposes; I have a cron job > >that runs a pg_dump whose output is then FTP'd elsewhere. Two things > >that would make my life easier: > > > >1) "grant select on database ..." or, hy

[GENERAL] requests / suggestions to help with backups

2007-02-15 Thread Lou Duchez
Like everyone else, I use pg_dump for backup purposes; I have a cron job that runs a pg_dump whose output is then FTP'd elsewhere. Two things that would make my life easier: 1) "grant select on database ..." or, hypothetically, "grant select on cluster". The goal would be to create a read-only Po