Do you need to patch PostgreSQL to show beer o’clock?
Posted by jpluimers on 2024/02/27
One might think a PostgreSQL patch is needed for [Wayback/Archive] Devrim Gündüz on Twitter: “Just forked PostgreSQL, and fixed a problem: …”
[Wayback/Archive] Andreas Scherbaum on Twitter: “@l_avrot @d_gustafsson @DevrimGunduz Folks, you are making life way too complicated. No patching required! #beer #whisky”
–jeroen
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SET search_path TO public, pg_catalog; | |
| SET | |
| CREATE OR REPLACE FUNCTION now(beverage TEXT= 'beer') | |
| RETURNS TEXT | |
| AS $$ | |
| BEGIN | |
| RETURN 'It's | quote literal(beverage) || o''clock! '; | |
| END; | |
| $$ | |
| LANGUAGE plpgsql | |
| IMMUTABLE | |
| COST 42 | |
| PARALLEL SAFE; | |
| CREATE FUNCTION | |
| SELECT NOW(); | |
| now | |
| ———————- | |
| It's 'beer' o'clock! | |
| (1 row) | |
| SELECT NOW('whisky'); | |
| now | |
| ———————— | |
| It's 'whisky' o'clock! | |
| (1 row) | |
| now=# |








Leave a comment