Re: PL/pgSQL 2

Поиск
Список
Период
Сортировка
Искать
От
Craig Ringer
Тема
Re: PL/pgSQL 2
Дата
Msg-id
540541D3.9060908@2ndquadrant.com
Ответ на
Re: PL/pgSQL 2 (David Johnston)
Список
Дерево обсуждения
PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Kevin Grittner <kgrittn@ymail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Kevin Grittner <kgrittn@ymail.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Kevin Grittner <kgrittn@ymail.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Kevin Grittner <kgrittn@ymail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Andrew Dunstan <andrew@dunslane.net>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Kevin Grittner <kgrittn@ymail.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Kevin Grittner <kgrittn@ymail.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 David G Johnston <david.g.johnston@gmail.com>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Hannu Krosing <hannu@2ndQuadrant.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Hannu Krosing <hannu@2ndQuadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Steven Lembark <lembark@wrkhors.com>
Re: PL/pgSQL 2 Hannu Krosing <hannu@2ndQuadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Steven Lembark <lembark@wrkhors.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Hannu Krosing <hannu@2ndQuadrant.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 David G Johnston <david.g.johnston@gmail.com>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Shaun Thomas <sthomas@optionshouse.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Heikki Linnakangas <hlinnakangas@vmware.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Tom Lane <tgl@sss.pgh.pa.us>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Bruce Momjian <bruce@momjian.us>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Bruce Momjian <bruce@momjian.us>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Bruce Momjian <bruce@momjian.us>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Tom Lane <tgl@sss.pgh.pa.us>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 David G Johnston <david.g.johnston@gmail.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Tom Lane <tgl@sss.pgh.pa.us>
Re: PL/pgSQL 2 Bruce Momjian <bruce@momjian.us>
Re: PL/pgSQL 2 "Joshua D. Drake" <jd@commandprompt.com>
Re: PL/pgSQL 2 David Johnston <david.g.johnston@gmail.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 "Joshua D. Drake" <jd@commandprompt.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 "Joshua D. Drake" <jd@commandprompt.com>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Andrew Dunstan <andrew@dunslane.net>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 Szymon Guz <mabewlun@gmail.com>
Re: PL/pgSQL 2 Christopher Browne <cbbrowne@gmail.com>
Re: PL/pgSQL 2 Bruce Momjian <bruce@momjian.us>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 "Joshua D. Drake" <jd@commandprompt.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 "Joshua D. Drake" <jd@commandprompt.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Robert Haas <robertmhaas@gmail.com>
Re: PL/pgSQL 2 David G Johnston <david.g.johnston@gmail.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Stephen Frost <sfrost@snowman.net>
Re: PL/pgSQL 2 "Joshua D. Drake" <jd@commandprompt.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: Allowing implicit 'text' -> xml|json|jsonb (was: PL/pgSQL 2) Craig Ringer <craig@2ndquadrant.com>
Re: Allowing implicit 'text' -> xml|json|jsonb Marko Tiikkaja <marko@joh.to>
Re: Allowing implicit 'text' -> xml|json|jsonb Craig Ringer <craig@2ndquadrant.com>
Re: Allowing implicit 'text' -> xml|json|jsonb Tom Lane <tgl@sss.pgh.pa.us>
Re: Allowing implicit 'text' -> xml|json|jsonb Craig Ringer <craig@2ndquadrant.com>
Re: Allowing implicit 'text' -> xml|json|jsonb Marko Tiikkaja <marko@joh.to>
Re: Allowing implicit 'text' -> xml|json|jsonb (was: PL/pgSQL 2) Merlin Moncure <mmoncure@gmail.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Hannu Krosing <hannu@2ndQuadrant.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Hannu Krosing <hannu@2ndQuadrant.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Marko Tiikkaja <marko@joh.to>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Tom Lane <tgl@sss.pgh.pa.us>
Re: PL/pgSQL 2 Neil Tiffin <neilt@neiltiffin.com>
Re: PL/pgSQL 2 Andrew Dunstan <andrew@dunslane.net>
Re: PL/pgSQL 2 Jan Wieck <jan@wi3ck.info>
Re: PL/pgSQL 2 David G Johnston <david.g.johnston@gmail.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 David Johnston <david.g.johnston@gmail.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Ian Barwick <ian@2ndquadrant.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Mark Kirkwood <mark.kirkwood@catalyst.net.nz>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Andrew Dunstan <andrew@dunslane.net>
Re: PL/pgSQL 2 Ryan Pedela <rpedela@datalanche.com>
Re: PL/pgSQL 2 Andrew Dunstan <andrew@dunslane.net>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Andrew Dunstan <andrew@dunslane.net>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Álvaro Hernández Tortosa <aht@nosys.es>
Re: PL/pgSQL 2 Neil Tiffin <neilt@neiltiffin.com>
Re: PL/pgSQL 2 Craig Ringer <craig@2ndquadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Tom Lane <tgl@sss.pgh.pa.us>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Pavel Stehule <pavel.stehule@gmail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Andres Freund <andres@2ndquadrant.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
Re: PL/pgSQL 2 Steven Lembark <lembark@wrkhors.com>
Re: PL/pgSQL 2 Merlin Moncure <mmoncure@gmail.com>
Re: PL/pgSQL 2 Merlin Moncure <mmoncure@gmail.com>
Re: PL/pgSQL 2 Joel Jacobson <joel@trustly.com>
On 09/02/2014 11:42 AM, David Johnston wrote:
> 
> ​Yet pl/pgsql does not have to use SPI-interface type calls to interact
> with PostgreSQL at the SQL level...

That's right.

> ​I don't have an answer to your questions but the one I'm asking is
> whether a particular language could hide all of the SPI stuff behind
> some custom syntax so that it in effect looks similar to what pl/pgsql
> does today?

Sure, it's possible. Have you seen Microsoft's "LINQ" for C# / .NET? One
of the few really awesome things they've done in a long time.

Do you see many other languages with good seamless SQL support, though?
The only one I can think of off the top of my head is PROGRESS/4GL, and
like PL/PgSQL it's designed around the idea of being a
database-integrated language.

The hard problem to solve here isn't "how do I make the language talk to
the database server backend". That's easy. The hard problem is "how
should the integrated SQL support look and work so it fits in with the
language while remaining as powerful and expressive as SQL its self".

It's *the same* problem as if you were using the same language via a
network connection to the database, instead of embedding it. How do you
make SQL syntax interoperate with your language's syntax, or produce a
clean-ish adapter layer?

Lots of people have tried. Most have failed dismally. ActiveRecord
becomes gruesomely ugly hodgepodge of text snippets and code as soon as
you try to do anything interesting/nontrivial with it. Hibernate
Criteria Query - ever wanted to write 100 lines of code for a simple
query? You'll love it. JOOQ? Django ORM? SQLAlchemy? iBatis/MyBatis?
QueryDSL? They're all ugly in various ways.

The underlying problem is that SQL, syntactically speaking, is a weird,
clunky way to do things that sticks out like a sore thumb when you put
it together with a language designed after 1975.

Also, most of the "modern" languages people want to use are to some
degree OO, not just procedural. That brings the OO/relational mismatch
into play, and there's no pretty and easy solution for that.

http://en.wikipedia.org/wiki/Object-relational_impedance_mismatch

PL/PgSQL gets away with it by not being OO - it fits its model around
that of SQL.

If you can solve that problem - create a smooth, seamless
language-integrated way to use SQL in any language of your choice - then
please, please come talk about it here.

> Or, more to the point, does pl/pgsql use the same SPI
> interface behind the scenes as PL/Perl or does it have its own special
> interface?

Take a look.

cd src/pl/pgsql/src

You'll see pl_handler.c, the PL/PgSQL procedural language handler.
There's also pl_exec.c, containing the guts of the language runtime. SPI
use is heavy throughout.

PL/PgSQL uses SPI to execute queries and fetch results. See, for
example, exec_stmt_execsql(...) in pl_exec.c .

Any other language that can run embedded into the PostgreSQL backend can
do the same.

PL/Python does it:

http://www.postgresql.org/docs/current/static/plpython-database.html

(though unfortunately the PL/Python interface for SQL does't follow the
Python DB-API).

PL/V8, PL/Lua, PL/Ruby, they all use the SPI. Same as PL/PgSQL.

The challenge isn't dispatching the SQL, the challenge is fitting SQL
into the language seamlessly.

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services


В списке pgsql-hackers по дате отправления
От: Craig Ringer
Дата:
Сообщение: Re: PL/pgSQL 2
От: Craig Ringer
Дата:
FAQ