惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Blog — PlanetScale
Blog — PlanetScale
G
Google Developers Blog
Microsoft Security Blog
Microsoft Security Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
腾讯CDC
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Jina AI
Jina AI
雷峰网
雷峰网
T
Tailwind CSS Blog
爱范儿
爱范儿
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
酷 壳 – CoolShell
酷 壳 – CoolShell
大猫的无限游戏
大猫的无限游戏
月光博客
月光博客
博客园 - 司徒正美
I
InfoQ
Engineering at Meta
Engineering at Meta
Vercel News
Vercel News
小众软件
小众软件
U
Unit 42
Google DeepMind News
Google DeepMind News
D
DataBreaches.Net

Hacker News: Show HN

PurrrrrFocus: Pomodoro Timer App - App Store Workflow Engine — Multi-Step Orchestration for Bun RapidPhoto: Pro Photo Editor App - App Store GitHub - DheerG/swarms: Achieve extraordinary results with claude code across a variety of tasks SPICE simulation → oscilloscope → verification with Claude Code — Lucas Gerads Show HN: VCoding – A 5 MB native Windows IDE with no dynamic dependencies Show HN: LLMs don't hallucinate because they're bad at math, it's the format GitHub - Agent-FM/agentfm-core: AgentFM is a peer-to-peer network that turns everyday computers into a decentralized AI supercomputer. AgentFM lets you run massive AI workloads directly across a global mesh of idle CPUs and GPUs. Show HN: Tracking Top US Science Olympiad Alumni over Last 25 Years GitHub - Potarix/agent-hub: One place to talk to all your agents Show HN: Runtime security for AI agents(injection,tool abuse, data exfiltration) GitHub - dubeyKartikay/lazyspotify: Terminal Spotify client for macOS and Linux GitHub - the-banana-tool/king-louie: Easy to use GUI Personal AI Assistant. Win/Linux/Mac. Show HN I made my vacation rental bookable by AI agents–no Airbnb, 0% commission GitHub - basteez/jsf-autoreload: maven plugin to enable hot reload on jsf projects uvm32/hosts/host-gdbstub at main · ringtailsoftware/uvm32 GitHub - labsai/EDDI: Config-driven engine that turns JSON into production-grade AI agents. Multi-agent orchestration, 12+ LLM providers, MCP/A2A protocols, RAG, persistent memory, and enterprise compliance (EU AI Act, GDPR, HIPAA). Built on Quarkus. GitHub - glitchnsec/fortyone-oss: AI Executive Assistant Platform Quickstart | Alien GitHub - muxshed/shed: One stream in, or many. Every destination, simultaneously. No cloud middleman, no per-channel fees, no limits. GitHub - ocrbase-hq/ocrbase: 📄 PDF/IMG ->.MD/JSON Document OCR API for PaddleOCR and GLMOCR. Self-hostable. GitHub - impactjo/home-memory: MCP server that lets your AI assistant remember everything about your home. GitHub - Sets88/dbcls: DbCls is a powerful terminal database client that supports various databases GitHub - neptun2000/heor-agent-mcp GitHub - SeanFDZ/macmind: Single-layer transformer in HyperTalk for the classic Macintosh RollQuation: Math Puzzles - Apps on Google Play GitHub - dropbox/witchcraft Show HN: Agent-cache – Multi-tier LLM/tool/session caching for Valkey and Redis GitHub - opentalon/opentalon: OpenTalon is an open-source platform built from the ground up in Go as a robust alternative to OpenClaw LinkedIn™ 职位抓取工具 - Chrome 应用商店
GitHub - Ladybug-Memory/vpg: Single process PostgreSQL in...
adsharma · 2026-05-09 · via Hacker News: Show HN

vPG – Single‑Process Postgres Wrapper (Vlang)

A thin Vlang layer that boots PostgreSQL 18.1 in standalone (single‑user) mode and exposes a simple API to run arbitrary SQL queries and collect result rows.

Overview

  • Uses the PostgreSQL source as a git submodule at ./postgresql (REL_18_1).
  • Calls the initialization sequence from PostgresSingleUserMain but replaces the interactive stdin/stdout with in‑memory buffers.
  • Executes queries via SPI (SPI_execute) and returns results as UTF‑8 strings.
  • No external postmaster or separate processes – everything runs in the same OS process.

Build

  1. Install V (>=0.4) and a C compiler.
  2. Initialize submodules: git submodule update --init --recursive.
  3. Build PostgreSQL in the submodule (for example ./configure --prefix=$(pwd)/installed && make -j4 install inside ./postgresql).
  4. Ensure a PostgreSQL data directory exists at ./data (created by ./postgresql/installed/bin/initdb).

Python packaging

The Python package uses uv with setuptools build hooks. A wheel build runs make python-lib, packages the generated libvpg_python.so inside vpg/, and tags the wheel for the current Python/platform ABI.

uv build --wheel
uv publish dist/*.whl

For PyPI publishing, set UV_PUBLISH_TOKEN to a PyPI API token before running uv publish, or pass the token with uv publish --token ....

Usage

mut pg := vpg.NewPGEmbedded{
	data_dir: './data',
	user:     'embed_user',
	db:       'embed_db',
} or { err => eprintln(err) }

defer pg.Close()

result := pg.Query('SELECT version();') or { err => eprintln(err) }
println(result) // e.g. [{version: 'PostgreSQL 18.1 on ...'}]

Implementation notes

  • The wrapper follows the exact startup order from PostgresSingleUserMain: InitStandaloneProcess → InitializeGUCOptions → process_postgres_switches → SelectConfigFiles → checkDataDir → ChangeToDataDir → CreateDataDirLockFile → LocalProcessControlFile → process_shared_preload_libraries → InitializeMaxBackends → InitPostmasterChildSlots → InitializeFastPathLocks → process_shmem_requests → InitializeShmemGUCs → InitializeWalConsistencyChecking → CreateSharedMemoryAndSemaphores → set_max_safe_fds → InitProcess → PostgresMain.
  • whereToSendOutput is set to DestNone; query results are captured via a custom DestReceiver that appends tuples to a string buffer.
  • Error handling propagates elog/ereport as V errors via errno and PG_TRY/PG_CATCH blocks wrapped in C functions.
  • All memory is allocated in PostgreSQL memory contexts; V only owns the final UTF‑8 strings.

Safety

  • Runs with the privileges of the calling process; ensure the data directory is owned by a non‑root user.
  • Signal handlers are installed as in the original backend (SIGINT, SIGTERM, SIGQUIT → die).
  • No network listeners are opened; the backend stays in standalone mode.