Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
oliverrice
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
9 ms
·
31.
▲
by
oliverrice
4y ago
I think there are a few things: 1) Its only been a few years since the trend of testing on sqlite locally and running postgres in production went away in favor of postgres everywhere (probably thanks to docker). That prevented using any fea
32.
▲
by
oliverrice
4y ago
Definitely. For the use-cases shown in the blog post, a table would be equally valid (and easier). The heuristic I use is to create custom types when the values will need to be used by SQL functions, or if support for things like ordering&#
33.
▲
by
oliverrice
4y ago
hi, author here happy to answer any questions another approach that works great is to use `create type`[1] with an `input_function` and `output_function` to build on top of an existing scalar type. For example, using that method would allow
34.
▲
Type constraints in 65 lines of SQL
(supabase.com)
134 points
by
oliverrice
4y ago
|
46 comments
35.
▲
by
oliverrice
4y ago
the jsonschema crate is spec compliant and has full implementations for the required parts of drafts 4,6, and 7 pg_jsonschema matches that support with the caveat that it doesn't support loading documents over http since that would be
36.
▲
by
oliverrice
4y ago
> On a sidenote, is not the wrappers for Airtable, BigQuery and ClickHouse opensourced? Or why did they skip that column in the second table? All of the wrappers are open source. You can see the source for the Airtable, BigQuery, and Cli
37.
▲
by
oliverrice
4y ago
> I wonder why this wasn't built on top of, or an enhancement to, the existing (excellent) multicorn[1] project Have to agree with you there, multicorn is extremely cool. I'm a big sqlalchemy fan so their default SQLA wrapper w
38.
▲
by
oliverrice
4y ago
> How do you mock it? How do you test it? Stripe and Firebase both offer test endpoints for their services. The foreign data wrappers for each allow subbing in a user defined endpoint in their `options` so thats how I'd recommend te
39.
▲
by
oliverrice
4y ago
what they're doing is clearly working for them, but have maintainers shown any interest in transitioning the contribution workflow to something more common nowadays like Issues/PRs to make contributing accessible to a wider audien
40.
▲
by
oliverrice
4y ago
thanks for the great work on the jsonschema crate! I didn't know about the pgx_json_schema (or is_jsonb_valid) and will add both of them to the README today
41.
▲
by
oliverrice
4y ago
> 4 different versions that differ in their capabilities pg_jsonschema is a (very) thin wrapper around https://docs.rs/jsonschema/latest/jsonschema/ it supports versions 4, 6, and 7 > appears to be a co
42.
▲
by
oliverrice
4y ago
if you add a check constraint to an existing table only new/updated records are checked. Existing records will not be checked
43.
▲
by
oliverrice
4y ago
> fast-fail (the first check constraint violated would bubble the error upward) rather than slow-fail (collect all invalid fields and return the collection of errors, which IME is more common on average web forms or api requests) ... >
44.
▲
Show HN: Pg_jsonschema – A Postgres extension for JSON validation
(github.com)
203 points
by
oliverrice
4y ago
|
56 comments
45.
▲
by
oliverrice
5y ago
Not yet, but we're evaluating options for how we'll be able to support this in the future
46.
▲
by
oliverrice
5y ago
Yes, its on the roadmap to implement custom mutations reflected from user defined functions
47.
▲
by
oliverrice
5y ago
Thanks! Yes, we currently support extending table types via functions using a naming convention. The docs for that feature are available here https://supabase.github.io/pg_graphql/computed_fields/#exten... It&#x
48.
▲
by
oliverrice
5y ago
Yes! We've been exploring https://github.com/tcdi/pgx internally so we'd be able to re-work the hotspots in rust. We haven't decided to go that route yet but its been incredibly easy to work with &
49.
▲
by
oliverrice
5y ago
> How does pg_graphql compare to Postgraphile? PostGraphile is very close to pg_graphql in goals. It was a big help during development to be able to reference their implementation. > Did you think about integrating Postgraphile with t
50.
▲
by
oliverrice
5y ago
pg_graphql and EdgeDB both provide a graph-like query language on top of Postgres. EdgeDB philosophically (I think) EdgeDB tries to do a more complete job of abstracting over Postgres. It has a custom query language (and GraphQL support via
51.
▲
by
oliverrice
5y ago
If you're an existing supabase customer you don't need to change any of your existing permissions. pg_graphql filters out any tables/columns that aren't accessible to the user making the request. It also respects your ro
52.
▲
by
oliverrice
5y ago
heyo, thanks for the ping I'm the dev lead on pg_graphql. Happy to answer any questions!
53.
▲
by
oliverrice
5y ago
Supabase passes all the JWT info to postgrest so it is still available in transaction local config
54.
▲
by
oliverrice
5y ago
All the data would be available and joining it would be possible with some jsonb gymnastics but its optimized more for compliance style auditing than rapid lookups for complex queries. For that scenario replicating audit data to a OLAP syst
55.
▲
by
oliverrice
5y ago
if `user_id` is in the table you're auditing you could do ``` alter table audit.record_version add column user_id bigint default (coalesce(record, old_record) ->> 'user_id'); ``` or if you meant the SQL `current_user` y
56.
▲
by
oliverrice
5y ago
thats a cool solution for reducing storage. nice!
57.
▲
by
oliverrice
5y ago
> I'm curious if any thought was given to using JSON over JSONB For sure! There is a conversion penalty that is paid incrementally (at write time). For paying that penalty, jsonb gets you reduced storage size and dramatically faster
58.
▲
by
oliverrice
5y ago
Being able to see when the primary key changes using `record_id` and `old_record_id` is a perk, but we also wanted to make sure a snapshot of the existing data was available when auditing is enabled on a table that already has data in it. S
59.
▲
by
oliverrice
5y ago
> Are you at all worried about the size of the audit table? Keeping a JSON copy of both the old and the new data is going to add up pretty quickly for fast-changing tables. That's def a valid concern if you're auditing a high f
60.
▲
by
oliverrice
5y ago
author here (of the blog post and https://github.com/supabase/supa_audit ) happy to answer any questions
More ›