Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed resource embedding opens an empty transaction #2428

Closed
steve-chavez opened this issue Aug 15, 2022 · 1 comment · Fixed by #2502
Closed

Failed resource embedding opens an empty transaction #2428

steve-chavez opened this issue Aug 15, 2022 · 1 comment · Fixed by #2502
Labels
hygiene cleanup or refactoring perf

Comments

@steve-chavez
Copy link
Member

$ PGRST_DB_ANON_ROLE='postgrest_test_anonymous' postgrest-with-postgresql-14 postgrest-run

curl 'localhost:3000/projects?select=*,wrong(*)'

{"code":"PGRST200","details":null,"hint":"Verify that 'projects' and 'wrong' exist in the schema 'test' and that there is a foreign key relationship between them. If a new relationship was created, try reloading the schema cache.","message":"Could not find a relationship between 'projects' and 'wrong' in the schema cache"}
2022-08-15 18:20:14.212 -05 [679420] LOG:  execute 0: BEGIN ISOLATION LEVEL READ COMMITTED READ ONLY
2022-08-15 18:20:14.213 -05 [679420] LOG:  execute 7: select set_config($1, $2, true), set_config($3, $4, true), set_config($5, $6, true), set_config($7, $8, true), set_config($9, $10, true),
set_config($11, $12, true), set_config($13, $14, true)
2022-08-15 18:20:14.213 -05 [679420] DETAIL:  parameters: $1 = 'search_path', $2 = '"test", "extensions"', $3 = 'role', $4 = 'postgrest_test_anonymous', $5 = 'request.jwt.claims', $6 = '{"role
":"postgrest_test_anonymous"}', $7 = 'request.method', $8 = 'GET', $9 = 'request.path', $10 = '/projects', $11 = 'request.headers', $12 = '{"host":"localhost:3000","accept":"*/*","user-agent":
"curl/7.81.0"}', $13 = 'request.cookies', $14 = '{}'
2022-08-15 18:20:14.220 -05 [679420] LOG:  execute 1: COMMIT

For solving this we need a refactor on DbRequestBuilder.hs/App.hs.

@wolfgangwalther wolfgangwalther added perf and removed bug labels Aug 27, 2022
@steve-chavez steve-chavez added the hygiene cleanup or refactoring label Aug 30, 2022
@steve-chavez
Copy link
Member Author

steve-chavez commented Aug 30, 2022

I was thinking that ideally the phases/modules in the codebase should be like:

ApiRequest(doesn't open a tx, doesn't need schema cache) ->

DbRequestBuilder(doesn't open a tx, needs schema cache) ->

QueryBuilder/Statements (opens a tx, needs schema cache) ->

DB

DbRequestBuilder needs renaming

Edit: DbRequestbuilder was renamed to Plan #2497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hygiene cleanup or refactoring perf
Development

Successfully merging a pull request may close this issue.

2 participants