louis's Blog

louis's Avatar Image
Software developer #Go #CommonLisp #JS #SQL. #LispWorks user. Soft spots for #Emacs #SmallWeb. Recently becoming #OpenBSD enthusiast. #LinuxMint as a daily driver. Recovering Apple addict.

Author of the Tuner app for Linux.

Other hobbies: #Running #FireFighter #StarTrek
← All posts

All that Scheme and Lisp programming makes me a bad SQL writer. Suddenly I wonder why (Postgre)SQL doesn’t support ad-hoc function definitions in SELECT queries (or does it?). Because this looks ugly:

SELECT 
   translate(lower(a."name"), '-() /', ''), r.id 
FROM my_objects a
LEFT OUTER JOIN other_objects r ON 
	translate(lower(a."name"), '-() /', '') = translate(lower(r.name->>'de'), '-() /', '');

Do you see the issue?

#sql

To like or reply, open original post on Emacs.ch