Re: proposal: plpgsql pragma statement

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: proposal: plpgsql pragma statement
Дата
Msg-id CAFj8pRCNcBYdfW3MDXNuM309tUyMv-HkPc5UA0+SRhvupnOv9g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: proposal: plpgsql pragma statement  ("Jonah H. Harris" <jonah.harris@gmail.com>)
Список pgsql-hackers
Hi

st 5. 12. 2018 v 18:28 odesílatel Jonah H. Harris <jonah.harris@gmail.com> napsal:
You can alter the lexer and create a comment node, right? That’s how we did hints in EnterpriseDB.

I don't think so it is adequate solution - sure, it is, if I would to implement Oracle's hints. But it is not my target. I afraid about performance impacts a) for SQL queries, b) for plpgsql.

I had a possibility to see a functions, procedures (ported from Oracle) with thousands lines of comments. It is not a Oracle problem, due compilation to persistent byte code. But I don't think so this cost is accepted for pragma implementation.

The native plpgsql statement PRAGMA has zero performance impact on existing code. More, the implementation is just local inside plpgsql, what is important for me.

Regards

Pavel


 

On Wed, Dec 5, 2018 at 11:41 AM Pavel Stehule <pavel.stehule@gmail.com> wrote:


st 5. 12. 2018 v 15:03 odesílatel Pavel Luzanov <p.luzanov@postgrespro.ru> napsal:

But maybe your extension could read the PERFORM statement preceding it and treat it as an annotation hint for the following statement.

In this case, comment line in some format will be better than real PERFORM statement. Like this:


/*+PRAGMA cmdtype CREATE; */
EXECUTE format('CREATE TABLE xxx ...

I looked there and It is not possible to implement it - plpgsql uses SQL lexer, and the content of comments are just ignored. So I cannot to read comments. There is not any possibility to read it simply from plpgsql. Unfortunately, but it is expected, there is nothing like query string for plpgsql statement.

Regards

Pavel 
 
-----
Pavel Luzanov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

--
Jonah H. Harris

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

Предыдущее
От: Stephen Frost
Дата:
Сообщение: Re: minor leaks in pg_dump (PG tarball 10.6)
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: psql display of foreign keys