Re: R: change owner on a table
От | D. Duccini |
---|---|
Тема | Re: R: change owner on a table |
Дата | |
Msg-id | Pine.GSO.4.03.10101271207300.1598-100000@ra.bpsi.net обсуждение исходный текст |
Ответ на | Re: R: change owner on a table (Francisco Reyes <fran@reyes.somos.net>) |
Список | pgsql-novice |
here's what i did (background methodology for future reference): 1. first i started psql -E to have it reveal the backend queries This is really a useful way to discover where/how information is stored/related in postgres via the console commands 2. I issued a \dt on the command to get the list of tables team=> \dt QUERY: SELECT usename, relname, relkind, relhasrules FROM pg_class, pg_user WHERE usesysid = relowner and ( relkind = 'r')and relname !~ '^pg_' ORDER BY relname you'll see that it joins on usesysid = relowner, so all you need to do is determine the usesysid of the new owner you want to own the table 3. select usesysid from pg_user where usename = 'newowner'; 4. update pg_class set relowner = USESYSID WHERE relname = 'tableToUpdate'; where USESYID is the user id returned from above query in step 3 5. pat yourself on the back for being clever (no one else in your org will ;) -duck > On Thu, 25 Jan 2001, Marco DI NARDO wrote: > > > I've a problem is quite the same. > > i've got a table that was created by one user in a database (me), and I want to > > grant to other postgres user the right to view or update this table. > > Marco > > m.dinardo@gruppodigito.com > > I thought this is what the "grant" command is. > I don't recall the exact syntax but it is something like: > grant all to <user> on <table>; > ----------------------------------------------------------------------------- david@backpack.com BackPack Software, Inc. www.backpack.com +1 651.645.7550 voice "Life is an Adventure. +1 651.645.9798 fax Don't forget your BackPack!" -----------------------------------------------------------------------------
В списке pgsql-novice по дате отправления: