
Andl, a relational language that is not SQL, is coming to Postgres - pjungwir
http://www.andl.org/2016/04/postgres-meet-andl/
======
yomly
Interesting coincidence for me that this hits the front page of HN today as I
recently read this article [0].

The author thinks we should move away using the database purely to persist the
data, while handling all logic/validation in the server language (e.g. By
using an ORM to map your server language to the database) was less robust over
time.

Instead, he suggests pushing knowledge of your data into your database as this
has proven to be more time resilient and takes advantage of the power of these
databases.

I liked the argument (which is better expressed that my paraphrasing) but my
largest reservation was that expressiveness is a big consideration for
choosing some language, and in this case the alternative to using
Ruby/JS/Python + ORM in your MVC framework is to use SQL functions, which are
syntactically clunky/dated at the very least.

It seems like Andl is looking to bridge this to some extent.

[0] [https://sivers.org/pg](https://sivers.org/pg)

~~~
mistermann
The problem with this theory is programming in some databases (MS SQL Server)
is extremely unpleasant.

For example, you can finally, in the year 2016, split strings natively in
TSQL:

[https://www.brentozar.com/archive/2016/03/splitting-
strings-...](https://www.brentozar.com/archive/2016/03/splitting-strings-sql-
server-2016-rescue/)

Compare that to this SO question:

[http://stackoverflow.com/questions/2647/how-do-i-split-a-
str...](http://stackoverflow.com/questions/2647/how-do-i-split-a-string-so-i-
can-access-item-x)

Note there are 32 answers on that question, many of which fail under various
edge cases. Also notice that no one finds this situation absurd in the
slightest (Stockholm Syndrome is alive and well in the MSSQL community
apparently). This is just one example of the nonsense you have to put up with
on SQL Server, there are many others.

And while PG is getting yet another new language capability, it appears
Microsoft is pulling SQLCLR support (in Azure, so far):

[https://www.brentozar.com/archive/2016/04/breaking-news-
lite...](https://www.brentozar.com/archive/2016/04/breaking-news-literally-
sql-clr-support-removed-azure-sql-db/)

...which probably doesn't matter at the end of the day because almost no DBA
would ever let you use it in production.

While it would cause harm to my personal career, nothing would make me happier
than to see Postgres crush MSSQL, Microsoft has earned nothing less with their
absolute disdain for their users.

~~~
NDizzle
You have been able to split strings in t-sql forever. The link you are
referring to splits a string by a delimiter and returns the result as a table.

I've also used CLRs in production since SQL Server 2005. Not sure which
circles you run in, but it's quite different than what I've seen. I also use
Service Broker, so maybe I'm just an odd duck?!

~~~
EvanAnderson
In my experience the fact that you even know the words "Service Broker" makes
you an odd duck. (My company uses the heck out of it, BTW... It boggles my
mind that it's so unknown to most developers using the Microsoft SQL Server
platform.)

~~~
mistermann
What's an example use case for Service Broker?

~~~
EvanAnderson
Asynchronous processing. Service Broker has a queue-based metaphor and it can
execute stored procedures asynchronously when new messages arrive. I gnash my
teeth every time I see problems "solved" by the "we'll just poll the database
periodically for changes" pattern that could be better-served by Service
Broker.

Service Broker performs store-and-forward reliably message delivery inside a
single SQL Server instance and between instances (on the same machine or over
a network). The inter-instance delivery is particularly nice insofar as that
it can use certificates for authentication (which is very nice when you have
disparate Active Directory environments in play).

We've built a couple of system that use it and have been very pleased with the
results. I can't figure out why it's so obscure. The documentation isn't
terrible but it's definitely got a steep learning curve.

------
pella
any news about commercial use ?

 _" LICENCE_

=======

 _This version of Andl is free for any kind of experimental use, especially
helping to make it better._

 _For now, the licence does not grant rights for distribution or commercial
use._

 _That will have to wait until I can choose the right licence, which depends a
lot on who might want to use it. "_

[https://github.com/davidandl/Andl](https://github.com/davidandl/Andl)

~~~
peteretep

        > That will have to wait until I can choose the right
        > licence, which depends a lot on who might want to 
        > use it
    

Anybody who introduces this in to a project needs firing.

~~~
tobltobs
Firing from his own project?

~~~
peteretep
Who is 'his'? If you introduce this software in to any project, regardless of
your gender, you should be fired, as a direct consequence of the insane
license.

~~~
tobltobs
That is of course correct. I did not even consider the possibility that
someone would do this.

------
pjungwir
Thought I'd submit this after leaving a comment about it here:
[https://news.ycombinator.com/item?id=11802900](https://news.ycombinator.com/item?id=11802900)

I'm not involved in any way, but I heard about it from the author's activity
on the Postgres mailing lists, and I'm very intrigued to see where the project
goes. I thought other HNers might be interested too. I'm glad to see people
are experimenting with ways to take the relational model beyond SQL.

------
koolba
From the article:

> The language handler plandl is a DLL written in C, which calls a C++
> function, which in turn uses COM to start up the CLR runtime and load the
> Andl Postgres entry point. Similar capabilities can be provided for Mono.

It's hard enough getting someone to install a non-core contrib module. This
sounds like it'd be impossible to get running.

~~~
MichaelGG
On Windows/CLR, that whole bit is auto-magic (IJW - "It Just Works") interop.
It's no harder than just having the DLL around.

For Mono there's a bit of work involved to load it up but apart from that it's
smooth enough. As far as the end-user is concerned, they should just need to
install mono and they're good.

Source: I wrote a similar module for FreeSWITCH which has lots of users both
on Windows/CLR and on Mono.

------
dmichulke
I'm sorry I don't really understand what Andl could be used for, and wikipedia
in English and German doesn't contain anything (ddg has as first hit
"paraphilic infantilism"?!), so I will ask here.

Is Andl only for stored procedures?

If so why would it be better than say python?

If I were to choose, I'd prefer a lispier SQL with support for the basic
things like map, filter, reduce, ... Is there something alike?

If not, why?

UPDATE: Nevermind, I just found the other links (quite small on top of the
headline), so most things are explained.

However, the article suggests people use python or perl for queries instead of
SQL. Did anyone see this in production (apart from Stored Procedures)?

~~~
tkyjonathan
Sounds like you would really enjoy Clojure's YeSQL.

------
tathougies
> Andl code can execute on any platform for which there is an implementation
> (in memory database, Sqlite or Postgres), providing identical results.

Sounds like SQL.

~~~
lugg
Heh, thats my same remark when someone tries to describe the point of an ORM
to me.

Further to that point, if you ignore the ORM issue there really isn't much
going for this Andl thing.

I'm hesitant to dump too much on it as I don't fully understand the
implications of what the article is talking about just yet.

I think its a good start but I'm not sold on moving my logic there yet.

I like my storage to be somewhat unknowledgeable to the rest of the world, it
only needs to know what my data is and where it is.

Just keep in mind, I understand fully that just because I find my current
situation all fine and dandy that doesn't mean there isn't a better way of
doing things.

I just don't see it with this andl thing yet.

------
rubyfan
What's the compelling argument for why we all need this? I'm unable to distill
this from the article.

------
armamut
SQL was here before I was born and I think will still be here long time. Like
C.

Thanks to Edgar F. Codd (not Larry Ellison :) )

By the way, I'll look at Andl. Even if I don't like the ORM idea.

~~~
ibejoeb
Why the shot at Ellison? He embraced Codd's idea and did a hell of a job
applying it, making it the de facto standard, making it commercially viable,
and advancing it.

~~~
chubot
I'd like to hear a little more of Ellison's story. Jobs and Gates both have
very well known stories, which intersect and which include partners Wozniak
and Paul Allen.

I don't know much about Ellison's story. He certainly has had an unusually
long and successful career. I think he had a partner but I can't remember his
name now.

Did Ellison really have a visionary connection with computer science? (e.g.
along the lines of Gates' "put a computer on every desk") It could be true,
but almost nobody thinks of him that way. Certainly relational databases have
had an enormous impact on computing and society. Did he ever make any
technical contributions, the way Gates and Jobs did? (note: I'm not getting
into an argument about Jobs' tech chops :) )

The core technology originated with IBM, and I think IBM had just as much of a
role in commercializing it as Oracle, but I don't know much beyond that.

I think there is a meme that Oracle was more of a ruthless competitor, skilled
in acquiring other successful companies whose names we don't remember anymore.
But perhaps they didn't really move things forward on a technological level
the way that Apple and yes even Microsoft did.

~~~
sievebrain
I had the same question. This Quora thread seems to settle it:

[https://www.quora.com/Was-Larry-Ellison-a-good-
programmer](https://www.quora.com/Was-Larry-Ellison-a-good-programmer)

tl;dr - yes Ellison is/was a pretty good programmer, enjoyed programming, and
could handle serious technical discussions. But there seems to be consensus
that the guys real genius was in business. Sounds kind of like Gates in that
respect, moreso than Jobs, who I believe was never that strong of a coder.

------
joe_the_user
It seems Andl is an implementation of the Language that Date and Darwin
referred to as D in their Third Manifesto.[1]

[1]
[https://en.wikipedia.org/wiki/D_%28data_language_specificati...](https://en.wikipedia.org/wiki/D_%28data_language_specification%29)

------
kragen
I hate SQL, so I was excited to see this, but there are two things that rule
this out to me:

1\. It's not open-source; the license on
[https://github.com/davidandl/Andl](https://github.com/davidandl/Andl)
specifically forbids distribution and commercial use.

2\. It only runs in Microsoft Windows.

Datalog
[https://en.wikipedia.org/wiki/Datalog](https://en.wikipedia.org/wiki/Datalog)
is much more interesting as an alternative query language — it has better
abstraction capabilities than SQL, and it's much less verbose, but as far as I
know there's no implementation of Datalog in Postgres.

------
cwyers
I am not sure I understand what this is. The documentation spends a fair
amount of time referencing The Third Manifesto... is it a D? If so, how does
it interact with valid Postgres tables that, say, have NULL values?

------
tkyjonathan
To be honest, I'd rather just use YeSQL (or any SQL template engine) to keep
my SQL separate from my code, keep everything looking clean and have no
impedance mismatch.

------
andersonmvd
"(...) written in C, which calls a C++ function (...)", well, memory bugs
ahead. That would be great if they could move to Rust or another similar
language.

------
dominotw
>Andl code can execute on any platform for which there is an implementation
(in memory database, Sqlite or Postgres), providing identical results.

sounds like .net LINQ

~~~
bbcbasic
The syntax reminds me of LINQ.

------
webjprgm
Also sounds similar to M (aka MUMPS), see InterSystem's Cache (commercial) or
GT.M (open source). It is an old programming language with a persistent key-
value store that is basically a NoSQL database with programming logic
combined. From what I've heard finance and health care software often uses
this. It similarly puts the business logic in the database.

------
bsg75
Is this limited to Windows? The source does not seem to define system
requirements, or I am missing it.

------
JohnDoe365
No example how it looks like?

> The language handler plandl is a DLL written in C, which calls a C++
> function, which in turn uses COM to start up the CLR runtime and load the
> Andl Postgres entry point. Similar capabilities can be provided for Mono

Seems like a lot of boilerplate

------
Pxtl
Good. SQL is getting very long in the tooth, but every "fix" throws the baby
out with the bathwater.

