Re: [DOCS] nothing ever works - Mailing list pgsql-docs

From Gerard Matthews
Subject Re: [DOCS] nothing ever works
Date
Msg-id CAO=GzUiAMWuOEvdOxW6T056Dh_-pEy9sqySFmmwWG-Xn2HK-Zg@mail.gmail.com
Whole thread Raw
In response to Re: [DOCS] nothing ever works  (Joe Conway <mail@joeconway.com>)
List pgsql-docs
Thank you very much guys. I'm on the right path now.

On Fri, 23 Jun 2017 at 01:25 Joe Conway <mail@joeconway.com> wrote:
On 06/22/2017 04:29 AM, Gerard Matthews wrote:
> It's under this page on the
> docs https://www.postgresql.org/docs/9.1/static/ecpg-dynamic.html.

Perhaps a bit confusing but notice the title in the top middle of the
page: "Chapter 33. ECPG - Embedded SQL in C"

That is definitely not what you are looking for by the sound of it. As
others have pointed out, most likely you want plpgsql:

https://www.postgresql.org/docs/current/static/plpgsql.html

although you can also write dynamic SQL in other Procedural Languages
which ship with Postgres, for example plpython and plperl:

https://www.postgresql.org/docs/current/static/plpython.html
https://www.postgresql.org/docs/current/static/plperl.html

Note however, while plpgsql is installed into your database by default,
plperl and plpython are not, so you would have to log into the database
of interest and run the following (once), e.g. (only do for the language
of interest, not all three; also note that depending on how you
installed Postgres, you might need to also install extra packages):

CREATE EXTENSION plperl;
CREATE EXTENSION plpythonu;
CREATE EXTENSION plperlu;

Also note the difference between "trusted" and "untrusted" procedural
languages. plpgsql and plperl are "trusted" while plperlu and plpythonu
are "untrusted". See this link for an explanation:

https://www.postgresql.org/docs/current/static/plperl-trusted.html

Hope this helps.

Joe

--
Crunchy Data - http://crunchydata.com
PostgreSQL Support for Secure Enterprises
Consulting, Training, & Open Source Development

pgsql-docs by date:

Previous
From: Michael Paquier
Date:
Subject: Re: [DOCS] gen_random_uuid security not explicit in documentation
Next
From: Kurt Kartaltepe
Date:
Subject: [DOCS] Suggested changes to plpgsql-structure section of plpgsql