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

推荐订阅源

Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
Martin Fowler
Martin Fowler
Hacker News - Newest:
Hacker News - Newest: "LLM"
Cyberwarzone
Cyberwarzone
Recorded Future
Recorded Future
H
Hackread – Cybersecurity News, Data Breaches, AI and More
T
Threat Research - Cisco Blogs
Know Your Adversary
Know Your Adversary
Recent Announcements
Recent Announcements
L
LINUX DO - 热门话题
D
DataBreaches.Net
K
Kaspersky official blog
T
Threatpost
F
Full Disclosure
T
The Exploit Database - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
S
Securelist
I
Intezer
有赞技术团队
有赞技术团队
罗磊的独立博客
爱范儿
爱范儿
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
L
LangChain Blog
美团技术团队
G
Google Developers Blog
T
Tor Project blog
Project Zero
Project Zero
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
The Hacker News
The Hacker News
W
WeLiveSecurity
Engineering at Meta
Engineering at Meta
Apple Machine Learning Research
Apple Machine Learning Research
aimingoo的专栏
aimingoo的专栏
PCI Perspectives
PCI Perspectives
L
LINUX DO - 最新话题
MyScale Blog
MyScale Blog
阮一峰的网络日志
阮一峰的网络日志
酷 壳 – CoolShell
酷 壳 – CoolShell
V
V2EX
Hugging Face - Blog
Hugging Face - Blog
P
Proofpoint News Feed
Webroot Blog
Webroot Blog
T
Troy Hunt's Blog

Supabase Blog

AI Agents Know About Supabase. They Don't Always Use It Right. Custom OIDC Providers for Supabase Auth 100,000 GitHub stars Supabase docs over SSH Navigating Regional Network Blocks Supabase Joins the Stripe Projects Developer Preview Log Drains: Now available on Pro Supabase Storage: major performance, security, and reliability updates Supabase incident on February 12, 2026 Hydra joins Supabase X / Twitter OAuth 2.0 is now available for Supabase Auth BKND joins Supabase Supabase is now an official Claude connector Supabase PrivateLink is now available Introducing: Postgres Best Practices When to use Read Replicas vs. bigger compute Introducing TRAE SOLO integration with Supabase Supabase Security Retro: 2025 Sync Stripe Data to Your Supabase Database in One Click Building ChatGPT Apps with Supabase Edge Functions and mcp-use Own Your Observability: Supabase Metrics API Introducing iceberg-js: A JavaScript Client for Apache Iceberg Introducing Supabase for Platforms Adding Async Streaming to Postgres Foreign Data Wrappers Build "Sign in with Your App" using Supabase Auth Introducing Seven New Email Templates for Supabase Auth The new Supabase power for Kiro Introducing Supabase ETL Introducing Analytics Buckets Introducing Vector Buckets Snap, Inc. Launches Snap Cloud, Powered by Supabase Triplit joins Supabase Supabase Series E 1000 Y Combinator Founders Choose Supabase gm 👋 web3, welcome aboard to Sign in with Web3 (Solana, Ethereum) Announcing the Supabase Remote MCP Server Enterprise speed, enterprise standards with Bolt Cloud + Supabase PostgREST 13 Lovable Cloud + Supabase: The Default Platform for AI Builders Processing large jobs with Edge Functions, Cron, and Queues Defense in Depth for MCP Servers OrioleDB Patent: now freely available to the Postgres community Supabase Launch Week 15 Hackathon Winner Announcement The Vibe Coder's Guide to Supabase Environments Testing for Vibe Coders: From Zero to Production Confidence The Vibe Coding Master Checklist Vibe Coding: Best Practices for Prompting Supabase Auth: Build vs. Buy Top 10 Launches of Launch Week 15 Supabase Launch Week 15 Hackathon Storage: 10x Larger Uploads, 3x Cheaper Cached Egress, and 2x Egress Quota Persistent Storage and 97% Faster Cold Starts for Edge Functions Algolia Connector for Supabase New Observability Features in Supabase Improved Security Controls and A New Home for Security Introducing Branching 2.0 Stripe-To-Postgres Sync Engine as standalone Library Supabase Analytics Buckets with Iceberg Support Create a Supabase backend using Figma Make Introducing JWT Signing Keys Supabase UI: Platform Kit Build a Personalized AI Assistant with Postgres Announcing Multigres: Vitess for Postgres Building on open table formats Open Data Standards: Postgres, OTel, and Iceberg Simplifying back-end complexity with Supabase Data APIs PostgreSQL Event Triggers without superuser access Top 10 Launches of Launch Week 14 Supabase MCP Server Data API Routes to Nearest Read Replica Declarative Schemas for Simpler Database Management Realtime: Broadcast from Database Keeping Tabs on What's New in Supabase Studio Edge Functions: Deploy from the Dashboard + Deno 2.1 Automatic Embeddings in Postgres Introducing the Supabase UI Library Supabase Auth: Bring Your Own Clerk Postgres Language Server: Initial Release Migrating from Fauna to Supabase Migrating from the MongoDB Data API to Supabase Dedicated Poolers Postgres as a Graph Database: (Ab)using pgRouting AI Hackathon at Y Combinator Calendars in Postgres using Foreign Data Wrappers Supabase Launch Week 13 Hackathon Winners How to Hack the Base! Running Durable Workflows in Postgres using DBOS database.build v2: Bring-your-own-LLM Restore to a New Project Hack the Base! with Supabase Top 10 Launches of Launch Week 13 Supabase Queues High Performance Disk Supabase Cron Supabase CLI v2: Config as Code Supabase Edge Functions: Introducing Background Tasks, Ephemeral Storage, and WebSockets Supabase AI Assistant v2 OrioleDB Public Alpha Executing Dynamic JavaScript Code on Supabase with Edge Functions ClickHouse Partnership, improved Postgres Replication, and Disk Management
What is new in PostgREST v11.1?
Steve Chavez · 2023-07-12 · via Supabase Blog

What is new in PostgREST v11.1?

PostgREST 11.1 is now available on the Supabase platform. Besides the pre-release features, we’ve added configuration and querying improvements. Here is what's new:

Every role that passes PostgREST JWT Authentication is an impersonated role. On the Supabase platform, these are the anon, authenticated and service_role roles.

These roles can now have settings applied with a regular ALTER ROLE .. SET. This is useful, for example, to prevent web users from running expensive queries.

Let’s try it by setting a statement timeout and cost limit.

Statement timeout#

statement_timeout aborts any statement that takes more than the specified amount of time. Let’s set it for the anon, authenticated and service_role roles:


_17

-- anonymous users can run queries that take 100 milliseconds max

_17

alter

_17

role anon

_17

set

_17

statement_timeout = '100ms';

_17

_17

-- authenticated users can run queries that take 5 seconds max

_17

alter

_17

role authenticated

_17

set

_17

statement_timeout = '5s';

_17

_17

-- backend-only users can run queries that take 15 seconds max

_17

alter

_17

role service_role

_17

set

_17

statement_timeout = '15s';


You need to reload PostgREST config cache to apply these changes.


_10

NOTIFY pgrst,

_10

'reload config';


Now, suppose you do an expensive query with the anon role. Like filtering on a big table's unindexed column (this will cause a full table scan):


_10

const { data, error } = await supabase.from('big_table').select().eq('unindexed_column', 'value')


Then, after 5 seconds, the request will be aborted with the response:


_10

{

_10

"hint": null,

_10

"details": null,

_10

"code": "57014",

_10

"message": "canceling statement due to statement timeout"

_10

}


Which is what we wanted. Note that there's already a global statement_timeout set but you can be more fine-grained with this feature. See timeouts for more details.

Statement Cost Limit#

With a statement timeout, expensive queries will still get executed for a length of time. They'll consume resources until they’re terminated.

The pg_plan_filter extension (available on the Supabase platform), brings a statement cost limit. This abort queries at the planning phase, before they get executed.

You can use it like:


_22

-- anonymous users can only run cheap queries

_22

ALTER

_22

USER anon

_22

SET

_22

plan_filter.statement_cost_limit = 10000;

_22

_22

-- authenticated users can run more expensive queries

_22

ALTER

_22

USER authenticated

_22

SET

_22

plan_filter.statement_cost_limit = 1e6;

_22

_22

-- backend-only users can run any query

_22

ALTER

_22

USER service_role

_22

SET

_22

plan_filter.statement_cost_limit = 0;

_22

_22

NOTIFY pgrst,

_22

'reload config';

_22

_22

-- reload postgREST config cache to apply changes


Let’s repeat the previous expensive query with the anon role.


_10

const { data, error } = await supabase.from('big_table').select().eq('unindexed_column', 'value')


Then, immediately, the request will be aborted and the response will be:


_10

{

_10

"hint": null,

_10

"details": null,

_10

"code": "54001",

_10

"message": "plan cost limit exceeded"

_10

}


Note that tuning is required to get the cost limit right. You should use the plan_filter.statement_cost_limit with care as it can invalidate legitimate queries.

By default, all queries run in a transaction with the default read committed isolation level.

You can now modify this with the default_transaction_isolation setting.

If you want a function to run with repeatable read isolation level:


_10

create function hello()

_10

returns text as $$

_10

select 'hello';

_10

$$ language sql

_10

set default_transaction_isolation = 'repeatable read';


Or if you want an impersonated role to run its queries with a serializable isolation level:


_10

alter

_10

role service_role

_10

set

_10

default_transaction_isolation = 'serializable';

_10

_10

NOTIFY pgrst,

_10

'reload config';

_10

_10

-- reload postgREST config cache


Note that the default read committed is good enough for almost all use cases. Higher isolation levels incur in overhead as they use more sophisticated locking. They're only needed in special cases.

A long wanted feature was bulk inserting JSON while considering columns' default values.

Having the following sample table.


_10

create table

_10

foo (

_10

id bigint generated by default as identity primary key,

_10

bar text,

_10

baz int default 100

_10

);


You can now do it like this:


_10

const { error } = await supabase

_10

.from('foo')

_10

.insert([

_10

{ "bar": "val1"

_10

}

_10

, { "bar": "val2"

_10

, "baz": 15

_10

}

_10

], defaultToNull: false)

_10

.select()


And the response will be:


_10

[

_10

{ "id": 1, "bar": "val1", "baz": 100 },

_10

{ "id": 2, "bar": "val2", "baz": 15 }

_10

]


As you can see, id and baz took their default values.

As a shortcut to OR filters, you can now use any modifiers on various filters. Take the like filter as an example:


_10

const res = await postgrest

_10

.from('users')

_10

.select()

_10

.likeAnyOf('username', ['%supa%', '%kiwi%'])


This is equivalent to the following in SQL.


_10

select *

_10

from users

_10

where username like ANY('{%supa%,%kiwi%}');


any modifiers are available for the eq,like,ilike,gt,gte,lt,lte,match,imatch filters.

For completeness, the all modifier is also included.

If you only use PostgREST through Supabase client libraries (like supabase-js) then it's safe to upgrade to v11. If you use PostgREST with other HTTP clients (like curl), consider the breaking changes for this version:

  • The Range header is now only considered on GET requests and is ignored for any other method. Previously PostgREST responded with an error but RFC 9110 dictates that we should ignore the Range header instead.
  • RPC requests no longer consider the Prefer: params=multiple-objects header. This header was already deprecated on v10.1.0.

By making use of Logflare, we detected that out of 20 thousands of projects:

  • Only 7 projects used Range for HTTP methods other than GET. In these cases all responses were errors so in fact this breaking change is a fix for those requests.
  • None were using Prefer: params=multiple-objects.

So overall the breaking changes are minimal.

There you have it, now you can make your API more secure with role settings and use higher isolation levels without resorting to direct PostgreSQL connections.

PostgREST v11.1 is available for all Supabase projects created after 5 July 2023. Existing projects can upgrade by doing a pause/unpause.

More Postgres resources#