{"schema": "pgtrue.report/1", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7", "published": "2026-10-21T03:56:26Z", "publisher": "PostgresAI", "article": {"title": "Introducing: Postgres Best Practices", "url": "https://supabase.com/blog/postgres-best-practices-for-ai-agents", "date_published": "2026-01-21T00:00:00Z", "author": "pedro_rodrigues", "publisher": "Supabase Blog"}, "grade": "B+", "axes": [{"axis": "Factual", "summary": "A \u00b7 0 wrong of 13 checked \u00b7 0 caveats \u00b7 partly assessed"}, {"axis": "Applicable", "summary": "A \u00b7 0 wrong of 4 checked \u00b7 0 caveats"}, {"axis": "Consistent", "summary": "A \u00b7 0 wrong of 13 checked \u00b7 0 caveats"}, {"axis": "Transparent", "summary": "A \u00b7 0 wrong of 7 checked \u00b7 0 caveats"}, {"axis": "Safe", "summary": "D \u00b7 1 wrong of 1 checked \u00b7 0 caveats"}], "findings": [{"anchor": "F1", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F1", "claim": "\u2026Database-enforced tenant isolation, prevent data leaks\u2026", "title": "The custom user setting does not authenticate tenants", "explanation": "app.current_user_id is caller-writable. guc.c:1196 assigns custom placeholders PGC_USERSET, and guc.c:3606 accepts those assignments. A tenant executing SQL can select another tenant's identity. The policy provides isolation only when trusted code controls SQL and the identity setting.", "verdict": "Dangerous", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L1196-L1200", "label": "REL_18_6 \u00b7 src/backend/utils/misc/guc.c:1196-1200"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L3606-L3608", "label": "REL_18_6 \u00b7 src/backend/utils/misc/guc.c:3606-3608"}, {"url": "https://github.com/postgres/postgres/blob/4b324845ba5d24682b9b3708a769f00d160afbd7/src/backend/utils/misc/guc.c#L1196-L1196", "label": "REL_18_1 \u00b7 src/backend/utils/misc/guc.c:1196-1196"}, {"url": "https://github.com/postgres/postgres/blob/4b324845ba5d24682b9b3708a769f00d160afbd7/src/include/utils/guc.h#L69-L69", "label": "REL_18_1 \u00b7 src/include/utils/guc.h:69-69"}]}, {"anchor": "F2", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F2", "claim": "\u2026enable row level security;\u2026", "title": "ENABLE ROW LEVEL SECURITY activates table row security", "explanation": "ALTER TABLE orders ENABLE ROW LEVEL SECURITY sets the table's relrowsecurity flag. tablecmds.c:18667 performs that catalog update.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/commands/tablecmds.c#L18667-L18667", "label": "REL_18_6 \u00b7 src/backend/commands/tablecmds.c:18667-18667"}]}, {"anchor": "F3", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F3", "claim": "\u2026for all using ( user_id = current_setting('app.current_user_id')::bigint );\u2026", "title": "FOR ALL also checks inserted and updated rows", "explanation": "The policy checks existing rows with USING. PostgreSQL also reuses that predicate for new rows when WITH CHECK is absent. create_policy.sgml:86-92 documents this behavior. rowsecurity.c:810-811 implements the fallback.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/rewrite/rowsecurity.c#L810-L811", "label": "REL_18_6 \u00b7 src/backend/rewrite/rowsecurity.c:810-811"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ref/create_policy.sgml#L86-L92", "label": "REL_18_6 \u00b7 doc/src/sgml/ref/create_policy.sgml:86-92"}]}, {"anchor": "F4", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F4", "claim": "\u2026Force RLS even for table owners\u2026", "title": "FORCE applies RLS to ordinary table owners", "explanation": "FORCE removes the ordinary table-owner exemption. rls.c:116-117 checks that flag. Superusers and BYPASSRLS roles still bypass policies, as ddl.sgml:2666-2670 states.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/rls.c#L116-L117", "label": "REL_18_6 \u00b7 src/backend/utils/misc/rls.c:116-117"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/ddl.sgml#L2666-L2670", "label": "REL_18_6 \u00b7 doc/src/sgml/ddl.sgml:2666-2670"}]}, {"anchor": "F5", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F5", "claim": "\u2026current_setting('app.current_user_id')::bigint\u2026", "title": "current_setting retrieves the configured comparison value", "explanation": "current_setting reads the named setting and returns text. guc_funcs.c:813-816 performs that lookup. The displayed bigint cast converts the value before comparing user_id.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc_funcs.c#L813-L816", "label": "REL_18_6 \u00b7 src/backend/utils/misc/guc_funcs.c:813-816"}, {"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/utils/misc/guc.c#L1196-L1200", "label": "REL_18_6 \u00b7 src/backend/utils/misc/guc.c:1196-1200"}]}, {"anchor": "F6", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F6", "claim": "\u2026to authenticated\u2026", "explanation": "TO authenticated selects policy applicability by database-role privileges. src/backend/rewrite/rowsecurity.c:927 checks has_privs_of_role(user_id, roles[i]).", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/src/backend/rewrite/rowsecurity.c#L926-L928", "label": "REL_18_6 \u00b7 src/backend/rewrite/rowsecurity.c:926-928"}]}, {"anchor": "F7", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F7", "claim": "\u2026an index that makes writes slower\u2026", "title": "Indexes can add write overhead", "explanation": "PostgreSQL maintains indexes when table data changes. indices.sgml:130-147 documents that maintenance overhead and its effect on heap-only tuples.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/indices.sgml#L130-L147", "label": "REL_18_6 \u00b7 doc/src/sgml/indices.sgml:130-147"}]}, {"anchor": "F8", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F8", "claim": "\u2026creating an index that locks your table\u2026", "title": "Ordinary index creation blocks concurrent writes", "explanation": "Ordinary CREATE INDEX permits concurrent reads but blocks INSERT, UPDATE, and DELETE during the build. indices.sgml:124-130 documents that behavior.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/indices.sgml#L124-L130", "label": "REL_18_6 \u00b7 doc/src/sgml/indices.sgml:124-130"}]}, {"anchor": "F9", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F9", "claim": "\u2026decades of features\u2026", "title": "PostgreSQL development spans decades", "explanation": "PostgreSQL's history records its renaming in 1996. REL_18_6 doc/src/sgml/history.sgml:195\u2013197 supports the article's historical description.", "verdict": "Accurate", "sources": [{"url": "https://github.com/postgres/postgres/blob/724edf9bde9d356724ad384a2e196edc3c9f80f7/doc/src/sgml/history.sgml#L195-L197", "label": "REL_18_6 \u00b7 doc/src/sgml/history.sgml:195-197"}]}, {"anchor": "F10", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F10", "claim": "\u2026npx skills add supabase/agent-skills\u2026", "title": "The installation command matches current documentation", "explanation": "The installation documentation specifies `npx skills add supabase/agent-skills`. The article reproduces that command exactly.", "verdict": "Accurate", "sources": [{"url": "https://supabase.com/docs/guides/ai-tools/ai-skills", "label": "https://supabase.com/docs/guides/ai-tools/ai-skills"}]}, {"anchor": "F11", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F11", "claim": "\u2026an open standard for giving agents domain expertise\u2026", "explanation": "The Agent Skills overview describes an open format for extending agent capabilities with specialized knowledge and workflows.", "verdict": "Accurate", "sources": [{"url": "https://agentskills.io/", "label": "https://agentskills.io/"}]}, {"anchor": "F12", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F12", "claim": "The agent reads the skill when it needs guidance\u2026", "title": "The standard loads instructions when a task matches", "explanation": "The Agent Skills overview specifies activation when a task matches a skill's description. Activation loads the full `SKILL.md` instructions.", "verdict": "Accurate", "sources": [{"url": "https://agentskills.io/", "label": "https://agentskills.io/"}]}, {"anchor": "F13", "url": "https://pgtrue.postgres.ai/shared/brief/29aa4c7d-ee73-44fb-a278-a3a2bd920ca7#F13", "claim": "Agents can create tables, run queries, manage schemas\u2026", "title": "The MCP database tools support migrations and SQL", "explanation": "The MCP documentation lists `apply_migration` and `execute_sql`. Those tools support schema changes and queries when connection permissions allow them.", "verdict": "Accurate", "sources": [{"url": "https://supabase.com/docs/guides/ai-tools/mcp", "label": "https://supabase.com/docs/guides/ai-tools/mcp"}]}]}