Brandon Williams (@is_brandon) header
Brandon Williams (@is_brandon) profile picture
Pacific Northwest
Joined October 2008
Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)Photo by Brandon Williams (@is_brandon)
Ankus now supports .NET 11: write PostgreSQL extensions in C# 15 and ship them with .NET 11 Native AOT. Tested on PostgreSQL 13 through 19 on Linux, macOS and Windows. dotnet tool install -g Ankus.Tool ankus new Hello --framework net11.0 ankus.net/reference/dotnet-s…
1
82
Claude blames Postgres so often I had to ban it from drafting maintainer reports. This mf is under a restraining order from pgsql-hackers.
33
Pretty happy with the Ankus CLI. ankus new creates a C# PostgreSQL extension and tests. ankus run builds it and opens psql to try it. Then dotnet test runs the managed and database tests.
1
51
Ankus is out: write PostgreSQL extensions in C# and ship them with .NET Native AOT. A port of pgrx. Functions, custom types, triggers, background workers, planner hooks and more. dotnet tool install -g Ankus.Tool ankus new Hello ankus.net
42
You can search gzipped logs without pulling every blob into your .NET app. Ankus runs your C# GZipStream reader inside PostgreSQL. SQL filters the decoded text and returns just the matching messages.
1
86
Can’t get .NET’s Native AOT runtime to cooperate with PostgreSQL’s fork model? Just fork the runtime.
56
Postgres will check your pg_hba.conf for you before you reload it: select line_number, error from pg_hba_file_rules where error is not null; I built a language server on that view and its siblings, so the editor shows the error a reload would give. github.com/willibrandon/post…
3
3
160
Ankus can give your C# extension its own PostgreSQL settings. This bool controls the table drop guard. SET LOCAL enables a migration override for one transaction. PostgreSQL restores the previous value on commit or rollback.
1
1
140
A DROP TABLE from psql can run your C# code. With Ankus, a PostgreSQL event trigger can reject the command and roll it back. This one protects tables in the billing schema, whether the command comes from a migration, an admin tool or another SQL client.
1
1
139
Ankus enables PostgreSQL to host a C# background worker too. This one starts with the server, counts databases every ten seconds in its own transaction, and lets any SQL session read the latest count.
65
Sometimes a sensor has a reading. Sometimes it only has a reason it couldn’t get one. Ankus turns these C# records into one PostgreSQL type, so the database can store either result and check its shape on insert.
1
49
I like how little code this takes. [PgType] turns the Reading record into a PostgreSQL type. A table can store it as reading, and any SQL client can insert a value using JSON text.
2
2
207
Say you store webhook URLs as text. A provider changes hosts, and you need to find every affected endpoint. Ankus can run .NET’s Uri parser inside Postgres, then index the host it returns. The lookup stays in SQL.
1
1
82
Last time I used Ankus to filter rows by version. Now that C# rule guards the table itself. A PostgreSQL CHECK constraint rejects 2.9 whether the insert comes from Npgsql, Python, or a SQL script.
1
49
Version strings are a good example of why I want C# inside Postgres. As text, 2.9 can sort after 2.10. This function uses .NET’s Version rules in a SQL WHERE clause, so Postgres filters rows with the same logic as my app.
1
65
Errors matter too. This C# function runs inside Postgres. Pass it zero and the caller gets SQLSTATE 22023, a message, and a hint. You can see the same error from psql or Npgsql.
1
72
With Ankus, string and string? mean different things to PostgreSQL. Pass NULL to greet(string) and PostgreSQL returns NULL without calling C#. Pass NULL to greet_or_default(string?) and C# runs, returning Hello, world!.
1
57
Ankus can turn a C# method into a PostgreSQL cast. Here, Priority is a PostgreSQL enum, and the C# Score method converts it to an integer. SQL can write 'High'::priority::integer and get 30. The conversion runs inside PostgreSQL.
1
64
Ankus lets a C# function return PostgreSQL’s integer range type. PgRange<int> becomes int4range, so SQL can store it and use its built-in containment operator. [10,20) means 10 through 19; @> 15 returns true.
46
Ankus can turn a C# enum into a PostgreSQL enum. [PgEnum] creates delivery_status, and [PgFunction] exposes C# logic that accepts and returns it. Any SQL client can call advance_delivery('pending') and get in transit.
41