Hacker News new | ask | show | jobs
by johnwatson11218 648 days ago
The article you linked, "tetris-sql," appears to be using database extensions to overcome SQL's limitations. While the core SQL language itself is not Turing complete, these extensions, such as Common Table Expressions (CTEs) and procedural languages, can provide the necessary constructs for iterative execution and conditional logic.

By leveraging these extensions, the author has effectively created a Turing complete environment within the database system, allowing them to implement Tetris. However, it's important to note that the implementation would be more convoluted and less efficient compared to a traditional programming language designed for game development.

Essentially, the article is demonstrating how to create a Turing complete environment using SQL and its extensions, but it's not a direct representation of SQL's inherent capabilities.

1 comments

While there were some workarounds needed to implement the game, such as handling input and output, the core of the game logic uses regular SQL. Even recursive CTEs are part of the SQL standard (https://en.wikipedia.org/wiki/SQL:1999#Common_table_expressi...), which makes the language Turing complete. Also, apart from the small function to print to stdout, there were no procedural languages used.