Follow

Siri, add a reminder: become a ninja.

Handy way to get used to types without needing a table or anything: :

SELECT CAST('05/21/2019' AS date) AS "test";

" is not much more than a thin wrapper around some carefully tuned queries."

I've been aware of this perspective, and this way of building websites, for years (blog.pinboard.in/2011/03/anato but also and ) but only recently committed to leveling up sqillz, because I have a reason to use it (work).

Looks like I still have to buy a VPS to run Postgres on to use it though, which means securing it and patching it and… yeah I don't know.

@22 CAST('05/21/2019' AS date) won't work for most european installs, which use the DMY datestyle.

CAST('2019-05-21' AS date) should work for everyone (ISO-style)

@22 Worse, CAST('05/12/2019' as date) will work for both but not produce the same date (Dec,5 or May, 12) depending on the DateStyle setting

@DanielVerite yup, I was testing how smart/stupid it was :)!

Sign in to participate in the conversation
Octodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!