SQLite has pretty limited builtin functions
datastation.multiprocess.io
datastation.multiprocess.io
This is what we have done. We have a lot of domain-specific UDFs available in our SQLite scopes. Both scalar and aggregate types. Note that not all functions must be pure. You can quickly repurpose SQLite into a full-blown DSL by going down this path.
See: https://www.sqlite.com/appfunc.html
And: https://docs.microsoft.com/en-us/dotnet/standard/data/sqlite...
I remember my first encounter with it under the hood. It was a huge list of all my location data stored on my early generation iphone, you had to pull some tricks to extract the file off of your phone and then boom I got a map of where I had been around 2009 better than even I remember it. I think there was a congressional hearing over this. Now they just store that stuff off of the device.
I mean... SQLite is famous for having almost a thousand lines of test code per line of application code. So yeah, I think they view the functions not just in terms of implementing, but also in terms of a commitment to robust maintenance.
That's a large part of it, yes. The sqlite project has only 2 full-time core developers and, AFAIK, only 3 current part-timers who tend to work on more "outer rim" features like the shell app, the .Net bindings, and the new WASM/JS parts.
Richard (sqlite architect/lead) has an explicit goal of supporting sqlite through at least 2050, and sqlite has a long history of strong backwards compatibility guarantees. Every feature (e.g. new SQL-facing function) added to it may well have to be maintained until 2050 by that small group of people. Thus Richard is necessarily extremely selective about what goes in.
I’m wondering if they have a probation (—edit— prohibition even, stupid spellcheck) on new utility functions (so they would only have to be written once and everyone would benefit) hidden behind feature flags or if nobody has bothered to send in a patch?
Also wondering if there’s a benefit to having the database call the functions over just doing it yourself in whatever language you are using? Not a db person so don’t know.
> if nobody has bothered to send in a patch
Quoting from SQLite:
> SQLite is open-source, meaning that you can make as many copies of it as you want and do whatever you want with those copies, without limitation. But SQLite is not open-contribution.
They pretty tightly control who can contribute to the code base for a few reasons .. they don't accept patches from the outside.
SELECT col1, COUNT(1) FROM table1;
happily returns a single row of data.
I struggle to understand why that is preferable to throwing an error?
Section 2.5, starting with:
Special processing occurs when the aggregate function is either min() or max()
In my entirely unscientific go test on 100000 incremented integers, it's look like "some" impact.
inserts took: 891.307359ms
count: 100000 6.76659ms SELECT count(integer) from itable
lower one: 1111 31.708µs SELECT lower(integer || integer || integer || integer) from itable
repeat one: 1111 64.275µs SELECT repeat(integer, 4) from itable
lower4: 149.027976ms SELECT lower(integer || integer || integer || integer) from itable
repeat4: 507.223713ms SELECT repeat(integer, 4) from itable
concat4: 132.156995ms SELECT integer || integer || integer || integer from itable
It probably doesn't matter a huge amount for the ad hoc `dsq` use, having them available is better than not. db function regexp {regexp --}Oracle "external tables" will allow you to see your CSVs directly, without creating a physical table within the database or otherwise using resources. If you actually have SQLite databases, you can join them in Oracle directly with dg4odbc inserted into your listener.
Note that the SQL/PSM standard is based on Oracle pl/SQL, and many databases implement it; SQLite doesn't.
"SQL/PSM is derived, seemingly directly, from Oracle's PL/SQL. Oracle developed PL/SQL and released it in 1991, basing the language on the US Department of Defense's Ada programming language."
The EnterpriseDB sales page for this product would be a good start on what's missing.
https://www.enterprisedb.com/why-edb/leave-oracle-for-postgr...
That page doesn't list features. It only shows you tools to help migrating.
Here is a synopsis, there is probably more.
EDB Postgres Advanced Server is an enhanced version of PostgreSQL that offers compatibility with Oracle in the following areas:
Oracle-specific and syntax-compatible database object types
Oracle-specific data types
Oracle-specific SQL extensions
Oracle PL/SQL support as a built-in native procedural language
Oracle data dictionary views (i.e., ALL_, DBA_, USER_ views)
Oracle built in PL/SQL packages
EDB Postgres Advanced Server doesn't fully implement all Oracle-specific features in these areas. Nevertheless, the compatibility is extensive and covers many of the most commonly used Oracle constructs.
https://www.enterprisedb.com/docs/migrating/oracle/migration...
(If you don't care for Oracle, don't use their database. However, SQL/PSM is the ISO PSM-96 standard; using this dialect will be maximally portable.)
The general attitude towards Oracle tends to be quite negative on HN. Maybe for good reason, but I'd like to hear a different perspective and this seemed like a good opportunity.
This is a double-edged sword. If you use these (proprietary) features and you outgrow XE, then you have to buy a license. XE also doesn't get quarterly patches - it's updated every couple of years (hardening is essential).
Oracle Enterprise retails for $47,500/CPU core. The stripped-down SE2 falls to about $18k.
Definitely beware of the lock-in, but XE likely remains the best for procedural programming in SQL.
For the extremely Oracle-averse, there still may be some value in running it alongside Postgres(with the SQL/PSM extension) and MySQL to verify that your code is portable.
Granted, most databases can do this. However, if you are specifically interested in SQL/PSM, you really can't do better than Oracle.
Fyi, Microsoft/Sybase do not implement SQL/PSM at all; they use Transact-SQL. I've read that IBM db2 is the best implementation outside Oracle, but EnterpriseDB is likely identical.
IBM db2 udb for Unix/Windows happens to have a community edition.