Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOBTr-0001vH-H2 for pgsql-docs@arkaria.postgresql.org; Thu, 22 Jun 2017 23:25:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dOBTq-0007fL-U1 for pgsql-docs@arkaria.postgresql.org; Thu, 22 Jun 2017 23:25:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dOBTT-00070t-Ge for pgsql-docs@postgresql.org; Thu, 22 Jun 2017 23:25:19 +0000 Received: from 104-190-1-44.lightspeed.sndgca.sbcglobal.net ([104.190.1.44] helo=joeconway.com) by makus.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dOBTM-0007M9-NW for pgsql-docs@postgresql.org; Thu, 22 Jun 2017 23:25:18 +0000 Received: from [72.214.29.243] (account jconway@joeconway.com HELO [192.168.4.41]) by joeconway.com (CommuniGate Pro SMTP 6.1.4) with ESMTPSA id 18774419; Thu, 22 Jun 2017 16:25:09 -0700 Subject: Re: nothing ever works To: Gerard Matthews , Pavel Stehule Cc: "David G. Johnston" , Michael Paquier , pgsql-docs References: <20170621083940.27874.47470@wrigleys.postgresql.org> From: Joe Conway Openpgp: id=4EA5B4659ED59CC9538139A5332B7E68B699434A Message-ID: Date: Thu, 22 Jun 2017 16:25:08 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VUx4BF4JfUfvsnePcDg5PLG2iqbSbhXIH" List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-docs Precedence: bulk Sender: pgsql-docs-owner@postgresql.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --VUx4BF4JfUfvsnePcDg5PLG2iqbSbhXIH From: Joe Conway To: Gerard Matthews , Pavel Stehule Cc: "David G. Johnston" , Michael Paquier , pgsql-docs Message-ID: Subject: Re: [DOCS] nothing ever works References: <20170621083940.27874.47470@wrigleys.postgresql.org> In-Reply-To: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Content-Language: en-US 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 --=20 Crunchy Data - http://crunchydata.com PostgreSQL Support for Secure Enterprises Consulting, Training, & Open Source Development --VUx4BF4JfUfvsnePcDg5PLG2iqbSbhXIH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJZTFHUAAoJEDfy90M199hlAPUP/iONKhsCxES5n+YdCDEOTXJ4 l0WUFqCVagfflAAgfa0K/hu6Sk76IOlawh9m/768ommd7YrIEpJQC+sI374e6qag wrJuY+0xZXCeEzq6ba62fTAnlhA3OQHy4bZ7sYwlgo7l37xrTU5+lxjE9Ev/gYCK EvgX8XeZcNyuy/Z8S/6SAQ9c712AAjfet5QVg4U2GMO1H80SNyMqtIGYGs0kQJVP wHpGOn7y0lB1vnldmeuf5gqvSyEXmeaVZ+YtUbipbr9LMSsDaYQKI7psOCc6FWai gol1dsFAWax4WmQ/sHpp4DUIWoM6vc3LyceB5sXK85DTENMHfGn2V3FGL8NCLZjK +rtxIqV9nQjLu+Z1yhO+Hjb5EO/3ciGZrRYa/6iNCG/qAEjX6Jn68dvcwXqO1Lys xpuc1joTN8qKXcoMY/5Y2OMeYtoov3kfmPqSIteCZ+Wec9P8Z/riziudGAXJitoB YxRyY8jEeDbbqNu6SLWjvjZxrpxSewLj+9Ab4rZ1dbEv83RYBLB/JKv3iG3XnpJJ 5Bf7/D0U2IXUtssncNxzoMrI8g4cDSar2Kj7TJH4wWMpqtCifPF6IG5AdF4WErcY tM4n8KkMNVYLkFTdHA5r8NqotXCm7qorD4hC9x83gZC2Zhak3qmJ0Uj1ah/NFz4j qlS7h819nUMtecpTIMgA =IBif -----END PGP SIGNATURE----- --VUx4BF4JfUfvsnePcDg5PLG2iqbSbhXIH--