HN user

steve-chavez

617 karma

https://github.com/steve-chavez/

Posts38
Comments135
View on HN
github.com 22d ago

Single header Parser Combinators for C

steve-chavez
80pts15
pgpointcloud.github.io 8mo ago

PgPointcloud – A PostgreSQL extension for storing point cloud (Lidar) data

steve-chavez
3pts0
github.com 10mo ago

FFI Overhead

steve-chavez
2pts1
simonmar.github.io 10mo ago

Asynchronous Exceptions in Practice (2017)

steve-chavez
1pts0
github.com 10mo ago

pg_csv: Flexible CSV Processing for Postgres

steve-chavez
2pts0
supabase.com 1y ago

PostgreSQL Event Triggers without superuser access

steve-chavez
1pts0
supabase.com 1y ago

PostgreSQL Event Triggers without superuser access

steve-chavez
4pts0
supabase.com 1y ago

PostgreSQL Event Triggers without superuser access

steve-chavez
2pts0
docs.postgrest.org 1y ago

Domain Representations

steve-chavez
2pts1
www.tweag.io 1y ago

Introduction to NixOS Specialisations (2022)

steve-chavez
1pts0
www.vldb.org 1y ago

Beyond Relations: A Case for Elevating to the Entity-Relationship Abstraction [pdf]

steve-chavez
2pts0
news.ycombinator.com 1y ago

Ask HN: Devshops Websites for Inspiration

steve-chavez
1pts0
www.youtube.com 1y ago

Nginx vs. Caddy Performance [video]

steve-chavez
1pts2
www.youtube.com 1y ago

Nginx vs. Caddy Performance [video]

steve-chavez
2pts5
dl.acm.org 1y ago

SQL/SE Query Language Extension for Schema Evolution (1992) [pdf]

steve-chavez
31pts4
dl.acm.org 1y ago

SQL/SE Query Language Extension for Schema Evolution (1992) [pdf]

steve-chavez
2pts0
illuminatedcomputing.com 2y ago

Postgres Temporal PKs Merged

steve-chavez
1pts0
dbos-project.github.io 2y ago

Your Infrastructure Should Know More About Your Database (2022)

steve-chavez
1pts0
revistas.um.edu.uy 2y ago

In defense of extreme database-centric architecture [pdf]

steve-chavez
3pts1
revistas.um.edu.uy 2y ago

In defense of extreme database-centric architecture [pdf]

steve-chavez
2pts0
revistas.um.edu.uy 2y ago

In defense of extreme database-centric architecture [pdf]

steve-chavez
4pts2
www.depesz.com 2y ago

Waiting for PostgreSQL 17 – Add support event triggers on authenticated login

steve-chavez
1pts1
blog.bigsmoke.us 2y ago

Finding the right PostgreSQL UUID generation algorithm for FlashMQ.com

steve-chavez
1pts0
blog.bigsmoke.us 2y ago

Finding the right PostgreSQL UUID generation algorithm for FlashMQ.com

steve-chavez
2pts0
postgrest.org 3y ago

A REST resource can be the equivalent of a database stored procedure

steve-chavez
1pts0
www.youtube.com 3y ago

Pspg – Postgres Pager[video]

steve-chavez
2pts1
mydbops.wordpress.com 3y ago

PostgreSQL 16 brings Load Balancing Support in libpq

steve-chavez
3pts0
aiven.io 3y ago

Why you should offload your PostgreSQL analytical workloads to ClickHouse

steve-chavez
5pts0
postgrest.org 3y ago

PostgREST 10 Release Notes

steve-chavez
2pts0
supabase.io 5y ago

Protecting reserved roles with PostgreSQL Hooks

steve-chavez
100pts15

It's a replacement for SQL, the language

PostgREST doesn't provide a replacement, rather a subset of the SQL language meant to be safe to expose to untrusted (frontend) clients.

Load balancing is not built-in currently, but it can be done at the proxy layer, taking the advantage that GET/HEAD requests are always executed on read only transactions, so they can be routed to read replicas. This is what Supabase does [1] for example.

[1] https://supabase.com/docs/guides/platform/read-replicas#api-...

PostgREST translates HTTP straight into SQL, so if you get a policy wrong (or forget one), game over

Do note that by default in PostgreSQL/PostgREST, RLS is the third layer of AuthZ defense, you have table and column level security before and these are closed by default.

In Supabase's model, it's a breach.

Supabase is currently working on being closed by default.

Not really, the work is much reduced.

1. If your function returns a table type, you can reuse all the filters that PostgREST offers on regular tables or views [1].

2. The SQL code will be much more concise (and performant, which leads to less maintenance work) than the code of a backend programming language.

3. The need for migrations is a common complaint, but you can treat SQL as regular code and version control it. Supabase recently released some tooling [2] that helps with this.

[1] https://docs.postgrest.org/en/v12/references/api/functions.h...

[2] https://supabase.com/docs/guides/local-development/declarati...

If my DB structure changes, I have to force new app versions on every platform because I didn't insulate back-end changes with an API.

To avoid the above problem, it's a standard practice in PostgREST to only expose a schema consisting of views and functions. That allows you to shield the applications from table changes and achieve "logical data independence".

For more details, see https://docs.postgrest.org/en/v12/explanations/schema_isolat....

So cool! For some reason navigating to Github/Discord by clicking the links is slow on my phone (old galaxy s20fe). The click highlight of the button is normal, just going to the sites is slow.

There's not much substance in the reply there, on one part there's this argument:

Go programs are fast enough for Google, Netflix, Stripe, and many other large Internet companies… it’s probably fast enough for you

Which of course is an appeal to authority. Overall, it's pretty well known that a GC language will have downsides in perf when compared to system programming languages.

That's false. On the same youtube channel there's a video [1] comparing Nginx vs Envoy and Nginx offers higher throughput.

Besides that, from what I've seen Envoy has a higher dependency footprint:

- It comes bloated with GRPC functionality.

- Configuration requires running python.

I'd be glad to be proven wrong on the performance side of Envoy but so far I've only heard rumors and never seen a conclusive benchmark.

[1] https://www.youtube.com/watch?v=0Q9I-x--np4

You have explicit control over transactions with functions https://postgrest.org/en/latest/references/api/functions.htm....

I think this sentiment stems from users of postgrest-js[1], which is a JS library that gives an ORM feel to PostgREST requests. Under that abstraction, users don't realize they're using a REST API, instead of a direct postgres connection.

So in this case users are really asking for "client-side transactions"[2], which are not supported in PostgREST.

[1] https://github.com/supabase/postgrest-js

[2] https://github.com/PostgREST/postgrest/issues/286

* there is no column level security – e.g. I want to show payment_total to admin, but not to user

I think what you want is dynamic data masking. RDMBSes like IBM DB2[1] and SQL Server[2] offer it out of the box.

For PostgreSQL, there's the postgresql_anonymizer[3] extension. For which you could do something like:

  SECURITY LABEL FOR user ON COLUMN invoice.payment_total
  IS 'MASKED WITH VALUE $$CONFIDENTIAL$$';
Last time I tried it though, it didn't play well with transaction variables (`current_setting(my.username)`), so you could not combine it with RLS logic and application users[4]. I'll be exploring an alternative on https://github.com/steve-chavez/pg_masking.

To be fair, this discussion is more related to a PostgreSQL feature than PostgREST. PostgREST relies on PostgreSQL for all authorization logic by design.

[1] https://www.ibm.com/docs/en/db2-for-zos/12?topic=statements-...

[2] https://learn.microsoft.com/en-us/sql/relational-databases/s...

[3] https://postgresql-anonymizer.readthedocs.io/en/latest/decla...

[4] https://www.2ndquadrant.com/en/blog/application-users-vs-row...

Simon Riggs's 2ndQuadrant was one of the first patreons for PostgREST. I'll forever be grateful, their support came in a hard time. Rest in peace Simon.

Already PostGREST is getting complicated, additions like this will make it less attractive to me.

This feature[1] actually simplified a lot and removed a lot of magic assumptions in the PostgREST codebase. It goes in line with REST as well — SQL functions are REST resources and HTML is just another representation for them.

Most of the code you see here is pure SQL and plpgSQL. The only PostgREST-specific part is the CREATE DOMAIN.

Right now most users view PostgREST as a HTTP->JSON->SQL->JSON->HTTP service and we're trying to turn that into HTTP->SQL->HTTP. If that's not some true top level simplification, I don't know what is!

[1] https://postgrest.org/en/stable/references/api/media_type_ha...

We segregate responsibilities so no one has complete control of the PostgREST project. For example, begriffs[1] is in charge of handling the funds (Patreon), wolfgangwalther[2] owns the .org and .com domains and both are owners of the PostgREST's GitHub org. For development, this ensures I don't go crazy and add some feature that is Supabase-specific, since I'm not the only one who has a say in the project's direction.

This has been working well until now and if you follow PostgREST's development, you'll notice that all enhancements are vendor-neutral and keep the original design.

We're a much smaller team but we took some inspiration from PostgreSQL distributed model (no single company owns development) for this.

[1]: PostgREST author https://github.com/begriffs

[2]: Also part of the PostgREST team and major contributor https://github.com/PostgREST/postgrest/graphs/contributors