Need feedback on new feature (\for)
От | Martijn van Oosterhout |
---|---|
Тема | Need feedback on new feature (\for) |
Дата | |
Msg-id | 20030817155453.GE27010@svana.org обсуждение исходный текст |
Ответы |
Re: Need feedback on new feature (\for)
Re: Need feedback on new feature (\for) Re: Need feedback on new feature (\for) |
Список | pgsql-general |
I've had some fun in the past where I've had to grant a lot of tables and other similar system commands. Unfortunatly, you can't use queries to fill in fields for you. Anyway, I've implemented a patch which allows the following: grant select on ":2" to ":1" \for select usename, relname from pg_catalog.pg_user, pg_catalog.pg_class where relname not like 'pg_%'; Produces: Expanded to: grant select on "test" to "postgres" Expanded to: grant select on "test2" to "postgres" [etc] Anyway, I'm sure you can come up with all sorts of uses. It occurs to me to be a way to produce a whole lot of commands to create very similar triggers based on a list of tables. And other commands to remove them again. My questions are as follows: 1. Due to the way that backslash commands are implemented, the entire second query has to be on one line. I don't see a good way to deal with this. 2. If the results being substituted contain quotes, they might not substitute cleanly. Do we care? 3. Do people even want something like this? 4. Should it list the commands being executed? 5. What should happen upon an error in the generated query? 6. Maybe \foreach is clearer? 7. There should probably be a test mode to just dump the queries without executing. Thoughts welcome. Preliminary patch at: http://svana.org/kleptog/pgsql/forloop1.patch Anonymous CVS access isn't working for me so it's not against the latest, hopefully it's not too changed. It's somewhere around 7.3.2. Have a nice day, -- Martijn van Oosterhout <kleptog@svana.org> http://svana.org/kleptog/ > "All that is needed for the forces of evil to triumph is for enough good > men to do nothing." - Edmond Burke > "The penalty good people pay for not being interested in politics is to be > governed by people worse than themselves." - Plato
Вложения
В списке pgsql-general по дате отправления: