Re: proposal: plpgsql pragma statement

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Dmitriy Igrishin <dmitigr(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: proposal: plpgsql pragma statement
Date: 2018-12-05 18:41:17
Message-ID: CAFj8pRAZaNDFuEPZGa6p7W3bWKg6ZMTfhr2UdSNJaQPZDou4FA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

st 5. 12. 2018 v 19:12 odesílatel Dmitry Igrishin <dmitigr(at)gmail(dot)com>
napsal:

> вт, 4 дек. 2018 г. в 20:13, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>:
> >
> > Hi
> >
> > I wrote plpgsql_check https://github.com/okbob/plpgsql_check.
> >
> > It is working well, but because it does static analyse only, sometimes
> it can produces false alarms or it should to stop a analyse, because there
> are not necessary data.
> >
> > https://github.com/okbob/plpgsql_check/issues/36
> >
> > I see one possible solution in introduction of pragma statement with
> syntax:
> >
> > PRAGMA keyword [content to semicolon];
> >
> > The pragma has a relation to following statement. So the issue 36 can be
> solved by pragma
> >
> > PRAGMA cmdtype CREATE;
> > EXECUTE format('CREATE TABLE xxx ...
> >
> > The PRAGMA statement does nothing in runtime. It works only in compile
> time, and add a pair of key, value to next non pragma statement. This
> information can be used by some plpgsql extensions.
> >
> > What do you think about this proposal?
> I think it's a good idea in common. But how about multiple PRAGMAs?
> Consider
>
> PRAGMA cmdtype CREATE;
> PRAGMA objtype TABLE;
> EXECUTE format('CREATE TABLE');
>

yes, it is possible. They are assigned to next non pragma statement.

some like

PRAGMA cmdtype SELECT
PRAGMA resulttype (a int, b int, c int)
EXECUTE format('SELECT ... FROM %I ...

PRAGMA tmp_table_query
PRAGMA resulttype (a int, b int, c int)
FOR r IN SELECT * FROM some_temporary_table ...

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-12-05 18:41:32 Re: slow queries over information schema.tables
Previous Message Andres Freund 2018-12-05 18:25:55 Re: slow queries over information schema.tables