TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Prolog language for PostgreSQL proof of concept

214 pointsby triskaabout 1 year ago

12 comments

mark_l_watsonabout 1 year ago
As a proof of concept, this looks very cool. Suggestion: add a short example to the README.<p>I had one experience with Prolog in the 1980s that blew my mind. I had an IR&amp;D project to build a complete prototype of an air&#x2F;land battle simulator (yes, I was a defense contractor back then) in Common Lisp given 6 weeks of coverage to write it and demo it. After a month I was satisfied with the functionality and after demoing it I asked permission to rewrite it in ExperProlog on the Mac (I had done the Common Lisp version in my Xerox 1108 Lisp Machine). In ten days time it was done, and also had nice graphics and UI extensions that the Common Lisp version did not have. Anyway, except for few small open source things, that was the only large project I ever did in Prolog.
评论 #39874789 未加载
评论 #39876163 未加载
评论 #39879225 未加载
steinuilabout 1 year ago
If you&#x27;re interested in this I would also recommend you check out Logica[0], which is a datalog-like language that is explicitly made to compile to SQL queries.<p>0: <a href="https:&#x2F;&#x2F;logica.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;logica.dev&#x2F;</a>
评论 #39875603 未加载
评论 #39874605 未加载
larodiabout 1 year ago
Love this, I&#x27;ve long considered that this should&#x27;ve been made as Prolog and SQL are ternary logic and basically SQL derives from Datalog and it itself from Prolog. A table record can be taught as of as a Prolog fact, so this makes the WHERE clauses the predicates in the conjunction on the right-hand side of a rule. And then exhausting the goal is actually returning the result-set.<p>Hope to see this develop even further, as Prolog has its place with relational databases.
评论 #39875091 未加载
评论 #39880362 未加载
评论 #39874832 未加载
joeatworkabout 1 year ago
An alternative query language for PostgreSQL would be a wonderful thing! But it isn’t clear that’s what this is.
评论 #39873784 未加载
评论 #39873833 未加载
评论 #39873829 未加载
AceJohnny2about 1 year ago
Tangentially, Gerrit (a git Code Review web-app) deprecated the use of Prolog for the Submission Requirement feature.<p><a href="https:&#x2F;&#x2F;gerrit-review.googlesource.com&#x2F;Documentation&#x2F;prolog-cookbook.html" rel="nofollow">https:&#x2F;&#x2F;gerrit-review.googlesource.com&#x2F;Documentation&#x2F;prolog-...</a><p>Prolog was introduced in 2.2.2 (2012), and deprecated in 3.6 (2022)
p4bl0about 1 year ago
I would have liked actual examples of what it can do. With a simple table, and a few requests and their outputs.
评论 #39873723 未加载
madsbuchabout 1 year ago
When I saw the title I hopes this would be schema aware. Looking into the current proof of concept they allow to write prolog definitions.<p>How cool would be be, if all relations in a Postgres database would be lifted into the scope of a prolog process to work directly on the relations.
评论 #39875044 未加载
west0nabout 1 year ago
Recently, I learned that PostgreSQL can integrate with many languages through plugins, such as PL&#x2F;Python, pgrx (Rust), pgzx (Zig), and so on. I wonder if anyone is planning to write one for Java or C#, lol.
评论 #39876283 未加载
评论 #39876018 未加载
ekoontzabout 1 year ago
I did some something like this a while ago:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;ekoontz&#x2F;psqlog">https:&#x2F;&#x2F;github.com&#x2F;ekoontz&#x2F;psqlog</a>
ainar-gabout 1 year ago
On a related note, have there ever been extensions for PosgreSQL&#x2F;SQLite&#x2F;any other FOSS DBMS that would allow using Tutorial D[1] (the Third-Manifesto one, not to be confused with Walter Bright&#x27;s D language) to define and query data? In particular, I feel like PostgreSQL&#x27;s CREATE TYPE[2] feature would allow for easier bridging between SQL and Tutorial D.<p>Unfortunately, searches for “PostgreSQL Tutorial D” don&#x27;t issue useful results for obvious reasons.<p>[1]: <a href="https:&#x2F;&#x2F;www.dcs.warwick.ac.uk&#x2F;~hugh&#x2F;TTM&#x2F;index.html" rel="nofollow">https:&#x2F;&#x2F;www.dcs.warwick.ac.uk&#x2F;~hugh&#x2F;TTM&#x2F;index.html</a><p>[2]: <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;sql-createtype.html" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;docs&#x2F;current&#x2F;sql-createtype.html</a>
评论 #39873732 未加载
评论 #39874092 未加载
nextaccounticabout 1 year ago
So, I expected this to actually query the DB using prolog (using the correspondence between relational algebra and logic programming).<p>I mean, can those prolog stored procedures use the db as a source of facts for prolog, or otherwise write queries?
评论 #39873616 未加载
评论 #39876625 未加载
ilakshabout 1 year ago
Postgres is not just a relational db. It&#x27;s a way of life.<p>JSONB, HSTORE, LTREE, Full Text Search, Logical Replication, Range Types, BRIN Indexes, GIN Indexes, GiST Indexes, SP-GiST Indexes, Table Inheritance, Foreign Data Wrappers, XML Support, UUID-OSSP, pg_trgm, Cube, Earthdistance, pg_prolog, pg_partman, pgvector, TimescaleDB, PostGIS, Citus, pg_cron, BDR (Bi-Directional Replication), PL&#x2F;Python, PL&#x2F;Java, PL&#x2F;V8, pg_stat_statements, pg_prewarm, pg_hint_plan, pg_repack, pgAudit, pgRouting, Multicorn (FDW), HypoPG, pg_squeeze, pglogical, Postgres-XL, Wal2json
评论 #39874790 未加载
评论 #39874843 未加载
评论 #39903724 未加载
评论 #39875199 未加载