From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: backlog4.nntp.dca3.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!takemy.news.telefonica.de!telefonica.de!feed.news.schlund.de!schlund.de!news.online.de!not-for-mail From: Dirk Heinrichs Newsgroups: comp.lang.ada Subject: Re: Ada and PL/pgSQL ? Date: Sat, 10 May 2014 11:37:17 +0200 Organization: Privat Message-ID: References: <304f2721-64bc-4959-a7e8-0cc29cf5204f@googlegroups.com> NNTP-Posting-Host: pd9ff9284.dip0.t-ipconnect.de Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8Bit X-Trace: online.de 1399714638 5143 217.255.146.132 (10 May 2014 09:37:18 GMT) X-Complaints-To: abuse@einsundeins.com NNTP-Posting-Date: Sat, 10 May 2014 09:37:18 +0000 (UTC) User-Agent: KNode/4.12.4 Xref: number.nntp.dca.giganews.com comp.lang.ada:186341 Date: 2014-05-10T11:37:17+02:00 List-Id: sdalemorrey@gmail.com wrote: > While researching the PL/pgSQL language I noticed that it bears a shocking > similarity to Ada. Almost like it's Ada but tailored for SQL. > > Still I would like to maintain the safety and provability of Ada. > It appears that Postgres has the ability to import various languages such > as C and execute those about as easily as it's own native language. > > So the question I have here is, does anyone know of a path to get Ada > functions operational in Postgres. Or (assuming there is a pathway) is > Postgres's PL/pgSQL going to give the same benefits of Ada? While I mostly agree with what Björn has already written, I would nevertheless like to tell you how it could be done. In PostgreSQL, you can not only write Stored Procedures in PL/yourFavoriteLanguage (I prefer Perl, btw.), but you can also import procedures written in a compiled language such as C[1]. The documentation also states "or a language that can be made compatible with C, such as C++", which could as well include Ada. And then, there's also the SPI[2] (Server Programming Interface). With an Ada binding to the SPI (which to my knowlegde does not exist, yet), you would be able to write PostgreSQL functions in Ada. However, as Björn wrote, that would make your project depend on PostgreSQL in a way you might not want. If you want to stay independent of a specific RDBMS, you should look into something like APQ[3], SOCI[4] or GnatColl's database interface[5] [1]: http://www.postgresql.org/docs/9.3/static/xfunc-c.html [2]: http://www.postgresql.org/docs/9.3/static/spi.html [3]: http://sourceforge.net/projects/apq/ [4]: http://soci.sourceforge.net/doc/3.2/languages/ada/index.html [5]: http://docs.adacore.com/gnatcoll-docs/sql.html Bye... Dirk -- Dirk Heinrichs Tel: +49 (0)2471 209385 | Mobil: +49 (0)176 34473913 GPG Public Key CB614542 | Jabber: dirk.heinrichs@altum.de Sichere Internetkommunikation: http://www.retroshare.org