PostgREST / PostgREST/postgrest
Multiple requests in a transaction
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 27.7k
- Forks
- 1.2k
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 54
Description
I have a schema capturing events and participants:
CREATE TABLE demo.participant(
id BIGINT DEFAULT,
name VARCHAR(255) NOT NULL
);
CREATE TABLE demo.event(
id BIGINT DEFAULT,
title VARCHAR(255) NOT NULL
);
CREATE TABLE demo.event_participant(
event_id BIGINT NOT NULL REFERENCES demo.event(id),
participant_id BIGINT NOT NULL REFERENCES demo.participant(id),
PRIMARY KEY(event_id,participant_id)
);
I can expose these tables directly with 3 postgrest views. However, I required that inserting/updating an event and the participants in that event should be atomic.
I think I need a single view that somehow data from event and event_participant, and is insertable/updateable.
Is there any way to do this with postgrest?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names a PostgreSQL schema with event, participant, and event_participant tables and three PostgREST views, but no source file or test. Start by checking PostgREST's writable-view and transaction behavior; done would require a supported way to insert or update an event and its participants atomically, or a documented limitation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- postgresql
- Domain
- api, database
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100