Re: DO ... RETURNING

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: DO ... RETURNING
Дата
Msg-id CAFj8pRAh-AsvVwedNBy0Cze_v1Pz2EXTx1bYFOjNNaPTG1oLbA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: DO ... RETURNING  (David Fetter <david@fetter.org>)
Список pgsql-hackers
2013/6/11 David Fetter <david@fetter.org>:
> On Tue, Jun 11, 2013 at 09:30:32AM +0200, Pavel Stehule wrote:
>> Hello
>> >
>> > The current situation is akin to not being able to use queries
>> > directly but always requiring you to create a view first and
>> > then do "select ... from myview"
>> >
>>
>> ok
>>
>> probably we can allow using DO in CTE without impact on other SQL
>> statements, and for this purpose we need to know returned
>> TupleDescriptor early.
>>
>> so I am able accept it, although I am thinking so we are going in
>> strange direction. We are not able do simply tasks simply (we cannot
>> execute SQL script on server side simply) :(. But it is not problem of
>> Hannu design.
>>
>> other question - can we find some readable and intuitive syntax for DO
>> parametrization?
>
> The thing I'm thinking of where this does something we don't yet do is
> in the realm of access control, e.g. allowing people to use DO rather
> than giving them DDL permission to create temporary functions.
>
> Is this what you have in mind?  What other things?

no - I don't see any difference if we allow temporary functions or DO statement.

I am missing some simple tool for scripting any administration tasks -
cleaning schema, cleaning databases, user management, report
calculation.

For this a some procedural functionality is necessary. Now I use a
combination bash/psql/SQL and PL/pgSQL functions. It works, it works
well, but it is hard for leaning, hard for maintaining.

I had a idea - procedural enhancing of psql. When I work on prototype
I leave this idea. Probably we can implement some like C macros to
psql, but it is a end. So my second idea is a plpgsql server side
scripting. PL/pgSQL is readable and strong - "just" we need to eval
our procedural code outside a query. For these tasks a performance is
not top - because there hard bottleneck is IO. And "slow combination
Bash/psql" worked without performance problems. A server side
scripting can be consistent - probably all PL languages should be used
and enough for typical administrative tasks.

Regards

Pavel

>
> Cheers,
> David.
> --
> David Fetter <david@fetter.org> http://fetter.org/
> Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
> Skype: davidfetter      XMPP: david.fetter@gmail.com
> iCal: webcal://www.tripit.com/feed/ical/people/david74/tripit.ics
>
> Remember to vote!
> Consider donating to Postgres: http://www.postgresql.org/about/donate



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Batch API for After Triggers
Следующее
От: Dimitri Fontaine
Дата:
Сообщение: Re: erroneous restore into pg_catalog schema