Comments (1)
It looks like supabase_wrappers::scan::get_foreign_plan
allocates the scan_clauses
that end up in the query plan from the FDW temp memory context (state.tmp_ctx
), which appears to be erroneous, as EXPLAIN ANALYZE
accesses the plan and its quals well after the context has been reset by the many other calls to temp_ctx.reset
.
It appears the plan and quals need to be allocated in the query memory context (the current one when supabase_wrappers::scan::get_foreign_plan
is called) to live enough.
I'm wondering whether there are other similar instances due to the extensive use of state.temp_ctx
for allocating data returned to pg.
At the moment, changing the code of supabase_wrappers::scan::get_foreign_plan
as follows fixes the problem:
#[pg_guard]
pub(super) extern "C" fn get_foreign_plan<W: ForeignDataWrapper>(
_root: *mut pg_sys::PlannerInfo,
baserel: *mut pg_sys::RelOptInfo,
_foreigntableid: pg_sys::Oid,
_best_path: *mut pg_sys::ForeignPath,
tlist: *mut pg_sys::List,
scan_clauses: *mut pg_sys::List,
outer_plan: *mut pg_sys::Plan,
) -> *mut pg_sys::ForeignScan {
debug2!("---> get_foreign_plan");
unsafe {
let mut state = PgBox::<FdwState<W>>::from_pg((*baserel).fdw_private as _);
// DO NOT ALLOCATE IN THE TEMP MEMCTX; pg will use the plan later if EXPLAIN ANALYZEing
// state.tmp_ctx.reset();
// let mut old_ctx = state.tmp_ctx.set_as_current();
// make foreign scan plan
let scan_clauses = pg_sys::extract_actual_clauses(scan_clauses, false);
// old_ctx.set_as_current();
from wrappers.
Related Issues (20)
- Depend on a specific version of the `supabase-wrappers` project instead of a path based dependency HOT 2
- Support `import foreign schema` for wrappers with static schema.
- Document clean removal of a FDW
- Support json data type for Airtable FDW HOT 1
- add limitation description for each FDW
- `postgres` ownership not preserved during pause/restore HOT 3
- wrappers_fdw_stats in read-only query HOT 3
- Firebase FDW not support nested collection
- `permission denied for table wrappers_fdw_stats` error when `wrappers` is created in the `extensions` schema HOT 4
- Use of GitHub-specific emoji syntax breaks documentation in other contexts HOT 1
- Add Stripe API URL configuration and documentation HOT 4
- Firebase Wrapper: Failed to retrieve rows from table
- I get 'undefined symbol: __pgrx_marker' while testing helloworld_fdw HOT 6
- Publish v0.2 on crates.io HOT 2
- Cant find Clerk FDW inside extension list HOT 2
- Stripe Wrapper Rate Limit? HOT 3
- Server died HOT 2
- Stripe FDW randomly returns no data HOT 8
- Clickhouse parametized query: unsupported operator expression in qual HOT 1
- Hello World Wrapper HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wrappers.