[go: up one dir, main page]

Today I Learned

tags


2021/11/29

that there’s a pg_sleep(seconds) function: see https://til.hashrocket.com/posts/8a6f68519d-sleeping-in-postgresql


2022/05/04

Not to use BETWEEN for timestamps Not to use char(n), or varchar(n), since they’re not natively fixed-width and will defy expectations. See https://wiki.postgresql.org/wiki/Don't_Do_This

Also, I learned that you can’t run chsh(1) with sudo; chsh needs to run as the user who’s changing their shell.


2022/05/09


2022/05/31

That sql has assertions:

CREATE ASSERTION <Constraint name>
CHECK (search condition)
[ <constraint attributes> ]

see https://crate.io/docs/sql-99/en/latest/chapters/20.html#create-assertion-statement.

h/t https://www.scattered-thoughts.net/log/0024/ for bringing that to my attention.

Also, from the weekend: in postgres, at least, you can call TABLE :table_name; directly to SELECT * FROM :table_name;

Also: how to look up a domain name from an ip:

reverse_ip_lookup() {
  ip_address="$1"
  dig -x $ip_address +noall +answer
}

Also: how to audit AWS VPC flow logs from CloudWatch Log Insights: use the example queries in the right sidebar.

Also: python can execute .zip files directly, like so:

:; echo 'print("Hello, World!")' > __main__.py
:; zip hello-world.zip __main__.py
:; python3 ./hello-world.zip
## Hello, World!

h/t https://pradeepchhetri.xyz/til/pythonzip/ for pointing that out.


2022/07/30

Of the existence of MDX (MultiDimensional eXpressions), a query language for OLAP cubes. I came across it while researching clickhouse db.


2024/01/31

That SQL implementations with recursive CTEs are Turing-complete! It makes sense: recursion and conditionals are all that is required for Turing completeness.

See https://learnsql.com/blog/sql-subquery-cte-difference/