{"repo":"Giorgi/SharpPostgres","free":true,"listed":false,"github":"https://github.com/Giorgi/SharpPostgres","clone":"git clone https://github.com/Giorgi/SharpPostgres.git","description":"A proof-of-concept toolkit for building PostgreSQL extensions in C# with Native AOT","language":"C#","stars":48,"topics":["naot","native-aot","postgres","postgresql","postgresql-extension"],"license":"MIT","category":"databases-storage","readme_excerpt":"SharpPostgres A proof-of-concept toolkit for building PostgreSQL extensions in C# with Native AOT - no C shim, just [UnmanagedCallersOnly] exports that Postgres loads as a C extension, and DirectPInvoke for callbacks into the running backend. The source generator turns that into the matching pg finfo + wrapper pair - a small generated function that decodes PG's FunctionCallInfo arguments, forwards to the C# method, and encodes the return value as a Datum. The generator also derives STRICTness from C# nullable annotations and emits the CREATE FUNCTION SQL. Writing a new function is one method with one attribute. Status Experimental. The foundation is solid (114 integration tests pass against postgres:18 ), but several pieces remain: - No PG TRY / PG CATCH interop. Error reporting itself works correctly: NOTICE / WARNING / ERROR with proper SQLSTATE all flow to the client, and the connection stays healthy after an ERROR (PG aborts the statement, cleans up its memory contexts, returns the error). What doesn't run is C# finally / Dispose - PG's siglongjmp skips over the managed stack frames. Workaround: don't hold external resources (HttpClient, FileStream, etc.) across calls that might raise. - Limited type catalog (no arrays, bytea , timestamptz , interval , custom types). - Limited toolkit coverage (no aggregates, triggers, hooks, GUCs, SPI, background workers). Motivation I wanted to see how far .NET 10 Native AOT could go for building Postgres extensions, which are usually w","default_branch":null,"files":null,"tree":[],"storefront":"/r/Giorgi","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/Giorgi/SharpPostgres/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}